/* SUPER MISOMOCHI & FRIENDS — the playable cartridge */
:root {
  color-scheme: dark;
  --ink: #10111e;
  --ink-soft: #191929;
  --panel: #222031;
  --line: #34303f;
  --cream: #f0e9d9;
  --muted: #a49dab;
  --faint: #756f83;
  --gold: #f3cd80;
  --gold-light: #ffe3a8;
  --lavender: #b9a7cf;
  --mint: #94cbb0;
  --red: #e68a91;
  --sans: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  --mono: "Lucida Console", "Courier New", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 280px; background: var(--ink); scroll-behavior: smooth; }
body { margin: 0; color: var(--cream); font-family: var(--sans); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button { border: 0; }
a { color: inherit; text-decoration: none; }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 5px; }
canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
button, a, input { touch-action: manipulation; }
.ambient { position: fixed; z-index: -1; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 22% 0, #29203466, transparent 54%), radial-gradient(ellipse at 95% 53%, #1a263331, transparent 50%); }
.site-header, main, footer { width: min(1196px, calc(100% - 84px)); margin-inline: auto; }
.site-header { min-height: 98px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--gold); line-height: 1.2; font-size: 15px; font-weight: 800; letter-spacing: .16em; flex: 0 0 auto; }
.brand svg { width: 32px; height: 32px; }
.brand-sub { display: block; font: 8px/1.8 var(--mono); letter-spacing: .2em; color: var(--muted); margin-top: 3px; }
.header-actions { display: flex; align-items: center; gap: 27px; }
.text-button { background: none; padding: 7px 0; font-size: 12px; color: var(--muted); transition: color .15s; }
.text-button:hover { color: var(--cream); }
.icon-button { padding: 7px 0; background: none; color: var(--muted); font-size: 12px; }
.icon-button:hover { color: var(--gold); }
.outlined { border: 1px solid #655646; border-radius: 4px; padding: 11px 18px; color: var(--gold); background: #29222a66; font: 11px/1.35 var(--mono); letter-spacing: .025em; transition: border-color .16s, background .16s; }
.outlined:hover { border-color: var(--gold); background: #3b302b; }
.outlined.compact { padding: 9px 14px; font-family: var(--sans); font-size: 12px; }
.outlined.compact span { display: inline-block; margin-left: 9px; }
.game-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 6px 1px 22px; }
.eyebrow { color: var(--gold); font: 9px/1.6 var(--mono); letter-spacing: .18em; }
h1, h2, h3, p { margin: 0; }
.game-heading h1 { font: 500 28px/1.3 Georgia, "Times New Roman", serif; letter-spacing: -.025em; margin-top: 5px; }
.game-heading h1 span { color: var(--lavender); }
.edition { display: flex; align-items: center; gap: 8px; font: 9px/1.5 var(--mono); color: var(--muted); letter-spacing: .08em; margin-bottom: 5px; white-space: nowrap; }
.edition i { width: 5px; height: 5px; background: var(--mint); border-radius: 50%; }
.cabinet { background: #242130; border: 1px solid #4b4050; border-radius: 13px; padding: 0 9px; box-shadow: 0 2px 0 #100e18, 0 5px 0 #312739, 0 8px 0 #120f1c, 0 22px 55px #07080e80, inset 0 1px 0 #5f4f6244; overflow: hidden; }
.cabinet-top { height: 34px; padding: 0 8px; display: flex; align-items: center; gap: 13px; color: #a89aaf; font: 8px/1 var(--mono); letter-spacing: .11em; }
.cabinet-top > span:first-child { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; }
.cabinet-top > span:nth-child(2) { font-size: 7px; letter-spacing: .08em; color: #746c84; }
.power-light { width: 4px; height: 4px; border-radius: 50%; background: #a5d5a2; box-shadow: 0 0 7px #9bcfa159; }
#fullscreen-button { width: 22px; height: 24px; background: transparent; color: #c4b4c9; font-size: 18px; line-height: 1; }
#fullscreen-button:hover { color: var(--gold); }
.screen { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; isolation: isolate; border: 2px solid #100d1a; border-radius: 5px; background: #171a32; container-type: size; }
#game { width: 100%; height: 100%; outline-offset: -3px; touch-action: none; }
.scanlines { position: absolute; z-index: 2; inset: 0; pointer-events: none; opacity: .12; background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, #090819 2px, #090819 3px); box-shadow: inset 0 0 70px #08081855; }
.menu-overlay { position: absolute; z-index: 4; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2cqh; padding: 5cqh 4%; text-align: center; background: linear-gradient(180deg, #14152e40 0%, #11112735 50%, #13142988 100%); }
.menu-kicker { display: flex; align-items: center; justify-content: center; gap: 12px; color: #e9d9bc; font: 1.65cqh/1.4 var(--mono); letter-spacing: .13em; text-shadow: 0 2px 2px #100f20; white-space: nowrap; }
.menu-kicker > span { width: 20px; height: 1px; background: #d3b58b88; }
#title-art { width: min(83%, 760px); height: auto; max-height: 26cqh; object-fit: contain; flex: none; filter: drop-shadow(0 6px 0 #14143070); }
.menu-copy { color: #d9cddd; font-size: 2.15cqh; line-height: 1.4; margin-top: -1.8cqh; text-shadow: 0 1px 4px #17142c; }
.character-select { display: flex; align-items: stretch; justify-content: center; gap: 2%; width: min(78%, 700px); margin: 1cqh 0; }
.character { flex: 1 1 0; position: relative; display: flex; align-items: center; justify-content: center; gap: 1cqw; height: 19cqh; padding: 1cqh 1cqw; text-align: left; background: #17182cdb; border: 1px solid #8e7a9c66; border-radius: 6px; color: #cdc3d1; box-shadow: 0 4px 0 #0f1128aa; transition: border-color .14s, background .14s, transform .14s; }
.character:hover { border-color: #e2c39b; background: #2a2338ed; transform: translateY(-2px); }
.character.selected { border-color: #ebc878; background: #322c3ada; box-shadow: inset 0 0 0 1px #e8c77a33, 0 4px 0 #121126; }
.character[data-character="mochi"].selected { border-color: #a3d6b3; background: #233b3cdb; box-shadow: inset 0 0 0 1px #acd2b033, 0 4px 0 #121126; }
.portrait { width: 17cqh; height: 15.2cqh; max-width: 112px; max-height: 100px; object-fit: contain; flex-shrink: 0; }
.character > span { display: flex; flex-direction: column; min-width: 0; }
.character b { font: 700 2.9cqh/1.2 var(--mono); color: var(--cream); letter-spacing: .15em; }
.character small { color: #d0bdc5; font-size: 1.9cqh; line-height: 1.55; margin-top: 3px; }
.character em { font: normal 1.2cqh/1.5 var(--mono); letter-spacing: .06em; color: var(--gold); margin-top: 5px; white-space: nowrap; }
.character[data-character="mochi"] em { color: var(--mint); }
.selected-mark { display: none; position: absolute; right: 8px; top: 6px; color: var(--gold); font-style: normal; font-size: 12px; }
.selected .selected-mark { display: block; }
.character[data-character="mochi"] .selected-mark { color: var(--mint); }
.start-actions { display: flex; justify-content: center; align-items: center; gap: 24px; margin-top: 1cqh; }
.primary { padding: 14px 24px; background: var(--gold); color: #372a28; border: 1px solid #ffe7ac; border-radius: 4px; box-shadow: 0 3px 0 #937047, 0 6px 13px #080c1826; font: 700 11px/1.3 var(--mono); letter-spacing: .035em; transition: background .13s, transform .13s, box-shadow .13s; }
.primary:hover { background: var(--gold-light); transform: translateY(-1px); box-shadow: 0 4px 0 #937047, 0 8px 15px #080c1826; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #937047; }
#start-button { font-size: 2cqh; padding: 2.2cqh 3cqw; }
#start-button > span { margin-right: 8px; font-size: .9em; }
.menu-popup { color: #e3d1bd; background: none; font: 1.5cqh/1.6 var(--mono); letter-spacing: .03em; padding: 10px 0; border-bottom: 1px solid #bca88b70; }
.menu-popup:hover { color: var(--gold-light); border-color: var(--gold); }
.press-enter { color: #beadb8; font: 1.35cqh/1.5 var(--mono); letter-spacing: .1em; padding-top: .5cqh; }
.controller-bar { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 12px 14px; }
.direction-controls, .action-controls { display: flex; align-items: center; gap: 8px; }
.direction-controls > button { border-radius: 4px; width: 36px; height: 34px; background: #373143; border: 1px solid #51465e; color: #d8c5d5; font-size: 12px; box-shadow: 0 2px 0 #14121d; }
.direction-controls > span { margin-left: 5px; color: #9b8f9f; font: 8px/1.4 var(--mono); letter-spacing: .02em; }
kbd { padding: 2px 4px; border: 1px solid #5b5262; border-bottom-width: 2px; border-radius: 3px; background: #302a39; color: #d3c6d1; font: 10px/1.7 var(--mono); }
.direction-controls kbd { border: none; background: transparent; font-size: inherit; padding: 0; }
.mouse-switch { display: flex; align-items: center; gap: 9px; color: #aea2b3; font-size: 10px; cursor: pointer; white-space: nowrap; }
.mouse-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 26px; height: 14px; background: #151421; border: 1px solid #5a4f63; border-radius: 10px; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 8px; height: 8px; border-radius: 50%; background: #897b94; transition: transform .15s, background .15s; }
.mouse-switch input:checked + .switch-track { border-color: #90b9a0; background: #354c43; }
.mouse-switch input:checked + .switch-track::after { transform: translateX(12px); background: #b8dfbc; }
.mouse-switch input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 3px; }
.action-controls button { display: flex; align-items: center; gap: 12px; min-height: 34px; border-radius: 4px; padding: 8px 13px; font: 9px/1.3 var(--mono); letter-spacing: .04em; box-shadow: 0 2px 0 #14121d; }
.jump-control { background: #44384f; border: 1px solid #71617e; color: #e4d4ed; }
.attack-control { background: #534239; border: 1px solid #806853; color: #f5dbaa; }
.action-controls small { color: #b0a1ac; font-size: 7px; letter-spacing: 0; }
[data-control] { touch-action: none; user-select: none; -webkit-user-select: none; }
[data-control].pressed, [data-control]:active { transform: translateY(2px); box-shadow: none; border-color: var(--gold); background: #655145; color: #fff2d1; }
.hud { position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 2cqw; padding: 3cqh 2.6cqw 4cqh; color: #fff2d7; background: linear-gradient(#14152be8, #16172b80 70%, transparent); pointer-events: none; text-shadow: 0 2px 1px #15122b; }
.hud > div { display: flex; flex-direction: column; gap: 3px; }
.hud-label { font: 1.6cqh/1.4 var(--mono); letter-spacing: .08em; color: #e8dbd0; }
.hud strong { font: 700 3cqh/1.3 var(--mono); letter-spacing: .08em; color: #ffdc8c; }
.hearts { color: #f596a1; font-size: 3.4cqh; line-height: 1.2; letter-spacing: .06em; }
.hud-world { text-align: center; padding-top: 1px; }
.progress-track { width: 100%; height: 3px; margin-top: 5px; background: #b1a2b044; border-radius: 2px; overflow: hidden; }
.progress-track i { display: block; width: 0; height: 100%; background: #b8dbbb; }
#pause-button { pointer-events: auto; width: 5cqh; min-width: 24px; height: 5cqh; min-height: 24px; border-radius: 4px; background: #302b428f; border: 1px solid #a08b9d88; color: #eee3d8; font-size: 2.2cqh; }
.power-hud { position: absolute; z-index: 3; left: 2.6cqw; top: 13cqh; display: flex; align-items: center; gap: 8px; max-width: 70%; color: #f9e2ad; border: 1px solid #a88f5c77; border-radius: 3px; padding: 5px 8px; background: #17192bba; font: 1.6cqh/1.4 var(--mono); }
.power-hud:empty { display: none; }
.toast { position: absolute; z-index: 7; top: 22%; left: 50%; max-width: 82%; transform: translate(-50%, -8px); border: 1px solid #c5ad7f88; border-radius: 5px; padding: 10px 18px; background: #151627ef; color: var(--gold-light); text-align: center; font: 12px/1.5 var(--mono); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; box-shadow: 0 5px 24px #07091455; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.state-overlay { position: absolute; z-index: 8; inset: 0; display: flex; align-items: center; justify-content: center; padding: 3cqh 4cqw; background: #101124b8; backdrop-filter: blur(3px); }
.state-card { display: flex; flex-direction: column; align-items: center; gap: 2.4cqh; text-align: center; width: min(550px, 95%); max-height: 100%; overflow-y: auto; padding: 5cqh 4cqw; background: #211d31ed; border: 1px solid #76617c; border-radius: 8px; box-shadow: 0 10px 0 #12102577, 0 18px 44px #0b0c2055; scrollbar-width: thin; scrollbar-color: #6c5d70 #272032; }
.state-card .eyebrow { font-size: 1.65cqh; }
.state-card h2 { color: var(--gold-light); font: 700 5.2cqh/1.2 var(--mono); letter-spacing: .02em; text-shadow: 0 3px #51405b; }
.state-card p { color: #bcafc6; font-size: 2cqh; line-height: 1.5; }
.state-card .primary, .state-card .outlined { font-size: 1.8cqh; padding: 2cqh 2.6cqw; }
.state-card .text-button { font-size: 1.75cqh; }
.result-score { color: var(--gold); font: 700 7cqh/1.05 var(--mono); letter-spacing: .07em; }
.end-card { gap: 1.65cqh; padding: 3.3cqh 3.5cqw; }
.end-card h2 { font-size: 4.5cqh; }
.end-card .result-score { font-size: 6cqh; }
#score-form { width: 100%; margin: 1cqh 0 .3cqh; }
#score-form label { display: block; margin-bottom: 1.2cqh; color: #b6a7bc; font: 1.35cqh/1.5 var(--mono); letter-spacing: .025em; }
.score-entry { display: flex; align-items: stretch; justify-content: center; gap: 8px; }
.score-entry input { display: block; width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid #67576e; border-radius: 4px; background: #151522; color: var(--cream); font: 2cqh/1.4 var(--mono); }
.score-entry input::placeholder { color: #81768e; }
.score-entry .primary { white-space: nowrap; padding-inline: 1.6cqw; }
.end-card .save-message { font-size: 1.55cqh; color: var(--mint); min-height: 0; }
.save-message:empty { display: none; }
.end-actions { display: flex; justify-content: center; gap: 10px; width: 100%; }
.end-actions > button { flex: 1; }
.below-game { display: grid; grid-template-columns: 1.45fr 1fr; gap: 45px; padding: 49px 2px 34px; }
.section-title h2, .board-heading h2 { font: 400 24px/1.35 Georgia, "Times New Roman", serif; letter-spacing: -.02em; margin-top: 6px; }
.guide-items { display: grid; gap: 21px; margin-top: 27px; }
.guide-items > div { display: flex; align-items: center; gap: 18px; }
.guide-icon { width: 54px; height: 48px; flex: 0 0 54px; }
.guide-items p { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.guide-items b { color: #dcd2df; font-weight: 600; font-size: 13px; }
.guide-items p span { max-width: 370px; }
.power-guide { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 30px; padding-top: 18px; border-top: 1px solid #37303d; }
.power-guide > span { display: inline-flex; align-items: center; gap: 6px; color: #a297ab; font: 8px/1.5 var(--mono); letter-spacing: .04em; }
.item { font-style: normal; font-size: 15px; line-height: 1; }
.item.fire { color: #f5a86f; }.item.shield { color: #9dd4d4; }.item.heart { color: #eb93a8; }.item.star { color: var(--gold); }
.leaderboard { padding-left: 41px; border-left: 1px solid #39313f; min-width: 0; }
.board-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.board-heading h2 > span { color: var(--gold); font-family: Georgia, serif; font-size: 19px; margin-left: 5px; }
.refresh { font-size: 23px; padding: 0 6px; color: #b6a2b5; }
:is(#score-list, #modal-score-list) { list-style: none; padding: 0; margin: 21px 0 0; }
:is(#score-list, #modal-score-list) > li { min-height: 46px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid #302b39; }
:is(#score-list, #modal-score-list) > li:last-child { border-bottom: 0; }
:is(#score-list, #modal-score-list) .empty-score { display: flex; align-items: center; justify-content: center; min-height: 150px; border: 1px dashed #46394e; border-radius: 4px; padding: 18px; margin-top: 24px; text-align: center; color: #a99ab0; font-size: 12px; }
.score-rank, :is(#score-list, #modal-score-list) .rank { width: 20px; flex: 0 0 20px; color: #88788f; font: 11px/1.5 var(--mono); }
:is(#score-list, #modal-score-list) > li:first-child .score-rank, :is(#score-list, #modal-score-list) > li:first-child .rank { color: var(--gold); }
.score-player, .score-name { font-size: 12px; color: #d9cfdf; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-player, :is(#score-list, #modal-score-list) .score-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.score-character, .score-char, .score-player small { color: #8e819a; font: 8px/1.5 var(--mono); letter-spacing: .07em; }
.score-value, :is(#score-list, #modal-score-list) .score-number { margin-left: auto; font: 11px/1.5 var(--mono); letter-spacing: .03em; color: var(--gold); white-space: nowrap; }
.score-row > div { min-width: 0; }
.score-row > strong:last-child, .score-row > b:last-child { margin-left: auto; color: var(--gold); font: 11px/1.5 var(--mono); }
.board-note { color: #86798e; font-size: 10px; line-height: 1.6; margin-top: 13px; }
.cartridge-note { display: flex; align-items: center; gap: 18px; padding: 25px 2px; border-top: 1px solid #352d3c; }
.card-thumb { flex: 0 0 auto; padding: 0; width: 47px; height: 60px; background: transparent; transform: rotate(-5deg); transition: transform .2s; }
.card-thumb:hover { transform: rotate(0) scale(1.06); }
.card-thumb img { width: 100%; height: 100%; object-fit: contain; }
.cartridge-note p { display: flex; flex-direction: column; gap: 5px; color: var(--faint); font-size: 11px; }
.cartridge-note p b { color: #c6b7ca; font-size: 12px; font-weight: 500; }
.cartridge-note > a { margin-left: auto; white-space: nowrap; font-size: 11px; color: #bda887; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 21px 2px 33px; color: #716479; font: 7px/1.6 var(--mono); letter-spacing: .07em; }
dialog { width: min(660px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 38px; border: 1px solid #78617e; border-radius: 9px; color: var(--cream); background: #211e30; box-shadow: 0 20px 80px #05050dcc; }
dialog::backdrop { background: #0a0b18cf; backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 12px; top: 8px; padding: 0 6px; color: #beabc8; background: transparent; font: 28px/1.2 var(--sans); }
.dialog-close:hover { color: var(--gold); }
dialog h2 { font: 400 28px/1.35 Georgia, serif; margin: 8px 0 24px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.help-grid h3 { font: 10px/1.5 var(--mono); color: var(--gold); letter-spacing: .1em; margin-bottom: 13px; }
.help-grid p { font-size: 12px; line-height: 1.8; color: #c1b4cc; margin: 7px 0; }
.help-tip { font-size: 11px; line-height: 1.7; color: #aa9bb7; margin-top: 17px; padding-top: 16px; border-top: 1px solid #42364d; }
dialog > .primary { margin-top: 24px; }
.artwork-dialog { width: fit-content; max-width: min(80vw, 560px); padding: 0; overflow: visible; border-radius: 4px; background: #111524; }
.artwork-dialog img { display: block; width: auto; height: auto; max-height: 85dvh; max-width: min(80vw, 560px); border-radius: 3px; }
.artwork-dialog .dialog-close { right: -30px; top: -9px; color: #f4e2d0; }
.global-notice { position: fixed; z-index: 99; left: 50%; bottom: 24px; transform: translate(-50%, 15px); opacity: 0; pointer-events: none; width: max-content; max-width: calc(100% - 32px); padding: 12px 20px; color: #eadcc7; border: 1px solid #8f725d; border-radius: 5px; background: #292331f2; box-shadow: 0 8px 40px #080910aa; text-align: center; font-size: 12px; transition: opacity .2s, transform .2s; }
.global-notice.visible { opacity: 1; transform: translate(-50%, 0); }

/* A separate browser window keeps every control inside the available height. */
body.popup { min-height: 100dvh; overflow-x: hidden; }
body.popup .game-heading, body.popup .below-game, body.popup .cartridge-note, body.popup footer, body.popup #popup-button, body.popup #menu-popup { display: none !important; }
body.popup .site-header { min-height: 50px; height: 50px; width: min(1196px, calc(100% - 32px)); }
body.popup .brand { font-size: 12px; }
body.popup .brand svg { width: 25px; height: 25px; }
body.popup .brand-sub { font-size: 6px; }
body.popup main { width: min(calc(100vw - 24px), calc((100dvh - 143px) * 16 / 9)); margin-inline: auto; }
body.popup .cabinet-top { height: 28px; }
body.popup .controller-bar { min-height: 52px; padding-block: 8px; }
.cabinet:fullscreen { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 0 16px; background: #10111e; border: 0; border-radius: 0; box-shadow: none; overflow: hidden; }
.cabinet:fullscreen .screen { width: min(100%, calc((100dvh - 110px) * 16 / 9)); flex: 0 0 auto; }
.cabinet:fullscreen .cabinet-top, .cabinet:fullscreen .controller-bar { width: min(100%, calc((100dvh - 110px) * 16 / 9)); }

@media (max-width: 1000px) {
  .site-header, main, footer { width: calc(100% - 48px); }
  .header-actions { gap: 18px; }
  .below-game { gap: 28px; }
  .leaderboard { padding-left: 27px; }
  .controller-bar { gap: 12px; padding-inline: 7px; }
  .direction-controls > span { font-size: 7px; }
  .action-controls button { gap: 7px; padding-inline: 10px; }
  .power-guide { gap: 14px; }
  .guide-items > div { gap: 12px; }
}
@media (max-width: 720px) {
  .site-header, main, footer { width: calc(100% - 32px); }
  .site-header { min-height: 76px; gap: 12px; }
  .brand { font-size: 12px; gap: 8px; letter-spacing: .12em; }
  .brand svg { width: 27px; height: 27px; }
  .brand-sub { font-size: 6px; }
  .header-actions { gap: 14px; }
  .header-actions .text-button, .header-actions .icon-button { font-size: 10px; }
  .outlined.compact { padding: 7px 9px; font-size: 10px; }
  .outlined.compact span { margin-left: 3px; }
  .game-heading { padding-bottom: 17px; }
  .game-heading h1 { font-size: 22px; }
  .game-heading .eyebrow { font-size: 7px; }
  .edition { font-size: 7px; }
  .cabinet { padding-inline: 6px; border-radius: 9px; }
  .cabinet-top { height: 27px; padding-inline: 4px; font-size: 6px; }
  .cabinet-top > span:nth-child(2) { font-size: 6px; }
  .menu-overlay { gap: 1.8cqh; padding: 4cqh 3%; }
  .menu-kicker { font-size: max(6px, 1.65cqh); gap: 7px; letter-spacing: .07em; }
  .menu-kicker > span { width: 10px; }
  #title-art { width: 79%; max-height: 25cqh; }
  .menu-copy { font-size: max(8px, 2.1cqh); }
  .character-select { width: 86%; gap: 9px; margin-block: .8cqh; }
  .character { height: 20cqh; padding: 1cqh; gap: 4px; }
  .portrait { width: 17cqh; height: 15.2cqh; }
  .character b { font-size: max(10px, 2.9cqh); }
  .character small { font-size: max(8px, 1.9cqh); margin-top: 1px; }
  .character em { font-size: max(6px, 1.2cqh); margin-top: 2px; }
  .selected-mark { right: 5px; top: 3px; font-size: 10px; }
  .start-actions { gap: 16px; }
  #start-button { font-size: max(9px, 2cqh); padding: 2.2cqh 3cqw; }
  .menu-popup { font-size: max(7px, 1.5cqh); padding: 6px 0; }
  .press-enter { font-size: max(6px, 1.35cqh); }
  .controller-bar { min-height: 58px; padding: 10px 3px 12px; gap: 8px; }
  .direction-controls { gap: 6px; }
  .direction-controls > button { width: 32px; height: 30px; font-size: 10px; }
  .direction-controls > span { display: none; }
  .mouse-switch { font-size: 9px; gap: 5px; }
  .action-controls { gap: 6px; }
  .action-controls button { min-height: 30px; padding: 7px 10px; font-size: 8px; gap: 6px; }
  .action-controls small { font-size: 6px; }
  .hud { padding: 2.7cqh 2.6cqw; gap: 1.5cqw; }
  .hud-label { font-size: max(6px, 1.6cqh); }
  .hud strong { font-size: max(11px, 3cqh); }
  .hud-world .hud-label { max-width: 125px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .progress-track { margin-top: 4px; }
  .hearts { font-size: max(12px, 3.4cqh); }
  .power-hud { padding: 3px 5px; font-size: max(6px, 1.6cqh); top: 15cqh; }
  .toast { font-size: 9px; padding: 7px 12px; }
  .state-card { padding: 3cqh 3cqw; gap: 2cqh; border-radius: 5px; }
  .state-card .eyebrow { font-size: max(7px, 1.65cqh); }
  .state-card h2 { font-size: max(18px, 4.8cqh); }
  .state-card p { font-size: max(9px, 2cqh); }
  .state-card .primary, .state-card .outlined { font-size: max(8px, 1.8cqh); padding: 1.8cqh 2cqw; }
  .state-card .text-button { font-size: max(8px, 1.75cqh); }
  .end-card { gap: 1.2cqh; }
  .end-card .result-score { font-size: max(23px, 6cqh); }
  #score-form label { font-size: max(6px, 1.35cqh); margin-bottom: 1cqh; }
  .score-entry input { font-size: max(10px, 2cqh); padding: 5px 8px; }
  .end-card .save-message { font-size: max(7px, 1.55cqh); }
  .end-actions { gap: 8px; }
  .below-game { grid-template-columns: 1fr; gap: 30px; padding-top: 36px; }
  .section-title h2, .board-heading h2 { font-size: 25px; }
  .guide-items { gap: 18px; margin-top: 22px; }
  .guide-items p span { max-width: 100%; }
  .power-guide { gap: 22px; margin-top: 23px; }
  .leaderboard { padding: 27px 0 0; border-left: 0; border-top: 1px solid #39313f; }
  :is(#score-list, #modal-score-list) { margin-top: 16px; }
  :is(#score-list, #modal-score-list) .empty-score { min-height: 110px; }
  .cartridge-note { gap: 14px; flex-wrap: wrap; padding-block: 23px; }
  .cartridge-note > a { margin-left: 61px; }
  footer { font-size: 6px; padding-top: 5px; flex-wrap: wrap; gap: 9px; }
  dialog { padding: 28px 24px; }
  dialog h2 { font-size: 24px; }
  .help-grid { gap: 16px; }
  .help-grid p { font-size: 11px; }
}
@media (max-width: 460px) {
  .site-header, main, footer { width: calc(100% - 24px); }
  .site-header { min-height: 70px; }
  .header-actions { gap: 12px; }
  .header-actions #how-button { display: none; }
  .brand { font-size: 11px; gap: 6px; }
  .brand svg { width: 24px; height: 24px; }
  .brand-sub { letter-spacing: .08em; }
  .edition { font-size: 6px; gap: 5px; }
  .game-heading h1 { font-size: 19px; }
  .game-heading h1 span { display: block; font-size: 17px; }
  .game-heading { align-items: flex-end; padding-top: 0; }
  .cabinet { padding-inline: 4px; }
  .cabinet-top { font-size: 5px; height: 25px; gap: 6px; letter-spacing: .05em; }
  .cabinet-top > span:nth-child(2) { display: none; }
  .screen { border-width: 1px; }
  .menu-overlay { padding: 6px 2.5%; gap: 5px; }
  .menu-kicker { font-size: 5.8px; gap: 5px; letter-spacing: .02em; }
  #title-art { width: 74%; max-height: 24cqh; }
  .menu-copy { display: none; }
  .character-select { width: 96%; gap: 7px; margin: 2px 0; }
  .character { height: 26cqh; min-height: 44px; padding: 3px; gap: 3px; border-radius: 4px; }
  .portrait { width: 21cqh; height: 19cqh; }
  .character b { font-size: 10px; letter-spacing: .08em; }
  .character small { font-size: 7px; line-height: 1.5; }
  .character em { display: none; }
  .selected-mark { font-size: 8px; right: 4px; }
  .start-actions { gap: 12px; margin-top: 2px; }
  #start-button { font-size: 8px; min-height: 28px; padding: 7px 10px; }
  #start-button > span { margin-right: 4px; }
  .menu-popup { font-size: 6px; padding: 5px 0; }
  .press-enter { display: none; }
  .controller-bar { gap: 6px; min-height: 55px; padding: 10px 3px; }
  .direction-controls { gap: 4px; }
  .direction-controls > button { width: 29px; height: 31px; }
  .mouse-switch { gap: 4px; font-size: 7px; flex-direction: column; line-height: 1.1; }
  .switch-track { width: 24px; }
  .mouse-switch input:checked + .switch-track::after { transform: translateX(10px); }
  .action-controls { gap: 5px; }
  .action-controls button { flex-direction: column; gap: 2px; min-width: 49px; padding: 5px 7px; min-height: 31px; font-size: 7px; }
  .action-controls small { font-size: 5px; }
  .hud { padding: 6px 8px 10px; }
  .hud-label { font-size: 5.5px; }
  .hud-world .hud-label { max-width: 87px; }
  .hud strong { font-size: 10px; }
  .hearts { font-size: 11px; letter-spacing: 0; }
  .hud > div { gap: 1px; }
  #pause-button { min-width: 21px; min-height: 21px; font-size: 11px; }
  .power-hud { top: 37px; font-size: 5.5px; padding: 2px 4px; }
  .state-overlay { padding: 5px 7px; }
  .state-card { padding: 9px 12px; gap: 5px; width: min(290px, 98%); }
  .state-card h2 { font-size: 17px; }
  .state-card .eyebrow { font-size: 6px; }
  .state-card p { font-size: 8px; line-height: 1.35; }
  .state-card .primary, .state-card .outlined { font-size: 7px; min-height: 25px; padding: 6px 8px; }
  .state-card .text-button { font-size: 8px; padding: 4px 0; }
  .result-score { font-size: 26px; }
  .end-card { padding: 6px 11px; gap: 3px; }
  .end-card h2 { font-size: 15px; }
  .end-card .result-score { font-size: 22px; }
  .end-card #run-stats { font-size: 7px; }
  #score-form { margin: 2px 0; }
  #score-form label { font-size: 5.5px; margin-bottom: 3px; }
  .score-entry { gap: 5px; }
  .score-entry input { font-size: 9px; padding: 3px 6px; }
  .end-card .save-message { font-size: 6px; }
  .end-actions { gap: 6px; }
  .toast { font-size: 7px; padding: 5px 9px; border-radius: 3px; }
  .power-guide { gap: 12px; }
  .power-guide > span { font-size: 6.5px; }
  .help-grid { grid-template-columns: 1fr; gap: 18px; }
  dialog { padding: 25px 21px; }
  .cartridge-note p { max-width: calc(100% - 62px); font-size: 10px; }
  .cartridge-note p b { font-size: 11px; }
  body.popup .site-header { width: calc(100% - 22px); }
  body.popup main { width: min(calc(100vw - 12px), calc((100dvh - 137px) * 16 / 9)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .character:hover, .primary:hover, .card-thumb:hover { transform: none; }
}

#scores-dialog { max-height:85dvh; overflow-y:auto; }
#scores-dialog > .primary { margin-top:20px; }
@media(max-width:720px){.header-actions{gap:12px}.header-actions #popup-button{display:none}}
