:root {
  --bg: #16081f;
  --panel: rgba(42, 16, 72, .92);
  --line: rgba(230, 193, 90, .45);
  --gold: #e6c15a;
  --pink: #ff5fa8;
  --glow: #c9a6ff;
  --text: #fff6ff;
  --muted: #d7c6ea;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body { background: radial-gradient(80% 42% at 50% -8%, #6a2ca8 0%, transparent 55%), var(--bg); }
#park { height: 100%; max-width: 480px; margin: 0 auto; position: relative; }
.screen {
  position: absolute; inset: 0 0 calc(68px + var(--safe-b)) 0;
  padding: calc(12px + var(--safe-t)) 14px 12px;
  display: flex; flex-direction: column; gap: 10px; overflow: auto;
}
.hidden { display: none !important; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { margin: 0; color: var(--gold); letter-spacing: .14em; font-size: .78rem; }
h1, h2 { margin: 0; font-size: 1.2rem; }
.mini { width: 28px; height: 28px; object-fit: contain; }
.tag { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.35; }
.map { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.map button, .list button {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 12px; padding: 8px 4px; font: inherit; cursor: pointer;
}
.map button { min-height: 52px; }
.map button strong, .list button strong { display: block; }
.map button span, .list button span { color: var(--gold); font-size: .72rem; }
.map button:disabled { opacity: .4; cursor: default; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list button { text-align: left; padding: 12px; border-radius: 16px; }
.goal { margin: 0; color: var(--gold); font-weight: 700; font-size: .92rem; }
.board-wrap { position: relative; width: min(100%, 360px); margin: 0 auto; }
.board { display: grid; gap: 4px; width: 100%; touch-action: none; }
#wire { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#wire polyline { fill: none; stroke: #fff4c4; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 2px #e6c15a); }
.sq {
  aspect-ratio: 1; border-radius: 10px; background: #241038;
  border: 1px solid rgba(201,166,255,.25);
  display: grid; place-items: center; position: relative; color: #fff; font-weight: 800;
  padding: 0; font: inherit;
}
.sq.wall { background: #07030d; border-color: transparent; }
.sq .pip {
  width: 46%; height: 46%; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff, var(--pink) 46%, #8a2b6a);
  box-shadow: 0 0 10px var(--pink);
}
.sq .n {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: .85rem; text-shadow: 0 1px 2px #16081f;
}
.sq.on { background: linear-gradient(160deg, #f0d48a, #b388ff); border-color: var(--gold); }
.sq.head { outline: 2px solid #fff; outline-offset: -3px; }
.sq.start { animation: pulse 1.1s ease-in-out infinite; }
.sq.next { background: #3d2a16; box-shadow: inset 0 0 0 2px var(--gold); }
@keyframes pulse {
  50% { box-shadow: inset 0 0 0 3px #fff, 0 0 12px var(--pink); }
}
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn {
  border: 0; border-radius: 16px; padding: 12px; font: inherit; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn img { width: 22px; height: 22px; object-fit: contain; }
.btn.gold { background: linear-gradient(135deg, #ffe7a3, var(--gold)); color: #16081f; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { color: #ffb4d0; }
.stars { color: var(--gold); letter-spacing: .12em; }
.card {
  padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line);
}
.card strong { color: var(--gold); }
.tog {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
}
.dock {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(480px, 100%); display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px calc(8px + var(--safe-b)); background: rgba(14, 6, 22, .96);
  border-top: 1px solid var(--line); z-index: 8;
}
.dock button {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: .58rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.dock button img { width: 18px; height: 18px; object-fit: contain; }
.dock button.on { color: var(--gold); }
