:root {
  --bg: #0b0b0c;
  --panel: #151517;
  --panel2: #1d1d20;
  --line: #2a2a2e;
  --text: #ececee;
  --dim: #9a9aa2;
  --accent: #5fd39b;
  --warn: #ff8a7a;
  --p: #ff6fae;
  --b: #5aa9ff;
  --g: #4cc97f;
  --y: #f2c94c;
  --r: #c9c9d1;
  --radius: 12px;
  --tap: 44px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { min-height: var(--tap); padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; }
button:hover { border-color: #3a3a40; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: #1f3b2e; border-color: #2f6b4f; color: #dff7ea; font-weight: 600; }
button.hinted, .card.hinted { box-shadow: 0 0 0 3px var(--accent); }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; background: rgba(11,11,12,.94); border-bottom: 1px solid var(--line); }
.brand { font-size: 16px; margin: 0; font-weight: 650; }
.status { color: var(--dim); font-size: 14px; flex: 1; min-width: 0; }
.status .badge { margin-left: 6px; }
.tools { display: flex; gap: 6px; width: 100%; }
.tools button { flex: 1; padding: 0 6px; }
.tools button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
@media (min-width: 760px) { .tools { width: auto; } .tools button { flex: none; padding: 0 14px; } }

main { max-width: 980px; margin: 0 auto; padding: 10px 12px 40px; }
.setup { max-width: 520px; margin: 0 auto; }
.setup h2 { margin: 8px 0 12px; }
.field { display: block; margin: 0 0 14px; }
.label { display: block; color: var(--dim); font-size: 13px; margin-bottom: 6px; }
.field input, .field select { width: 100%; min-height: var(--tap); padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); }
.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; border: 0; border-radius: 0; background: var(--panel); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-checked="true"] { background: #1f3b2e; color: #dff7ea; font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; min-height: var(--tap); }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); }
.check small, .note { color: var(--dim); }
.note { margin: 6px 0 0; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.game { display: grid; gap: 10px; }
.seats { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .seats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }
.seat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.seat.turn { border-color: var(--accent); }
.seat-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.seat-name { font-weight: 650; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; color: var(--dim); white-space: nowrap; }
.badge.cmd { color: #ffd98a; border-color: #5a4a22; }
.badge.turn { color: var(--accent); border-color: #2f6b4f; }
.badge.warn { color: var(--warn); border-color: #5a2a26; }
.seat-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }

.card { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 52px; height: 72px; min-height: 0; padding: 0; border-radius: 9px; border: 2px solid currentColor; background: #111114; font-weight: 750; font-size: 20px; line-height: 1; }
.card svg { width: 20px; height: 20px; fill: currentColor; margin-top: 4px; }
.card.s-p { color: var(--p); } .card.s-b { color: var(--b); } .card.s-g { color: var(--g); } .card.s-y { color: var(--y); }
.card.s-r { color: #fff; background: repeating-linear-gradient(135deg, #2b2b33 0 6px, #202027 6px 12px); border-color: #e7e7ee; border-style: double; border-width: 4px; }
.card.s-r::after { content: "ROCKET"; position: absolute; bottom: 3px; font-size: 7px; letter-spacing: .5px; color: #ddd; }
.card.small { width: 34px; height: 46px; font-size: 14px; border-width: 2px; border-radius: 7px; }
.card.small svg { width: 13px; height: 13px; margin-top: 2px; }
.card.small.s-r { border-width: 3px; }
.card.small.s-r::after { content: none; }
.card.shown { outline: 2px dashed var(--dim); outline-offset: 2px; }
button.card:hover { border-color: currentColor; filter: brightness(1.2); }
button.card.s-r:hover { border-color: #e7e7ee; }

.task { --suit: var(--dim); display: inline-flex; align-items: stretch; height: 30px; min-height: 0; padding: 0; overflow: hidden; border-radius: 6px; border: 1px dashed var(--suit); background: #141418; color: var(--suit); font-size: 12px; line-height: 1; }
.task.s-p { --suit: var(--p); } .task.s-b { --suit: var(--b); } .task.s-g { --suit: var(--g); } .task.s-y { --suit: var(--y); }
.task-tag { display: flex; align-items: center; padding: 0 6px; background: var(--suit); color: #0b0b0c; font-size: 9px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.task-face { display: flex; align-items: center; gap: 3px; padding: 0 6px; font-weight: 750; font-size: 15px; }
.task-face svg { width: 12px; height: 12px; fill: currentColor; }
.task .tok, .goal .tok { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; padding: 0 5px; margin: 4px 4px 4px 0; border-radius: 999px; background: #2c2a3a; color: #e8e2ff; font-weight: 700; font-size: 12px; }
.task-state { display: flex; align-items: center; padding: 0 6px 0 2px; color: var(--text); }
.task.done { border-style: solid; }
.task.done .task-state { color: var(--accent); }
.task.failed .task-state { color: var(--warn); }
button.task { height: var(--tap); }
button.task:hover { border-color: var(--suit); filter: brightness(1.2); }
.table .task { height: 40px; }

.goal { background: var(--panel); border: 1px solid #3a3550; border-left: 4px solid #8f84d6; border-radius: var(--radius); padding: 8px 10px; }
.goal h2 { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #c9c2f2; }
.goal-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.goal-task { display: flex; align-items: center; gap: 6px; min-height: 26px; }
.goal-task .tok { margin: 0; }
.goal-what { flex: 1; min-width: 0; font-weight: 600; }
.goal-state { font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim); white-space: nowrap; }
.goal-task.done .goal-state { color: var(--accent); border-color: #2f6b4f; }
.goal-task.done .goal-what { color: var(--dim); }
.goal-task.failed .goal-state { color: var(--warn); border-color: #5a2a26; }
.goal-text { margin: 0; font-weight: 600; }
.goal-rule { margin: 4px 0 0; font-size: 13px; color: var(--dim); }

.card.theirs { box-shadow: 0 0 0 2px #0b0b0c, 0 0 0 4px #8f84d6; }
.card.theirs::before { content: "!"; position: absolute; top: -7px; right: -7px; width: 16px; height: 16px; border-radius: 50%; background: #8f84d6; color: #0b0b0c; font-size: 11px; font-weight: 750; line-height: 16px; text-align: center; }
.hand-note { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 13px; color: #c9c2f2; }
.hand-note .mark { flex: none; width: 16px; height: 16px; border-radius: 50%; background: #8f84d6; }
.hand-note .mark::before { content: "!"; display: block; color: #0b0b0c; font-size: 11px; font-weight: 750; line-height: 16px; text-align: center; }
.radio { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); }
.radio .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); display: inline-block; }
.radio.red .dot { background: var(--warn); }

.table { background: #101a14; border: 1px solid #1f3328; border-radius: var(--radius); padding: 10px; min-height: 112px; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.table .play { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--dim); }
.table .play.win .who { color: var(--accent); font-weight: 650; }
.table .caption { width: 100%; font-size: 13px; color: var(--dim); }

.msg { min-height: 44px; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--dim); }
.msg.error { color: #ffd3cc; border-color: #6b2f2a; background: #1d1211; }
.msg.hint { color: #dff7ea; border-color: #2f6b4f; background: #102018; }
.prompt { display: grid; gap: 8px; }
.prompt h3 { margin: 0; font-size: 15px; }
.prompt .choices { display: flex; flex-wrap: wrap; gap: 8px; }
.prompt .rec { font-size: 13px; color: var(--dim); }
.result { padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line); }
.result.win { border-color: #2f6b4f; background: #102018; }
.result.loss { border-color: #6b2f2a; background: #1d1211; }
.result p { margin: 4px 0 8px; }

.me { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.me.turn { border-color: var(--accent); }
.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin-top: 8px; justify-items: center; }

.logbox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; }
.logbox summary { min-height: 32px; display: flex; align-items: center; cursor: pointer; color: var(--dim); }
.logbox ol { margin: 6px 0 4px; padding-left: 20px; font-size: 13px; max-height: 260px; overflow: auto; }

.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.sheet-body { width: 100%; max-width: 760px; max-height: 88vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 12px 14px 24px; }
@media (min-width: 760px) { .sheet { align-items: center; } .sheet-body { border-radius: 16px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; position: sticky; top: -12px; background: var(--panel); padding: 4px 0; }
.sheet h2 { font-size: 18px; margin: 0; }
.sheet h3 { font-size: 15px; margin: 14px 0 4px; }
.sheet ul { padding-left: 18px; margin: 4px 0; }
.sheet li { margin: 3px 0; }
.review-hands { display: grid; gap: 6px; margin: 8px 0; }
.review-hands .row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.review-hands .who { width: 100%; color: var(--dim); font-size: 13px; }
@media (min-width: 760px) { .review-hands .who { width: 64px; } }

.callout { position: fixed; z-index: 15; left: 8px; right: 8px; bottom: 8px; max-width: 520px; margin: 0 auto; background: #18221d; border: 1px solid #2f6b4f; border-radius: 14px; padding: 10px 14px 12px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.callout h3 { margin: 0 0 4px; font-size: 15px; color: #dff7ea; }
.callout p { margin: 0 0 10px; }
body.tutorial main { padding-bottom: 220px; }
.card.theirs.hinted { box-shadow: 0 0 0 3px var(--accent), 0 0 0 6px #8f84d6; }
