:root {
  color-scheme: dark;
  --bg: #071420;
  --bg-2: #0a2233;
  --panel: rgba(9, 24, 38, 0.9);
  --panel-strong: rgba(12, 34, 54, 0.98);
  --line: rgba(150, 215, 255, 0.14);
  --text: #eef7ff;
  --muted: #9fbbcf;
  --cyan: #67e8f9;
  --gold: #ffd166;
  --rose: #ff8fab;
  --good: #7ef0a9;
  --danger: #ff7f7f;
  --shadow: 0 22px 54px rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(105, 193, 255, 0.12), transparent 38%),
    linear-gradient(180deg, var(--bg), #030a12 72%);
  color: var(--text);
}

a { color: inherit; }
button { font: inherit; }

.shell {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.topnav {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.topnav a {
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.55;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr);
  gap: 18px;
}

.game-panel,
.side-panel {
  padding: 18px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.hud > div {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

strong {
  font-size: 1.35rem;
}

.dock-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.dock {
  padding: 10px;
  border-radius: 14px 14px 8px 8px;
  text-align: center;
  font-weight: 700;
  color: #04111a;
}

.dock-cyan { background: linear-gradient(180deg, #9af4ff, var(--cyan)); }
.dock-gold { background: linear-gradient(180deg, #ffe6a3, var(--gold)); }
.dock-rose { background: linear-gradient(180deg, #ffc0d2, var(--rose)); }

.board-wrap {
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 22px;
}

.board {
  position: relative;
  height: 380px;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)),
    linear-gradient(90deg, rgba(103, 232, 249, 0.04), transparent 28%, transparent 72%, rgba(255, 209, 102, 0.04));
}

.lane,
.route,
.lock,
.gate-line,
.spawn-zone,
.dock-zone {
  position: absolute;
}

.lane {
  left: 0;
  right: 0;
  height: 64px;
  border-top: 2px solid rgba(189, 236, 255, 0.12);
  border-bottom: 2px solid rgba(189, 236, 255, 0.12);
  background: linear-gradient(180deg, rgba(74, 140, 176, 0.15), rgba(8, 46, 66, 0.36));
}

.lane-top { top: 36px; }
.lane-mid { top: 158px; }
.lane-bot { top: 280px; }

.lock {
  left: 44%;
  width: 16px;
  height: 86px;
  background: linear-gradient(180deg, #dbeafe, #6b7f93);
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.08);
}

.lock-top { top: 24px; }
.lock-mid { top: 146px; }
.lock-bot { top: 268px; }

.route {
  right: 16%;
  width: 22%;
  height: 10px;
  transform-origin: left center;
  border-radius: 999px;
  background: rgba(214, 240, 255, 0.38);
  box-shadow: 0 0 18px rgba(124, 204, 255, 0.18);
}

.route-up { top: 128px; transform: rotate(-28deg); }
.route-straight { top: 188px; }
.route-down { top: 248px; transform: rotate(28deg); }

.gate-line {
  left: 43%;
  width: 22px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
}

.gate-a { top: 76px; }
.gate-b { top: 198px; }
.gate-c { top: 320px; }

.spawn-zone {
  left: 2%;
  top: 0;
  bottom: 0;
  width: 20%;
  background: linear-gradient(90deg, rgba(255,255,255,0.06), transparent);
}

.dock-zone {
  right: 0;
  top: 0;
  bottom: 0;
  width: 21%;
  background: linear-gradient(270deg, rgba(255,255,255,0.06), transparent);
}

#boats-layer {
  position: absolute;
  inset: 0;
}

.boat {
  position: absolute;
  width: 56px;
  height: 28px;
  border-radius: 14px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
  border: 2px solid rgba(255,255,255,0.65);
  transition: box-shadow 120ms ease;
}

.boat::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 18px;
  width: 10px;
  height: 12px;
  background: rgba(255,255,255,0.9);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.boat-cyan { background: linear-gradient(180deg, #c6fbff, var(--cyan)); }
.boat-gold { background: linear-gradient(180deg, #fff1c6, var(--gold)); }
.boat-rose { background: linear-gradient(180deg, #ffd5e1, var(--rose)); }

.pattern-btn {
  flex: 1;
  min-width: 0;
  padding: 14px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-align: left;
}

.pattern-btn.active {
  background: linear-gradient(180deg, rgba(103, 232, 249, 0.18), rgba(255, 255, 255, 0.08));
  border-color: rgba(103, 232, 249, 0.48);
  box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.2), 0 14px 30px rgba(37, 99, 235, 0.18);
}

.pattern-name {
  display: block;
  font-weight: 800;
  margin-bottom: 4px;
}

.pattern-note {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

#status {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.restart-btn {
  padding: 12px 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #f8fafc, #cbd5e1);
  color: #0f172a;
  font-weight: 800;
}

.side-panel h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.side-panel section + section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.side-panel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.status-good { color: var(--good) !important; }
.status-bad { color: var(--danger) !important; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .shell { width: min(100% - 14px, 100%); padding-top: 14px; }
  .hero, .game-panel, .side-panel { padding: 16px; border-radius: 20px; }
  .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dock-row { font-size: 0.84rem; }
  .board { height: 330px; }
  .controls { flex-direction: column; }
  .status-row { flex-direction: column; align-items: stretch; }
  .restart-btn { width: 100%; }
  strong { font-size: 1.2rem; }
}
