/* ============================================================================
   R3 Relay — prose-first table.
   Hierarchy contract (the inverse of the original build):
     1. player prose        17-18px serif, never clamped, never clipped
     2. what to do now      the directive + one checklist
     3. cards               chips and hand cards
     4. bookkeeping         smallest, or absent
   ========================================================================== */

:root {
  --table:      #0c1416;
  --table-2:    #101b1e;
  --panel:      #14232699;
  --line:       #2b3d40;
  --line-soft:  #22333614;
  --paper:      #f2e9d4;
  --paper-2:    #ece1c6;
  --ink:        #2b3536;
  --ink-soft:   #55605f;
  --cream:      #f4eee0;
  --cream-dim:  #c9d4d0;
  --mut:        #8fa3a0;
  --gold:       #d7ad63;
  --danger:     #e2766a;
  --ok:         #6fce8f;

  --c-aspect:   #9d8cff;
  --c-agent:    #e9a13b;
  --c-engine:   #5cc9d6;
  --c-anchor:   #6fce8f;
  --c-conflict: #e77c7c;

  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: Consolas, 'Cascadia Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 50% -10%, #17393c66, transparent 60%),
    radial-gradient(1400px 800px at 50% 40%, #d7ad6309, transparent 65%),
    radial-gradient(800px 500px at 90% 110%, #3a2c1226, transparent 55%),
    repeating-linear-gradient(115deg, #ffffff01 0 2px, transparent 2px 6px),
    var(--table);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

.t-aspect   { --tc: var(--c-aspect); }
.t-agent    { --tc: var(--c-agent); }
.t-engine   { --tc: var(--c-engine); }
.t-anchor   { --tc: var(--c-anchor); }
.t-conflict { --tc: var(--c-conflict); }

/* ---------- primitives ---------------------------------------------------- */

.btn {
  font: 600 .95rem var(--sans);
  color: var(--cream);
  background: #1d2f32;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
}
.btn:hover:not(:disabled) { background: #24393d; }
.btn.primary { background: #2b6a63; border-color: #3c8a80; }
.btn.primary:hover:not(:disabled) { background: #337d74; }
.btn.ghost { background: transparent; }
.btn.slim { padding: 6px 12px; font-size: .85rem; }
.btn.big { padding: 14px 26px; font-size: 1.05rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn em { font-style: normal; font-weight: 400; opacity: .75; font-size: .85em; }
.btn.danger, .flagbtn { color: #ffd5d1; }

:is(button, input, select, textarea, [href]):focus-visible {
  outline: 3px solid var(--c-engine);
  outline-offset: 2px;
  border-radius: 6px;
}

input[type=text], textarea, select {
  width: 100%;
  font: 1rem/1.55 var(--sans);
  color: var(--cream);
  background: #0a161899;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  margin: 4px 0 10px;
}
textarea { resize: vertical; min-height: 96px; font-family: var(--serif); font-size: 1.05rem; }
textarea::placeholder, input::placeholder { color: #7e9391; }
label { font-size: .9rem; color: var(--cream-dim); }
.vislabel { display: block; margin-top: 10px; font-weight: 600; color: var(--cream); }
.vislabel em { color: var(--mut); font-weight: 400; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.row.spread { justify-content: space-between; }
.fine { font-size: .82rem; color: var(--mut); }
.counter { font: .8rem var(--mono); color: var(--mut); }
.cost { font-size: .85rem; color: var(--gold); font-weight: 600; }
.eyebrow {
  font: 600 .72rem var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mut);
  margin: 0 0 6px;
}
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; }

.card-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  margin: 18px 0;
}

/* chips: the card, demoted to an annotation */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 .82rem var(--sans);
  color: var(--tc, var(--cream));
  background: color-mix(in srgb, var(--tc, #888) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tc, #888) 45%, transparent);
  border-radius: 999px;
  padding: 3px 11px 3px 8px;
  white-space: nowrap; max-width: 100%;
}
.chip i { font-style: normal; font-size: .9em; }
.plus { color: var(--mut); margin: 0 6px; }

/* ---------- top bar -------------------------------------------------------- */

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px clamp(12px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: #0a1315cc;
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(8px);
}
.brandbtn { font: 700 .95rem var(--sans); letter-spacing: .12em; color: var(--cream); background: none; border: 0; cursor: pointer; padding: 4px 6px; }
.brandbtn b { color: var(--gold); margin-right: 6px; }
.topchip { font: .75rem var(--mono); color: var(--mut); }
.topgrow { flex: 1; }

#main { max-width: 1200px; margin: 0 auto; padding: 0 clamp(12px, 3vw, 28px) 120px; }

/* ---------- home ----------------------------------------------------------- */

.home { max-width: 820px; margin: 0 auto; }
.home-hero { padding: clamp(30px, 6vw, 64px) 0 8px; }
.brand { font: 700 .85rem var(--sans); letter-spacing: .3em; color: var(--gold); margin: 0 0 14px; }
.home h1 {
  font: 800 clamp(2rem, 5.5vw, 3.3rem)/1.08 var(--sans);
  letter-spacing: -.02em;
  margin: 0 0 16px;
  text-wrap: balance;
}
.home-lede { font-size: 1.08rem; color: var(--cream-dim); max-width: 62ch; }
.home-formula { margin: 18px 0 6px; display: flex; flex-wrap: wrap; align-items: center; row-gap: 8px; }
.start-panel h2, .how h2 { margin: 0 0 12px; font-size: 1.25rem; }
.name-row { margin-bottom: 8px; }
.name-row input { max-width: 420px; display: block; }
.advanced { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.advanced summary { cursor: pointer; font-weight: 600; }
.adv-hint { font-weight: 400; color: var(--mut); font-size: .85rem; }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0; min-width: 0; }
legend { font: 600 .78rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--mut); padding: 0 6px; }
.pick { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; font-size: .92rem; color: var(--cream); }
.pick input { width: auto; margin: 0; }
.pick em { color: var(--mut); font-style: normal; font-size: .85em; }
.start-row { margin-top: 18px; }
.how-steps { margin: 0; padding-left: 20px; }
.how-steps li { margin-bottom: 8px; }
.resume { border-color: var(--gold); }

/* ---------- draft ----------------------------------------------------------- */

.draft { max-width: 1120px; margin: 40px auto; text-align: center; }
.draft h2 { font-size: 1.6rem; margin: 4px 0 6px; }
.draft .lede { color: var(--cream-dim); }
.draft-cards { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.dcard {
  width: 196px; min-height: 244px;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  text-align: left;
  background: linear-gradient(150deg, #fdf6e5, var(--paper));
  color: var(--ink);
  border: 1px solid #55402b7a;
  border-top: 7px solid var(--tc);
  border-radius: 13px;
  padding: 14px;
  cursor: pointer;
  transition: transform .15s;
}
.dcard:hover { transform: translateY(-6px); }
.dcard.is-picked {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 0 0 3px var(--gold), 0 14px 30px #000a;
}
.dcard-value { font: 700 1.35rem/1.15 var(--serif); overflow-wrap: anywhere; }
.dcard-picked { margin-top: auto; font: 700 .78rem var(--sans); color: #7c5c1d; background: #d7ad63; border-radius: 999px; padding: 3px 10px; }
.draft-form { max-width: 520px; margin: 22px auto 0; text-align: left; }
.draft-form .btn.big { width: 100%; justify-content: center; }

/* ---------- turn panel ------------------------------------------------------ */

.table { display: grid; grid-template-columns: minmax(340px, 470px) minmax(0, 1fr); gap: 22px; align-items: start; padding-top: 18px; }

.coach {
  grid-column: 1 / -1;
  background: #d7ad6314;
  border: 1px solid #d7ad6355;
  border-radius: 14px;
  padding: 14px 18px;
}
.coach-goal { margin: 0 0 8px; font: 600 1rem/1.5 var(--sans); color: var(--gold); }
.coach ol { margin: 0 0 10px; padding-left: 20px; color: var(--cream-dim); }
.coach li { margin-bottom: 4px; }

.whatnow {
  font-size: .92rem;
  color: var(--ok);
  border-left: 3px solid var(--ok);
  padding: 5px 12px;
  margin: 10px 0;
  background: #6fce8f0f;
  border-radius: 0 8px 8px 0;
}
.whatnow strong { color: var(--cream); }

.baton {
  border: 1px solid color-mix(in srgb, var(--pc, var(--gold)) 55%, transparent);
  border-left: 4px solid var(--pc, var(--gold));
  background: color-mix(in srgb, var(--pc, var(--gold)) 8%, transparent);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0;
}
.baton-head { margin: 0 0 6px; font: 700 .8rem var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--cream-dim); }
.baton-card { margin: 0 0 4px; }
.curtain-baton { background: #d7ad631a; border-left: 3px solid var(--gold); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.turnpanel {
  position: sticky; top: 64px;
  background: linear-gradient(160deg, #16272b, #0e1a1d);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  max-height: calc(100vh - 84px);
  overflow-y: auto;
}
.tp-head { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; }
.directive { font: 400 1.06rem/1.5 var(--serif); color: var(--cream); margin: 0; }
.directive strong { color: var(--gold); }
.points { text-align: center; min-width: 58px; border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; }
.points-n { display: block; font: 700 1.4rem var(--sans); }
.points-l { font-size: .68rem; color: var(--mut); text-transform: uppercase; letter-spacing: .08em; }

/* the turn stepper — each step carries its own control */
.steps { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 7px; }
.step { display: flex; gap: 11px; align-items: flex-start; border-radius: 11px; padding: 7px 10px; }
.step-n {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  font: 700 .78rem var(--sans);
  transform: translateY(1px);
}
.step-body { display: grid; gap: 6px; min-width: 0; }
.step-label { font-size: .97rem; line-height: 1.4; }
.step-hint { font-size: .8rem; color: var(--gold); font-weight: 600; }
.step-cardline { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.tight { margin-top: 2px; }

.step.done { color: var(--mut); }
.step.done .step-n { background: #2f8f66; color: #04120c; }
.step.done .step-label { text-decoration: line-through; text-decoration-color: #2f8f6688; }
.step.todo { opacity: .55; }
.step.todo .step-n { border: 1.5px dashed #6c7f82; color: #8ba0a2; }
.step.current {
  background: linear-gradient(150deg, #d7ad631f, #d7ad630a);
  border: 1px solid #d7ad6360;
  box-shadow: 0 0 0 1px #d7ad6325, 0 4px 14px #0004;
}
.step.current .step-n { background: var(--gold); color: #221703; }
.step.current .step-label { font-weight: 700; color: var(--cream); }

.hand-title { margin: 12px 0 4px; font: 700 .8rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }
.hand-title.is-step { color: var(--gold); }
.hand.is-step {
  outline: 2px solid #d7ad6370;
  outline-offset: 5px;
  border-radius: 12px;
  animation: hand-glow 1.6s ease-in-out infinite;
}
@keyframes hand-glow {
  0%, 100% { outline-color: #d7ad6340; }
  50% { outline-color: #d7ad63b0; }
}

.btn.pulse { animation: btn-pulse 1.5s ease-in-out infinite; }
@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 #3c8a8000; }
  50% { box-shadow: 0 0 0 6px #3c8a8045; }
}

.chdots { color: var(--gold); letter-spacing: .18em; margin-right: 6px; }

.points-n.bump { animation: pts-pop .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pts-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.45); color: var(--gold); }
  100% { transform: scale(1); }
}

.premise {
  font: italic .95rem/1.5 var(--serif);
  color: var(--cream-dim);
  border-left: 3px solid var(--gold);
  padding: 6px 12px; margin: 10px 0;
  background: #d7ad630f;
  border-radius: 0 8px 8px 0;
}
.premise span { font: 600 .7rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); display: block; margin-bottom: 3px; font-style: normal; }

.decks { display: flex; gap: 7px; margin: 12px 0; flex-wrap: wrap; }
.deck {
  flex: 1 1 70px; min-width: 70px;
  display: grid; gap: 2px; justify-items: center;
  background: color-mix(in srgb, var(--tc) 10%, #101c1f);
  border: 1px solid color-mix(in srgb, var(--tc) 40%, transparent);
  border-radius: 10px;
  color: var(--cream);
  padding: 8px 4px;
  cursor: pointer;
}
.deck:hover:not(:disabled) { background: color-mix(in srgb, var(--tc) 20%, #101c1f); }
.deck:disabled { opacity: .4; cursor: not-allowed; }
.deck { position: relative; }
.deck-count {
  position: absolute; top: 3px; right: 5px;
  font: 600 .58rem var(--mono); font-style: normal;
  color: var(--mut);
}
.deck i { font-style: normal; color: var(--tc); font-size: 1rem; }
.deck b { font-size: .72rem; }
.deck small { font-size: .6rem; color: var(--mut); text-align: center; line-height: 1.2; }

.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin: 6px 0 4px; }
.hcard {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  min-height: 118px;
  text-align: left;
  background: linear-gradient(150deg, #fdf6e5, var(--paper));
  color: var(--ink);
  border: 1px solid #55402b7a;
  border-top: 6px solid var(--tc);
  border-radius: 11px;
  padding: 9px 10px;
  cursor: pointer;
  transition: transform .12s;
}
.hcard:hover:not(:disabled), .hcard:focus-visible { transform: translateY(-4px) rotate(-.5deg); box-shadow: 0 8px 18px #0006; }
.hcard:disabled { opacity: .45; cursor: not-allowed; filter: saturate(.5); }
.hcard { animation: deal-in .4s cubic-bezier(.2, .9, .3, 1.15) backwards; animation-delay: calc(var(--mi, 0) * 60ms); }
@keyframes deal-in {
  from { opacity: 0; transform: translateY(16px) rotate(2.5deg) scale(.94); }
  to   { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
.hcard-type { font: 700 .62rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: color-mix(in srgb, var(--tc) 70%, #333); display: flex; gap: 5px; align-items: center; }
.hcard-value { font: 700 .98rem/1.15 var(--serif); overflow-wrap: anywhere; }
.hcard-genre { margin-top: auto; font: .62rem var(--mono); color: var(--ink-soft); }

.tp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 14px; }
.tp-actions .primary { margin-left: auto; }

/* ---------- the story column (the hero) ------------------------------------- */

.story { min-width: 0; }
.story-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 10px; }
.story-head h2 { font: 700 1.15rem var(--sans); margin: 0; }
.story-empty { border: 1px dashed var(--line); border-radius: 14px; padding: 34px; text-align: center; color: var(--mut); font-family: var(--serif); font-size: 1.05rem; }

.chap-head { margin: 26px 0 10px; display: flex; align-items: center; gap: 12px; color: var(--gold); font: 600 .8rem var(--sans); letter-spacing: .16em; text-transform: uppercase; }
.chap-head:after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, #d7ad6350, transparent); }
.chap-head:first-child { margin-top: 4px; }

.beat {
  background: linear-gradient(160deg, #fdf7e8, var(--paper) 55%);
  color: var(--ink);
  border: 1px solid #55402b66;
  border-left: 5px solid var(--pc, var(--gold));
  border-radius: 12px;
  padding: 13px 17px 12px;
  margin: 0 0 12px;
  max-width: 70ch;
}
.beat-head { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 7px; }
.beat-by { font: 700 .8rem var(--sans); color: color-mix(in srgb, var(--pc) 60%, #333); }
.beat-note { font: .72rem var(--mono); color: #8a5a4e; }
.flagbtn { margin-left: auto; background: none; border: 0; cursor: pointer; font-size: .95rem; color: #b04f43; opacity: .55; padding: 2px 6px; }
.flagbtn:hover { opacity: 1; }

/* THE point of the rebuild: prose at reading size, no clamps anywhere. */
.beat-prose { font: 1.06rem/1.66 var(--serif); color: var(--ink); }
.beat-prose p { margin: 0 0 .6em; }
.beat-prose p:last-child { margin-bottom: 0; }
.beat.struck .beat-prose { text-decoration: line-through; opacity: .5; }

.beat.is-new { animation: beat-arrive 1.4s ease-out; }
@keyframes beat-arrive {
  0% { box-shadow: 0 0 0 3px var(--gold), 0 10px 30px #0008; transform: translateY(6px); }
  100% { box-shadow: none; transform: translateY(0); }
}

.cast-entry {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  border: 1px dashed color-mix(in srgb, var(--pc, var(--gold)) 55%, transparent);
  border-left: 4px solid var(--pc, var(--gold));
  background: color-mix(in srgb, var(--pc, var(--gold)) 7%, transparent);
  border-radius: 10px;
  padding: 9px 14px;
  margin: 0 0 12px;
  max-width: 70ch;
  animation: beat-arrive 1.2s ease-out;
}
.cast-star { color: var(--pc, var(--gold)); font-size: 1.1rem; }
.cast-line { font: 1rem/1.5 var(--serif); color: var(--cream); }
.cast-line strong { color: var(--pc, var(--gold)); }

.reply {
  margin: 9px 0 0 14px;
  padding: 7px 12px;
  border-left: 3px solid var(--pc, var(--gold));
  background: #ffffff70;
  border-radius: 0 9px 9px 0;
  font: .98rem/1.55 var(--serif);
}
.reply-by { display: block; font: 700 .72rem var(--sans); color: color-mix(in srgb, var(--pc) 60%, #333); margin-bottom: 2px; }

.tablelog { grid-column: 1 / -1; margin-top: 8px; }
.log-toggle { background: none; border: 0; color: var(--mut); font: .8rem var(--mono); cursor: pointer; padding: 6px 0; }
.loglist { list-style: none; margin: 4px 0 0; padding: 0; font: .8rem var(--mono); color: var(--mut); display: grid; gap: 3px; }

/* ---------- curtain ---------------------------------------------------------- */

.curtain {
  position: fixed; inset: 0; z-index: 60;
  background: #050d0ff2;
  display: grid; place-items: center;
  padding: 18px;
  overflow-y: auto;
}
.curtain-card { max-width: 640px; width: 100%; }
.curtain-card h2 { font: 800 clamp(1.5rem, 4vw, 2.2rem) var(--sans); margin: 2px 0 14px; }
.curtain-note { color: var(--cream-dim); }
.recap { background: var(--paper); color: var(--ink); border-radius: 12px; padding: 13px 16px; margin: 12px 0; border-left: 5px solid var(--gold); }
.recap-label { font: 700 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 6px; }
.recap-quote { margin: 0; font: 1.04rem/1.6 var(--serif); }
.recap-quote p { margin: 0 0 .5em; } .recap-quote p:last-child { margin: 0; }
.recap-card { margin: 8px 0 0; font-size: .8rem; color: var(--ink-soft); }
.curtain-you { font-size: 1.02rem; }
.curtain-dir { color: var(--cream-dim); }
.curtain-dir strong { color: var(--gold); }
.curtain-wait { font-size: .88rem; color: var(--mut); border-top: 1px dashed var(--line); padding-top: 10px; }

/* ---------- modals ------------------------------------------------------------ */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: #04090bd9;
  display: grid; place-items: center;
  padding: 16px;
  overflow-y: auto;
}
.modal {
  width: min(660px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: linear-gradient(165deg, #182a2e, #0e181b);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
}
.modal.wide { width: min(860px, 100%); }
.modal h2 { margin: 0 0 10px; font-size: 1.25rem; }
.modal-card-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; }
.compose-q { font: italic 1.05rem/1.5 var(--serif); color: var(--cream-dim); margin: 6px 0 4px; }

.target-list { display: grid; gap: 9px; max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.target {
  display: grid; gap: 6px;
  text-align: left;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #55402b66;
  border-left: 4px solid var(--pc, var(--gold));
  border-radius: 10px;
  padding: 10px 13px;
  cursor: pointer;
  font: 1rem/1.5 var(--serif);
}
.target:hover:not(.chosen) { background: #fdf7e8; }
.target.chosen { cursor: default; margin-bottom: 6px; }
.target.slim { padding: 8px 12px; background: #16272b; border-left-width: 1px; }
.target-head { font: 700 .74rem var(--sans); color: var(--ink-soft); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.target.slim .target-head { color: var(--cream-dim); }
.target-text { white-space: pre-wrap; }

.flag-reason { background: #e2766a1a; border-left: 3px solid var(--danger); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.vote-rows { display: grid; gap: 8px; margin-top: 10px; }
.vote-row { display: flex; align-items: center; gap: 10px; }
.vote-name { min-width: 110px; font-weight: 600; }

.switch-list { display: grid; gap: 6px; margin: 8px 0; }
.switch-decks select { width: auto; margin-right: 8px; }

.rules { font-size: .95rem; color: var(--cream-dim); }
.rules h4 { color: var(--cream); margin: 16px 0 4px; }
.rules p, .rules ol { margin: 6px 0; }
.rules strong { color: var(--cream); }

.drawer-scroll { max-height: 68vh; overflow-y: auto; padding-right: 6px; }

/* ---------- manuscript --------------------------------------------------------- */

.finale { max-width: 760px; margin: 24px auto 0; }
.ms {
  background: var(--paper);
  color: var(--ink);
  border-radius: 16px;
  border: 1px solid #55402b66;
  padding: clamp(20px, 4vw, 44px);
}
.ms-title { font: 700 clamp(1.5rem, 4vw, 2.2rem)/1.15 var(--serif); margin: 0 0 6px; }
.ms-untitled { color: var(--ink-soft); font-weight: 400; font-style: italic; font-size: .6em; }
.ms-byline { color: var(--ink-soft); font-size: .92rem; margin: 0 0 18px; }
.ms-cast { border: 1px dashed #55402b55; border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.ms-cast h4 { margin: 0 0 6px; font: 600 .72rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.ms-cast p { margin: 3px 0; font-size: .95rem; }
.ms-castcard { color: var(--ink-soft); }
.ms-chap { font: 600 .8rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: #8a6d3b; margin: 26px 0 10px; }
.ms-beat { margin-bottom: 16px; font: 1.08rem/1.7 var(--serif); }
.ms-beat p { margin: 0 0 .6em; }
.ms-attr { font: .74rem var(--sans); color: color-mix(in srgb, var(--pc, #888) 55%, #444); }
.ms-reply { margin: 6px 0 0 16px; font: .98rem/1.55 var(--serif); color: #4c4438; }
.ms-ending { border-top: 1px solid #55402b44; padding-top: 14px; }

.seal h3 { margin: 0 0 4px; }
.seal textarea, .seal input { background: #0a1618; }
.scoretable { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .92rem; }
.scoretable th, .scoretable td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
.scoretable th { color: var(--mut); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.credits summary { cursor: pointer; font-weight: 600; }
.export { margin: 18px 0 60px; }

/* ---------- toast + live -------------------------------------------------------- */

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  z-index: 90;
  background: #26150f; color: #ffd9c9;
  border: 1px solid #a4542f;
  border-radius: 12px;
  padding: 11px 18px;
  max-width: min(560px, 92vw);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  font-size: .95rem;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

/* ---------- responsive ----------------------------------------------------------- */

@media (max-width: 940px) {
  .table { grid-template-columns: 1fr; }
  .turnpanel { position: static; max-height: none; order: 1; }
  .story { order: 2; }
  .tablelog { order: 3; }
  /* the relay control stays reachable — pinned, never 2,400px away */
  .tp-actions {
    position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 40;
    background: #101d20f2;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
    margin: 0;
    box-shadow: 0 -8px 28px #000a;
  }
  #main { padding-bottom: 170px; }
  .hand { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .beat { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- print: the manuscript is the deliverable ------------------------------ */

@media print {
  body { background: #fff; color: #000; }
  .topbar, .seal, .credits, .export, .row, #toast, .turnpanel, .tablelog { display: none !important; }
  #main { padding: 0; max-width: none; }
  .finale { max-width: none; margin: 0; }
  .ms { border: 0; border-radius: 0; padding: 0; background: #fff; color: #000; }
  .ms-attr, .ms-reply { color: #444; }
}


/* ---------- targeted plays ------------------------------------------------- */

.bigcard {
  display: inline-flex; flex-direction: column; gap: 6px;
  min-width: 168px; max-width: 230px;
  background: linear-gradient(150deg, #fdf6e5, var(--paper));
  color: var(--ink);
  border: 1px solid #55402b7a;
  border-top: 6px solid var(--tc);
  border-radius: 12px;
  padding: 11px 13px;
  animation: deal-in .35s cubic-bezier(.2, .9, .3, 1.15) backwards;
}
.bigcard-value { font: 700 1.15rem/1.15 var(--serif); overflow-wrap: anywhere; }

.onto-arrow { font-size: 1.5rem; color: var(--gold); margin: 0 4px; }
.onto-label {
  font: 700 1rem var(--sans);
  color: var(--oc, var(--gold));
  border: 1px solid color-mix(in srgb, var(--oc, #d7ad63) 55%, transparent);
  background: color-mix(in srgb, var(--oc, #d7ad63) 12%, transparent);
  border-radius: 999px;
  padding: 6px 14px;
}

.target-list .target { animation: deal-in .3s cubic-bezier(.2, .9, .3, 1.1) backwards; animation-delay: calc(var(--mi, 0) * 45ms); }
.hero-target { border-left-width: 6px; }
.hero-target .target-head { font-size: .92rem; color: #2b2416; }
.cost-chip {
  font: 700 .68rem var(--sans);
  color: #7c5c1d; background: #d7ad63;
  border-radius: 999px; padding: 2px 9px;
  margin-left: auto;
}

.beat-onto { font: .74rem var(--sans); color: var(--ink-soft); }
.beat-onto strong { color: color-mix(in srgb, var(--pc) 65%, #333); }

.beat.is-linked, .cast-entry.is-linked { animation: link-flash 1.5s ease-out; }
@keyframes link-flash {
  0% { box-shadow: 0 0 0 3px var(--c-engine), 0 0 26px #5cc9d688; }
  100% { box-shadow: none; }
}
.reply-mini { display: block; width: 100%; font: .88rem/1.45 var(--serif); }


/* ---------- the story spine ------------------------------------------------ */

.spine {
  grid-column: 1 / -1;
  position: sticky; top: 54px; z-index: 20;
  background: linear-gradient(160deg, #122023f2, #0d181af6);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  padding: 8px 12px;
  backdrop-filter: blur(6px);
}
.spine-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.spine-head span { font: 700 .72rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.spine-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 132px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1px;
  scrollbar-width: thin;
}
.spine-ch { font: 600 .62rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mut); padding: 4px 2px 1px 26px; }
.spine-line {
  display: flex; align-items: baseline; gap: 8px;
  width: 100%; text-align: left;
  background: none; border: 0; cursor: pointer;
  color: var(--cream-dim);
  font: .86rem/1.45 var(--serif);
  padding: 2px 4px; border-radius: 6px;
}
.spine-line:hover:not(:disabled) { background: #ffffff0d; color: var(--cream); }
.spine-line:disabled { cursor: default; }
.spine-line i { font-style: normal; color: var(--tc, var(--gold)); font-size: .8rem; flex: none; width: 14px; text-align: center; }
.spine-line strong { color: var(--tc, var(--cream)); font-family: var(--sans); font-size: .82rem; }
.spine-text { min-width: 0; }
.spine-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; margin-left: auto; transform: translateY(-1px); }

.spine.mini {
  position: static;
  border-left-color: var(--line);
  margin: 8px 0 2px;
  padding: 6px 10px;
}
.spine.mini .spine-list { max-height: 96px; }

@media (max-width: 940px) {
  .spine { position: static; }
}


/* ---------- polish pass: tactile cards, calm motion, small delights -------- */

/* double-frame + watermark makes cards read as physical objects */
.hcard, .dcard, .bigcard {
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px #55402b26, inset 0 0 0 5px #ffffff59, 0 2px 6px #0005;
}
.hcard-wm {
  position: absolute; right: -8px; bottom: -16px;
  font-style: normal;
  font-size: 4.2rem; line-height: 1;
  color: var(--tc);
  opacity: .1;
  pointer-events: none;
}

/* a held hand, not a grid of tiles */
.hand .hcard:nth-child(odd) { transform: rotate(-1.1deg); }
.hand .hcard:nth-child(even) { transform: rotate(1deg) translateY(2px); }
.hand .hcard:hover:not(:disabled), .hand .hcard:focus-visible {
  transform: translateY(-5px) rotate(0); z-index: 3;
}

/* animate the deal only when cards actually arrive */
.hand.settled .hcard { animation: none; }

/* spine: slide in only the newest statement */
.spine-list li { animation: none; }
.spine.grew .spine-list li:last-child { animation: spine-in .35s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes spine-in {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* modals arrive, not appear */
.modal { animation: modal-in .2s cubic-bezier(.2, .9, .3, 1.05); }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* buttons press */
.btn:active:not(:disabled) { transform: scale(.97); }

/* points as gold tokens */
.points-tokens { display: flex; justify-content: center; gap: 3px; margin-top: 3px; }
.ptoken {
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f4d9a4, var(--gold) 60%, #8a6a2e);
  box-shadow: 0 1px 2px #0008;
}

/* your-signals tracker */
.signals-row { display: flex; align-items: center; gap: 7px; margin: 8px 0 2px; }
.signals-label { font: 600 .62rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--mut); }
.sig {
  font-style: normal; font-size: .95rem;
  color: var(--tc);
  opacity: .22;
  filter: grayscale(.6);
  transition: opacity .3s, filter .3s, transform .3s;
}
.sig.lit { opacity: 1; filter: none; transform: scale(1.12); text-shadow: 0 0 8px color-mix(in srgb, var(--tc) 60%, transparent); }

.fullsignal { color: var(--gold); font-size: .92rem; margin-top: 8px; }

/* landing-page fan */
.fan { display: flex; justify-content: flex-start; padding: 26px 8px 4px 18px; }
.fan-card {
  width: 138px; min-height: 128px;
  flex: none;
  margin-right: -30px;
  transform: rotate(calc((var(--fi) - 2) * 4deg)) translateY(calc((var(--fi) - 2) * (var(--fi) - 2) * 3px));
  transform-origin: 50% 130%;
  transition: transform .18s, z-index 0s;
  animation: deal-in .5s cubic-bezier(.2, .9, .3, 1.15) backwards;
  animation-delay: calc(var(--fi) * 90ms);
}
.fan-card:hover { transform: rotate(0) translateY(-12px) scale(1.06); z-index: 5; }

/* empty story watermark */
.empty-glyphs { display: flex; justify-content: center; gap: 18px; font-size: 1.6rem; margin-bottom: 6px; }
.empty-glyphs i { font-style: normal; color: var(--tc); opacity: .4; }

/* chapter headers get their star */
.chap-head span::before { content: '\2726  '; color: var(--gold); }
