:root {
  --bg: #070b19;
  --surface: rgba(18, 28, 52, .86);
  --surface-2: rgba(24, 38, 68, .9);
  --text: #f6fbff;
  --muted: #8fa2bf;
  --cyan: #55e8ff;
  --cyan-2: #00b7dc;
  --gold: #ffc74f;
  --danger: #ff6d7d;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% 20%, rgba(0, 182, 220, .19), transparent 38%),
    linear-gradient(180deg, #101a32 0%, var(--bg) 55%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button { font: inherit; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 18px calc(90px + var(--safe-bottom));
}

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

.eyebrow {
  margin: 0;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .22em;
}

h1, h2 { margin: 4px 0 0; }
h1 { font-size: 22px; }
h2 { font-size: 22px; margin-bottom: 18px; }

.level-chip {
  padding: 9px 13px;
  border: 1px solid rgba(85, 232, 255, .45);
  border-radius: 999px;
  background: rgba(85, 232, 255, .08);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.stats article {
  padding: 12px 8px;
  border: 1px solid rgba(130, 167, 215, .15);
  border-radius: 16px;
  background: var(--surface);
  text-align: center;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
}

.stats strong { display: block; margin-top: 5px; font-size: 16px; }

main { margin-top: 12px; }

.view { display: none; }
.view.active { display: block; }

.coin-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
}

.coin-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(0, 207, 240, .2);
  filter: blur(48px);
}

.tap-coin {
  position: relative;
  width: 246px;
  height: 246px;
  border: 8px solid #ffdc75;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #ffe596, #f6ae25 42%, #b9670f 72%, #70400b);
  box-shadow:
    inset 0 0 0 5px rgba(79, 40, 2, .34),
    0 20px 60px rgba(0, 0, 0, .46),
    0 0 0 2px rgba(85, 232, 255, .55);
  color: #12223e;
  cursor: pointer;
  transition: transform .08s ease;
  touch-action: manipulation;
}

.tap-coin:active { transform: scale(.95); }

.coin-mark {
  position: relative;
  z-index: 2;
  font-size: 63px;
  font-weight: 1000;
  letter-spacing: -.12em;
  text-shadow: 0 2px 0 rgba(255,255,255,.25);
}

.horn {
  position: absolute;
  top: 35px;
  width: 28px;
  height: 92px;
  border-radius: 90% 10% 60% 40%;
  background: linear-gradient(#abf6ff, #08c4e7);
}
.horn.left { left: 45px; transform: rotate(-38deg); }
.horn.right { right: 45px; transform: scaleX(-1) rotate(-38deg); }

.float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.float-point {
  position: absolute;
  color: white;
  font-size: 24px;
  font-weight: 1000;
  animation: floatUp .8s ease-out forwards;
}

@keyframes floatUp {
  from { transform: translate(-50%, -30%); opacity: 1; }
  to { transform: translate(-50%, -150px); opacity: 0; }
}

.energy-row {
  padding: 0 8px;
  color: var(--text);
  font-size: 15px;
}

.energy-track {
  height: 11px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
}

.energy-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan-2), var(--cyan));
  transition: width .2s ease;
}

.primary-button {
  width: 100%;
  margin-top: 18px;
  padding: 15px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #2be1ff, #009ec1);
  color: #04101a;
  font-weight: 900;
}

.primary-button:disabled {
  opacity: .45;
}

.status-message {
  min-height: 22px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.card-list, .leaderboard {
  display: grid;
  gap: 10px;
}

.upgrade-card, .rank-row, .profile-card {
  padding: 16px;
  border: 1px solid rgba(114, 164, 220, .16);
  border-radius: 18px;
  background: var(--surface);
}

.upgrade-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.upgrade-card h3, .upgrade-card p { margin: 0; }
.upgrade-card p { margin-top: 5px; color: var(--muted); font-size: 12px; }

.upgrade-card button {
  padding: 11px 13px;
  border: 0;
  border-radius: 13px;
  background: rgba(255, 199, 79, .15);
  color: var(--gold);
  font-weight: 900;
}

.rank-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
}
.rank-row.me { border-color: rgba(85, 232, 255, .6); }
.rank-row span { color: var(--muted); }
.rank-row strong:last-child { color: var(--gold); }

.profile-card p {
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 12px;
}
.profile-card strong { font-size: 18px; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 520px);
  transform: translateX(-50%);
  padding: 9px 10px calc(9px + var(--safe-bottom));
  border-top: 1px solid rgba(122, 165, 220, .12);
  background: rgba(7, 11, 25, .94);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  display: grid;
  gap: 3px;
  justify-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
}

.bottom-nav button span {
  font-size: 10px;
  font-weight: 800;
}

.bottom-nav button.active { color: var(--cyan); }
