:root {
  --bg: #07090c;
  --accent: #3ecf9a;
  --ink: #e8fff6;
  --muted: #7d8b86;
  --line: #ff4d6d;
  --card: #0e1318;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "SF Pro Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  padding:
    var(--safe-t)
    var(--safe-r)
    var(--safe-b)
    var(--safe-l);
  background:
    radial-gradient(120% 70% at 50% -10%, #12352c 0%, transparent 55%),
    radial-gradient(80% 50% at 100% 100%, #122033 0%, transparent 50%),
    var(--bg);
}

.app {
  height: 100%;
  height: calc(100dvh - var(--safe-t) - var(--safe-b));
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: 0 auto;
}

.hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  gap: 2px 12px;
  padding: 10px 16px 8px;
  align-items: start;
}

.hud-left { grid-column: 1; grid-row: 1 / span 2; }
.hud-right { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

.logo {
  font-size: 13px;
  letter-spacing: 0.42em;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(62, 207, 154, 0.55);
}

.score-wrap { margin-top: 2px; }

.score-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.score {
  display: block;
  font-size: clamp(36px, 11vw, 56px);
  line-height: 0.95;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: #f4fff9;
  text-shadow: 0 0 24px rgba(62, 207, 154, 0.25);
}

.help {
  grid-column: 1 / -1;
  grid-row: 3;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
  padding-top: 4px;
}

.next {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.next-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.next-orb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2ee6ff;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.08),
    0 0 16px currentColor,
    inset 0 -6px 10px rgba(0, 0, 0, 0.25),
    inset 0 4px 8px rgba(255, 255, 255, 0.35);
}

.play {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 10px 10px;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 20%),
    #0a0d11;
  box-shadow:
    inset 0 0 0 1px rgba(62, 207, 154, 0.14),
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 18px 40px rgba(0, 0, 0, 0.45);
}

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

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(24px + var(--safe-t))
    calc(20px + var(--safe-r))
    calc(24px + var(--safe-b))
    calc(20px + var(--safe-l));
  background: rgba(4, 6, 8, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
  touch-action: pan-y;
}

.overlay.hidden { display: none; }

.card {
  width: min(400px, 100%);
  background: linear-gradient(180deg, #12181e, var(--card));
  border: 1px solid rgba(62, 207, 154, 0.22);
  border-radius: 22px;
  padding: 22px 20px 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(62, 207, 154, 0.08);
}

.over-kicker {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--accent);
}

.over-score {
  text-align: center;
  font-size: clamp(44px, 14vw, 68px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 6px 0 16px;
  font-variant-numeric: tabular-nums;
}

.name-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 6px;
}

.name {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #07090c;
  color: var(--ink);
  font-size: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 12px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
}

.name:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(62, 207, 154, 0.2);
}

.btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #052016;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.14em;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(62, 207, 154, 0.35);
}

.btn:active { transform: scale(0.98); }

.rank-wrap { margin-top: 18px; }

.rank-wrap h3 {
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--muted);
  margin-bottom: 8px;
}

.rank {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

.rank li b { color: var(--accent); font-weight: 700; }
.rank li span { color: #c5d4ce; overflow: hidden; text-overflow: ellipsis; }
.rank .empty { color: var(--muted); justify-content: center; }
