:root {
  --ink: #16213a;
  --paper: #f8fafc;
  --cyan: #67e8f9;
  --gold: #f7c948;
  --rose: #fb7185;
  --line: rgba(248, 250, 252, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; touch-action: manipulation; }

body {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: 'Outfit', 'M PLUS Rounded 1c', sans-serif;
  color: var(--paper);
  background:
    radial-gradient(circle at 16% 12%, rgba(103, 232, 249, 0.19), transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(247, 201, 72, 0.17), transparent 24%),
    linear-gradient(145deg, #07101f, #16213a 58%, #2b1a31);
}

#app { width: 100%; min-height: 100vh; display: flex; justify-content: center; padding: 16px; }
.back-link {
  position: fixed; top: 15px; left: 15px; z-index: 20; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--paper); background: rgba(7,16,31,0.72);
  text-decoration: none; font-weight: 900; font-size: 0.78rem; backdrop-filter: blur(12px);
}

.app-shell { width: min(540px, 100%); min-height: calc(100vh - 32px); display: flex; flex-direction: column; justify-content: center; gap: 12px; padding-top: 40px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.eyebrow { color: var(--gold); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.12em; }
h1 { font-size: 2.05rem; line-height: 1; font-weight: 900; letter-spacing: 0; }
h1 span { color: var(--cyan); }
.wallet { min-width: 118px; padding: 10px 12px; border: 1px solid rgba(103,232,249,0.32); border-radius: 8px; background: rgba(255,255,255,0.08); text-align: right; }
.wallet span, .scorebar span { display: block; color: rgba(255,255,255,0.68); font-size: 0.68rem; font-weight: 900; letter-spacing: 0.08em; }

.scorebar, .board-wrap, .mini-guide {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.045));
  box-shadow: 0 18px 34px rgba(0,0,0,0.24);
}

.scorebar { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 8px; padding: 12px; align-items: stretch; }
.scorebar div { padding: 10px; border-radius: 8px; background: rgba(255,255,255,0.08); text-align: center; }
.scorebar b { display: block; margin-top: 4px; font-size: 1.22rem; }
button {
  border: 0; border-radius: 8px; min-height: 50px; padding: 10px 12px;
  color: var(--ink); background: var(--gold); font-family: inherit; font-size: 0.86rem; font-weight: 900;
  box-shadow: 0 8px 0 rgba(0,0,0,0.24);
}

.board-wrap { position: relative; padding: 12px; }
.maze { display: grid; grid-template-columns: repeat(11, 1fr); gap: 3px; aspect-ratio: 1 / 1; }
.tile {
  display: grid; place-items: center; min-width: 0; border-radius: 4px; background: rgba(248,250,252,.08);
  font-size: clamp(1rem, 4.8vw, 1.8rem);
}
.wall { background: linear-gradient(135deg, #0b1324, #31415f); box-shadow: inset 0 0 0 1px rgba(103,232,249,.12); }
.start { background: rgba(134,239,172,.22); }
.finish { background: rgba(247,201,72,.28); }
.player { background: rgba(103,232,249,.3); filter: drop-shadow(0 0 10px rgba(103,232,249,.5)); }
.overlay {
  position: absolute; inset: 12px; display: none; place-items: center; align-content: center; gap: 8px;
  border-radius: 8px; background: rgba(7,16,31,0.76); text-align: center; padding: 20px;
}
.overlay.show { display: grid; }
.overlay strong { color: var(--gold); font-size: 2rem; line-height: 1; }
.overlay p { color: rgba(255,255,255,0.82); line-height: 1.45; font-weight: 900; }
.controls { display: grid; place-items: center; gap: 8px; }
.controls div { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.controls button { width: min(100%, 160px); background: var(--cyan); }
.mini-guide { padding: 14px 16px; }
.mini-guide h2 { font-size: 1.05rem; margin-bottom: 6px; }
.mini-guide p { color: rgba(255,255,255,0.76); font-size: 0.88rem; line-height: 1.55; }

@media (max-width: 560px) {
  #app { padding: 12px; }
  .app-shell { min-height: calc(100vh - 24px); gap: 10px; padding-bottom: 96px; }
  h1 { font-size: 1.62rem; }
  .scorebar { grid-template-columns: 1fr 1fr; }
  .scorebar button { grid-column: 1 / -1; }
}
