:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --base: #0b1315;
  --panel: #111d20;
  --line: #273738;
  --muted: #9bb0b2;
  --white: #f5f9ed;
  --lime: #e2fc68;
  --dark-ink: #182517;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--white);
  background: radial-gradient(ellipse at 72% 0%, #14282a 0%, transparent 65%), var(--base);
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid #9eefff; outline-offset: 4px; }
button:disabled { opacity: .48; cursor: default; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.arcade { width: min(100% - 72px, 1400px); margin: auto; padding-bottom: 26px; }
.masthead, .brand, .toolbar, .mode { display: flex; align-items: center; }
.masthead { height: 75px; justify-content: space-between; gap: 14px; }
.brand { gap: 12px; font-size: 17px; font-weight: 780; letter-spacing: -.035em; }
.toolbar { gap: 9px; }
.mode {
  gap: 8px;
  margin-right: 7px;
  color: #c3d2cb;
  font: 700 11px var(--mono);
  letter-spacing: .11em;
}
.mode span, .goal span {
  background: var(--lime);
  border-radius: 50%;
  height: 7px;
  width: 7px;
  box-shadow: 0 0 10px #e2fc6870;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid #304244;
  border-radius: 10px;
  background: #172528;
}
.icon-button:not(:disabled):hover, .secondary:hover { background: #263b3b; }
.icon-button[aria-pressed="false"] .sound-on, .icon-button[aria-pressed="true"] .sound-off { display: none; }
.stage {
  isolation: isolate;
  position: relative;
  height: clamp(485px, 72dvh, 730px);
  overflow: hidden;
  border: 1px solid #33494b;
  border-radius: 20px;
  background: #12393e;
  box-shadow: 0 18px 50px #030a0b65;
}
#scene, #scene canvas, .vignette { position: absolute; inset: 0; width: 100%; height: 100%; }
#scene canvas { display: block; }
.vignette {
  pointer-events: none;
  background: linear-gradient(90deg, #07191bf2 0%, #081e20eb 18%, #071d20a8 39%, transparent 68%), linear-gradient(0deg, #061618ab, transparent 25%);
}
.stage:not([data-state="menu"]) .vignette { background: linear-gradient(#06141670, transparent 20%, transparent 80%, #06141660); }
.intro {
  position: absolute;
  left: clamp(24px, 5vw, 76px);
  top: 50%;
  transform: translateY(-49%);
  max-width: calc(100% - 46px);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 21px;
  font: 750 12px/1.3 var(--mono);
  letter-spacing: .16em;
  color: #dce8de;
}
.eyebrow span { color: var(--lime); background: #b9dc461c; border: 1px solid #bcdb5a51; border-radius: 4px; padding: 6px 8px; }
.eyebrow i { display: block; width: 15px; height: 1px; background: #91ad9a80; }
h1, .result h2, dialog h2 { letter-spacing: -.075em; margin: 0; line-height: .88; font-weight: 950; }
h1 { font-size: clamp(60px, 8.25vw, 122px); letter-spacing: -.05em; text-shadow: 0 7px 32px #0822227a; }
h1 em { color: var(--lime); font-style: normal; }
.lead { font-size: clamp(16px, 1.6vw, 22px); line-height: 1.46; color: #e2eeeb; margin: 24px 0 27px; font-weight: 460; }
.actions { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.primary, .secondary {
  min-height: 48px;
  padding: 11px 19px;
  font-weight: 780;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: 9px;
}
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--dark-ink);
  background: var(--lime);
  box-shadow: 0 4px 20px #b3e84038;
}
.primary:hover:not(:disabled) { background: #efffa4; }
.primary svg { width: 19px; height: 19px; fill: currentColor; stroke-width: 0; }
.secondary { background: #142728df; border-color: #52685e; }
#load-error { color: #ffcdad; max-width: 30ch; }
.coordinate { position: absolute; right: 25px; bottom: 21px; display: flex; align-items: center; gap: 9px; color: #e0f8e6; font: 650 10px var(--mono); letter-spacing: .15em; }
.coordinate span { color: var(--lime); }
.coordinate i { display: inline-block; height: 1px; width: 25px; background: #c4f1da9c; }
.stage:not([data-state="menu"]) .coordinate { display: none; }
.hud, .hud-group { display: flex; gap: 9px; align-items: stretch; }
.hud { pointer-events: none; position: absolute; top: 15px; inset-inline: 15px; justify-content: space-between; }
.hud-card, .goal, .notice { background: #0d2024ed; border: 1px solid #648286a0; border-radius: 10px; }
.hud-card { padding: 9px 12px; min-width: 86px; }
.hud-label { display: block; color: #b3cdcc; font: 700 9px var(--mono); letter-spacing: .12em; margin-bottom: 3px; }
.hud strong { font-size: 14px; }
.progress-row { display: flex; align-items: center; gap: 6px; }
progress { width: 90px; height: 9px; accent-color: var(--lime); }
#progress-label { min-width: 33px; }
.eel-hud[data-danger="true"] { border-color: #ffb168; }
.eel-hud[data-disabled="true"] { border-color: #c1e464; }
.zaps { min-width: 55px; text-align: center; }
.goal {
  pointer-events: none;
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  color: var(--lime);
  font: 750 10px var(--mono);
  letter-spacing: .11em;
}
.notice {
  position: absolute;
  left: 50%;
  bottom: 19px;
  z-index: 2;
  max-width: calc(100% - 24px);
  width: max-content;
  transform: translateX(-50%);
  padding: 10px 15px;
  font-size: 14px;
  font-weight: 680;
  text-align: center;
  pointer-events: none;
}
.notice[data-kind="danger"] { color: #ffddae; border-color: #eaa672; }
.notice[data-kind="good"] { color: var(--lime); border-color: #afcf61; }
.intermission { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 17px; background: #071719b9; }
.result, .dialog-inner { border: 1px solid #4e6765; background: #112426; border-radius: 18px; }
.result { width: min(100%, 460px); padding: clamp(22px, 5vw, 39px); }
.result .eyebrow, dialog .eyebrow { color: var(--lime); }
.result h2 { font-size: clamp(40px, 7vw, 68px); }
.result p:not(.eyebrow) { margin: 16px 0 24px; color: #cee0de; line-height: 1.5; }
.control-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  margin-top: 13px;
}
.control {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 73px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.control-icon {
  display: grid;
  place-items: center;
  flex: 0 0 41px;
  height: 41px;
  border-radius: 9px;
  background: #26372e;
  color: var(--lime);
}
.control h2 { margin: 0 0 2px; font-size: 14px; }
.control p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.25; }
.keyset { margin-left: auto; display: flex; align-items: center; gap: 4px; }
kbd, .finish {
  min-width: 21px;
  border: 1px solid #3a4b4b;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 4px;
  background: #1e2d30;
  color: #e5eeeb;
  font: 650 11px var(--mono);
  text-align: center;
}
.finish { min-width: 27px; justify-content: center; color: var(--lime); }
dialog { width: min(490px, calc(100% - 28px)); padding: 0; background: transparent; border: 0; color: var(--white); }
dialog::backdrop { background: #020a0cbb; }
.dialog-inner { position: relative; padding: 26px; }
dialog h2 { font-size: 45px; }
dialog ol { padding-left: 24px; color: #c8dbd7; line-height: 1.5; }
dialog li { padding-left: 3px; margin: 11px 0; }
dialog strong { color: var(--white); }
.close { position: absolute; top: 14px; right: 14px; font-size: 24px; }
.touch { display: none; }
@media (max-width: 900px) {
  .arcade { width: calc(100% - 36px); }
  .control { gap: 8px; }
  .control-icon { flex-basis: 32px; height: 34px; }
  .control-icon svg { width: 19px; height: 19px; }
}
@media (max-width: 680px) {
  .arcade { width: calc(100% - 22px); }
  .masthead { height: 60px; }
  .brand { font-size: 15px; gap: 8px; }
  .brand img { width: 31px; height: 31px; }
  .mode { display: none; }
  .stage { height: clamp(510px, 76dvh, 730px); border-radius: 14px; }
  .intro { top: auto; bottom: 33px; transform: none; }
  h1 { font-size: clamp(49px, 13vw, 86px); }
  .vignette { background: linear-gradient(0deg, #07191bfa 0%, #071c20de 32%, #071d2020 74%); }
  .coordinate { top: 17px; right: 17px; bottom: auto; }
  .eyebrow { margin-bottom: 14px; }
  .lead { margin: 16px 0 18px; }
  .control-strip { gap: 5px; }
  .control { flex-wrap: wrap; align-content: center; padding: 8px; gap: 5px; }
  .control-icon { display: none; }
  .keyset { display: none; }
  .hud { inset: 9px 8px auto; gap: 4px; }
  .hud-group { gap: 4px; }
  .hud-card { min-width: auto; padding-inline: 7px; }
  progress { width: 46px; }
}
@media (any-pointer: coarse) {
  .touch { position: absolute; inset: auto 12px 12px; display: flex; justify-content: space-between; align-items: end; pointer-events: none; }
  .touch button { touch-action: none; pointer-events: auto; user-select: none; }
  .dpad { display: grid; grid-template: repeat(2, 44px) / repeat(3, 44px); gap: 3px; }
  .dpad button, .touch-bite { border: 1px solid #afcbbed4; background: #0b2529e8; border-radius: 10px; font-weight: 800; font-size: 19px; }
  .dpad button:first-child { grid-column: 2; }
  .dpad button:nth-child(2) { grid-column: 1; grid-row: 2; }
  .dpad button:nth-child(3) { grid-column: 2; grid-row: 2; }
  .dpad button:nth-child(4) { grid-column: 3; grid-row: 2; }
  .touch-bite { width: 64px; height: 64px; border-radius: 50%; font-size: 13px; background: var(--lime); color: var(--dark-ink); }
  .notice { bottom: 112px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
#stage:focus { outline: none; }
.level-hud { min-width: 114px; }
.level-hud strong { font-family: var(--mono); font-size: 12px; }
@media (max-width: 680px) {
  .level-hud { min-width: auto; }
  .level-hud strong { font-size: 9px; }
  .hud .eel-hud strong { font-size: 12px; }
  .hud-label { letter-spacing: .06em; }
}
