:root {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #f6ecd3;
  background: #0e1c1b;
  font-synthesis: none;
  color-scheme: dark;
  --paper: #f6ecd3;
  --muted: #b4c1ad;
  --gold: #ecc583;
  --line: #354944;
  --deep: #102220;
  --green: #23453c;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 40% 0%, #1b3530 0%, #101f1d 42%, #0e1c1b 85%); }
button, select, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, .scene:focus-visible { outline: 2px solid #f1c979; outline-offset: 3px; }
[hidden] { display: none !important; }
.shell { width: min(100% - 64px, 1376px); margin-inline: auto; }
.topbar { background: #0e1d1bea; border-bottom: 1px solid #30403a; }
.topbar-inner { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--paper); font-weight: 850; font-size: 20px; text-decoration: none; letter-spacing: -.045em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #254637; border: 1px solid #597456; box-shadow: inset 0 1px #ffffff13; }
.brand-mark i { width: 16px; height: 19px; border: 3px solid #f5ca80; border-radius: 10px 10px 10px 2px; border-right-color: transparent; transform: rotate(-25deg); position: relative; }
.brand-mark i::after { content: ""; position: absolute; right: -5px; top: -2px; width: 7px; height: 6px; background: #f5ca80; border-radius: 45% 50% 56% 30%; }
.top-actions, .game-actions { display: flex; align-items: center; gap: 8px; }
.quiet, .new-game, .view-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: #182d28; color: var(--paper);
  border-radius: 9px; font-weight: 720; font-size: 14px; padding: 8px 11px; white-space: nowrap;
}
.quiet:hover, .new-game:hover, .view-button:hover { background: #2e4c3d; border-color: #72866a; }
.quiet span[aria-hidden], .view-button span { color: var(--gold); }
.help-icon { border: 1px solid currentColor; border-radius: 50%; font-size: 10px; width: 15px; height: 15px; display: grid; place-items: center; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 21px 0 17px; }
.intro h1 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2rem, 4vw, 3.35rem); letter-spacing: -.055em; line-height: 1.02; margin: 0; font-weight: 800; color: #fbefcf; }
.intro h1 i { font-weight: 600; color: #e1b56c; }
.new-game { background: #254535; border-color: #53785a; padding: 10px 13px; color: #fbebce; }
.new-game span, .square-button span { font-size: 19px; color: var(--gold); line-height: 1; }
.square-button { min-height: 42px; min-width: 43px; padding: 9px; }
.layout { display: grid; grid-template-columns: minmax(0,1fr) 306px; gap: 17px; align-items: start; }
.board-card, .panel {
  background: #182e29; border: 1px solid #3b5144; border-radius: 16px;
  box-shadow: 0 16px 48px #050f0d50, inset 0 1px #f8d69b0e;
}
.board-card { overflow: hidden; }
.stage {
  height: clamp(543px, 49.2vw, 690px); position: relative; isolation: isolate; overflow: hidden;
  background: radial-gradient(ellipse at 43% 42%,#295043 0%,#142e29 61%,#102423 100%);
}
.stage::after {
  content: ""; position: absolute; pointer-events: none; inset: 0;
  box-shadow: inset 0 0 100px 17px #0717136b;
}
.scene, .scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene { cursor: grab; touch-action: pan-y; }
.scene:focus-visible { outline-offset: -5px; }
.scene.dragging { cursor: grabbing; }
.stage-meta, .camera-tools { position: absolute; z-index: 1; top: 16px; }
.stage-meta {
  left: 16px; display: flex; align-items: center; gap: 8px; color: #f8ebc9; background: #122823ed;
  border: 1px solid #65785f; border-radius: 8px; padding: 9px 11px; font-weight: 790; font-size: 14px; pointer-events: none;
}
.live-dot { width: 7px; height: 7px; background: #edc578; transform: rotate(45deg); box-shadow: 0 0 7px #eab96350; }
.camera-tools { right: 16px; display: flex; align-items: center; gap: 10px; }
.camera-hint { color: #d0d5bb; font-size: 12px; text-shadow: 0 1px 5px #0b1814; pointer-events: none; }
.view-button { background: #142923ea; border-color: #61735e; font-size: 13px; padding: 8px 10px; }
.view-button span { font-size: 16px; line-height: 1; }
.view-button[aria-pressed="true"] { background: #365a45; }
.legend, .legend > div, .legend-item { display: flex; align-items: center; }
.legend { justify-content: space-between; gap: 10px; padding: 13px 16px; min-height: 43px; background: #172d26; color: #c4cfb5; font-weight: 660; font-size: 13px; border-top: 1px solid #405449; }
.legend > div { gap: 14px; flex-wrap: wrap; }
.legend-item { gap: 6px; white-space: nowrap; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ladder { background: #e7ae58; }.snake { background: #e57f63; }.spring { background: #ebd571; }.swatch.chute { background: #7dbac9; }
.goal { white-space: nowrap; }.goal span { color: var(--gold); margin-right: 3px; }
.sidebar { display: grid; gap: 13px; }
.panel { padding: 15px 16px; }
.turn-panel { background: radial-gradient(ellipse at 100% 0%, #34574a 0%, #203b32 53%, #192f28 100%); }
.turn-header, .panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.turn-label { font-size: 12px; letter-spacing: .09em; font-weight: 850; color: #edc98e; }
#turn-count, #players-count {
  background: #152b25; color: #d2debf; border: 1px solid #3a5748; font-size: 12px;
  font-weight: 720; padding: 4px 8px; border-radius: 6px; white-space: nowrap;
}
.turn-main { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-height: 110px; }
.turn-main h2 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(1.55rem,2.5vw,2.15rem); line-height: 1.04; letter-spacing: -.05em; margin: 0 0 6px; overflow-wrap: anywhere; }
.turn-main p { color: #c9d3ba; margin: 0; font-size: 14px; line-height: 1.4; }
.roll-button {
  width: 100%; min-height: 48px; background: linear-gradient(#f4d59c,#e5b16c); border: 1px solid #eec48a;
  border-radius: 9px; color: #332313; font-weight: 880; box-shadow: 0 3px 0 #9b6d37, 0 6px 13px #12241e76;
  display: flex; align-items: center; justify-content: center; gap: 9px;
}
.roll-button span[aria-hidden] { font-size: 24px; line-height: 1; }
.roll-button:not(:disabled):hover { background: linear-gradient(#ffe6b5,#efbd78); }
.roll-button:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 #9b6d37; }
.roll-button:disabled { opacity: .66; }
.keyboard { margin: 13px 0 0; text-align: center; font-size: 12px; color: #bbc9ae; }
kbd { font: inherit; font-weight: 820; border: 1px solid #5c7258; border-bottom-width: 2px; border-radius: 4px; background: #1a3228; padding: 1px 5px; color: #e8dfbd; }
.dice-scene { width: 92px; height: 92px; flex: none; border-radius: 50%; position: relative; touch-action: none; cursor: grab; background: radial-gradient(ellipse at 50% 66%,#081b18 0%,transparent 66%); }
.dice-scene canvas { display:block; width:100%; height:100%; }
.dice-scene[aria-disabled="true"] { cursor: default; }
.dice-scene:focus-visible { outline:2px solid var(--gold); outline-offset:3px; }
.panel-heading h2 { font-size: 17px; letter-spacing: -.02em; margin: 0; }
.players, .history { list-style: none; padding: 0; margin: 11px 0 0; display: grid; gap: 7px; }
.player { display: grid; grid-template-columns: 33px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 7px 8px; border: 1px solid #304a3e; border-radius: 8px; background: #142a24; }
.player.active { background: #294737; border-color: #718160; }
.player-icon { display: grid; place-items: center; width: 30px; height: 30px; background: color-mix(in srgb,var(--piece) 25%,#142824); border-radius: 8px; position: relative; }
.player-icon::after { content: ""; width: 13px; height: 16px; border-radius: 8px 8px 5px 5px; background: radial-gradient(circle at 29% 26%,#fff9,transparent 50%),var(--piece); box-shadow: inset 0 -3px #17192555,0 3px 3px #0d161490; }
.player-name { font-size: 14px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-progress { display: block; margin-top: 4px; height: 3px; background: #3b584a; border-radius: 5px; overflow: hidden; }
.player-progress span { display: block; height: 100%; background: var(--piece); border-radius: inherit; }
.player-position { font-size: 12px; font-weight: 740; color: #c3ccac; white-space: nowrap; }
.text-toggle { font-weight: 730; font-size: 12px; color: #d7dec5; background: #213b30; border: 1px solid #48614e; border-radius: 7px; padding: 4px 8px; }
.text-toggle[aria-pressed="true"] { background: #45633f; border-color: #9fa774; color: #fff3c3; }
.history { max-height: 124px; overflow: auto; }
.history li { font-size: 13px; color: #c6d4bc; line-height: 1.45; display: flex; align-items: baseline; gap: 7px; }
.history li::before { content: ""; display: inline-block; flex: none; width: 6px; height: 6px; border-radius: 3px; background: #b99c63; transform: translateY(-1px); }
main.shell { padding-bottom: 26px; }
main:fullscreen { overflow: auto; width: 100%; max-width: none; padding: 0 max(16px,calc((100vw - 1390px) / 2)) 15px; background: #122420; }
main:fullscreen .stage { height: max(460px,calc(100vh - 145px)); }
dialog { border: 1px solid #526c56; border-radius: 17px; padding: 22px; width: min(520px,calc(100% - 27px)); max-height: 90vh; overflow: auto; color: var(--paper); background: #1c352d; box-shadow: 0 24px 90px #06100e9e; }
dialog::backdrop { background: #081511bd; backdrop-filter: blur(6px); }
.dialog-heading { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 18px; }
.dialog-heading p { margin: 0; color: #bdcdb2; line-height: 1.45; }
.dialog-heading h2 { margin: 0 0 4px; letter-spacing: -.035em; font: 800 29px Georgia,serif; }
.close { border: 1px solid #4a6454; border-radius: 8px; background: #142b24; color: var(--paper); width: 34px; height: 34px; font-size: 22px; line-height: 1; flex: none; }
fieldset { padding: 0; border: 0; margin: 0 0 16px; }
legend, .count-label { font-weight: 780; font-size: 14px; margin-bottom: 8px; }
.mode-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.mode-options input { position: absolute; opacity: 0; }
.mode-options span { display: block; min-height: 66px; padding: 8px; background: #142b25; border: 1px solid #385648; border-radius: 8px; cursor: pointer; }
.mode-options input:checked + span { border-color: #d9ae70; background: #385440; }
.mode-options input:focus-visible + span { outline: 2px solid #d9ae70; }
.mode-options b { font-size: 14px; }.mode-options small { display: block; margin-top: 4px; color: #c6d2b8; font-size: 12px; line-height: 1.3; }
.count-label { display: flex; justify-content: space-between; align-items: center; }
select { color: var(--paper); border: 1px solid #587460; background: #173126; border-radius: 7px; padding: 5px 7px; min-width: 54px; max-width: 100%; font-size: 14px; }
#slots { display: grid; gap: 6px; margin-bottom: 15px; }
.slot { display: grid; grid-template-columns: minmax(55px,1fr) minmax(78px,1fr) minmax(79px,1fr); gap: 5px; align-items: center; padding: 5px 7px; background: #263f34; border-radius: 8px; font-size: 13px; font-weight: 750; }
.rules-list { padding-left: 22px; line-height: 1.55; color: #c7d4bb; }.rules-list li { padding-left: 4px; margin: 0 0 10px; }
.celebration { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.celebration i { position: absolute; top: -20px; width: 9px; height: 16px; border-radius: 2px; animation: fall 1.8s ease-in both; }
@keyframes fall { to { transform: translate3d(var(--drift),min(78vh,700px),0) rotate(580deg); opacity: .2; } }
@media(max-width: 1000px) {
  .shell { width: calc(100% - 34px); }
  .layout { grid-template-columns: minmax(0,1fr) 268px; gap: 12px; }
  .stage { height: clamp(435px,58vw,580px); }
  .panel { padding: 13px; }
}
@media(max-width: 720px) {
  .shell { width: calc(100% - 20px); }
  .topbar-inner { height: 54px; }
  .intro { padding: 15px 0 12px; gap: 7px; }
  .layout { grid-template-columns: 1fr; }
  .stage { height: clamp(325px,97vw,560px); }
  .sidebar { grid-template-columns: 1fr 1fr; gap: 9px; }
  .turn-panel { grid-column: 1/-1; }
  .turn-main { min-height: 89px; }
  .stage-meta, .camera-tools { top: 9px; }
  .stage-meta { left: 9px; }.camera-tools { right: 9px; }
  .camera-hint { display: none; }
  .legend { padding: 9px 10px; min-height: 37px; }.legend > div { gap: 8px; }
  main:fullscreen .stage { height: clamp(290px,65vh,540px); }
}
@media(max-width: 430px) {
  .brand { font-size: 16px; gap: 6px; }.brand-mark { width: 29px; height: 29px; }
  .top-actions, .game-actions { gap: 4px; }.quiet { padding: 7px; font-size: 12px; gap: 4px; }
  .new-game { padding: 7px; font-size: 12px; gap: 3px; }.new-game span { font-size: 15px; }
  .intro h1 { font-size: clamp(1.35rem,6vw,2rem); }
  .square-button { min-width: 32px; min-height: 33px; }
  .legend, .stage-meta, .view-button { font-size: 12px; }
  .sidebar { grid-template-columns: 1fr; }
}
@media(prefers-reduced-motion: reduce) { .celebration i { animation: none; display: none; } }

.figure-name { display: block; margin-top: 2px; color: #d0d7b8; font-size: 12px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tile-focus{position:absolute;inset:0;background:#ffeb71a0;pointer-events:none;animation:tile-glow .7s ease-in-out infinite alternate}
@keyframes tile-glow{to{opacity:.42}}
.match-options,.builder-tools,.room-form{display:flex;flex-wrap:wrap;gap:9px;align-items:end}
.match-options label,.builder-tools label,.room-form label,.builder-body label{display:grid;gap:5px;font-size:13px;color:#e5dcc3;font-weight:750}
.muted{color:var(--muted);font-size:13px}
.setup-content{display:grid;grid-template-columns:1fr 145px;gap:12px;margin:12px 0}
.figure-pane{border:1px solid #547261;border-radius:10px;overflow:hidden;align-self:start;background:#193329}
#figure-preview{height:138px;cursor:grab;touch-action:pan-y}
#figure-preview canvas{width:100%;height:100%;display:block}
.preview-actions{display:flex;align-items:center;justify-content:space-between;gap:3px;padding:4px;font-size:11px}
.preview-actions button{padding:4px 6px}
.choice-list{display:flex;flex-wrap:wrap;align-items:center;gap:7px;margin-top:10px}
.choice-list .roll-button{margin-bottom:4px}
.cup-status{margin-top:10px;color:#f0dcaa;font-size:13px;line-height:1.5}
.wide-dialog{width:min(760px,calc(100% - 24px))}
.builder-body{display:grid;grid-template-columns:minmax(240px,1fr) minmax(170px,.62fr);gap:16px;margin-top:14px}
.builder-board{position:relative;align-self:start}
.builder-grid{display:grid;grid-template-columns:repeat(10,1fr);aspect-ratio:1;gap:1px;background:#405950}
.builder-grid button{aspect-ratio:1;border:0;padding:0;color:#243329;background:#dcd7ab;font-size:12px;font-weight:750;cursor:pointer}
.builder-grid button:nth-child(even){background:#a9c4a0}
.builder-grid button[data-feature]{background:#dfa269}
.builder-grid button.selected{outline:3px solid #fff3c7;outline-offset:-4px}
#builder-paths{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
#builder-errors{max-height:110px;overflow:auto;padding-left:20px;color:#ffc89a;font-size:13px}
dialog input,dialog textarea{width:100%;min-width:0;padding:7px 8px;border:1px solid #587460;border-radius:7px;background:#173126;color:#fff4d9;font:inherit}
.room-form{border-bottom:1px solid #496657;padding:10px 0}
.room-form label:has(input){max-width:132px}
.room-form .roll-button{width:auto;padding:0 12px}
#room-number{letter-spacing:.16em;color:#ffd893}
#room-seats{padding-left:22px}
.game-actions{flex-wrap:wrap;justify-content:flex-end}
@media(max-width:540px){.builder-body{grid-template-columns:1fr}.setup-content{grid-template-columns:1fr 105px;gap:6px}#figure-preview{height:105px}.preview-actions{font-size:9px}.camera-hint{display:none}.game-actions .quiet{font-size:11px}}
@media(prefers-reduced-motion:reduce){.tile-focus{animation:none}}
@media(max-width:525px){.slot{grid-template-columns:repeat(2,minmax(0,1fr))}.slot>span{grid-column:1/-1}.slot select{min-width:0}.intro{flex-wrap:wrap}.game-actions{justify-content:flex-start}.panel-heading:has(#cinematic){gap:4px}}

@media(max-width:525px){.stage-meta{max-width:48%;min-width:0}.stage-meta .live-dot{flex:none}#mode-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.camera-tools{gap:5px}.view-button{padding-inline:7px}}
/* Keep diagnostics in the footer, away from the board and orbit gestures. */
.legend { flex-wrap:wrap; }
.legend > .legend-status { gap: 8px; justify-content:flex-end; }
.renderer-debug { font-size:11px; font-weight:650; }
.renderer-debug summary { color:#e5ddba; padding:4px 7px; cursor:pointer; border:1px solid #51695a; border-radius:5px; }
.renderer-debug[open] { flex-basis:100%; }
.renderer-debug[open] summary { width:max-content; }
.renderer-debug p { margin:5px 0 0; max-width:52ch; color:#dae3d1; white-space:pre-line; overflow-wrap:anywhere; }
@media(max-width:525px){.legend > .legend-status{justify-content:flex-start}}


/* Rainforest controls use the same enamel, dark timber and brass palette as the table. */
.activity-log > summary { display: none; }
[data-biome="jungle"] .sidebar { gap: 10px; }
[data-biome="jungle"] .turn-panel {
  background: linear-gradient(155deg,#34493c,#1a3029 72%);
  border-color: #637053;
  box-shadow: inset 0 1px #ffe6a824, 0 7px 0 #0a181647, 0 16px 32px #08181560;
}
[data-biome="jungle"] .turn-main { min-height: 99px; padding-bottom: 4px; }
[data-biome="jungle"] .turn-label,
[data-biome="jungle"] .keyboard,
[data-biome="jungle"] #players-count,
[data-biome="jungle"] #history-title { display: none; }
[data-biome="jungle"] .turn-header { justify-content: flex-start; }
[data-biome="jungle"] #turn-count { background: transparent; border: 0; padding: 0; color: #dbc89a; }
[data-biome="jungle"] #roll { min-height: 64px; font-size: 23px; }
[data-biome="jungle"] .sidebar .player-progress { display: none; }
[data-biome="jungle"] .sidebar .player { min-height: 52px; }
[data-biome="jungle"] .activity-log > summary {
  display: list-item; font-size: 13px; color: #cbd3bc; cursor: pointer; margin-top: 11px;
}
[data-biome="jungle"] .history-panel .panel-heading { justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
@media (max-width: 520px) {
  [data-biome="jungle"] .turn-main { min-height: 79px; }
  [data-biome="jungle"] #roll { min-height: 56px; }
  [data-biome="jungle"] .history-panel { grid-column: 1/-1; }
  [data-biome="jungle"] .players-panel { grid-column: 1/-1; }
}


.credits-link { color: #c7d4bb; text-underline-offset: .2em; font-size: 13px; }
.credits-link:hover { color: var(--gold); }
.credits-list { margin: 0; line-height: 1.4; }
.credits-list dt { margin-top: 12px; color: var(--paper); font-weight: 800; }
.credits-list dd { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.credits-list a { color: var(--gold); text-underline-offset: .18em; }
@media (max-width: 565px) {
  .camera-tools:has(#zoom:not([hidden])) { top: auto; bottom: 9px; gap: 4px; }
  .camera-tools:has(#zoom:not([hidden])) .view-button { padding-inline: 6px; }
  .credits-link { font-size: 11px; }
}

.snowfall { pointer-events:none; }

.volcanic-atmosphere { pointer-events:none; }

.skip-moment { width:100%; margin-top:7px; }
.victory-dialog { width:min(440px,calc(100% - 27px)); text-align:center; }
.victory-dialog .dialog-heading { margin-bottom:5px; }
.victory-portrait { position:relative; height:225px; overflow:hidden; border-radius:12px; background:#182e27; }
#victory-figure, #victory-figure canvas { width:100%; height:100%; display:block; }

.volume-sliders { display:grid; gap:14px; }
.volume-sliders label { display:grid; grid-template-columns:90px 1fr; align-items:center; }
.volume-sliders input { width:100%; accent-color:var(--gold); }

.board-toolbar { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:9px 12px; background:#152a25; }
.board-toolbar .stage-meta, .board-toolbar .camera-tools { position:static; }
.board-toolbar .stage-meta { max-width:none; border:0; background:transparent; padding:2px 3px; font-size:13px; }
.board-toolbar .camera-tools { flex-shrink:0; }
.board-toolbar .view-button { min-height:33px; }
.turn-panel { border-color:color-mix(in srgb,var(--turn-color,#b99c63) 54%,#354944); }
#turn-count { border-left:3px solid var(--turn-color,#b99c63); }
[data-biome] .turn-main { min-height:83px; }
[data-biome] #roll { min-height:57px; font-size:21px; }
[data-biome] .activity-log > summary { display:list-item; cursor:pointer; font-size:13px; color:var(--muted); margin-top:9px; }
[data-biome] #history-title { display:none; }
.history-panel .panel-heading { justify-content:flex-start; flex-wrap:wrap; }
[data-biome] .keyboard { display:none; }
@media (max-width:720px) {
  .topbar-inner { height:auto; min-height:44px; gap:5px; padding-block:5px; }
  .top-actions { min-width:0; flex-wrap:wrap; justify-content:flex-end; }
  .intro { padding:8px 0; }
  .game-actions > button { min-height:35px; }
  .layout { grid-template-columns:minmax(0,1fr); }
  .board-toolbar { padding:6px 8px; flex-wrap:wrap; }
  .board-toolbar .camera-tools { gap:4px; }
  .board-toolbar .stage-meta { font-size:12px; }
  .stage { height:clamp(244px,min(96vw,52svh),510px); }
  .legend { padding-block:5px; }
  .sidebar { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  [data-biome] .turn-main { min-height:61px; padding:0; }
  .turn-main h2 { font-size:1.46rem; }
  .turn-panel .dice-scene { width:68px; height:68px; margin:0; }
  [data-biome] #roll { min-height:49px; }
  .turn-panel { padding:8px 12px 12px; }
}
@media (max-width:450px) {
  .top-actions { gap:3px; }
  .top-actions .quiet { font-size:10.5px; min-height:30px; padding:4px 5px; }
  .brand { font-size:14px; }
  .brand-mark { width:25px;height:25px; }
  .brand-mark i { transform:scale(.78) rotate(-25deg); }
  .sidebar { grid-template-columns:minmax(0,1fr); }
  .board-toolbar .view-button { padding:5px; font-size:11px; }
  .legend { font-size:11px; }
}
@media (max-width:470px) and (max-height:670px) {
  .stage { height:clamp(225px,44svh,277px); }
  .turn-panel .dice-scene { width:59px;height:59px; }
}

.quality-setting { display:flex; gap:8px; align-items:center; justify-content:space-between; margin-top:10px; font-size:13px; color:var(--muted); }
@media (max-width:720px) {
  .sidebar { display:contents; }
  .turn-panel { grid-row:1; grid-column:1; display:grid; grid-template-columns:minmax(0,1fr) clamp(108px,32vw,173px); align-items:center; gap:3px 10px; }
  .turn-panel .turn-header { grid-column:1/-1; }
  .turn-panel .turn-main { min-width:0; }
  .turn-panel .turn-main h2 { font-size:clamp(1.13rem,4.7vw,1.45rem); margin:0; }
  .turn-panel .turn-main p { font-size:11px; }
  .turn-panel .dice-scene { width:59px; height:59px; }
  [data-biome] .turn-panel #roll { font-size:17px; min-height:48px; }
  .turn-panel .choice-list, .turn-panel .cup-status, .turn-panel .skip-moment { grid-column:1/-1; margin-top:2px; }
  .board-card { grid-row:2; }
  .intro { display:grid; gap:6px; }
  .game-actions { display:grid; grid-template-columns:auto repeat(3,minmax(0,1fr)); width:100%; }
  .game-actions button { min-width:0; justify-content:center; white-space:normal; text-align:center; }
}
@media (max-width:380px) {
  .turn-panel .dice-scene { width:53px;height:53px; }
  .turn-panel .turn-main { gap:4px; }
  .game-actions .new-game { font-size:11px; }
  .game-actions .new-game span { display:none; }
  .board-toolbar { gap:4px; }
}
