:root {
  --ink: #101820;
  --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 18% 12%, rgba(103, 232, 249, 0.2), transparent 28%),
    radial-gradient(circle at 84% 10%, rgba(251, 113, 133, 0.18), transparent 24%),
    linear-gradient(145deg, #07101d, #101820 58%, #351a2d);
}

#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,29,0.72);
  text-decoration: none; font-weight: 900; font-size: 0.78rem; backdrop-filter: blur(12px);
}

.app-shell { width: min(620px, 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: 10px; aspect-ratio: 520 / 340; }
canvas { width: 100%; height: 100%; display: block; border-radius: 8px; background: #0b1324; }
.overlay {
  position: absolute; inset: 10px; display: none; place-items: center; align-content: center; gap: 8px;
  border-radius: 8px; background: rgba(7,16,29,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; }
.controls { display: grid; }
.controls button { background: var(--cyan); min-height: 58px; }
.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.56rem; }
  .scorebar { grid-template-columns: 1fr 1fr; }
  .scorebar button { grid-column: 1 / -1; }
}
