:root { color-scheme: dark; font-family: system-ui, sans-serif; background: #0b120f; color: #f2f5db; }
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
button, canvas { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; font-weight: 650; color: inherit; background: #1c3528e6; border: 1px solid #e7f5bb66; border-radius: 16px; min-height: 44px; padding: 10px 16px; cursor: pointer; }
button:focus-visible { outline: 3px solid #e3f18b; outline-offset: 3px; }
button:active, button.pressed { background: #b6d96c; color: #172316; }
button:disabled { opacity: .5; cursor: wait; }
[hidden] { display: none !important; }
#game { position: fixed; left: var(--viewport-left, 0px); top: var(--viewport-top, 0px); width: var(--viewport-width, 100%); height: var(--viewport-height, 100dvh); }
#safe-area { position: absolute; visibility: hidden; pointer-events: none; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
#canvas { display: block; width: 100%; height: 100%; object-fit: contain; outline: none; }
#welcome { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 30%, #304932, #0b1812 80%); padding: 20px; overflow: auto; }
.card { max-width: 600px; text-align: center; }
h1 { font: 900 clamp(52px, 12vw, 100px)/1 Georgia, serif; letter-spacing: -4px; margin: 12px 0; color: #d8ed8c; text-shadow: 0 5px #071e16; }
.eyebrow { font-size: 11px; letter-spacing: 3px; color: #c1ceac; }
.hint, small { font-size: 12px; line-height: 1.6; color: #b2c1b6; }
a { color: #d8ed8c; }
#start { background: #d8ed8c; color: #182619; min-width: 200px; }
#welcome { z-index: 40; }
#toolbar { position: absolute; z-index: 30; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); display: flex; gap: 8px; }
#toolbar button { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 23px; }
#toolbar button, #actions button { background: #120e098c; color: #f5e6b4f2; border: 2px solid #78642d8c; box-shadow: 0 2px 10px #0006; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
#toolbar [aria-pressed="true"] { border-color: #c8aa41bf; }
#mute { display: grid; place-items: center; }
#mute .sound-off, #mute[aria-pressed="true"] .sound-on { display: none; }
#mute[aria-pressed="true"] .sound-off { display: initial; }
#touch-controls { --ring: 140px; --inset: 20px; --primary: 76px; --face: 58px; --arc: 92px; --diagonal: 65px; --center: calc(var(--inset) + var(--primary)/2); position: absolute; z-index: 20; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
[data-touch-stick] { position: absolute; width: var(--ring); height: var(--ring); display: flex; align-items: center; justify-content: center; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity .12s ease; background: radial-gradient(circle, #14100a2e 60%, #14100a0f 100%); border: 2px solid #c8aa414d; }
.stick-knob { width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #f5e18cb3, #b48c2899); border: 2px solid #fff0be80; }
#actions button { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: var(--face); height: var(--face); padding: 0; border-radius: 50%; opacity: .85; }
#actions button span { font-size: 24px; line-height: 1; }
#actions button small { font: bold 9px monospace; letter-spacing: .5px; color: inherit; opacity: .85; }
#actions { position: absolute; top: calc(64px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); width: var(--primary); display: flex; flex-direction: column; align-items: center; gap: 8px; }
#actions button { position: relative; flex-shrink: 0; }
#actions .primary { width: var(--primary); height: var(--primary); background: #78281e99; border-color: #dc7850b3; color: #ffe1c8; }
#actions button.pressed, #toolbar button.pressed { background: #3c3012d9; border-color: #c8aa41bf; color: #f5e182; opacity: 1; }
.gesture-hint { position: absolute; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); pointer-events: none; text-align: center; width: 240px; font-size: 11px; color: #f5e6b4b3; text-shadow: 0 1px 4px #000; }
#confirm { position: absolute; z-index: 30; bottom: max(18px, env(safe-area-inset-bottom)); right: max(18px, env(safe-area-inset-right)); }
#notice { position: absolute; z-index: 50; top: max(60px, calc(env(safe-area-inset-top) + 54px)); left: 50%; transform: translateX(-50%); pointer-events: none; font-size: 12px; text-align: center; background: #102119cf; border-radius: 8px; padding: 4px 8px; }
#notice:empty { display: none; }
@media (max-height: 360px) { #touch-controls { --ring: 112px; --inset: 14px; --primary: 62px; --face: 48px; --arc: 74px; --diagonal: 52px; } }
@media (max-height: 450px) { .hint { margin: 8px 0; } h1 { font-size: 54px; } }
@media (orientation: portrait) {
  #actions { top: calc(112px + env(safe-area-inset-top, 0px)); }
  .gesture-hint { bottom: 205px; width: 220px; }
}

/* A five-action game still fits the same column on small landscape phones. */
#touch-controls[data-buttons="5"] { --primary: 60px; --face: 48px; }
@media (max-height: 360px) {
  #touch-controls[data-buttons="5"] { --primary: 44px; --face: 44px; }
}
