:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(9, 20, 35, 0.82);
  --panel-border: rgba(163, 230, 255, 0.18);
  --text: #eff8ff;
  --muted: #b9d3e4;
  --accent: #7ee0ff;
  --accent-2: #ffd479;
  --danger: #ff8f8f;
  --success: #9bf4b6;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(70, 132, 180, 0.25), transparent 28%),
    linear-gradient(180deg, #0d1d31, var(--bg));
  color: var(--text);
}
button { font: inherit; }
.app {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 18px 14px 28px;
}
.topnav {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  margin-bottom: 14px;
}
.topnav a { color: var(--accent); text-decoration: none; }
.hero, .hud, .controls, .howto, .card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.hero {
  padding: 18px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent-2);
}
h1, h2, p { margin-top: 0; }
.subtitle { margin-bottom: 0; color: var(--muted); max-width: 56ch; }
.primary, .ghost {
  border-radius: 999px;
  padding: 12px 16px;
  border: 0;
  cursor: pointer;
}
.primary {
  background: linear-gradient(135deg, var(--accent), #4ab8ff);
  color: #032235;
  font-weight: 800;
}
.ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
}
.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  margin-bottom: 14px;
}
.hud div {
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 10px 12px;
}
.hud span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.board-wrap {
  position: relative;
  margin-bottom: 14px;
}
.board {
  position: relative;
  aspect-ratio: 9 / 14;
  min-height: 520px;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.12);
  background:
    radial-gradient(circle at 50% 10%, rgba(255,255,255,0.08), transparent 20%),
    linear-gradient(90deg, #b8895f 0 12%, #1c5074 12% 88%, #b8895f 88% 100%);
}
.board::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent 30%),
    repeating-linear-gradient(160deg, rgba(255,255,255,0.05) 0 14px, transparent 14px 34px);
  pointer-events: none;
}
.bank-label, .goal-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(5, 16, 29, 0.58);
  border: 1px solid rgba(255,255,255,0.12);
  z-index: 2;
}
.bank-label { bottom: 18px; }
.goal-label { top: 18px; }
.lane {
  position: absolute;
  left: 12%;
  width: 76%;
  height: 10px;
  border-radius: 999px;
  background: rgba(161, 227, 255, 0.12);
  border: 1px solid rgba(161, 227, 255, 0.12);
}
.stone {
  position: absolute;
  width: 14%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(222, 244, 255, 0.3);
  background: radial-gradient(circle at 35% 30%, #f4fbff, #98bed4 60%, #58798f 100%);
  box-shadow: 0 8px 18px rgba(0,0,0,0.22);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  color: #072132;
  font-weight: 900;
  z-index: 3;
}
.stone::after {
  content: attr(data-order);
  opacity: 0.9;
  font-size: 0.95rem;
}
.stone.frozen {
  background: radial-gradient(circle at 35% 30%, #ffffff, #aff0ff 58%, #67a9ff 100%);
  box-shadow: 0 0 0 6px rgba(126, 224, 255, 0.18), 0 12px 22px rgba(0,0,0,0.28);
}
.stone.used {
  background: radial-gradient(circle at 35% 30%, #fff5d7, #ffc66e 58%, #c07d2a 100%);
}
.stone:disabled { cursor: default; }
.courier {
  position: absolute;
  width: 11%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3d0, #ffb35c 65%, #b15e20 100%);
  border: 2px solid rgba(255,255,255,0.32);
  transform: translate(-50%, -50%);
  z-index: 4;
  transition: left 0.36s ease, top 0.36s ease;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 18px rgba(0,0,0,0.28);
}
.courier::after {
  content: "📦";
  font-size: clamp(1rem, 3vw, 1.35rem);
}
.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 8, 15, 0.48);
  z-index: 8;
}
.overlay.visible { display: flex; }
.card { padding: 18px; max-width: 420px; }
.overlay-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.controls { display: flex; gap: 10px; padding: 12px; margin-bottom: 14px; }
.howto { padding: 16px; color: var(--muted); }
.howto ul { padding-left: 18px; margin-bottom: 0; }
.status-good { color: var(--success); }
.status-bad { color: var(--danger); }
@media (max-width: 720px) {
  .hero { flex-direction: column; }
  .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { min-height: 460px; }
}
