:root {
  --bg: #08161d;
  --bg-2: #0d2029;
  --ink: #e6f3f0;
  --ink-soft: #b6cecb;
  --water: #57d4c4;
  --moss: #79c78c;
  --bloom: #f0c79a;
  --stone-line: #4a7a83;
  --panel: #112932;
  --panel-line: #46707a;
  --focus: #ffd79a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  justify-content: center;
}

.frame {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 620px;
  height: 100dvh;
  padding: calc(8px + env(safe-area-inset-top)) 12px calc(8px + env(safe-area-inset-bottom));
  gap: 6px;
}

.head { text-align: center; }

.title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
}

.caption {
  margin: 2px 0 0;
  min-height: 22px;
  font-size: 16px;
  color: var(--ink-soft);
}

.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(60% 45% at 50% 46%, rgba(46,120,128,0.20), rgba(8,22,29,0) 70%),
    radial-gradient(40% 30% at 50% 78%, rgba(87,212,196,0.07), rgba(8,22,29,0) 72%);
}

.board { position: relative; }

.board canvas {
  display: block;
  border-radius: 14px;
}

.grid {
  position: absolute;
  inset: 0;
  display: grid;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.tile {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 6px;
  border: 2px solid transparent;
  pointer-events: none;
}

.tile:focus-visible { outline: none; }
.tile:focus-visible::after { border-color: var(--focus); }

.dock {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px 6px;
  border-radius: 14px;
  border: 1px solid var(--panel-line);
  background: linear-gradient(180deg, var(--panel), #0e2229);
}

.dock-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.ctl {
  min-height: 46px;
  min-width: 46px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid var(--panel-line);
  background: #16333c;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}

.ctl[hidden] { display: none; }

.ctl .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64828a;
  box-shadow: none;
}

.ctl[aria-pressed="true"] .dot {
  background: var(--water);
  box-shadow: 0 0 10px rgba(87, 212, 196, .8);
}

.ctl:disabled { opacity: .5; cursor: default; }

.ctl:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.go { background: #1d4a46; border-color: var(--water); }

.foot { justify-content: space-between; }

.level, .pips { margin: 0; font-size: 16px; color: var(--ink-soft); }

.pips { display: flex; gap: 6px; }

.pip {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--panel-line);
  background: transparent;
}

.pip.on { background: var(--moss); border-color: var(--moss); }
.pip.now { background: var(--water); border-color: var(--water); }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .pipe, .glow { transition: none !important; animation: none !important; }
}

@media (max-width: 420px) {
  .frame { padding-left: 8px; padding-right: 8px; }
  .ctl { padding: 0 10px; }
}
