:root {
  --ink: #1b1b2f;
  --paper: #fffdf7;
  --blue: #4d96ff;
  --yellow: #ffd93d;
  --red: #ff6b6b;
  --sky: #bcd9ff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--sky); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang HK", sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hud {
  position: fixed; z-index: 5; left: 16px; right: 16px;
  top: calc(14px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 8px;
}
.pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink); padding: 6px 14px;
  font-weight: 900; font-size: 20px; font-variant-numeric: tabular-nums;
}
.pill .label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
.pill.coin .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--yellow); border: 3px solid #d69e00; }
.icon-btn {
  margin-left: auto; width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--ink); background: var(--paper); box-shadow: 0 3px 0 var(--ink);
  font-size: 18px; cursor: pointer;
}

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 16px;
  background: linear-gradient(to bottom, rgba(27,27,47,0) 30%, rgba(27,27,47,.45));
}
.panel {
  width: min(360px, 100%);
  background: var(--paper); border: 4px solid var(--ink); border-radius: 26px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 22px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  animation: pop .35s cubic-bezier(.2, 1.6, .5, 1);
}
#menu { place-items: end center; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
.badge {
  background: var(--ink); color: var(--yellow);
  font-weight: 900; font-size: 12px; letter-spacing: .08em;
  padding: 4px 12px; border-radius: 999px;
}
h1 { margin: 0; font-size: 36px; line-height: .95; font-weight: 900; }
h1 span { color: var(--blue); font-size: 46px; letter-spacing: .06em; }
h2 { margin: 0; font-size: 32px; font-weight: 900; }
.how { margin: 0; display: grid; gap: 4px; font-size: 13px; color: #444; }
kbd {
  display: inline-block; min-width: 20px; padding: 0 4px; margin-right: 2px;
  border: 2px solid var(--ink); border-radius: 6px; font: 800 11px/16px inherit; background: #fff;
}
.play-btn {
  font: inherit; font-weight: 900; font-size: 22px;
  width: 100%; padding: 14px; border-radius: 18px;
  border: 4px solid var(--ink); background: var(--yellow); color: var(--ink);
  box-shadow: 0 6px 0 var(--ink); cursor: pointer;
}
.play-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.best { margin: 0; font-size: 13px; font-weight: 700; opacity: .7; }
.stats { display: flex; gap: 12px; width: 100%; }
.stats div {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  border: 3px solid var(--ink); border-radius: 16px; padding: 8px;
}
.stats .label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
.stats strong { font-size: 30px; font-variant-numeric: tabular-nums; }
.back { font-size: 13px; color: #555; font-weight: 700; }

.loading {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: var(--sky); font-weight: 900; font-size: 20px;
}
[hidden] { display: none !important; }
