:root { --orange: #FF5E00; --black: #050505; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--orange); color: #000; font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 12px 10px 20px; touch-action: manipulation; }
.top { width: min(960px, 100%); display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.top a.back { font-weight: 800; text-transform: uppercase; letter-spacing: .1em; font-size: 15px; color: #000; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.top a.back:hover { color: #fff; }
.sticker { display: inline-block; padding: 5px 10px; background: #000; color: var(--orange); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; border-radius: 6px; transform: rotate(-3deg); box-shadow: 0 0 0 3px #fff; }
.langs { display: inline-flex; gap: 2px; background: #0c0c0c; border: 2px solid #2a2a2a; border-radius: 999px; padding: 3px; }
.langs button { padding: 4px 10px; border-radius: 999px; border: 0; background: none; color: #9a938d; font: inherit; font-weight: 700; letter-spacing: .1em; font-size: 12px; cursor: pointer; }
.langs button.on { background: var(--orange); color: #000; }
.device { position: relative; width: min(960px, 100%, calc((100dvh - 96px) * 16 / 9 + 34px)); min-width: min(320px, 100%); border-radius: 26px; background: linear-gradient(180deg, #262626 0%, #141414 38%, #070707 100%); border: 3px solid #0b0b0b; box-shadow: 0 0 0 3px rgba(255, 150, 80, .55), 0 22px 46px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -5px 0 rgba(0, 0, 0, .75); padding: 14px; }
.stage { position: relative; width: 100%; }
.screen { position: relative; width: 100%; background: #000; border-radius: 14px; overflow: hidden; border: 3px solid #000; box-shadow: inset 0 0 0 2px #1a1a1a, inset 0 0 40px rgba(0, 0, 0, .8); }
canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; image-rendering: pixelated; image-rendering: crisp-edges; background: #0b0b10; touch-action: none; }

/* overlays cover the whole stage (screen + touch pad on phones) */
.ov { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 14px; color: #fff; background: rgba(0, 0, 0, .78); overflow-y: auto; border-radius: 14px; z-index: 5; }
.ov.on { display: flex; justify-content: safe center; }
/* never squeeze the contents of an overlay: on short screens it scrolls instead */
.ov > * { flex-shrink: 0; }
.ov h1, .ov h2 { font-family: "Press Start 2P", monospace; text-transform: uppercase; color: var(--orange); margin: 0 0 8px; line-height: 1.5; text-shadow: 3px 3px 0 #000; }
.ov h2 { font-size: clamp(12px, 2.4vw, 20px); }
.ov h3 { font-family: "Press Start 2P", monospace; font-size: 9px; color: var(--orange); text-transform: uppercase; margin: 14px 0 6px; line-height: 1.5; }
.ov p { margin: 3px 0; font-size: clamp(13px, 1.8vw, 17px); color: #d8d2cc; font-weight: 600; letter-spacing: .04em; }
.ov .muted { color: #8C8580; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 4px 0; padding: 9px 22px 11px; border-radius: 999px; border: 0; cursor: pointer; background: linear-gradient(180deg, #FF9A55 0%, var(--orange) 50%, #D64D00 100%); color: #1B0A00; font-family: "Press Start 2P", monospace; font-size: clamp(9px, 1.4vw, 12px); text-transform: uppercase; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35), inset 0 -5px 0 rgba(0, 0, 0, .3), 0 10px 20px rgba(0, 0, 0, .35), 0 0 0 3px #0b0b0b; transition: transform .12s; }
.btn:hover, .btn:focus-visible { transform: translateY(-2px); outline: none; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35), inset 0 -5px 0 rgba(0, 0, 0, .3), 0 10px 20px rgba(0, 0, 0, .35), 0 0 0 3px #fff; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: linear-gradient(180deg, #303030 0%, #121212 45%, #030303 100%); color: var(--orange); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .2), inset 0 -5px 0 rgba(0, 0, 0, .85), 0 10px 20px rgba(0, 0, 0, .38), 0 0 0 3px rgba(255, 150, 80, .55); }
.btn.ghost:hover, .btn.ghost:focus-visible { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .2), inset 0 -5px 0 rgba(0, 0, 0, .85), 0 10px 20px rgba(0, 0, 0, .38), 0 0 0 3px #fff; }
.btn small { font-size: 8px; opacity: .8; }
.btn[disabled] { opacity: .4; cursor: default; transform: none; }
.row2 { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

/* title */
#ov-title { background: transparent; }
.logo { font-family: "Press Start 2P", monospace; line-height: 1.15; text-shadow: 4px 4px 0 #000; margin-bottom: 4px; }
.logo span { display: block; }
.logo .l1 { color: #fff; font-size: clamp(16px, 4.2vw, 40px); letter-spacing: .06em; }
.logo .l2 { color: var(--orange); font-size: clamp(22px, 6vw, 58px); letter-spacing: .04em; }
.tag { max-width: 560px; }
.menu { display: grid; grid-template-columns: repeat(3, auto); gap: 4px 6px; justify-content: center; margin-top: 4px; }
.menu .btn { margin: 6px 0 0; }

/* select */
#ov-select { background: transparent; justify-content: flex-start; padding-top: 10px; }
.grid { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tile { position: relative; width: clamp(70px, 11vw, 96px); padding: 6px 4px 6px; border-radius: 12px; border: 3px solid #0b0b0b; background: linear-gradient(180deg, #2a2a2a, #0f0f0f); color: #fff; cursor: pointer; box-shadow: 0 0 0 2px rgba(255, 150, 80, .35), 0 8px 18px rgba(0, 0, 0, .5); font: inherit; transition: transform .12s; }
.tile:hover, .tile:focus-visible { transform: translateY(-2px); outline: none; }
.tile.on { box-shadow: 0 0 0 3px var(--orange), 0 10px 22px rgba(0, 0, 0, .6); background: linear-gradient(180deg, #4a2a10, #1a0d04); }
.tile.p2 { box-shadow: 0 0 0 3px #4fb2ff, 0 10px 22px rgba(0, 0, 0, .6); }
.tile.locked { opacity: .4; cursor: default; }
.tile canvas, .tile .pic { display: block; width: 100%; height: auto; aspect-ratio: auto; background: none; image-rendering: pixelated; margin: 0 auto 4px; }
.tile .q { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-family: "Press Start 2P", monospace; font-size: clamp(18px, 4vw, 30px); color: var(--orange); background: #120c08; border-radius: 6px; }
.tile b { display: block; font-family: "Press Start 2P", monospace; font-size: 7px; color: var(--orange); line-height: 1.4; text-transform: uppercase; hyphens: manual; overflow-wrap: anywhere; }
.tile b .w { display: inline-block; max-width: 100%; }
.tile .tag2 { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: var(--orange); color: #000; font-family: "Press Start 2P", monospace; font-size: 7px; padding: 3px 5px; border-radius: 4px; }
.tile .tag2.b { background: #4fb2ff; }
.info { max-width: 520px; margin-top: 8px; min-height: 64px; background: rgba(0, 0, 0, .55); border-radius: 12px; padding: 8px 12px; }
.info b { font-family: "Press Start 2P", monospace; font-size: 10px; color: var(--orange); }
.info p { font-size: 14px; margin: 4px 0; }
.info .sp { color: #ffd0a0; font-size: 13px; }
.bars { display: flex; gap: 12px; justify-content: center; margin-top: 4px; }
.bars span { font-size: 11px; color: #b3aba5; text-transform: uppercase; letter-spacing: .08em; display: inline-flex; align-items: center; gap: 4px; }
.bars i { display: inline-block; width: 6px; height: 8px; background: #333; margin-left: 1px; }
.bars i.f { background: var(--orange); }
.opts { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.opts .lbl { font-size: 11px; color: #8C8580; text-transform: uppercase; letter-spacing: .12em; margin-left: 6px; }
.opts button { border: 2px solid #333; background: #0c0c0c; color: #b3aba5; border-radius: 999px; padding: 5px 11px; font: inherit; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.opts button.on { background: var(--orange); color: #000; border-color: var(--orange); }

/* tower */
#ov-tower { background: transparent; justify-content: flex-end; padding-bottom: 10px; }
#ov-tower .panel { background: rgba(0, 0, 0, .72); border-radius: 14px; padding: 8px 14px 10px; border: 2px solid rgba(255, 150, 80, .45); max-width: 420px; margin-left: auto; }
#ov-tower h2 { font-size: clamp(10px, 1.8vw, 14px); margin-bottom: 2px; }

/* results */
.stats { display: grid; grid-template-columns: auto auto; gap: 2px 16px; margin: 8px auto; text-align: left; }
.stats span { color: #b3aba5; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stats b { font-family: "Press Start 2P", monospace; font-size: 10px; color: #fff; text-align: right; line-height: 1.8; }
#end-pic canvas { width: auto; height: clamp(90px, 22vw, 180px); aspect-ratio: auto; background: none; }

/* badges + help */
.ov.form { justify-content: flex-start; padding-top: 16px; background: rgba(5, 5, 5, .96); }
.badges { width: min(720px, 100%); display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; text-align: left; margin: 6px 0 4px; }
.badge { display: flex; gap: 8px; align-items: center; background: #111; border: 2px solid #2a2a2a; border-radius: 10px; padding: 6px 8px; }
.badge.got { border-color: var(--orange); }
.badge canvas { width: 32px; height: 32px; flex: none; aspect-ratio: auto; background: none; }
.badge b { display: block; font-family: "Press Start 2P", monospace; font-size: 7px; color: var(--orange); line-height: 1.5; }
.badge:not(.got) b { color: #8C8580; }
.badge span { display: block; font-size: 12px; color: #b3aba5; line-height: 1.25; }
.badge small { display: block; font-size: 10px; color: #6e6862; text-transform: uppercase; letter-spacing: .08em; }
.help { width: min(640px, 100%); text-align: left; }
.help p { font-size: 14px; }
.movelist { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin-top: 6px; }
.movelist div { background: #111; border: 2px solid #2a2a2a; border-radius: 10px; padding: 6px 8px; font-size: 13px; color: #d8d2cc; font-weight: 600; }
.movelist b { display: block; font-family: "Press Start 2P", monospace; font-size: 7px; color: var(--orange); line-height: 1.6; }

/* toast (badge unlocked) */
.toast { position: absolute; left: 50%; top: 8px; transform: translate(-50%, -140%); z-index: 9; display: flex; gap: 10px; align-items: center; background: #0c0c0c; border: 3px solid var(--orange); border-radius: 12px; padding: 6px 12px 6px 8px; color: #fff; box-shadow: 0 10px 24px rgba(0, 0, 0, .6); transition: transform .35s, opacity .35s; pointer-events: none; max-width: 92%; opacity: 0; }
.toast.on { transform: translate(-50%, 0); opacity: 1; }
.toast canvas { width: 32px; height: 32px; aspect-ratio: auto; background: none; flex: none; }
.toast small { display: block; font-size: 10px; color: #ffb37a; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.toast b { display: block; font-family: "Press Start 2P", monospace; font-size: 9px; color: var(--orange); line-height: 1.5; }

/* touch pad: hidden on PCs, below the screen in portrait, beside it in landscape */
.pad { display: none; }
body.touch .pad { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 12px 4px 4px; user-select: none; -webkit-user-select: none; touch-action: none; }
.dpad { position: relative; width: min(34vw, 170px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #2a2a2a 0%, #141414 60%, #0a0a0a 100%); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .12), 0 0 0 3px #0b0b0b, 0 0 0 5px rgba(255, 150, 80, .45); touch-action: none; }
.dpad i { position: absolute; width: 22%; height: 22%; background: #3a3a3a; border-radius: 4px; }
.dpad i.u { left: 39%; top: 8%; } .dpad i.d { left: 39%; bottom: 8%; } .dpad i.l { top: 39%; left: 8%; } .dpad i.r { top: 39%; right: 8%; }
.dpad i.on { background: var(--orange); }
.dpad .knob { position: absolute; left: 50%; top: 50%; width: 34%; height: 34%; margin: -17% 0 0 -17%; border-radius: 50%; background: linear-gradient(180deg, #ff9a55, #d64d00); box-shadow: 0 0 0 3px #0b0b0b; pointer-events: none; }
.pmid { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.pbtns { justify-self: end; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(34vw, 170px); }
.pb { position: relative; aspect-ratio: 1; border-radius: 50%; border: 0; background: linear-gradient(180deg, #303030 0%, #121212 50%, #030303 100%); color: var(--orange); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .2), inset 0 -4px 0 rgba(0, 0, 0, .85), 0 0 0 3px rgba(255, 150, 80, .55); font-family: "Press Start 2P", monospace; font-size: 9px; touch-action: none; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 0; }
.pb.heavy { background: linear-gradient(180deg, #ff9a55 0%, var(--orange) 50%, #d64d00 100%); color: #1b0a00; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35), inset 0 -4px 0 rgba(0, 0, 0, .3), 0 0 0 3px #0b0b0b; }
.pb.on { transform: scale(.92); filter: brightness(1.35); }
.pb .ic canvas { width: 22px; height: 22px; aspect-ratio: auto; background: none; display: block; }
.pb small { font-size: 7px; margin-top: 2px; }
.pb.small, .pb.sp { width: 44px; aspect-ratio: 1; font-size: 8px; }
.pb.sp { width: 52px; background: linear-gradient(180deg, #5a2a86, #2c1446); color: #ffd0a0; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .2), 0 0 0 3px rgba(255, 150, 80, .55); }
/* phone held sideways: the cross left of the screen, the buttons right of it */
body.touch.land { padding: 4px 6px 8px; }
body.touch.land .top { margin-bottom: 4px; }
body.touch.land .device { width: 100%; max-width: 1100px; padding: 8px; border-radius: 18px; }
body.touch.land .stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, calc((100dvh - 100px) * 16 / 9)) minmax(0, 1fr); grid-template-areas: "dpad screen btns" "mid screen btns"; align-items: center; gap: 4px 8px; }
body.touch.land .pad { display: contents; }
body.touch.land .screen { grid-area: screen; }
body.touch.land .dpad { grid-area: dpad; width: min(100%, 150px); justify-self: center; align-self: end; }
body.touch.land .pmid { grid-area: mid; flex-direction: row; justify-self: center; align-self: start; }
body.touch.land .pbtns { grid-area: btns; width: min(100%, 150px); justify-self: center; }
body.touch:not(.playing) .pad > * { visibility: hidden; }
/* phone upright: menus get the full height, the pad is hidden there anyway */
body.touch:not(.land):not(.playing) .stage { min-height: calc(100dvh - 100px); }

.hint { width: min(960px, 100%); margin-top: 10px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; color: #2a1200; }
.hint button { border: 0; background: none; font: inherit; font-weight: 800; cursor: pointer; color: #000; text-transform: uppercase; letter-spacing: .1em; }
.hint button:hover { color: #fff; }
.hint .legal a { color: #2a1200; text-decoration: none; } .hint .legal a:hover { color: #fff; }

@media (max-width: 600px) {
  body { padding: 8px 6px 14px; } .device { padding: 8px; border-radius: 18px; } .screen { border-radius: 10px; } .top a.back span.t { display: none; }
  .ov { padding: 8px; }
  .menu { grid-template-columns: repeat(2, auto); }
  .menu .btn { padding: 8px 12px 10px; }
  .tile { width: 70px; }
  .info { padding: 6px 8px; } .info p { font-size: 13px; }
  .badges { grid-template-columns: 1fr; }
  .opts button { padding: 4px 8px; font-size: 11px; }
}
@media (max-height: 520px) and (min-width: 601px) { .tag { display: none; } .info { min-height: 0; } .tile { width: 70px; } }

/* fullscreen toggle next to the sound switch */
.hint #btn-fs { margin-right: 14px; }
.hint #btn-fs.on { color: #fff; }
/* training: dummy + reset buttons in the pause screen; the move list there keeps its line breaks */
.tr-only { display: none; }
body.training .tr-only { display: flex; }
#pause-moves { white-space: pre-line; text-transform: none; letter-spacing: .03em; line-height: 1.5; max-width: 92%; margin: 6px auto 0; }
/* desktop (Mike 11.10.): use more of the screen in the window, but always keep the whole 16:9 game visible */
@media (pointer: fine) and (min-width: 1000px) {
  .top, .hint, .device { width: min(1280px, 100%, calc((100dvh - 150px) * 16 / 9 + 34px)); }
}
