
* { box-sizing: border-box; }
body { font-family: Georgia, 'Iowan Old Style', serif; margin: 0; background: #f4ede0; color: #2a2a2a; line-height: 1.55; }
a { color: #6b3a1a; }
header.book-header { padding: 1rem 2rem; background: var(--series-color, #2d1b3d); color: #f4ede0; }
header.book-header h1 { margin: 0; font-size: 1.5rem; }
header.book-header .meta { opacity: 0.85; font-size: 0.9rem; }
nav.phase-tabs { display: flex; gap: 0; background: #2a2a2a; }
nav.phase-tabs button { flex: 1; padding: 0.8rem 1rem; border: 0; background: #2a2a2a; color: #aaa; font-family: inherit; font-size: 0.95rem; cursor: pointer; border-bottom: 3px solid transparent; }
nav.phase-tabs button.active { color: #fff; background: #3a3a3a; border-bottom-color: #d4a04a; }
nav.phase-tabs button.disabled { color: #555; cursor: not-allowed; }
nav.phase-tabs button .badge { font-size: 0.7rem; margin-left: 0.4rem; opacity: 0.6; }
nav.view-toggle { display: flex; gap: 0.5rem; padding: 0.6rem 2rem; background: #ebe2d0; border-bottom: 1px solid #d4c8b0; }
nav.view-toggle button { padding: 0.4rem 1rem; border: 1px solid #b8a988; background: #fff; cursor: pointer; font-family: inherit; }
nav.view-toggle button.active { background: #2a2a2a; color: #fff; border-color: #2a2a2a; }
nav.view-toggle button:disabled { opacity: 0.4; cursor: not-allowed; }
main { padding: 1.5rem 2rem 4rem; }

/* Spread view: two facing pages */
.spread-stage { display: flex; flex-direction: column; align-items: center; }
.spread-nav { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.spread-nav button { padding: 0.4rem 1rem; border: 1px solid #999; background: #fff; cursor: pointer; font-family: inherit; }
.spread-nav .spread-label { font-weight: bold; min-width: 12rem; text-align: center; }
.spread-pages { display: grid; grid-template-columns: 1fr 1fr; gap: 0; max-width: 1400px; width: 100%; min-height: 60vh; box-shadow: 0 8px 30px rgba(0,0,0,0.2); }
.spread-page { background: #fffef8; padding: 2rem 2.5rem; min-height: 60vh; position: relative; }
.spread-page.left { border-right: 1px solid #d8cba8; box-shadow: inset -10px 0 20px -10px rgba(0,0,0,0.12); }
.spread-page.right { box-shadow: inset 10px 0 20px -10px rgba(0,0,0,0.12); }
.spread-page .page-num { position: absolute; bottom: 0.6rem; font-size: 0.75rem; color: #999; }
.spread-page.left .page-num { left: 1rem; }
.spread-page.right .page-num { right: 1rem; }
.spread-text { font-size: 1.05rem; line-height: 1.7; min-height: 50vh; outline: 0; }
.spread-text[contenteditable="true"]:focus { background: #fff8e0; }
.spread-text:empty::before { content: attr(data-placeholder); color: #bbb; font-style: italic; }
.illustration-zone { border: 2px dashed #c0a878; padding: 1rem; background: #faf3e0; color: #6b5a30; font-size: 0.9rem; min-height: 50vh; display: flex; flex-direction: column; gap: 0.5rem; }
.illustration-zone .label { font-weight: bold; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 1px; color: #8b6f30; }
.spread-index { display: flex; gap: 0.3rem; margin-top: 1rem; flex-wrap: wrap; justify-content: center; }
.spread-index button { width: 2.2rem; height: 2.2rem; border: 1px solid #b8a988; background: #fff; cursor: pointer; font-family: inherit; }
.spread-index button.current { background: #d4a04a; border-color: #b88828; color: #fff; }

/* Reader view: stacked artifacts */
.reader-view { max-width: 880px; margin: 0 auto; }
.reader-view details { background: #fffef8; margin-bottom: 1rem; padding: 0 1.5rem; border: 1px solid #d8cba8; }
.reader-view summary { padding: 1rem 0; font-weight: bold; cursor: pointer; font-size: 1.05rem; color: #4a3520; }
.reader-view details[open] summary { border-bottom: 1px solid #d8cba8; margin-bottom: 1rem; }
.reader-view h1, .reader-view h2, .reader-view h3, .reader-view h4 { color: #3a2818; }
.reader-view table { border-collapse: collapse; margin: 1rem 0; font-size: 0.92rem; }
.reader-view th, .reader-view td { border: 1px solid #c8b888; padding: 0.4rem 0.8rem; text-align: left; vertical-align: top; }
.reader-view th { background: #ebe2d0; }
.reader-view blockquote { border-left: 4px solid #c0a878; padding-left: 1rem; color: #5a4a30; margin: 1rem 0; }
.reader-view code { background: #ebe2d0; padding: 0.1rem 0.3rem; border-radius: 2px; font-family: 'SF Mono', Menlo, monospace; font-size: 0.9em; }

.feedback-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #2a2a2a; color: #f4ede0; padding: 0.8rem 2rem; display: flex; gap: 1rem; align-items: center; box-shadow: 0 -4px 12px rgba(0,0,0,0.2); }
.feedback-bar button { padding: 0.5rem 1rem; background: #d4a04a; border: 0; color: #2a2a2a; font-weight: bold; cursor: pointer; font-family: inherit; }
.feedback-bar .status { opacity: 0.8; font-size: 0.9rem; }

.empty-state { padding: 3rem; text-align: center; color: #888; }

/* Index page */
.index-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; padding: 2rem; max-width: 1400px; margin: 0 auto; }
.series-section { padding: 2rem; max-width: 1400px; margin: 0 auto; }
.series-section h2 { color: #3a2818; border-bottom: 2px solid #c0a878; padding-bottom: 0.5rem; }
.book-card { background: #fffef8; border: 1px solid #d8cba8; padding: 1.2rem 1.4rem; text-decoration: none; color: inherit; display: block; transition: transform 0.1s, box-shadow 0.1s; }
.book-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.book-card h3 { margin: 0 0 0.4rem; color: #3a2818; font-size: 1.05rem; }
.book-card .phases { display: flex; gap: 0.3rem; margin-top: 0.6rem; }
.book-card .phase-dot { width: 1.6rem; height: 1.6rem; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: bold; }
.book-card .phase-dot.done { background: #2d6a3d; color: #fff; }
.book-card .phase-dot.missing { background: #e8e0c8; color: #b8a878; }
.book-card .series-tag { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: #8b6f30; }

/* Comment boxes — book-level (top) and view-level (bottom of current view) */
.book-comment-bar { padding: 0.7rem 2rem 0.9rem; background: #ebe2d0; border-bottom: 1px solid #d4c8b0; }
.book-comment-bar label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: #8b6f30; margin-bottom: 0.3rem; font-weight: bold; }
.book-comment-bar textarea { width: 100%; min-height: 2.6rem; padding: 0.5rem 0.7rem; border: 1px solid #c0a878; background: #fffef8; font-family: inherit; font-size: 0.95rem; resize: vertical; line-height: 1.4; color: #2a2a2a; }
.book-comment-bar textarea:focus { outline: 2px solid #d4a04a; outline-offset: -1px; background: #fff8e0; }
.book-comment-bar .hint { font-size: 0.78rem; color: #8b6f30; margin-bottom: 0.35rem; opacity: 0.9; }

.view-comment-bar { max-width: 1100px; margin: 2.5rem auto 1rem; padding: 1rem 1.2rem 1.1rem; background: #fffef8; border: 1px solid #d8cba8; }
.view-comment-bar label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: #8b6f30; margin-bottom: 0.3rem; font-weight: bold; }
.view-comment-bar .hint { font-size: 0.8rem; color: #6b5a30; margin-bottom: 0.5rem; opacity: 0.95; font-style: italic; }
.view-comment-bar textarea { width: 100%; min-height: 4.5rem; padding: 0.6rem 0.8rem; border: 1px solid #c0a878; background: #faf3e0; font-family: inherit; font-size: 0.95rem; resize: vertical; line-height: 1.5; color: #2a2a2a; }
.view-comment-bar textarea:focus { outline: 2px solid #d4a04a; outline-offset: -1px; background: #fff8e0; }
