:root {
  --bg: #16261d; --bg2: #1f3328; --paper: #efe4c4; --paper-2: #e3d3a0; --paper-3: #cdb77f; --ink: #2a1a0a; --ink-soft: #5a4631;
  --gold: #d9a441; --gold-dark: #a87a24; --danger: #b3362f; --good: #2e7d4f; --warn: #b06a1b; --sky: #2f9fe0;
  --panel: rgba(239, 228, 196, 0.97); --glass: rgba(18, 32, 24, 0.84);
  --radius: 12px;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  color: var(--ink);
  font-size: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); line-height: 1.35; }
h1, h2, h3, .display { font-family: 'Oswald', 'Source Sans 3', sans-serif; font-weight: 500; letter-spacing: .02em; margin: 0; }
h1 { font-size: 2.4rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.1rem; color: var(--ink-soft); border-bottom: 1px solid var(--paper-3); padding-bottom: 2px; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .08em; }
button, input, select { font: inherit; color: inherit; }
button { background: var(--gold); color: var(--ink); border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; box-shadow: 0 2px 0 var(--gold-dark); }
button:hover { filter: brightness(1.06); } button:active { transform: translateY(1px); box-shadow: none; }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; }
button.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-soft); color: var(--ink-soft); }
button.good { background: var(--good); color: #fff; box-shadow: 0 2px 0 #1d5635; }
button.danger { background: var(--danger); color: #fff; box-shadow: 0 2px 0 #7a241f; }
button.small { padding: 3px 9px; font-size: .9rem; border-radius: 6px; }
input[type=text], input[type=number], select { background: #fff8e8; border: 1px solid var(--paper-3); border-radius: 6px; padding: 7px 9px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid #ffd166; outline-offset: 2px; }
label { display: block; font-size: .9rem; color: var(--ink-soft); font-weight: 600; }
.muted { color: var(--ink-soft); } .small { font-size: .88rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .grow { flex: 1 1 auto; }
.row > input[type=text], .row > select { width: auto; flex: 1 1 120px; }
.stack > * + * { margin-top: 10px; }
svg.ic { width: 1.25em; height: 1.25em; vertical-align: -.3em; }
.ibtn { width: 50px; height: 50px; border-radius: 8px; background: rgba(255,255,255,.08); color: var(--paper); box-shadow: none; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.ibtn svg { width: 32px; height: 32px; } .ibtn:hover { background: rgba(255,255,255,.18); }
.ibtn.on { background: rgba(255,255,255,.22); } .ibtn.off { opacity: .45; } .ibtn.off svg { filter: grayscale(1); }
.panel .ibtn { background: rgba(60,40,20,.08); color: var(--ink); } .panel .ibtn:hover { background: rgba(60,40,20,.16); }
.shake { animation: shake .5s; } @keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* Panels & screens */
.panel { background: var(--panel); border-radius: var(--radius); padding: 16px 18px; box-shadow: 0 12px 40px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.4); position: relative; }
.screen { height: 100%; overflow: auto; padding: 24px 16px 48px; background-image: radial-gradient(1200px 600px at 20% -10%, rgba(47,159,224,0.28), transparent 60%), radial-gradient(900px 500px at 90% 110%, rgba(217,164,65,0.22), transparent 60%); }
.screen > * { max-width: 1480px; margin-left: auto; margin-right: auto; }
.center { max-width: 560px; margin: 8vh auto 0; }
.brand { text-align: center; color: var(--paper); margin-bottom: 18px; }
.brand h1 { font-size: 3.6rem; text-shadow: 0 2px 0 var(--bg), 0 6px 24px rgba(0,0,0,.5); letter-spacing: .08em; text-transform: uppercase; }
.brand p { margin: 4px 0 0; opacity: .85; font-style: italic; font-size: 1.15rem; }
.code-input { text-transform: uppercase; letter-spacing: .25em; font-weight: 700; font-size: 1.2rem; text-align: center; }
.notice { padding: 10px 14px; border-radius: 10px; background: rgba(60,40,20,.08); font-size: 1rem; }
.notice.rejoin { background: rgba(217,164,65,.22); box-shadow: inset 0 0 0 1.5px var(--gold); }
.lobby { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .lobby { grid-template-columns: 1fr 1fr; } .lobby .preview { grid-column: 1 / -1; } }
@media (max-width: 720px) { .lobby { grid-template-columns: 1fr; } }
.players { list-style: none; padding: 0; margin: 0; }
.players li { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px dashed var(--paper-3); font-size: 1.1rem; }
.swatch { width: 24px; height: 24px; border-radius: 6px; border: 2px solid rgba(0,0,0,.25); display: inline-block; cursor: pointer; }
.swatch.on { outline: 3px solid var(--ink); outline-offset: 1px; } .swatch.taken { opacity: .3; cursor: not-allowed; }
button.swatch.big { width: 46px; height: 46px; padding: 0; box-shadow: none; border: 2px solid rgba(0,0,0,.25); }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.set { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sethead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; } .sethead label { margin: 0; }
.setval { font-family: 'Oswald', sans-serif; font-size: 1.3rem; color: var(--gold-dark); white-space: nowrap; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 34px; margin: 0; background: transparent; cursor: pointer; --pct: 0%; touch-action: pan-y; }
input[type=range]:disabled { cursor: default; opacity: .6; }
input[type=range]::-webkit-slider-runnable-track { height: 12px; border-radius: 999px; background: linear-gradient(90deg, var(--gold) var(--pct), rgba(60,40,20,.18) var(--pct)); box-shadow: inset 0 1px 2px rgba(0,0,0,.25); }
input[type=range]::-moz-range-track { height: 12px; border-radius: 999px; background: rgba(60,40,20,.18); }
input[type=range]::-moz-range-progress { height: 12px; border-radius: 999px; background: var(--gold); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 30px; height: 30px; margin-top: -9px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2c2, var(--gold) 60%, var(--gold-dark)); border: 2.5px solid var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.35); }
input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2c2, var(--gold) 60%, var(--gold-dark)); border: 2.5px solid var(--ink); }
.ticks { display: flex; justify-content: space-between; padding: 0 13px; margin-top: -8px; } .ticks i { width: 4px; height: 6px; border-radius: 2px; background: rgba(60,40,20,.35); }
.pills { display: inline-flex; background: rgba(60,40,20,.14); border-radius: 999px; padding: 3px; gap: 2px; align-self: flex-start; }
.pill { border-radius: 999px; padding: 8px 18px; background: transparent; box-shadow: none; color: var(--ink-soft); font-weight: 700; min-height: 40px; }
.pill.on { background: var(--gold); color: var(--ink); box-shadow: 0 1px 0 var(--gold-dark); } .pill:disabled { opacity: .7; cursor: default; }
.seedset .row { gap: 6px; } .seedset input { flex: 1; }
.code-big { font-family: 'Oswald', sans-serif; font-size: 2.2rem; letter-spacing: .25em; }
.preview { display: flex; flex-direction: column; min-height: 420px; }
.preview .boardwrap { flex: 1; border-radius: 10px; overflow: hidden; background: #1b2f3d; min-height: 360px; position: relative; }
.preview .boardwrap svg { width: 100%; height: 100%; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; font-size: 1rem; } .legend span { display: inline-flex; align-items: center; gap: 5px; } .legend svg { width: 30px; height: 30px; }

/* ===== Game grid ===== */
#game { position: fixed; inset: 0; display: grid; gap: 12px; padding: 12px; grid-template-columns: 240px minmax(0, 1fr) 440px; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "players top right" "players stage right" "resbar resbar right"; }
#players { grid-area: players; display: flex; flex-direction: column; gap: 8px; overflow: auto; scrollbar-width: thin; min-height: 0; }
#top { grid-area: top; display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; height: 160px; }
#toprow { display: flex; gap: 8px; align-items: center; height: 56px; min-width: 0; }
#topbtns { display: flex; gap: 4px; padding: 3px; flex: none; } #topbtns .ibtn { width: 46px; height: 46px; } #topbtns .ibtn svg { width: 30px; height: 30px; }
#right { grid-area: right; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
#stage { grid-area: stage; position: relative; overflow: hidden; border-radius: var(--radius); touch-action: none; cursor: grab; min-height: 0; background: radial-gradient(120% 90% at 35% 25%, #244a5e, #122733 85%); box-shadow: 0 12px 40px rgba(0,0,0,.5), inset 0 0 0 2px rgba(255,255,255,.14), inset 0 0 60px rgba(0,0,0,.35); }
#stage:active { cursor: grabbing; }
#boardwrap { position: absolute; inset: 0; } #boardwrap svg { width: 100%; height: 100%; display: block; }
#resbar { grid-area: resbar; }
.hud { position: absolute; z-index: 5; }
.glass { background: var(--glass); color: var(--paper); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.08); backdrop-filter: blur(6px); }
#zoom { bottom: 12px; left: 12px; z-index: 6; display: flex; flex-direction: column; gap: 4px; padding: 4px; }
#hint { top: 12px; left: 50%; transform: translateX(-50%); padding: 8px 16px; font-size: 1.15rem; font-weight: 600; pointer-events: none; white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis; }

/* top: cycle, phase, clock */
#topbox { padding: 8px 10px; display: flex; align-items: center; justify-content: stretch; gap: 8px; flex-wrap: nowrap; width: 100%; height: 96px; overflow: hidden; }
.frame { padding: 4px 10px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); text-align: center; height: 78px; display: flex; flex-direction: column; justify-content: center; flex: 1 1 0; min-width: 0; }
.frame.cyclef { flex: 0 0 84px; } .frame.order { align-items: stretch; text-align: left; flex-grow: 1.25; } button.frame.readybtn { flex: 1 1 0; }
.frame .big { overflow: hidden; text-overflow: ellipsis; }
.orow { display: flex; align-items: center; gap: 3px; height: 30px; min-width: 0; } .orow .sub { flex: 0 0 30px; font-size: .78rem; text-align: left; white-space: nowrap; overflow: hidden; } .orow.next { opacity: .6; }
.ochip { display: inline-flex; align-items: center; justify-content: center; flex: 1 1 0; min-width: 18px; max-width: 30px; height: 24px; overflow: hidden; border-radius: 6px; background: var(--team); color: #fff; font-weight: 800; font-size: .8rem; text-shadow: 0 1px 1px rgba(0,0,0,.5); box-shadow: inset 0 0 0 1px rgba(0,0,0,.3); }
.ochip.on { outline: 2px solid #ffd166; outline-offset: 1px; } .ochip.done { opacity: .35; }
.frame .big { font-family: 'Oswald', sans-serif; font-size: 2rem; line-height: 1.05; color: #ffd166; white-space: nowrap; }
.frame .sub { font-size: .95rem; opacity: .75; text-transform: uppercase; letter-spacing: .08em; }
.frame.phase { flex-direction: row; gap: 10px; align-items: center; }
.frame.phase svg { width: 40px; height: 40px; flex: none; }
.frame.phase, button.frame.readybtn { flex-direction: row; gap: 8px; align-items: center; justify-content: center; }
.frame.phase > div { min-width: 0; }
button.frame.readybtn { flex-direction: row; gap: 10px; align-items: center; background: rgba(46,125,79,.55); color: var(--paper); box-shadow: inset 0 0 0 2px #7fd49a; cursor: pointer; font: inherit; padding: 4px 14px; border: 0; border-radius: 8px; }
button.frame.readybtn svg { width: 44px; height: 44px; } button.frame.readybtn:hover { background: rgba(46,125,79,.8); } button.frame.readybtn.on { background: rgba(255,214,102,.22); box-shadow: inset 0 0 0 2px #ffd166; animation: none; } button.frame.readybtn .sub { font-size: 1.15rem; letter-spacing: .06em; color: #fff; }
.frame.turn { box-shadow: inset 0 0 0 2px var(--team, #fff); }
.frame.turn.mine { background: rgba(255,214,102,.14); animation: pulse 1.6s infinite; }
.clock { font-variant-numeric: tabular-nums; font-size: 2.3rem; font-family: 'Oswald', sans-serif; min-width: 86px; text-align: center; line-height: 1; }
.clock.hurry { color: #ff8c7a; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.gauge { display: flex; gap: 4px; align-items: center; justify-content: center; }
.gauge i { width: 16px; height: 16px; border-radius: 50%; background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }
.gauge i.used { background: var(--team, #fff); } .gauge i.sup { border-radius: 4px; }
.topbtns { display: flex; gap: 4px; }
.newsbar { display: flex; gap: 8px; flex-wrap: nowrap; justify-content: flex-start; align-items: center; height: 52px; overflow: hidden; flex: 1 1 auto; min-width: 0; }
.newsbar .ntc { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-size: 1.1rem; font-weight: 600; box-shadow: inset 0 0 0 1.5px var(--gold); background: var(--glass); color: var(--paper); white-space: nowrap; }
.newsbar .ntc.quiet { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18); opacity: .7; }
.newsbar .ntc svg { width: 30px; height: 30px; }

/* left: team cards */
.tcard { padding: 8px 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.08); background: linear-gradient(100deg, color-mix(in srgb, var(--team) 26%, transparent), transparent 55%), var(--glass); }
.tcard.me { box-shadow: 0 8px 24px rgba(0,0,0,.4), inset 0 0 0 2px rgba(255,214,102,.7); }
.tcard.active { box-shadow: 0 8px 24px rgba(0,0,0,.4), inset 0 0 0 2px var(--team); }
.tcard.finished { opacity: .6; }
.ttop { display: flex; align-items: center; gap: 8px; }
.tname { font-family: 'Oswald', sans-serif; font-size: 1.35rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tstate svg { width: 30px; height: 30px; } .tstate { display: flex; gap: 2px; }
.tstats { display: flex; flex-wrap: wrap; gap: 6px; font-size: 1.15rem; font-weight: 700; margin-top: 4px; }
.tstats span { display: inline-flex; align-items: center; gap: 3px; background: rgba(255,255,255,.08); border-radius: 6px; padding: 1px 6px; }
.tstats svg { width: 28px; height: 28px; }
.tstats .score { background: rgba(255,214,102,.2); }

/* right: dock (log/chat/news) and the phase panel */
#dock { flex: 0 0 auto; height: 36%; min-height: 160px; display: flex; flex-direction: column; }
#game[data-phase="planning"] #dock { height: 22%; min-height: 120px; }
#dock .tabs { display: flex; gap: 2px; padding: 6px 6px 0; align-items: center; }
#dock .tabs .ibtn { width: 48px; height: 44px; position: relative; }
#dock .tabs .spacer { flex: 1; }
.badge { position: absolute; top: 2px; right: 2px; background: #ff6b5a; color: #fff; border-radius: 999px; font-size: .75rem; padding: 0 5px; font-weight: 700; }
.loglist { overflow: auto; padding: 6px 12px 8px; font-size: 1.05rem; scrollbar-width: thin; flex: 1; }
.loglist > div { padding: 3px 0; border-bottom: 1px dotted rgba(255,255,255,.12); display: flex; gap: 6px; align-items: flex-start; }
.loglist > div > b { opacity: .6; font-weight: 600; min-width: 30px; }
.loglist .news { color: #ffe9a8; } .loglist .warn { color: #ffd38a; } .loglist .phase { color: #9fe0b4; font-weight: 600; } .loglist .team { opacity: .85; }
.loglist .chatline b { opacity: 1; min-width: 0; }
.chatform { display: flex; gap: 6px; padding: 6px; } .chatform input { flex: 1; background: rgba(255,255,255,.1); border: 0; color: var(--paper); border-radius: 8px; padding: 8px 10px; font-size: 1.05rem; } .chatform input::placeholder { color: rgba(255,255,255,.5); }
.newscard { padding: 10px 12px; display: flex; gap: 12px; align-items: flex-start; border-bottom: 1px solid rgba(255,255,255,.1); }
.newscard svg { width: 54px; height: 54px; flex: none; background: rgba(255,255,255,.08); border-radius: 12px; padding: 4px; }
.newscard .nh { font-family: 'Oswald', sans-serif; font-size: 1.3rem; color: #ffd166; } .newscard .nb { font-size: 1rem; opacity: .9; } .newscard .nc { font-size: .85rem; opacity: .6; text-transform: uppercase; letter-spacing: .08em; }
#phasebox { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
#phasebox h2 { display: flex; align-items: center; gap: 10px; color: #ffd166; font-size: 1.3rem; } #phasebox h2 svg { width: 34px; height: 34px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.abtn { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 10px; min-width: 96px; border-radius: 12px; background: rgba(255,255,255,.08); color: var(--paper); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.14); font-size: 1rem; font-weight: 700; }
.abtn svg { width: 44px; height: 44px; } .abtn:hover { background: rgba(255,255,255,.16); }
.abtn.good { background: rgba(46,125,79,.75); box-shadow: inset 0 0 0 2px #7fd49a; } .abtn.danger { background: rgba(179,54,47,.7); box-shadow: inset 0 0 0 2px #ff8c7a; } .abtn.on { background: rgba(255,214,102,.25); box-shadow: inset 0 0 0 2px #ffd166; }
.abtn:disabled { opacity: .35; }
.orderform { display: grid; grid-template-columns: auto 1fr auto auto auto auto; gap: 4px 8px; align-items: center; }
.orderform .oi svg { width: 42px; height: 42px; background: rgba(255,255,255,.14); border-radius: 10px; padding: 3px; } .orderform .on { font-size: 1.1rem; font-weight: 600; } .orderform .op { opacity: .75; font-size: 1rem; white-space: nowrap; }
.orderform .ibtn { width: 40px; height: 40px; } .orderform input { width: 64px; text-align: center; font-size: 1.2rem; font-weight: 700; background: rgba(255,255,255,.1); border: 0; color: var(--paper); border-radius: 8px; padding: 6px 4px; -moz-appearance: textfield; }
.orderform input::-webkit-outer-spin-button, .orderform input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.orderform .ot { text-align: right; font-weight: 700; min-width: 44px; font-size: 1.1rem; }
.total { display: flex; justify-content: space-between; align-items: center; font-size: 1.3rem; font-family: 'Oswald', sans-serif; padding: 6px 4px; border-top: 1px solid rgba(255,255,255,.15); }
.total .over { color: #ff8c7a; } .total .left { color: #ffd166; }
.hqpick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.07); font-size: 1.05rem; } .hqpick svg { width: 40px; height: 40px; } .hqpick .big { font-family: 'Oswald', sans-serif; font-size: 1.4rem; }
.hqpick.set { box-shadow: inset 0 0 0 2px #7fd49a; }
.offer { padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.07); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.offer .om { display: inline-flex; align-items: center; gap: 6px; font-family: 'Oswald', sans-serif; font-size: 1.2rem; flex: 1; } .offer .om svg { width: 40px; height: 40px; }
.chip { width: 56px; height: 56px; border-radius: 12px; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); padding: 0; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.chip svg { width: 40px; height: 40px; } .chip.on { background: rgba(255,214,102,.28); box-shadow: inset 0 0 0 3px #ffd166; } .chip:disabled { opacity: .3; }
.chip .pts { position: absolute; bottom: -2px; right: 2px; font-size: .85rem; font-weight: 800; color: #ffd166; }
.offer.locked { opacity: .7; }
.traderow { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 6px 8px; align-items: center; }
.traderow svg { width: 40px; height: 40px; background: rgba(255,255,255,.14); border-radius: 10px; padding: 3px; } .traderow .ibtn { width: 42px; height: 42px; }

/* bottom: resources */
#resbar { display: flex; gap: 8px; padding: 8px 10px; align-items: stretch; overflow-x: auto; scrollbar-width: thin; }
.res { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 88px; padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); gap: 0; position: relative; cursor: default; }
.res svg { width: 56px; height: 56px; background: rgba(255,255,255,.1); border-radius: 14px; padding: 5px; } .res .n { font-family: 'Oswald', sans-serif; font-size: 1.7rem; line-height: 1; color: #ffd166; }
.res .n.bump { animation: bump .5s; } @keyframes bump { 30% { transform: scale(1.3); } }
.res.capital { background: rgba(255,214,102,.14); min-width: 110px; }
.res.zero { opacity: .45; }
.res.spacer { flex: 1; background: none; box-shadow: none; min-width: 0; }

/* modals */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { width: min(640px, 100%); max-height: 92vh; overflow: auto; } .modal.wide { width: min(980px, 100%); }
.mhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.mhead .ibtn.x { width: 44px; height: 44px; }
.guide { display: grid; gap: 8px; }
.guide .g { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 8px; border-radius: 10px; background: rgba(60,40,20,.06); }
.guide .g svg { width: 60px; height: 60px; } .guide .g b { font-family: 'Oswald', sans-serif; font-size: 1.25rem; display: block; }
.revtable { width: 100%; border-collapse: collapse; font-size: 1.15rem; } .revtable th, .revtable td { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--paper-3); } .revtable th:first-child, .revtable td:first-child { text-align: left; }
.revtable svg { width: 40px; height: 40px; vertical-align: middle; } .revtable td b { font-family: 'Oswald', sans-serif; font-size: 1.3rem; }
.revtable .best { background: rgba(217,164,65,.28); border-radius: 6px; }
.stand { width: 100%; border-collapse: collapse; font-size: 1.1rem; } .stand th, .stand td { padding: 8px 10px; border-bottom: 1px solid var(--paper-3); text-align: right; } .stand th:nth-child(-n+2), .stand td:nth-child(-n+2) { text-align: left; }
.stand .total { font-family: 'Oswald', sans-serif; font-size: 1.4rem; color: var(--gold-dark); display: table-cell; border-top: 0; padding: 8px 10px; }
.stand tr.first td { background: rgba(217,164,65,.25); }
.rules h4 { margin: 10px 0 2px; font-family: 'Oswald', sans-serif; font-weight: 500; font-size: 1.1rem; }
.rules p { margin: 0 0 4px; font-size: .95rem; }
.rules .doom { margin: 10px 0 6px; padding: 12px 16px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 1.15rem; line-height: 1.35; }
.dlg .dbody { font-size: 1.1rem; margin-bottom: 12px; }

/* toasts, tooltip */
#toasts { position: fixed; bottom: 136px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 40; pointer-events: none; max-width: min(92vw, 640px); }
.toast { background: var(--paper); color: var(--ink); padding: 10px 18px 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4); font-size: 1.1rem; font-weight: 600; animation: toastin .25s ease-out; display: flex; align-items: center; gap: 10px; --kind: var(--gold); }
.toast::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--kind); flex: none; box-shadow: 0 0 0 2px rgba(0,0,0,.12); }
.toast.error { --kind: var(--danger); } .toast.ready, .toast.turn { --kind: var(--good); } .toast.news { --kind: var(--sky); } .toast.end { --kind: var(--ink); }
@keyframes toastin { from { opacity: 0; transform: translateY(-10px); } }
#tooltip { position: fixed; z-index: 200; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 8px; font-size: 1rem; max-width: 320px; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.5); line-height: 1.3; }

/* board */
.tilehit { fill: transparent; }
.cand { pointer-events: none; }
.wave { animation: wave 6s linear infinite; will-change: transform; } @keyframes wave { to { transform: translateX(-48px); } }
.hqg text { font-family: 'Oswald', sans-serif; font-weight: 700; }
.roadpiece.fresh { animation: drop .35s ease-out; transform-box: fill-box; transform-origin: center; } @keyframes drop { from { transform: scale(2.4); opacity: 0; } }
.qmark { animation: pulse 1.6s infinite; }

/* mobile */
@media (max-width: 1000px) {
  #toasts { bottom: 16px; }
  #game { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-areas: "top" "stage" "resbar" "right"; gap: 8px; padding: 8px; }
  #players { display: none; }
  #right { max-height: 36vh; } #dock { height: 40%; }
  #top { height: auto; } #topbox { flex-wrap: wrap; height: auto; } .frame { height: 64px; flex-basis: 40%; } .frame.order, .frame.gaugef, .frame.readyf { display: none; } #toprow { height: auto; flex-wrap: wrap; }
  .frame .big { font-size: 1.5rem; } .clock { font-size: 2rem; min-width: 84px; }
  .res { min-width: 70px; } .res svg { width: 44px; height: 44px; } .res .n { font-size: 1.4rem; }
}
