:root { color-scheme: dark; font-family: system-ui, sans-serif; color: #e9f4ff; background: #09101d; }
* { box-sizing: border-box; }
body { margin: 0; }
.bar { min-height: 60px; padding: 10px clamp(12px, 4vw, 40px); display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #2b3b55; font-weight: 800; }
.bar span { text-align: center; letter-spacing: .08em; }
small { display: block; color: #94afc9; font-size: .62rem; }
a { color: #a6dfff; text-decoration: none; }
a:hover { text-decoration: underline; }
button { padding: 9px 15px; border: 1px solid #7095b8; border-radius: 8px; color: inherit; background: #17334d; font: inherit; font-weight: 750; cursor: pointer; }
button:hover { background: #22496c; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #82f0ff; outline-offset: 4px; }
main { max-width: 1060px; margin: auto; padding: clamp(10px, 3vw, 28px); }
.cabinet { position: relative; overflow: hidden; isolation: isolate; border: 1px solid #3b6386; border-radius: 14px; background: #124184; }
canvas { display: block; width: 100%; height: auto; touch-action: none; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; background: #040b18a8; overflow: auto; }
.panel { width: min(440px, 100%); text-align: center; padding: clamp(8px, 3vw, 26px); border: 1px solid #7095b8; border-radius: 12px; background: #101e32f5; }
.tag { color: #89e1ff; font-size: .68rem; font-weight: 850; letter-spacing: .14em; margin: 0; }
h1 { font-size: clamp(1.2rem, 5vw, 2.65rem); margin: .12em 0; }
.panel p { margin: .45em 0; }
.actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#start { background: #b4f361; color: #112509; border-color: #d5ff9c; }
.status { color: #ffcb9d; font-size: .85rem; }
.hud { position: absolute; inset: 10px 12px auto; display: grid; grid-template-columns: 1fr minmax(70px, 230px) 1fr; align-items: center; gap: 8px; font-weight: 850; text-shadow: 0 1px 3px #000; pointer-events: none; }
#percent { text-align: right; }
progress { width: 100%; height: .7em; accent-color: #b4f361; }
.controls, details, footer { color: #adc0d6; font-size: .9rem; }
kbd { color: #ecf6ff; font-weight: 800; }
summary { cursor: pointer; }
footer { margin-top: 16px; font-size: .75rem; }
[hidden] { display: none !important; }
@media (max-width: 560px) { .cabinet { min-height: 226px; } canvas { min-height: 226px; object-fit: contain; } .panel p { font-size: .81rem; } }

.bar-actions { display: flex; gap: 8px; }
.overlay[data-menu] .panel { width: min(610px, 100%); }
#menu-content { margin-top: 12px; }
.menu-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; max-height: min(30vh, 240px); overflow: auto; }
.menu-list button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; }
.menu-list button:disabled, .skin-list button:disabled { cursor: default; opacity: .58; }
.menu-list small, .skin-list small { font-weight: 600; letter-spacing: 0; }
.skin-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.skin-list button { display: grid; justify-items: center; gap: 5px; }
.skin-list button[aria-pressed=true] { border-color: #c3fb79; background: #254032; }
.skin-list canvas { width: 38px; height: 38px; }
@media (max-width: 560px) {
  .bar-actions { gap: 4px; }
  .bar-actions button { padding: 6px 8px; font-size: .72rem; }
  .cabinet:has(.overlay[data-menu]:not([hidden])) { min-height: 410px; }
  .skin-list canvas { min-height: 0; }
}

.overlay[data-home] { background: linear-gradient(#08164a33, #0b124842); }
.overlay[data-home] .panel { width: min(850px, 100%); border: 0; background: transparent; }
.overlay[data-home] .tag { display: none; }
.overlay[data-home] h1 { display: flex; justify-content: center; flex-wrap: wrap; gap: .18em; font-size: clamp(1.9rem, 6vw, 4.4rem); font-weight: 1000; text-transform: uppercase; line-height: 1; letter-spacing: -.055em; color: #ffde3e; -webkit-text-stroke: .045em #16232f; paint-order: stroke fill; text-shadow: 0 .075em #142644; }
.overlay[data-home] h1 span + span { color: #a9f554; }
.overlay[data-home] .actions { margin-top: 14px; }
.overlay[data-home] .status { color: #e1eaff; text-shadow: 0 1px 2px #000; }
.main-buttons, .extra-buttons { display: flex; justify-content: center; align-items: center; gap: clamp(4px, 4vw, 38px); }
.sprite-button { display: grid; justify-items: center; gap: 3px; padding: 3px; background: transparent; border: 0; color: white; font-weight: 850; text-shadow: 0 2px 2px #172c6f; }
.sprite-button:hover { background: #b9e3ff1a; transform: scale(1.06); }
.sprite-button canvas { width: clamp(54px, 11vw, 126px); height: auto; min-height: 0; }
.extra-buttons .sprite-button canvas { width: clamp(47px, 8vw, 72px); }
.fallback-symbol { display: grid; place-items: center; width: clamp(48px, 10vw, 90px); aspect-ratio: 1; border-radius: 18%; color: #e8ff91; background: #188f32; border: 3px solid #95df34; box-shadow: 0 4px 0 #0c3e28; font-size: clamp(1.55rem, 5vw, 3.1rem); }
.extra-buttons .fallback-symbol { width: clamp(35px, 7vw, 58px); font-size: clamp(1.3rem, 3vw, 2rem); background: #0e5795; border-color: #5fc5ff; }
.extra-buttons { margin-top: 12px; }
.achievement-list { list-style: none; margin: 0; padding: 0; }
.achievement-list li { opacity: .66; margin: 5px; }
.achievement-list li[data-earned=true] { color: #c8ff77; opacity: 1; }

.official-callout { margin: 0 0 12px; padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; border: 1px solid #3b6386; border-radius: 8px; background: #101e32; }
.official-callout a { font-weight: 800; }
.official-callout span { color: #adc0d6; font-size: .88rem; }
.official-player { display: block; width: 100%; height: clamp(320px, 60vw, 580px); border: 1px solid #3b6386; border-radius: 12px; background: #000; }

.player-tools, .round-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.player-tools { justify-content: flex-end; margin-bottom: 10px; }
.round-actions { justify-content: center; }
#menu-content > button + button { margin-top: 6px; }
:fullscreen main { max-width: min(1500px, 100vw); padding: 8px; }
:fullscreen .official-player { height: calc(100dvh - 126px); }
:fullscreen .cabinet { max-width: calc((100dvh - 128px) * 16 / 9); margin: auto; }
@media (prefers-reduced-motion: no-preference) {
  .cabinet[data-result=dead] .overlay { animation: crash .32s ease-out; }
  .cabinet[data-result=complete] .panel { animation: clear .45s ease-out; }
}
@keyframes crash { from { background: #f15e5799; } to { background: #040b18a8; } }
@keyframes clear { from { box-shadow: 0 0 72px #a8fa64; } to { box-shadow: 0 0 0 transparent; } }

.player-tools a { align-self: center; overflow-wrap: anywhere; }
.side-link-dialog { width: min(420px, calc(100vw - 24px)); border: 1px solid #7095b8; border-radius: 12px; background: #101e32; color: #e9f4ff; }
.side-link-dialog::backdrop { background: #040b18b8; }
.side-link-dialog form, .side-link-dialog label { display: grid; gap: 8px; }
.side-link-dialog h2, .side-link-dialog p { margin: 0; }
.side-link-dialog input { width: 100%; padding: 8px; font: inherit; }


.overlay[data-home] .native-logo { width: min(100%, 620px); height: auto; min-height: 0; margin: .12em auto; }
.official-menu-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 5px; }
.official-menu-links canvas { width: clamp(50px, 7vw, 80px); height: auto; min-height: 0; }

.overlay[data-selector] { padding: 0; background: transparent; }
.overlay[data-selector] .panel { width: 100%; height: 100%; padding: 0; border: 0; background: transparent; }
.overlay[data-selector] :is(.tag, h1, .actions, #message, #status) { display: none; }
.overlay[data-selector] #menu-content { height: 100%; margin: 0; }
.level-selector { --level-color: #0953d7; position: relative; display: grid; grid-template: auto 1fr auto / minmax(36px, 1fr) minmax(0, 590px) minmax(36px, 1fr); align-items: center; height: 100%; min-height: 300px; color: white; background: linear-gradient(#0001, #00163c66), var(--level-color); text-shadow: 0 2px 1px #000; touch-action: pan-y; }
.selector-top { grid-column: 1 / -1; display: flex; justify-content: space-between; padding: 5px 10px; }
.selector-center { grid-column: 2; grid-row: 2; width: 100%; align-self: center; }
.selector-level { width: 100%; padding: 5px; color: white; background: #071d4e9c; border: 2px solid #072655; border-radius: 14px; box-shadow: 0 4px 0 #0003; text-shadow: 0 2px 1px #000; }
.selector-level:disabled { cursor: default; }
.selector-level-label { display: flex; align-items: center; justify-content: space-between; min-height: 63px; gap: 7px; padding: 0 8px; }
.selector-level-name { font-size: clamp(.96rem, 4vw, 2.5rem); font-weight: 950; line-height: 1; }
.selector-rating { display: flex; align-items: center; color: #ffdb4f; font-weight: 950; }
.selector-coins { display: flex; justify-content: flex-end; gap: 4px; margin: 6px 4px 2px; }
.selector-progress { width: min(79%, 400px); margin: 3px auto 7px; font-weight: 900; }
.selector-track { position: relative; display: grid; place-items: center; height: 23px; overflow: hidden; border: 2px solid #142a45; border-radius: 20px; background: #0007; font-size: .87rem; }
.selector-fill { position: absolute; inset: 0 auto 0 0; background: #62dd1a; }
.selector-progress.practice .selector-fill { background: #22d7fa; }
.selector-percent { position: relative; }
.selector-arrow, .selector-icon-button { padding: 0; background: transparent; border: 0; box-shadow: none; }
.selector-arrow { grid-row: 2; justify-self: center; font-size: 2.7rem; line-height: 1; }
.selector-left { grid-column: 1; }
.selector-right { grid-column: 3; }
.selector-right .selector-art { transform: scaleX(-1); }
.selector-top .selector-art, .selector-arrow .selector-art { width: clamp(30px, 7vw, 63px); }
.selector-art { display: inline-block; width: auto; max-width: 100%; height: auto; min-height: 0; vertical-align: middle; }
.selector-dots { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: center; padding: 6px 10px; }
.selector-dot { position: relative; width: clamp(10px, 2.3vw, 17px); height: 21px; padding: 0; border: 0; background: transparent; }
.selector-dot::before { content: ""; position: absolute; inset: 7px auto auto 50%; width: 7px; height: 7px; border-radius: 50%; background: #a1b0cb; transform: translateX(-50%); }
.selector-dot[aria-current]::before { background: white; box-shadow: 0 0 5px #fff9; }
.selector-detail { font-size: .82rem; }
@media (max-width: 560px) { .cabinet:has(.overlay[data-selector]:not([hidden])) { min-height: 320px; } .selector-level-label { min-height: 42px; } .selector-level-label > .selector-art { max-width: 34px; } .selector-coins canvas { width: 22px; } }

.overlay[data-selector] #status.selector-error { display: block; position: absolute; inset: auto 14px 24px; z-index: 1; color: #fff; background: #641d2e; border-radius: 7px; padding: 6px; }

.selector-bitmap-title { display: block; width: auto; max-width: 76%; height: auto; min-height: 0; max-height: clamp(22px, 5vw, 48px); object-fit: contain; }

.overlay[data-home] { padding: 0; background: transparent; overflow: hidden; }
.overlay[data-home] .panel { position: relative; width: 100%; height: 100%; padding: 0; border-radius: 0; }
.overlay[data-home] h1 { position: absolute; top: 15%; left: 14%; width: 72%; margin: 0; }
.overlay[data-home] .native-logo { width: 100%; min-height: 0; }
.overlay[data-home] #menu-content { position: absolute; inset: 0; margin: 0; pointer-events: none; }
.overlay[data-home] #menu-content :is(button, a) { pointer-events: auto; }
.overlay[data-home] .main-buttons { position: absolute; top: 37%; left: 20%; width: 60%; height: 29%; gap: 8%; }
.overlay[data-home] .main-buttons .sprite-button { width: 26%; padding: 0; }
.overlay[data-home] .main-buttons #menu-levels { width: 34%; }
.overlay[data-home] .sprite-button canvas { width: 100%; }
.overlay[data-home] .sprite-caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.overlay[data-home] .extra-buttons { position: absolute; bottom: 3%; left: 35%; width: 30%; height: 14%; margin: 0; gap: 10%; }
.overlay[data-home] .extra-buttons .sprite-button { width: 26%; padding: 0; }
.overlay[data-home] .official-menu-links { position: absolute; bottom: 2%; left: 2%; width: 26%; margin: 0; gap: 3%; }
.overlay[data-home] .official-menu-links a { width: 31%; }
.overlay[data-home] .official-menu-links canvas { width: 100%; min-height: 0; }
.overlay[data-home] .actions { position: absolute; top: 2%; right: 2%; margin: 0; }
.overlay[data-home] .actions button { font-size: .65rem; padding: 3px 5px; }
.overlay[data-home] #status { position: absolute; bottom: 20%; left: 10%; width: 80%; }
@media (max-width: 560px) {
  .cabinet:has(.overlay[data-home]:not([hidden])) { min-height: 226px; }
}

/* MenuLayer::init positions use a 320-unit-high Cocos viewport. */
.overlay[data-home] .panel { container-type: size; }
.overlay[data-home] h1 { top: 15.625%; left: 50%; width: calc(429 * 100cqh / 320); transform: translate(-50%, -50%); }
.overlay[data-home] .main-buttons { inset: 0; width: auto; height: auto; display: block; pointer-events: none; }
.overlay[data-home] .main-buttons .sprite-button { position: absolute; top: 46.875%; width: calc(var(--sprite-width) * 100cqh / 320); transform: translate(-50%, -50%); }
.overlay[data-home] .main-buttons #menu-levels { left: 50%; width: calc(var(--sprite-width) * 100cqh / 320); }
.overlay[data-home] #menu-icons { left: calc(50% - 110 * 100cqh / 320); }
.overlay[data-home] #menu-creator { left: calc(50% + 110 * 100cqh / 320); }
.overlay[data-home] .extra-buttons { left: 50%; bottom: 14.0625%; width: auto; height: auto; gap: calc(5 * 100cqh / 320); transform: translate(-50%, 50%); }
.overlay[data-home] .extra-buttons .sprite-button { width: calc(var(--sprite-width) * 100cqh / 320); flex-shrink: 0; }
.overlay[data-home] .official-menu-links { inset: 0; width: auto; pointer-events: none; }
.overlay[data-home] .official-menu-links a { position: absolute; transform: translate(-50%, 50%); }
.overlay[data-home] .official-menu-links [data-menu-link=news] { left: calc(100% - 43 * 100cqh / 320); bottom: 14.0625%; width: calc(var(--sprite-width) * 100cqh / 320); }
.overlay[data-home] .official-menu-links [data-menu-link=robtop] { left: calc(50 * 100cqh / 320); bottom: 7.8125%; width: calc(var(--sprite-width) * 100cqh / 320); }
.resource-options { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; }
.overlay[data-settings] .panel { width: min(75%, 660px); padding: 0 4% 3%; border: 5px solid #a6ec35; border-radius: 8px; background: #041c25e8; box-shadow: 0 0 0 2px #101a17, 0 0 0 4px #fff; }
.overlay[data-settings] :is(.tag, #message, .actions, #status) { display: none; }
.overlay[data-settings] h1 { display: grid; place-items: center; margin: 0 -6% 12px; min-height: 35px; background: linear-gradient(#c1ff52 50%, #7bcc21 50%); color: #fff; border-block: 3px solid #213b13; }
.overlay[data-settings] #menu-content { margin: 0; }
.settings-back { position: absolute; left: 2%; top: 3%; background: #a640d1; border-color: white; }
.settings-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.settings-grid button { grid-column: span 2; padding: 4px; background: #7bd124; border: 2px solid white; color: #ffdb52; text-shadow: 1px 1px #202014, -1px -1px #202014; font-size: clamp(.66rem, 2.6vw, 1.36rem); }
.settings-grid button:nth-child(-n+4) { grid-column: span 3; }
.settings-grid button:disabled { opacity: .55; }
.settings-sound { position: relative; padding: 8px 20% 0 8%; }
.settings-sound label { display: block; font-weight: 850; }
.settings-sound input[type=range] { display: block; width: 100%; margin: 2px 0 5px; accent-color: #e2bb21; }
.settings-menu-music { position: absolute; right: 0; top: 20%; max-width: 20%; font-size: .76rem; }
.settings-menu-music input { display: block; margin: 3px auto; accent-color: #92e124; }
