:root {
  color-scheme: dark;
  --bg: #05070f;
  --ink: #f2f7ff;
  --dim: #8fa0b8;
  --accent: #6ef0ff;
  --accent-hot: #ff4fd8;
  --line: rgba(110, 240, 255, 0.45);
  --panel: rgba(7, 10, 18, 0.92);
  font-family: Outfit, "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(80, 180, 255, 0.14), transparent 55%),
    #02040a;
  color: var(--ink);
}

button,
p,
h2,
ol {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  color: inherit;
  background: transparent;
}

[hidden] {
  display: none !important;
}

#app {
  position: relative;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(8, 16, 32, 0.35), transparent 28%),
    var(--bg);
  box-shadow: 0 0 0 1px rgba(126, 240, 255, 0.06);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: calc(12px + env(safe-area-inset-top)) 14px 0;
}

.brand {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #e8fbff;
  text-shadow: 0 0 18px rgba(110, 240, 255, 0.45);
}

.tries {
  margin: 0;
  color: var(--dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.header-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  pointer-events: auto;
}

.header-actions button {
  padding: 6px 10px;
  border: 1px solid rgba(126, 240, 255, 0.18);
  border-radius: 999px;
  background: rgba(8, 12, 22, 0.55);
  color: var(--dim);
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.header-actions button:active {
  border-color: rgba(126, 240, 255, 0.4);
  color: var(--ink);
}

.score-block {
  position: absolute;
  top: 11%;
  right: 0;
  left: 0;
  text-align: center;
  pointer-events: none;
}

#score {
  margin: 0;
  font-size: clamp(4.5rem, 18vw, 6.5rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff 20%, #9ef6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(110, 240, 255, 0.35));
}

.unit,
#goal,
.pitch,
.note {
  margin: 8px 0 0;
  color: var(--dim);
}

.unit {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(158, 246, 255, 0.7);
}

#goal {
  color: var(--accent);
  font-size: 14px;
  text-shadow: 0 0 12px rgba(110, 240, 255, 0.35);
}

.dev-badge {
  position: absolute;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 14px;
  margin: 0;
  color: rgba(255, 255, 255, 0.35);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gate,
.sheet {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 28px 20px calc(24px + env(safe-area-inset-bottom));
}

.gate {
  align-items: stretch;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(3, 6, 14, 0.88) 38%, rgba(3, 6, 14, 0.96));
}

.gate button,
.gate .note,
.gate .pitch {
  pointer-events: auto;
}

.pitch {
  max-width: 28ch;
  margin-inline: auto;
  text-align: center;
  line-height: 1.4;
  color: #c5d4e8;
}

.sheet {
  background: linear-gradient(180deg, rgba(5, 6, 10, 0), #05070f 26%);
}

.sheet.panel {
  max-height: 78%;
  background: var(--panel);
  border-top: 1px solid rgba(126, 240, 255, 0.14);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.actions > button,
.gate > button,
.sheet.panel > button {
  display: block;
  width: 100%;
}

.primary,
.ghost,
.text {
  min-height: 48px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 500;
}

.primary {
  background: linear-gradient(135deg, #e8ffff 0%, #9ef0ff 55%, #7adfff 100%);
  color: #041018;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.25) inset,
    0 8px 28px rgba(80, 210, 255, 0.28);
}

.ghost {
  border: 1px solid var(--line);
  color: #e7fbff;
  background: rgba(110, 240, 255, 0.06);
}

.text {
  color: var(--dim);
}

.primary.xl {
  min-height: 56px;
  font-size: 18px;
}

button:disabled {
  opacity: 0.4;
}

#leaders {
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

#leaders li {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--dim);
}

#leaders li.you {
  color: var(--ink);
}

#leaders .empty {
  display: block;
  border: 0;
}

.toast {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top));
  left: 50%;
  margin: 0;
  padding: 8px 14px;
  transform: translateX(-50%);
  border-radius: 999px;
  border: 1px solid rgba(126, 240, 255, 0.2);
  background: rgba(8, 12, 22, 0.92);
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.gate[hidden],
.sheet[hidden],
.toast[hidden],
.dev-badge[hidden],
#goal[hidden] {
  display: none;
}
