@import url(/static/fonts/fonts.css);

:root {
  --navy: #14213d;
  --paper: #f6f1e7;
  --card: #fffdf8;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --line: #ddd5c4;
  --accent: #fca311;
  --good: #2a9d8f;
  --bad: #e63946;
  --info: #457b9d;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: Montserrat, system-ui, sans-serif; font-size: 15px; line-height: 1.45; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
main.table { max-width: 1600px; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; }
p { margin: 0 0 .5rem; }
a { color: var(--info); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.warn { color: var(--bad); font-weight: 600; }
.neg { color: var(--bad); font-weight: 700; }

/* topbar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--navy); color: #fff; flex-wrap: wrap; }
.topbar a, .topbar .linkbtn { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .01em; }
.brand img { width: 28px; height: 28px; }
.topbar nav { margin-left: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.roomcode { background: var(--accent); color: var(--navy); font-weight: 800; padding: 2px 10px; border-radius: 6px; letter-spacing: .15em; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

/* forms */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
button, .btn { font: inherit; font-weight: 700; border: 0; border-radius: 8px; padding: 10px 16px; cursor: pointer; background: var(--navy); color: #fff; text-decoration: none; display: inline-block; }
button:hover { filter: brightness(1.1); }
.btn-primary { background: var(--navy); }
.btn-accent { background: var(--accent); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn-small { padding: 6px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-big { padding: 14px 18px; font-size: 1.1rem; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-weight: 800; font-size: 1.3rem; text-align: center; }

/* layout */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.notice { padding: 12px 14px; border-radius: 8px; background: #fff; border-left: 4px solid var(--info); }
.notice.err { border-left-color: var(--bad); }
.notice.ok { border-left-color: var(--good); }
.pill, .chip { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eee; }
.chip.good { background: #d8f0ec; color: #1d6f65; }
.chip.bad { background: #fbdcde; color: #a0151f; }
.chip.info { background: #dde8f0; color: #2c5470; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.copybox { display: flex; gap: 6px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 8px; border-left: 4px solid var(--accent); z-index: 50; max-width: calc(100vw - 32px); }
.scroll-x { overflow-x: auto; }

/* home */
.hero { margin: 8px 0 20px; }
.memo { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 26px; box-shadow: 4px 4px 0 var(--navy); overflow: hidden; }
.memo-head { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; border-bottom: 2px solid var(--navy); padding-bottom: 8px; margin-bottom: 14px; font-size: .85rem; }
.memo h1 { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 900; color: var(--navy); }
.subtitle { font-size: 1.1rem; color: var(--muted); }
.stamp { position: absolute; right: 18px; bottom: 14px; transform: rotate(-8deg); border: 3px solid var(--bad); color: var(--bad); font-weight: 900; padding: 4px 10px; border-radius: 6px; letter-spacing: .1em; opacity: .75; font-size: .8rem; }
.rules { padding-left: 1.2rem; margin: 0; }
.rules li { margin-bottom: .5rem; }

/* lobby */
.bigcode { font-size: 3rem; font-weight: 900; letter-spacing: .25em; color: var(--navy); }
.qr { width: 200px; height: 200px; display: block; margin: 0 auto; }
.lobby-wait { max-width: 520px; margin: 0 auto; }

/* table */
.table-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
@media (max-width: 1000px) {
  .table-grid { grid-template-columns: 1fr; }
  .col-side { order: -1; }
}
.col-side > * + *, .col-board > * + * { margin-top: 12px; }
.board-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; overflow-x: auto; }
.board { width: 100%; min-width: 640px; height: auto; display: block; }
.board .links line { stroke: #c9bfa9; stroke-width: 8; stroke-linecap: round; }
.board .space text { fill: #fff; font-weight: 800; text-anchor: middle; pointer-events: none; }
.board .space .icon { font-size: 17px; }
.board .space .stop-text { font-size: 9px; }
.board .space.hl circle:first-of-type { stroke: var(--accent); stroke-width: 5; }
.board .lane-label { font-size: 15px; font-weight: 800; fill: var(--navy); opacity: .7; }
.board .token { transition: transform .25s ease-out; }
.board .token circle { stroke: #fff; stroke-width: 3; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.board .token text { fill: #fff; font-weight: 900; font-size: 14px; text-anchor: middle; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.legend i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; font-style: normal; font-weight: 800; font-size: 11px; margin-right: 5px; vertical-align: -3px; }
.hosttools { justify-content: flex-end; }

.firm { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.firm-top { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 8px; }
.gauge { position: relative; height: 22px; background: #eee6d6; border-radius: 999px; overflow: hidden; }
.gauge-fill { height: 100%; transition: width .6s; }
.gauge-fill.good { background: var(--good); }
.gauge-fill.mid { background: var(--accent); }
.gauge-fill.bad { background: var(--bad); }
.gauge-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--navy); opacity: .6; }
.gauge-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: var(--navy); }

.action .turn { font-weight: 800; font-size: 1.15rem; border-left: 6px solid var(--navy); padding-left: 10px; margin-bottom: 12px; }
.action > * + * { margin-top: 12px; }
.wheel-box { display: grid; place-items: center; }
.wheel { width: 190px; height: 190px; }
.wheel-num { fill: #fff; font-weight: 900; font-size: 22px; text-anchor: middle; }
.wheel-rot { transform-origin: 0 0; }
.wheel.spinning .wheel-rot { animation: spin 2.2s cubic-bezier(.15,.7,.2,1) both; animation-delay: inherit; }
.sound-toggle { margin-left: auto; }
@keyframes spin { from { transform: rotate(0deg); } }

.gcard { border-radius: 10px; padding: 14px; background: #fff; border: 2px solid var(--navy); border-top-width: 10px; }
.gc-event { border-color: var(--info); }
.gc-crisis { border-color: var(--bad); background: #fff7f7; }
.gc-anecdote { border-color: #9b5de5; }
.gc-payday { border-color: var(--good); }
.gc-shares { border-color: #e9a100; }
.gc-fixed { border-color: #a8a29e; }
.gcard-kind { text-transform: uppercase; font-size: .7rem; font-weight: 800; letter-spacing: .12em; color: var(--muted); margin-bottom: 4px; }
.notes { margin: 0; padding-left: 1.1rem; font-size: .88rem; }
.options { display: grid; gap: 10px; }
.option { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
.option p { margin: 4px 0 8px; }
.spinres { font-size: 1.2rem; min-width: 2ch; text-align: right; }

.pcards { display: grid; gap: 8px; }
.pcard { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
.pcard.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.pcard.mine { background: #fffaf0; }
.pcard-head { display: flex; align-items: center; gap: 8px; }
.pstats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .85rem; margin-top: 4px; }
.log ul { margin: 8px 0 0; padding-left: 1.1rem; font-size: .85rem; max-height: 320px; overflow-y: auto; }
.log summary { font-weight: 800; cursor: pointer; }

.scores { width: 100%; border-collapse: collapse; }
.scores th, .scores td { padding: 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.scores th:nth-child(2), .scores td:nth-child(2) { text-align: left; }
.scores tr.winner td { background: #fff4dc; font-weight: 700; }
.stories { margin-bottom: 12px; }
.stories ul { margin: 4px 0 0; padding-left: 1.1rem; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@media (max-width: 600px) { main { padding: 12px; } .bigcode { font-size: 2.2rem; } }
