:root {
  --ink: #241447;
  --paper: #fff6e8;
  --accent: #ff4d8d;
  --accent-2: #ffe14a;
  --mint: #2ad7a8;
  --line: #241447;
  --good: #1f9d62;
  --bad: #e23b5a;
  color: var(--ink);
  font-family: "Trebuchet MS", "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Noto Sans CJK JP", "Noto Sans CJK KR", "Geeza Pro", "Noto Naskh Arabic", "Noto Sans Devanagari", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #1a1033;
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

button, input { font-family: inherit; color: inherit; }

#app { position: fixed; inset: 0; }

#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#hud, #veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#veil {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 3;
}

#veil.top {
  align-items: center;
}

.panel {
  pointer-events: auto;
  width: min(560px, calc(100% - 20px));
  background: rgba(255, 248, 236, 0.94);
  border: 4px solid var(--line);
  border-radius: 28px;
  padding: 16px 16px 14px;
  box-shadow: 0 10px 0 rgba(36, 20, 71, 0.28);
  text-align: center;
  max-height: calc(100% - 16px);
  overflow: auto;
  touch-action: pan-y;
}

.kicker {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  opacity: 0.75;
  margin: 0 0 4px;
}

h1 {
  font-size: clamp(34px, 8vw, 68px);
  line-height: 0.9;
  margin: 0 0 6px;
  letter-spacing: -0.5px;
}

.sub { margin: 0 0 8px; font-weight: 700; font-size: 16px; }
.how { margin: 0 auto 10px; max-width: 46ch; font-size: 14px; line-height: 1.35; }

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 10px;
  flex-wrap: wrap;
}

.pill {
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 800;
  font-size: 14px;
}

.btn {
  pointer-events: auto;
  appearance: none;
  border: 4px solid var(--line);
  background: #fff;
  border-radius: 999px;
  min-height: 52px;
  padding: 10px 16px;
  font-weight: 900;
  font-size: 16px;
  box-shadow: 0 5px 0 var(--line);
  cursor: pointer;
}

.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.btn.primary { background: var(--accent); color: #fff; min-height: 64px; font-size: 22px; padding-inline: 28px; }
.btn.alt { background: var(--accent-2); }
.btn.mint { background: var(--mint); }
.btn.tiny { min-height: 40px; font-size: 13px; padding: 6px 10px; box-shadow: 0 3px 0 var(--line); }
.btn:disabled { opacity: 0.45; }

.langs { margin-top: 10px; }
.langs .btn { min-height: 36px; padding: 4px 8px; font-size: 12px; box-shadow: 0 3px 0 var(--line); }
.langs .btn.on { background: var(--ink); color: #fff; }

.topbar, .dock {
  pointer-events: none;
  position: absolute;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  z-index: 4;
}
.topbar { top: max(8px, env(safe-area-inset-top)); }
.dock {
  bottom: max(10px, env(safe-area-inset-bottom));
  justify-content: flex-end;
  align-items: flex-end;
}

.scorebub {
  pointer-events: none;
  background: #fff;
  border: 4px solid var(--line);
  border-radius: 18px;
  padding: 6px 10px;
  font-weight: 900;
  min-width: 88px;
  box-shadow: 0 4px 0 rgba(36, 20, 71, 0.25);
}
.scorebub b { font-size: 22px; display: block; line-height: 1; }
.scorebub span { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }

.iconbtn { pointer-events: auto; min-width: 52px; min-height: 52px; }

.action {
  pointer-events: auto;
  min-width: 92px;
  min-height: 92px;
  border-radius: 28px;
  font-size: 18px;
  background: var(--accent-2);
}

.pauseveil {
  position: absolute;
  inset: 0;
  background: rgba(20, 10, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 5;
}

.audition {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 20%, #3a2370, #120a24 70%);
  color: white;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.audition canvas { width: 100%; flex: 1; display: block; touch-action: none; }

.lane-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 8px;
}

.lane-row button {
  min-height: 84px;
  border-radius: 22px;
  border: 4px solid #fff;
  font-weight: 900;
  font-size: 18px;
  background: #ff4d8d;
  color: white;
  box-shadow: 0 6px 0 #7a1740;
}

.lane-row button:nth-child(2) { background: #ffe14a; color: #241447; box-shadow: 0 6px 0 #8a6a00; }
.lane-row button:nth-child(3) { background: #2ad7a8; color: #123; box-shadow: 0 6px 0 #0d6b54; }
.lane-row button:active { transform: translateY(3px); }

.skip {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  inset-inline-end: max(8px, env(safe-area-inset-right));
  z-index: 7;
  pointer-events: auto;
}

.cardlink {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 4px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 8px 0 rgba(36, 20, 71, 0.25);
}

.cardlink:active { transform: translateY(3px); }

@media (max-height: 520px) {
  h1 { font-size: 30px; }
  .how { display: none; }
  .panel { padding: 8px; border-width: 3px; }
  .btn.primary { min-height: 46px; font-size: 18px; }
  .langs { gap: 4px; }
  .action { min-width: 72px; min-height: 72px; }
}

@media (max-width: 420px) {
  .btn.primary { font-size: 20px; }
}
