/* The card table (SPEC-RUNWAY-LEA-007-the-board): agents are face cards, playbooks are
   cards dealt onto the felt, prospects are business cards. Boldness lives in the table;
   the conversation panel stays quiet. */

:root {
  --felt: #cfe0d6;
  --felt-deep: #b7cfc1;
  --felt-line: #9fbcad;
  --felt-ink: #16302a;
  --felt-muted: #4d6a60;
  --card: #fffdf7;
  --card-ink: #1f2623;
  --card-muted: #6a716d;
  --card-line: #e4e0d4;
  --panel: #fbfcfb;
  --panel-ink: #1f2623;
  --panel-muted: #66706b;
  --panel-line: #e1e6e3;
  --bubble-in: #eef2ef;
  --gold: #b8860b;
  --gold-soft: #f6e7b8;
  --stamp: #c3332a;
  --agent: #16302a;
  --shadow: 0 1px 0 rgba(22, 48, 42, .08), 0 6px 14px -8px rgba(22, 48, 42, .35);
  --lift: 0 2px 0 rgba(22, 48, 42, .1), 0 16px 30px -14px rgba(22, 48, 42, .5);
  --font: "Bricolage Grotesque", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --felt: #12352e; --felt-deep: #0c2923; --felt-line: #24524a; --felt-ink: #e3efe9; --felt-muted: #9dbcb1;
    --panel: #172320; --panel-ink: #e6ece9; --panel-muted: #9aaba4; --panel-line: #2a3a36; --bubble-in: #22322e;
    --gold-soft: #4a3c12;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 16px -8px rgba(0, 0, 0, .7);
    --lift: 0 2px 0 rgba(0, 0, 0, .3), 0 18px 34px -12px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --felt: #12352e; --felt-deep: #0c2923; --felt-line: #24524a; --felt-ink: #e3efe9; --felt-muted: #9dbcb1;
  --panel: #172320; --panel-ink: #e6ece9; --panel-muted: #9aaba4; --panel-line: #2a3a36; --bubble-in: #22322e;
  --gold-soft: #4a3c12;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 16px -8px rgba(0, 0, 0, .7);
  --lift: 0 2px 0 rgba(0, 0, 0, .3), 0 18px 34px -12px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 400 15px/1.45 var(--font);
  color: var(--felt-ink);
  background: var(--felt);
  background-image: radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px);
  background-size: 4px 4px;
  overflow-x: hidden;
}
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.boot { padding: 32px 16px; color: var(--felt-muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- selector: three face cards ---------- */
.selector { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.selector h1 { font-size: clamp(34px, 6vw, 60px); font-weight: 800; font-stretch: 75%; letter-spacing: -.02em; line-height: .95; margin: 0 0 10px; text-align: center; }
.selector .lede { text-align: center; color: var(--felt-muted); margin: 0 auto 36px; max-width: 46ch; }
.hand { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.face {
  position: relative; width: 220px; aspect-ratio: 5 / 7; border: 0; border-radius: 14px; padding: 18px;
  background: var(--card); color: var(--card-ink); box-shadow: var(--shadow); text-align: left;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.hand .face:nth-child(1) { transform: rotate(-4deg); }
.hand .face:nth-child(3) { transform: rotate(4deg); }
.face:hover, .face:focus-visible { transform: translateY(-10px) rotate(0); box-shadow: var(--lift); }
.face .corner { position: absolute; font-weight: 800; font-size: 26px; line-height: .9; text-align: center; color: var(--suit); }
.face .corner small { display: block; font-size: 20px; }
.face .corner.tl { top: 12px; left: 14px; }
.face .corner.br { bottom: 12px; right: 14px; transform: rotate(180deg); }
.face .big { position: absolute; inset: 0; display: grid; place-items: center; font-size: 120px; font-weight: 800; font-stretch: 75%; color: var(--suit); opacity: .12; pointer-events: none; }
.face h2 { margin: 0; font-size: 26px; font-weight: 800; }
.face .tone { color: var(--card-muted); font-size: 13px; }
.face q { font-size: 14px; font-style: italic; margin: 4px 0 8px; quotes: "«\202F" "\202F»"; }
.face .score { font-size: 13px; color: var(--card-muted); border-top: 1px dashed var(--card-line); padding-top: 8px; }
.face .score b { color: var(--card-ink); font-size: 18px; }

/* ---------- heads-up bar ---------- */
.hud {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--felt-deep); border-bottom: 1px solid var(--felt-line);
}
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chip-agent {
  width: 38px; height: 52px; border-radius: 6px; background: var(--card); color: var(--agent);
  display: grid; place-items: center; font-weight: 800; font-size: 20px; box-shadow: var(--shadow); flex: none;
}
.who strong { display: block; font-size: 16px; }
.linkish { background: none; border: 0; padding: 0; color: var(--felt-muted); font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.ring { display: flex; align-items: center; gap: 10px; }
.ring svg { width: 52px; height: 52px; transform: rotate(-90deg); }
.ring .track { stroke: var(--felt-line); }
.ring .fill { stroke: var(--gold); transition: stroke-dashoffset .8s ease; }
.ring .count { font-weight: 800; font-size: 22px; font-stretch: 85%; line-height: 1; }
.ring .count small { font-weight: 500; font-size: 13px; color: var(--felt-muted); }
.deck { display: flex; gap: 8px; margin-left: auto; overflow-x: auto; padding: 2px; }
.pb {
  flex: none; width: 92px; height: 64px; border-radius: 8px; padding: 6px 8px; border: 0;
  background: var(--card); color: var(--card-ink); box-shadow: var(--shadow); text-align: left;
  display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; line-height: 1.15;
  border-top: 4px solid var(--pb);
}
.pb b { font-size: 13px; }
.pb.locked { background: transparent; color: var(--felt-muted); box-shadow: none; border: 1.5px dashed var(--felt-line); border-top-width: 1.5px; }
.pb.soon { background: transparent; color: var(--felt-muted); box-shadow: none; border: 1.5px dashed var(--felt-line); border-top-width: 1.5px; font-style: italic; }
.lost-count { font-size: 13px; color: var(--felt-muted); white-space: nowrap; }
.lost-count b { color: var(--stamp); font-size: 18px; }

/* ---------- table layout ---------- */
.table { display: grid; grid-template-columns: 270px 1fr; min-height: calc(100vh - 74px); }
.rail { border-right: 1px solid var(--felt-line); padding: 14px 10px; }
.rail h2, .board h2 { font-size: 13px; font-weight: 600; color: var(--felt-muted); margin: 4px 6px 10px; }
.rail-list { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow-y: auto; }
.rail-item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; text-align: left; }
.rail-item:hover, .rail-item.active { background: var(--felt-deep); }
.rail-item .mono { width: 34px; height: 34px; font-size: 13px; }
.rail-item .meta { min-width: 0; flex: 1; }
.rail-item .line { font-size: 12px; color: var(--felt-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-empty { color: var(--felt-muted); font-size: 13px; padding: 8px 6px; max-width: 30ch; }

.board { padding: 14px 16px 60px; min-width: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.seg { display: inline-flex; background: var(--felt-deep); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; font-size: 13px; color: var(--felt-muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--card-ink); box-shadow: var(--shadow); }
.filters select { background: var(--felt-deep); border: 0; border-radius: 999px; padding: 7px 12px; font-size: 13px; }
.band { margin-top: 18px; }
.band-head { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 10px; }
.band-head h3 { margin: 0; font-size: 24px; font-weight: 800; font-stretch: 80%; }
.band-head span { color: var(--felt-muted); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

/* a business card */
.biz {
  position: relative; border: 0; border-radius: 6px; padding: 10px 10px 12px 14px; min-height: 92px;
  background: var(--card); color: var(--card-ink); box-shadow: var(--shadow); text-align: left; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px; transition: transform .15s ease, box-shadow .15s ease;
}
.biz::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--sector); }
.biz:hover, .biz:focus-visible { transform: translateY(-3px); box-shadow: var(--lift); }
.biz b { font-size: 14px; line-height: 1.2; }
.biz .prof { font-size: 12.5px; color: var(--card-muted); line-height: 1.25; }
.biz .city { font-size: 11.5px; color: var(--card-muted); margin-top: auto; }
.biz .heat { position: absolute; left: 5px; right: 0; bottom: 0; height: 4px; background: var(--card-line); }
.biz .heat i { display: block; height: 100%; background: var(--heat); }
.biz .marks { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; font-size: 12px; }
.biz .marks s { opacity: .7; text-decoration-color: var(--stamp); text-decoration-thickness: 2px; }
.biz.untouched { opacity: .92; }
.biz.stuck { filter: grayscale(.9); opacity: .6; }
.biz.won { background: linear-gradient(160deg, var(--card) 55%, var(--gold-soft)); }
.biz .stamp-sm {
  position: absolute; right: 6px; bottom: 10px; transform: rotate(-12deg); font-weight: 800; font-size: 13px;
  font-stretch: 75%; letter-spacing: .06em; padding: 1px 6px; border: 2px solid currentColor; border-radius: 4px;
}
.biz.won .stamp-sm { color: var(--gold); }
.biz.stuck .stamp-sm { color: var(--stamp); }
.mono { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--sector, #7a8a83); color: #fff; font-weight: 700; }

/* ---------- conversation panel ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 30, 25, .35); z-index: 30; animation: fade .2s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); z-index: 31; background: var(--panel); color: var(--panel-ink);
  display: flex; flex-direction: column; box-shadow: -20px 0 40px -20px rgba(0, 0, 0, .5); animation: slide .25s ease;
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer header { padding: 16px 18px 14px; border-bottom: 1px solid var(--panel-line); display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: start; }
.drawer header .mono { width: 52px; height: 52px; font-size: 18px; grid-row: span 2; }
.drawer header h2 { margin: 0; font-size: 21px; font-weight: 800; line-height: 1.15; }
.drawer header .sub { color: var(--panel-muted); font-size: 13px; }
.close { border: 0; background: none; font-size: 26px; line-height: 1; padding: 0 4px; color: var(--panel-muted); }
.about { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 8px; font-size: 13.5px; }
.about p { margin: 0; max-width: 60ch; }
.about .temper { color: var(--panel-muted); }
.gauge { min-width: 116px; text-align: right; }
.gauge .num { font-size: 30px; font-weight: 800; font-stretch: 80%; line-height: 1; color: var(--heat, var(--panel-muted)); transition: color .6s; }
.gauge .lbl { font-size: 12px; color: var(--panel-muted); }
.gauge .bar { height: 6px; border-radius: 3px; background: var(--panel-line); margin-top: 6px; overflow: hidden; }
.gauge .bar i { display: block; height: 100%; width: var(--w, 0%); background: var(--heat, var(--panel-muted)); transition: width .8s ease, background .6s; }
.tried { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--bubble-in); color: var(--panel-muted); }
.tag.now { background: var(--pb); color: #fff; }
.tag.lost { text-decoration: line-through; text-decoration-color: var(--stamp); text-decoration-thickness: 2px; }

.thread { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.pitch { align-self: center; font-size: 12px; color: var(--panel-muted); margin: 8px 0 2px; display: flex; gap: 6px; align-items: center; }
.pitch i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pb); }
.bubble { max-width: 84%; padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; animation: pop .22s ease-out; }
.bubble .meta { font-size: 11.5px; opacity: .75; margin-bottom: 3px; }
.bubble .subject { font-weight: 700; margin-bottom: 3px; }
.bubble.out { align-self: flex-end; background: var(--agent); color: #fff; border-bottom-right-radius: 4px; }
.bubble.in { align-self: flex-start; background: var(--bubble-in); border-bottom-left-radius: 4px; }
.event { align-self: center; font-size: 12.5px; color: var(--panel-muted); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--panel-line); animation: pop .22s ease-out; max-width: 92%; text-align: center; }
.event.dice { border-style: dashed; }
.typing { align-self: flex-start; font-size: 13px; color: var(--panel-muted); display: flex; gap: 6px; align-items: center; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(5px); } }

.stamp {
  align-self: center; margin: 14px 0 6px; transform: rotate(-8deg); font-weight: 800; font-stretch: 70%; font-size: 30px;
  letter-spacing: .05em; padding: 4px 16px; border: 4px solid currentColor; border-radius: 8px; animation: thud .35s cubic-bezier(.2, 1.6, .4, 1);
}
.stamp.lost { color: var(--stamp); }
.stamp.won { color: var(--gold); }
@keyframes thud { from { transform: rotate(-8deg) scale(2.2); opacity: 0; } }

.act { border-top: 1px solid var(--panel-line); padding: 14px 18px 18px; background: var(--panel); max-height: 58vh; overflow-y: auto; }
.act h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.hint { color: var(--panel-muted); font-size: 13px; }
.act .hint { margin: -4px 0 10px; }
.drafts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.draft {
  border: 1px solid var(--panel-line); border-radius: 12px; padding: 11px 12px; background: var(--panel); color: var(--panel-ink);
  text-align: left; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px;
}
.draft:hover:not(:disabled), .draft:focus-visible { border-color: var(--agent); box-shadow: 0 0 0 1px var(--agent); }
.draft:disabled { opacity: .5; cursor: default; }
.draft .kind { font-size: 12px; color: var(--panel-muted); display: flex; justify-content: space-between; gap: 6px; }
.draft .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.draft .go { align-self: flex-end; font-weight: 700; color: var(--agent); font-size: 13px; }
.playbooks { display: flex; gap: 10px; flex-wrap: wrap; }
.playbooks .pb { width: 150px; height: 96px; font-size: 12.5px; }
.playbooks .pb:hover { transform: translateY(-4px); box-shadow: var(--lift); }
.notice { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 13.5px; color: var(--panel-muted); }
.notice.bad { color: var(--stamp); }
.notice button, .btn { border: 1px solid var(--panel-line); background: var(--panel); border-radius: 8px; padding: 6px 12px; color: var(--panel-ink); }
.badges { display: flex; gap: 6px; margin: -4px 0 10px; flex-wrap: wrap; }
.badge { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--panel-ink); }

/* ---------- overlays: a dealt card, the final screen ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(10, 30, 25, .55); padding: 16px; animation: fade .2s ease; }
.dealt {
  width: 250px; aspect-ratio: 5 / 7; border-radius: 16px; background: var(--card); color: var(--card-ink); box-shadow: var(--lift);
  border-top: 10px solid var(--pb); padding: 22px; display: flex; flex-direction: column; gap: 8px;
  animation: deal .7s cubic-bezier(.2, .9, .3, 1.2);
}
.dealt .icon { font-size: 44px; }
.dealt h2 { margin: 0; font-size: 30px; font-weight: 800; font-stretch: 80%; line-height: 1; }
.dealt p { margin: 0; color: var(--card-muted); font-size: 14px; }
.dealt .btn { margin-top: auto; background: var(--card-ink); color: var(--card); border: 0; padding: 10px; border-radius: 10px; font-weight: 700; }
@keyframes deal { from { transform: translate(40vw, -40vh) rotate(160deg) scale(.4); opacity: 0; } }
.finale { text-align: center; color: #fff; }
.finale h2 { font-size: clamp(40px, 9vw, 96px); font-weight: 800; font-stretch: 70%; margin: 0; line-height: .9; }

.confetti { position: fixed; top: 40%; left: 50%; width: 8px; height: 12px; z-index: 60; pointer-events: none; animation: burst 1.3s ease-out forwards; }
@keyframes burst { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

@media (max-width: 860px) {
  .table { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--felt-line); }
  .rail-list { position: static; flex-direction: row; overflow-x: auto; max-height: none; }
  .rail-item { width: auto; flex: none; max-width: 220px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .biz { min-height: 84px; padding: 8px 8px 10px 11px; }
  .biz b { font-size: 12.5px; } .biz .prof { font-size: 11.5px; } .biz .city { display: none; }
  .deck { margin-left: 0; width: 100%; }
  .drafts { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; }
  .gauge { text-align: left; }
  .face { width: 170px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
