/* Epilogue — "Paper & Marquee" design system.
   A warm paper-light app with one dark room in it: the quiz plays in theater
   dark, and every book-facing screen lives on cream paper. Fraunces is the
   voice; Instrument Sans is the operator. Marquee red belongs to money and
   nothing else. Body floor is 16px; nothing recurring ships under 14px. */

:root {
  /* Sanzo Wada, A Dictionary of Color Combinations — combination #325:
     Naples Yellow, Eugenia Red, Yellow Ocher, Deep Slate Green. */
  /* paper — Naples Yellow #FBE6A0 and derivations */
  --paper: #FBE6A0;
  --paper-raised: #FFF6D6;
  --paper-sunken: #F0D77E;
  --paper-line: #E0C878;
  /* ink — Deep Slate Green #112F2C and derivations */
  --ink: #112F2C;
  --ink-soft: #3D5A50;
  --ink-faint: #5F7263;
  /* marquee: Eugenia Red — buy buttons + match numerals only */
  --marquee: #DA525D;
  --marquee-hover: #C13F4A;
  --marquee-tint: #F9DCD8;
  /* action: the slate-green ink family — letterpress buttons */
  --action: #1B443E;
  --action-hover: #112F2C;
  --action-tint: #E3E9D2;
  /* feedback — Yellow Ocher #E2B540 */
  --gold: #E2B540;
  --danger: #B23A44;
  --ok: #2E6B45;
  /* stage: the dark room, now deep slate green */
  --stage: #0C1F1D;
  --stage-raised: #16302D;
  --stage-ink: #F6ECC8;
  --stage-soft: #9BB0A2;
  --stage-line: #2A4540;
  --scrim: rgba(12, 31, 29, 0.55);
  /* type */
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Instrument Sans', -apple-system, 'Segoe UI', sans-serif;
  /* shape */
  --r-cover: 4px; --r-card: 12px; --r-btn: 10px; --r-chip: 999px;
  --e-1: 0 1px 2px rgba(60, 42, 20, 0.08);
  --e-2: 0 2px 8px rgba(60, 42, 20, 0.12);
  --e-3: 0 8px 28px rgba(60, 42, 20, 0.18);
  --e-cover: 0 1px 1px rgba(60,42,20,0.10), 0 6px 16px rgba(60,42,20,0.16);
  --tabbar-h: 64px;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px; line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { position: relative; min-height: 100dvh; max-width: 640px; margin: 0 auto; }

/* the old atmosphere layers are retired; the stage screens paint their own dark */
.atmosphere { display: none; }

/* ---------- screens ---------- */
.screen { position: relative; z-index: 2; display: none; min-height: 100dvh; padding: max(28px, env(safe-area-inset-top)) 20px 40px; flex-direction: column; background: var(--paper); }
.screen.active { display: flex; }
.screen.active { animation: screenIn 0.35s ease-out; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

/* stage rooms: the quiz and the thinking beat */
#screen-quiz, #screen-thinking { background: var(--stage); color: var(--stage-ink); }

/* ---------- shared type ---------- */
.wordmark { font-family: var(--serif); font-weight: 700; font-size: 24px; color: var(--ink); }
.mono-label { font-family: var(--sans); font-weight: 600; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.mono-label.ember { color: var(--gold); }
.mono-label.dim { color: var(--ink-faint); }
.mono-label.center { text-align: center; }
.pad-bottom { padding-bottom: max(10px, env(safe-area-inset-bottom)); }

.serif-hero { font-family: var(--serif); font-weight: 700; font-size: 40px; line-height: 1.1; color: var(--ink); text-wrap: balance; }
.serif-hero em { font-style: italic; color: var(--marquee); }
.serif-hero.small { font-size: 32px; font-weight: 600; }
.serif-sub { font-size: 18px; line-height: 1.55; color: var(--ink-soft); }
.serif-sub.center { text-align: center; }
.meta-line { font-size: 14px; font-weight: 500; color: var(--ink-faint); }

/* ---------- buttons: primary fill / secondary outline / tertiary link ---------- */
.btn-fill, .pool-btn.primary.big {
  border: none; cursor: pointer; border-radius: var(--r-btn);
  font-family: var(--sans); font-weight: 600; font-size: 16px;
  min-height: 52px; padding: 12px 24px; width: 100%; max-width: 360px;
  color: #fff; background: var(--action); box-shadow: var(--e-2);
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn-fill:hover, .pool-btn.primary.big:hover { background: var(--action-hover); transform: translateY(-1px); }
.btn-fill:active, .pool-btn.primary.big:active { transform: none; }
.pool-btn {
  border: 1.5px solid var(--ink); cursor: pointer; border-radius: var(--r-btn); background: none;
  color: var(--ink); font-family: var(--sans); font-weight: 600; font-size: 15px;
  min-height: 44px; padding: 8px 20px;
  transition: background 0.15s ease;
}
.pool-btn:not(.primary):hover { background: var(--paper-sunken); }
.pool-btn.small { min-height: 44px; }
.linklike {
  border: none; background: none; cursor: pointer; padding: 6px 8px;
  font-family: var(--sans); font-weight: 600; font-size: 15px; color: var(--action);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(31,95,78,0.35);
}
.linklike:hover { text-decoration-color: var(--action); }
.linklike.ember { color: var(--marquee); text-decoration-color: rgba(176,54,22,0.35); }
.btn-fill:focus-visible, .pool-btn:focus-visible, .linklike:focus-visible, .lb-input:focus-visible, .answer:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- inputs ---------- */
.lb-form { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.lb-form.col { flex-direction: column; align-items: stretch; }
.lb-input {
  background: var(--paper-raised); border: 1.5px solid var(--paper-line); border-radius: var(--r-card);
  color: var(--ink); font-family: var(--sans); font-size: 16px;
  padding: 13px 16px; min-height: 52px; width: 230px; outline: none;
}
.lb-input::placeholder { color: var(--ink-faint); }
.lb-input:focus { border-color: var(--action); box-shadow: 0 0 0 3px var(--action-tint); }
.lb-input.wide { width: 100%; max-width: 360px; }

/* ---------- intro ---------- */
#screen-intro { padding-top: max(24px, env(safe-area-inset-top)); }
.intro-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 20px; max-width: 480px; margin: 0 auto; width: 100%; }
.gift-door {
  display: flex; align-items: center; gap: 14px; width: 100%; max-width: 400px;
  background: var(--paper-raised); border: 1px solid var(--paper-line); border-radius: var(--r-card);
  box-shadow: var(--e-1); cursor: pointer; padding: 16px; text-align: left;
  transition: box-shadow 0.15s ease;
}
.gift-door:hover { box-shadow: var(--e-2); }
.gd-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.gd-text strong { font-size: 16px; font-weight: 600; color: var(--ink); }
.gd-text small { font-size: 14px; color: var(--ink-soft); }
.gd-chev, .door-chev, .row-chev { font-family: var(--serif); font-size: 24px; font-weight: 400; color: var(--ink-faint); line-height: 1; }

/* desktop hero ornament: posters becoming books */
.cover-fan { display: none; }

/* returning reader chips */
.mine { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mine-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 400px; }
.opt-row { display: flex; gap: 8px; }
.opt-chip {
  border: 1px solid var(--paper-line); cursor: pointer; border-radius: var(--r-chip); min-height: 40px; padding: 8px 16px;
  font-family: var(--sans); font-weight: 500; font-size: 14px; color: var(--ink-soft);
  background: var(--paper-raised);
}
.opt-chip.on { background: var(--action-tint); border: 1.5px solid var(--action); color: var(--ink); }

/* trending storefront */
.trend { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.trend-row { display: flex; gap: 8px; }
.trend-cover { width: 44px; height: 66px; border-radius: var(--r-cover); object-fit: cover; box-shadow: var(--e-cover); }

/* ---------- quiz: the dark room ---------- */
#screen-quiz { align-items: center; justify-content: flex-start; gap: 14px; padding-bottom: 16px; }
.quiz-top { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.motes { display: flex; gap: 2px; width: min(340px, 78vw); }
.mote { flex: 1; height: 3px; border-radius: 2px; background: var(--stage-line); transition: background 0.4s ease; }
.mote.lit { background: var(--gold); }
.mote.current { background: var(--stage-ink); }
#quizCount, #screen-quiz .mono-label.dim { color: var(--stage-soft); }
#quizCount { font-size: 14px; font-weight: 500; letter-spacing: 0.04em; text-transform: none; }
#screen-quiz .mono-label.ember { color: var(--gold); }

.projection { position: relative; width: min(78vw, 320px); flex: none; }
.halo { display: none; }
.poster-plane {
  position: relative; width: 100%; aspect-ratio: 2 / 3; border-radius: var(--r-cover); overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5); transition: opacity 0.25s ease; background: var(--stage-raised);
}
.poster-plane.swap { opacity: 0; }
.poster-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none; }
.poster-img.show { display: block; }
.poster-fallback { position: absolute; inset: 0; }

.film-name { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 0 10px; }
.serif-title { font-family: var(--serif); font-weight: 600; font-size: clamp(22px, 6vw, 28px); line-height: 1.15; color: var(--stage-ink); text-wrap: balance; }
#filmMeta { font-size: 14px; font-weight: 500; color: var(--stage-soft); letter-spacing: 0.02em; text-transform: none; }

.taste-graph { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 30px; padding: 0 8px; }
.tg-chip {
  font-family: var(--sans); font-weight: 500; font-size: 14px;
  padding: 6px 14px; border-radius: var(--r-chip); white-space: nowrap;
  animation: chipIn 0.5s ease-out;
}
#screen-quiz .tg-chip.pos { color: var(--gold); border: 1px solid var(--stage-line); background: var(--stage-raised); }
#screen-quiz .tg-chip.neg { color: var(--stage-soft); border: 1px solid var(--stage-line); background: none; text-decoration: line-through; }
.tg-chip.pos { color: var(--action); background: var(--action-tint); }
.tg-chip.neg { color: var(--ink-faint); background: var(--paper-sunken); text-decoration: line-through; }
.tg-chip.mid { color: var(--ink-soft); background: var(--paper-sunken); }
@keyframes chipIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* verdict bar: four equal doors */
.answers { display: flex; gap: 8px; width: 100%; max-width: 420px; margin-top: auto; }
.answer {
  flex: 1; border: 1px solid var(--stage-line); cursor: pointer; background: var(--stage-raised);
  border-radius: var(--r-btn); min-height: 72px; padding: 10px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.answer i { font-style: normal; font-size: 22px; line-height: 1; color: var(--stage-soft); }
.answer span { font-family: var(--sans); font-weight: 600; font-size: 14px; color: var(--stage-ink); }
.answer.loved i { color: var(--gold); }
.answer.loved { border-color: var(--gold); }
.answer:hover { background: var(--stage-line); }
.answer:active { transform: scale(0.96); }
.answer-row { display: contents; }
.dot { display: none; }

/* ---------- reveal: the lights come up ---------- */
#screen-reveal { align-items: center; justify-content: center; }
.reveal-col { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 0 6px; max-width: 480px; width: 100%; }
.rv { opacity: 0; }
.screen.active .rv { animation: fadeUp 0.8s ease-out forwards; }
.screen.active .r1 { animation-delay: 0.15s; }
.screen.active .r2 { animation-delay: 0.5s; }
.screen.active .r3 { animation-delay: 1.1s; }
.screen.active .r4 { animation-delay: 1.8s; }
.screen.active .r5 { animation-delay: 2.2s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes bookIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.shelf-header.enter, .roast.enter, .shelf-actions.enter, .capture.enter, .book-card.enter, .book-row.enter { opacity: 0; animation: bookIn 0.8s ease-out forwards; }
@media (prefers-reduced-motion: reduce) {
  .rv, .enter, .screen.active { animation: none !important; opacity: 1 !important; }
}

.capture-card {
  width: 100%; max-width: 400px; background: var(--paper-raised); border: 1px solid var(--paper-line);
  border-radius: var(--r-card); box-shadow: var(--e-1); padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.capture-title { font-size: 16px; font-weight: 600; color: var(--ink); text-align: center; }

/* ---------- thinking ---------- */
#screen-thinking { align-items: center; justify-content: center; }
.thinking-col { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.mote-lone { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 14px 4px rgba(184,134,11,0.5); animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.serif-think { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--stage-ink); text-align: center; transition: opacity 0.5s ease; }
.serif-think.fade { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .mote-lone { animation: none; } }

/* ---------- shelf: three hero cards, money on every one ---------- */
#screen-shelf { gap: 16px; align-items: center; }
.shelf-header { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; max-width: 560px; }
.shelf-books { display: flex; flex-direction: column; align-items: stretch; gap: 16px; width: 100%; max-width: 420px; }

.book-card {
  position: relative; background: var(--paper-raised); border: 1px solid var(--paper-line);
  border-radius: var(--r-card); box-shadow: var(--e-1); padding: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.book-card.top { padding-top: 48px; }
.top-tag {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  font-size: 14px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--marquee); background: var(--marquee-tint); border-radius: var(--r-chip); padding: 4px 12px;
}
.card-door { border: none; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; padding: 0; text-align: center; }
.card-door .row-cover { width: 170px; height: 255px; }
.card-match { display: flex; align-items: baseline; gap: 6px; }
.card-match .num { font-family: var(--serif); font-weight: 700; font-size: 32px; line-height: 1; color: var(--marquee); }
.card-match .cap { font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.row-title { font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.2; color: var(--ink); text-wrap: balance; }
.row-author { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.row-kicker { font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 1.4; color: var(--ink-soft); max-width: 320px; }
.row-title.big { font-size: 26px; }
.row-kicker.big { font-size: 19px; }

.row-cover {
  border-radius: var(--r-cover); overflow: hidden; flex: none; position: relative;
  box-shadow: var(--e-cover); background: var(--paper-sunken);
}
.row-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 8px 12px 14px; text-align: center;
}
.cover-fallback::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 1px; background: linear-gradient(180deg, rgba(243,234,217,0.3), rgba(243,234,217,0.08)); }
.fb-rule { width: 18px; height: 1px; background: rgba(243,234,217,0.45); }
.fb-title { font-family: var(--serif); font-style: italic; font-size: 14px; line-height: 1.25; color: rgba(246,240,228,0.96); }
.fb-author { font-size: 9px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(243,234,217,0.65); }

/* the buy triplet: amazon owns the marquee */
.buy-trip { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 320px; }
.buy-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.act {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px;
  border: 1.5px solid var(--ink); cursor: pointer; border-radius: var(--r-btn); text-decoration: none;
  font-family: var(--sans); font-weight: 600; font-size: 15px; color: var(--ink); background: none;
  transition: background 0.15s ease;
}
.act:hover { background: var(--paper-sunken); }
.act.buy {
  border: none; min-height: 52px; color: #fff; background: var(--marquee); box-shadow: var(--e-2);
  font-size: 16px;
}
.act.buy:hover { background: var(--marquee-hover); }
.act.big { width: 100%; max-width: 320px; }
.buy-pair.big { width: 100%; max-width: 320px; }

/* roast: one line of wry truth */
.roast { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 12px 0; text-align: center; max-width: 560px; }
.roast .roast-label { font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.roast .roast-title { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 26px; line-height: 1.2; color: var(--ink); }
.roast .roast-body { font-size: 16px; line-height: 1.5; color: var(--ink-soft); max-width: 380px; }

.shelf-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.shelf-actions .pool-btn { width: 100%; max-width: 360px; }

/* email capture on shelf */
.capture { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 400px; }
.capture .lb-form { width: 100%; }
.capture .lb-input { flex: 1; min-width: 0; width: auto; }
.capture-line { font-size: 16px; color: var(--ink-soft); text-align: center; }
.capture.done .capture-line { color: var(--ok); font-weight: 600; }

.wander { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.legal { font-size: 14px; color: var(--ink-soft); text-align: center; line-height: 1.6; max-width: 420px; }

/* ---------- book detail overlay ---------- */
.detail { position: fixed; inset: 0; z-index: 40; display: none; overflow-y: auto; background: var(--paper); }
.detail.open { display: block; animation: screenIn 0.25s ease-out; }
.detail.open .rv { animation: fadeUp 0.6s ease-out forwards; }
.detail.open .r1 { animation-delay: 0.05s; }
.detail.open .r2 { animation-delay: 0.2s; }
.detail.open .r3 { animation-delay: 0.4s; }
.detail.open .r4 { animation-delay: 0.6s; }
.detail-art, .detail-shade, .art-grad { display: none; }
.detail-close {
  position: fixed; top: max(16px, env(safe-area-inset-top)); left: 16px; z-index: 3;
  border: none; background: var(--paper-raised); box-shadow: var(--e-1); border-radius: var(--r-chip);
  cursor: pointer; padding: 10px 18px; font-family: var(--sans); font-weight: 600; font-size: 15px; color: var(--ink);
  letter-spacing: 0; text-transform: none;
}
.detail-inner {
  position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 16px;
  max-width: 480px; margin: 0 auto; padding: max(72px, env(safe-area-inset-top)) 20px max(40px, env(safe-area-inset-bottom));
  min-height: 100dvh; justify-content: flex-start; text-align: center;
}
.detail-cover { width: 200px; height: 300px; border-radius: var(--r-cover); overflow: hidden; position: relative; box-shadow: var(--e-cover); flex: none; }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-cover .fb-title { font-size: 18px; }
.detail-cover .fb-author { font-size: 10px; }
.match-inline { display: flex; align-items: baseline; gap: 6px; }
.match-num { font-family: var(--serif); font-weight: 700; font-size: 44px; line-height: 1; color: var(--marquee); }
.match-cap { font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.swap-note { font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--action); }
.shelf-chip {
  font-size: 14px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--action); padding: 6px 14px; border-radius: var(--r-chip); background: var(--action-tint);
}
.book-naming { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 0 8px; }
.book-title { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.15; color: var(--ink); text-wrap: balance; }
.book-author { font-size: 16px; font-weight: 500; color: var(--ink-soft); }
.kicker { font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.4; color: var(--ink-soft); }

/* the why: their movies are the authority behind the pick */
.because {
  font-size: 16px; line-height: 1.6; color: var(--ink); max-width: 380px;
  background: var(--action-tint); border-radius: var(--r-card); padding: 14px 18px; text-align: left;
}
.because em { font-style: italic; color: var(--action); font-weight: 500; }

.detail-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }

.feedback { display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 34px; border-top: 1px solid var(--paper-line); width: 100%; max-width: 340px; padding-top: 16px; }
.fb-line { font-size: 16px; color: var(--ink-soft); }
.fb-line.ember { color: var(--ok); font-weight: 600; }
.fb-choices { display: flex; align-items: center; gap: 10px; }
.fb-choices .dot { display: none; }
.fb-btn {
  border: 1px solid var(--paper-line); cursor: pointer; border-radius: var(--r-chip); min-height: 42px; padding: 8px 18px;
  font-family: var(--sans); font-weight: 500; font-size: 15px; color: var(--ink); background: var(--paper-raised);
}
.fb-btn:hover { background: var(--paper-sunken); }
.fb-btn.ember { background: var(--action-tint); border: 1.5px solid var(--action); }
.fb-btn.wide { padding: 8px 22px; }

/* ---------- gift ---------- */
#screen-gift { align-items: center; gap: 20px; }
.dedication {
  font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.6;
  color: var(--ink); text-align: center; max-width: 340px; padding: 14px 18px;
  background: var(--paper-raised); border: 1.5px solid var(--gold); border-radius: var(--r-card);
}

/* ---------- club ---------- */
#screen-club { align-items: center; gap: 20px; }
.club-body { width: 100%; display: flex; flex-direction: column; align-items: center; }
.club-col { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; max-width: 420px; }
.club-taste { font-size: 16px; font-style: italic; font-family: var(--serif); }
.club-brew { padding: 24px 10px; font-family: var(--serif); font-style: italic; font-size: 19px; }
.club-how { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin: 24px auto 12px; max-width: 340px; }
.how-step { display: flex; align-items: baseline; gap: 12px; font-size: 16px; line-height: 1.5; color: var(--ink-soft); text-align: left; }
.how-n {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; font-size: 14px; color: var(--action);
  background: var(--action-tint); transform: translateY(3px);
}
.member-line { font-size: 15px; line-height: 1.5; color: var(--ink-soft); text-align: center; max-width: 340px; }

/* the club's one pick */
.book-row.pick {
  flex-direction: column; align-items: center; gap: 12px; padding: 20px; width: 100%;
  background: var(--paper-raised); border: 1px solid var(--paper-line); border-radius: var(--r-card);
  box-shadow: var(--e-1); text-align: center; cursor: pointer;
}
.pick-cover { width: 150px; height: 225px; border-radius: var(--r-cover); overflow: hidden; position: relative; box-shadow: var(--e-cover); }
.pick-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-cover .fb-title { font-size: 15px; }
.book-row.pick .row-match .num, .row-match .num { font-family: var(--serif); font-weight: 700; font-size: 30px; line-height: 1; color: var(--marquee); }
.row-match { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.row-match .cap { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.pick-hint { font-size: 14px; font-weight: 500; color: var(--ink-faint); margin-top: 2px; }

/* ---------- queue & library ---------- */
#screen-queue, #screen-library { align-items: center; gap: 18px; }
#screen-queue .club-body, #screen-library .club-body { flex: 1; }
.q-row { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 460px; transition: transform 0.15s ease; }
.q-row .book-row { flex: 1; min-width: 0; }
.q-row.dragging { transform: scale(1.02); position: relative; z-index: 5; }
.q-row.dragging .book-row { box-shadow: var(--e-3); }

/* queue/list rows: cover, names, chevron */
.q-row .book-row, .mineclub-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border: 1px solid var(--paper-line); border-radius: var(--r-card); cursor: pointer; text-align: left;
  background: var(--paper-raised); box-shadow: var(--e-1);
}
.q-row .book-row:hover { box-shadow: var(--e-2); }
.q-row .row-cover { width: 64px; height: 96px; }
.q-row .row-title { font-family: var(--sans); font-weight: 600; font-size: 17px; }
.q-row .row-naming { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.q-handle {
  flex: none; width: 28px; height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: grab; touch-action: none; border-radius: 8px;
}
.q-handle:active { cursor: grabbing; }
.q-handle span { display: block; width: 16px; height: 2px; border-radius: 1px; background: var(--ink-faint); }
.q-pos { flex: none; width: 22px; text-align: center; font-family: var(--serif); font-weight: 600; font-size: 16px; color: var(--ink-faint); }

.lib-section { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; max-width: 460px; padding: 8px 0 20px; }
.lib-row { display: flex; align-items: baseline; gap: 12px; width: 100%; max-width: 380px; }
.lib-mark { flex: none; width: 20px; text-align: center; font-size: 15px; color: var(--ink-faint); }
.lib-mark.loved { color: var(--marquee); }
.lib-title { font-size: 17px; font-weight: 500; color: var(--ink); }
.lib-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 440px; }
.sh-row { border: none; background: none; cursor: pointer; opacity: 1; transition: opacity 0.2s ease; }
.sh-row:not(.on) { opacity: 0.4; }
.sh-row:not(.on) .lib-title { text-decoration: line-through; }
.sh-author { font-size: 14px; color: var(--ink-soft); margin-left: 8px; }

/* the shelf-photo door */
.door-card {
  display: flex; align-items: center; gap: 14px; width: 100%; max-width: 400px;
  background: var(--paper-raised); border: 1px solid var(--paper-line); border-radius: var(--r-card);
  box-shadow: var(--e-2); cursor: pointer; padding: 16px; text-align: left;
}
.door-main { font-size: 16px; font-weight: 600; color: var(--ink); display: block; }
.door-sub { font-size: 14px; color: var(--ink-soft); display: block; margin-top: 2px; }
.door-text { flex: 1; }

/* ---------- blend ---------- */
#screen-blend { align-items: center; gap: 28px; }
.blend-body { display: flex; flex-direction: column; align-items: center; gap: 28px; width: 100%; }
.blend-names { display: flex; align-items: baseline; gap: 14px; font-family: var(--serif); font-weight: 600; font-size: 30px; color: var(--ink); }
.blend-x { color: var(--marquee); font-style: italic; }
.blend-book { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.blend-cover { width: 130px; height: 195px; border-radius: var(--r-cover); display: flex; align-items: flex-end; padding: 10px; box-shadow: var(--e-cover); margin-bottom: 6px; }
.blend-cover span { font-family: var(--serif); font-style: italic; font-size: 15px; line-height: 1.25; color: rgba(246,240,228,0.92); text-align: left; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 640px; z-index: 30;
  display: none; align-items: stretch;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--paper-raised);
  border-top: 1px solid var(--paper-line);
  box-shadow: 0 -2px 12px rgba(60,42,20,0.08);
}
.tabbar.show { display: flex; }
.tab {
  flex: 1; border: none; background: none; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 52px; padding: 6px 0;
  font-family: var(--sans); font-weight: 600; font-size: 14px; letter-spacing: 0; text-transform: none;
  color: var(--ink-faint);
}
.tab::before { content: ""; position: absolute; top: 0; width: 22px; height: 3px; border-radius: 2px; background: transparent; transition: background 0.2s ease; }
.tab.on { color: var(--ink); }
.tab.on::before { background: var(--action); }
#screen-shelf, #screen-queue, #screen-library, #screen-club { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px); transform: translateX(-50%) translateY(16px);
  background: var(--ink); border-radius: var(--r-card); box-shadow: var(--e-3);
  color: var(--paper); font-family: var(--sans); font-weight: 500; font-size: 15px;
  padding: 13px 20px; max-width: min(420px, calc(100vw - 40px));
  opacity: 0; pointer-events: none; transition: all 0.35s ease; z-index: 60; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.no-scroll { overflow: hidden; }
.link-row { display: flex; align-items: center; gap: 8px; }

/* ---------- desktop: different layouts, not a fat phone ---------- */
@media (min-width: 700px) {
  #app { max-width: 1160px; }
  .screen { padding-left: 40px; padding-right: 40px; }
  .serif-hero { font-size: 48px; }
  .intro-col { max-width: 560px; gap: 22px; }
  .lb-input { width: 260px; }
  .reveal-col { max-width: 560px; }
  .capture-card .lb-form { flex-direction: row; }
  .capture-card .lb-input { flex: 1; }
  .capture-card .btn-fill { width: auto; }
  #screen-quiz .projection { width: auto; height: min(58vh, 480px); aspect-ratio: 2 / 3; }
  .poster-plane { height: 100%; width: auto; aspect-ratio: 2 / 3; }
  .answers { max-width: 560px; }
  .answer { min-height: 64px; }
}
@media (min-width: 1024px) {
  .shelf-books { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; max-width: 1100px; align-items: stretch; }
  .book-card { justify-content: flex-start; }
  .book-card .buy-trip { margin-top: auto; }
  .card-door .row-cover { width: 190px; height: 285px; }
  .shelf-header .serif-hero.small { font-size: 38px; }
  .detail-inner { max-width: 560px; }
  .tabbar {
    max-width: 420px; bottom: 20px; border-radius: var(--r-chip);
    border: 1px solid var(--paper-line); box-shadow: var(--e-3);
    padding: 6px 8px;
  }
  .q-row, .lib-section { max-width: 560px; }
  .club-col { max-width: 480px; }
  #screen-shelf, #screen-queue, #screen-library, #screen-club { padding-bottom: 130px; }
}
