/* ============================================================
   Mathlete — kid-friendly mental-math arcade
   Vanilla CSS, no external fonts/libs (works fully offline).
   ============================================================ */

:root {
  --bg:        #0b1026;
  --bg-2:      #131a3a;
  --card:      rgba(255,255,255,.07);
  --card-line: rgba(255,255,255,.14);
  --ink:       #f3f5ff;
  --ink-dim:   #aeb6e0;
  --violet:    #7c5cff;
  --pink:      #ff4d9d;
  --amber:     #ffb020;
  --green:     #2fe6a4;
  --red:       #ff5a6e;
  --blue:      #4db8ff;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

/* The HTML `hidden` attribute must win over any class that sets `display`
   (e.g. .countdown / .levelup overlays toggled via [hidden]). */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Baloo 2", ui-rounded, "Segoe UI Rounded", "SF Pro Rounded",
               -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  font-weight: 700;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}

body {
  background:
    radial-gradient(1200px 800px at 15% -10%, #1d2a63 0%, transparent 55%),
    radial-gradient(1000px 700px at 110% 10%, #3a1750 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

/* ---------- animated background blobs ---------- */
.bg-blobs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; filter: blur(40px); opacity: .55; }
.blob { position: absolute; border-radius: 50%; mix-blend-mode: screen; animation: float 18s ease-in-out infinite; }
.b1 { width: 46vmax; height: 46vmax; left: -12vmax; top: -10vmax; background: var(--violet); }
.b2 { width: 40vmax; height: 40vmax; right: -14vmax; top: 10vmax; background: var(--pink); animation-delay: -6s; }
.b3 { width: 38vmax; height: 38vmax; left: 20vmax; bottom: -18vmax; background: var(--amber); animation-delay: -11s; }
@keyframes float {
  0%,100% { transform: translate(0,0) scale(1); }
  33%     { transform: translate(6vmax,4vmax) scale(1.08); }
  66%     { transform: translate(-5vmax,-3vmax) scale(.94); }
}

#fx { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

#app {
  position: relative; z-index: 10;
  height: 100%;
  max-width: 560px; margin: 0 auto;
  padding: calc(var(--safe-top) + 8px) 16px calc(var(--safe-bottom) + 8px);
  display: flex; flex-direction: column;
}

/* ---------- screen switching ---------- */
.screen { display: none; flex: 1; min-height: 0; flex-direction: column; }
.screen.active { display: flex; animation: screen-in .4s cubic-bezier(.2,.9,.3,1.2); }
@keyframes screen-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ============================================================
   START SCREEN
   ============================================================ */
#screen-start { justify-content: center; gap: 14px; overflow-y: auto; }

.hero { text-align: center; margin-bottom: 4px; }
.logo {
  font-size: 64px; line-height: 1;
  filter: drop-shadow(0 6px 18px rgba(124,92,255,.6));
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
.title {
  margin: 4px 0 2px; font-size: 46px; font-weight: 900; letter-spacing: .5px;
  background: linear-gradient(100deg, var(--violet), var(--pink) 45%, var(--amber));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 0; color: var(--ink-dim); font-size: 15px; font-weight: 700; }

.field { display: block; }
.field-label { display: block; font-size: 14px; color: var(--ink-dim); margin: 0 0 6px 4px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.field-label small { text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 800; }

.name-input {
  width: 100%; padding: 14px 16px; font-size: 18px; font-weight: 800;
  color: var(--ink); background: var(--card); border: 2px solid var(--card-line);
  border-radius: 16px; outline: none; font-family: inherit;
  -webkit-user-select: text; user-select: text;
}
.name-input::placeholder { color: var(--ink-dim); opacity: .7; }
.name-input:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(124,92,255,.25); }

.picker { display: flex; flex-direction: column; }
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 16px 10px; border-radius: 20px; cursor: pointer;
  background: var(--card); border: 2px solid var(--card-line); color: var(--ink);
  font-family: inherit; transition: transform .12s, border-color .15s, background .15s;
}
.mode-card:active { transform: scale(.96); }
.mode-card[aria-pressed="true"] {
  border-color: var(--violet);
  background: linear-gradient(160deg, rgba(124,92,255,.28), rgba(255,77,157,.18));
  box-shadow: 0 8px 28px rgba(124,92,255,.35);
}
.mode-emoji { font-size: 30px; }
.mode-name { font-size: 17px; font-weight: 900; }
.mode-sub { font-size: 12px; color: var(--ink-dim); font-weight: 700; }
.mode-demo { margin-top: 6px; font-size: 13px; font-weight: 800; color: var(--amber); letter-spacing: 1px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  flex: 1; min-width: 56px; padding: 12px 8px; border-radius: 14px; cursor: pointer;
  background: var(--card); border: 2px solid var(--card-line); color: var(--ink);
  font-family: inherit; font-size: 16px; font-weight: 900; transition: transform .12s, border-color .15s, background .15s;
}
.chip:active { transform: scale(.94); }
.chip[aria-pressed="true"] {
  border-color: var(--green);
  background: linear-gradient(160deg, rgba(47,230,164,.25), rgba(77,184,255,.15));
  color: #fff;
}
.chip small { display: block; font-size: 10px; font-weight: 700; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .5px; }
.chip[aria-pressed="true"] small { color: var(--green); }

.best-line { text-align: center; font-size: 15px; color: var(--ink-dim); }
.best-line strong { color: var(--amber); font-size: 18px; }

.big-btn {
  width: 100%; padding: 18px; border: none; border-radius: 20px; cursor: pointer;
  font-family: inherit; font-size: 22px; font-weight: 900; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .1s, filter .15s;
}
.big-btn:active { transform: scale(.97); }
.big-btn.play {
  background: linear-gradient(120deg, var(--violet), var(--pink) 60%, var(--amber));
  box-shadow: 0 12px 34px rgba(255,77,157,.4);
}
.big-btn.ghost { background: var(--card); border: 2px solid var(--card-line); color: var(--ink); font-size: 17px; padding: 14px; box-shadow: none; }
.btn-icon { font-size: 18px; }

.sound-toggle {
  align-self: center; background: none; border: none; color: var(--ink-dim);
  font-family: inherit; font-size: 14px; font-weight: 800; cursor: pointer; padding: 4px 8px;
}
.sound-toggle .snd-off { display: none; }
.sound-toggle[aria-pressed="false"] .snd-on { display: none; }
.sound-toggle[aria-pressed="false"] .snd-off { display: inline; }

.hint { text-align: center; color: var(--ink-dim); font-size: 13px; margin: 0; opacity: .8; }

/* ============================================================
   COUNTDOWN
   ============================================================ */
.countdown {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(11,16,38,.86); backdrop-filter: blur(6px);
}
#countdown-num {
  font-size: 30vmin; font-weight: 900; line-height: 1;
  background: linear-gradient(120deg, var(--violet), var(--pink), var(--amber));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pop-num .9s ease-out;
}
@keyframes pop-num { 0% { transform: scale(.2); opacity: 0; } 35% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

/* ============================================================
   PLAY SCREEN
   ============================================================ */
#screen-play { gap: 10px; }

.hud {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  padding: 8px 0; margin-top: 4px;
}
.hud-quit {
  position: absolute; right: -2px; top: -2px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--card-line); color: var(--ink-dim);
  font-size: 16px; font-weight: 900; font-family: inherit;
}
.hud-stat { display: flex; flex-direction: column; align-items: center; background: var(--card); border: 1.5px solid var(--card-line); border-radius: 16px; padding: 8px 4px; }
.hud-label { font-size: 11px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .7px; font-weight: 800; }
.hud-value { font-size: 26px; font-weight: 900; line-height: 1.1; }
.timer .hud-value { font-variant-numeric: tabular-nums; }
.timer.warn .hud-value { color: var(--amber); }
.timer.danger .hud-value { color: var(--red); animation: pulse-danger .8s ease-in-out infinite; }
@keyframes pulse-danger { 50% { transform: scale(1.12); } }
.flame { font-size: 16px; opacity: 0; transition: opacity .2s; margin-left: 1px; }
.flame.lit { opacity: 1; animation: flicker .6s ease-in-out infinite alternate; }
@keyframes flicker { from { transform: scale(1) rotate(-3deg); } to { transform: scale(1.18) rotate(3deg); } }

.combo-bar { height: 8px; border-radius: 6px; background: var(--card); overflow: hidden; border: 1px solid var(--card-line); }
.combo-fill { height: 100%; width: 0%; border-radius: 6px; background: linear-gradient(90deg, var(--green), var(--amber), var(--pink)); transition: width .25s ease; }

.play-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; position: relative; }

.praise {
  position: absolute; top: 0; left: 0; right: 0; text-align: center;
  font-size: 22px; font-weight: 900; pointer-events: none; opacity: 0;
}
.praise.show { animation: praise-pop 1s ease-out; }
@keyframes praise-pop { 0% { opacity: 0; transform: translateY(10px) scale(.7); } 25% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-16px) scale(1); } }

/* the math column */
.problem {
  display: inline-flex; flex-direction: column; align-items: stretch;
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,.05); border: 2px solid var(--card-line);
  border-radius: 20px; padding: 14px 22px 12px;
  min-width: min(80vw, 320px);
}
.problem.shake { animation: shake .4s; }
@keyframes shake { 10%,90%{transform:translateX(-2px)} 20%,80%{transform:translateX(4px)} 30%,50%,70%{transform:translateX(-8px)} 40%,60%{transform:translateX(8px)} }
.problem.correct { animation: pop-correct .35s ease-out; border-color: var(--green); }
@keyframes pop-correct { 50% { transform: scale(1.06); } }

.prow { display: flex; align-items: center; justify-content: flex-end; gap: 10px; font-size: clamp(34px, 11vw, 56px); font-weight: 900; line-height: 1.16; }
.prow .op { width: 1ch; text-align: center; font-size: .82em; }
.prow .op.plus  { color: var(--green); }
.prow .op.minus { color: var(--pink); }
.prow .num { letter-spacing: 2px; }
.prow.first { justify-content: flex-end; }
.prow.first .op { visibility: hidden; }
.prule { height: 5px; background: var(--ink); border-radius: 4px; margin: 8px 0 4px; opacity: .9; }

.answer-boxes { display: flex; gap: 10px; }
.abox {
  width: clamp(46px, 14vw, 64px); height: clamp(58px, 17vw, 80px);
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(30px, 9vw, 44px); font-weight: 900;
  background: var(--card); border: 3px solid var(--card-line); border-radius: 16px;
  font-variant-numeric: tabular-nums;
}
.abox.filled { border-color: var(--blue); color: #fff; }
.abox.cursor { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(124,92,255,.25); animation: caret 1.1s ease-in-out infinite; }
@keyframes caret { 50% { border-color: rgba(124,92,255,.4); } }
.answer-boxes.correct .abox { border-color: var(--green); color: var(--green); animation: pop-correct .35s ease-out; }
.answer-boxes.wrong .abox { border-color: var(--red); color: var(--red); }

/* keypad */
.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; padding-top: 6px;
}
.key {
  font-family: inherit; font-size: 28px; font-weight: 900; color: var(--ink);
  background: var(--card); border: 2px solid var(--card-line); border-radius: 18px;
  padding: 16px 0; cursor: pointer; transition: transform .07s, background .1s, border-color .1s;
  min-height: 58px;
}
.key:active { transform: scale(.93); background: rgba(255,255,255,.16); }
.key-action { font-size: 24px; color: var(--ink-dim); }
.key-go {
  color: #06231a; background: linear-gradient(160deg, var(--green), #19c98a);
  border-color: transparent; box-shadow: 0 8px 22px rgba(47,230,164,.35);
}
.key.flash { animation: keyflash .2s; }
@keyframes keyflash { 50% { background: rgba(255,255,255,.28); } }

/* ============================================================
   END SCREEN
   ============================================================ */
#screen-end { justify-content: center; align-items: center; }
.result-card {
  width: 100%; text-align: center; display: flex; flex-direction: column; gap: 14px;
  background: var(--card); border: 2px solid var(--card-line); border-radius: 26px;
  padding: 26px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.result-medal { font-size: 64px; line-height: 1; animation: bob 3s ease-in-out infinite; }
.result-title { margin: 0; font-size: 28px; font-weight: 900; }
.record-banner {
  align-self: center; padding: 6px 16px; border-radius: 999px; font-weight: 900; font-size: 15px;
  color: #2a1a00; background: linear-gradient(90deg, var(--amber), #ffd56b);
  box-shadow: 0 6px 20px rgba(255,176,32,.45); animation: pulse-danger 1s ease-in-out infinite;
}
.result-score { display: flex; flex-direction: column; }
.result-score-num { font-size: 72px; font-weight: 900; line-height: 1;
  background: linear-gradient(120deg, var(--violet), var(--pink), var(--amber));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-score-label { font-size: 15px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 1px; }
.result-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.result-stat { background: rgba(255,255,255,.05); border: 1.5px solid var(--card-line); border-radius: 16px; padding: 12px 4px; display: flex; flex-direction: column; }
.rs-num { font-size: 24px; font-weight: 900; }
.rs-label { font-size: 11px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .6px; }
.result-stars { font-size: 38px; letter-spacing: 4px; min-height: 44px; }
.result-stars .star-dim { opacity: .22; }

/* ============================================================
   GAMIFICATION — profile, XP bar, score, multiplier, badges,
   rewards, level-up
   ============================================================ */

/* ----- profile strip (start screen) ----- */
.profile-strip {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1.5px solid var(--card-line); border-radius: 18px;
  padding: 10px 14px;
}
.lvl-badge {
  position: relative; flex: none; width: 52px; height: 52px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--violet), var(--pink)); color: #fff;
  box-shadow: 0 8px 22px rgba(124,92,255,.4);
}
.lvl-badge small { font-size: 9px; font-weight: 900; letter-spacing: 1px; opacity: .85; line-height: 1; }
.lvl-badge span { font-size: 24px; font-weight: 900; line-height: 1; }
.profile-mid { flex: 1; min-width: 0; }
.profile-rank { font-size: 15px; font-weight: 900; }
.profile-xptext { font-size: 11px; color: var(--ink-dim); font-weight: 700; margin-top: 2px; }
.profile-stats { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex: none; }
.ps-coin, .ps-streak { font-size: 14px; font-weight: 800; white-space: nowrap; }
.ps-coin b { color: var(--amber); }
.ps-streak b { color: var(--red); }
.ps-streak small { font-size: 10px; color: var(--ink-dim); margin-left: 2px; font-weight: 800; }
.ps-streak.cold { opacity: .45; }

/* ----- player picker ----- */
.players { display: flex; flex-direction: column; }
.players-row {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.players-row::-webkit-scrollbar { display: none; }
.player-chip {
  position: relative; flex: none; display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 6px; border-radius: 999px; cursor: pointer;
  background: var(--card); border: 2px solid var(--card-line); color: var(--ink);
  font-family: inherit; font-weight: 800; font-size: 14px;
  transition: transform .1s, border-color .15s, background .15s;
  --pc: var(--violet);
}
.player-chip:active { transform: scale(.95); }
.player-chip.active { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 18%, transparent); }
.pc-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--pc); color: #fff; font-weight: 900; font-size: 15px;
}
.pc-name { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-chip.add { color: var(--ink-dim); border-style: dashed; padding-right: 14px; }
.player-chip.add .pc-avatar { background: transparent; border: 2px dashed var(--card-line); color: var(--ink-dim); }
.pc-del {
  position: absolute; top: -5px; right: -3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 13px; font-weight: 900; line-height: 18px; text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}

/* xp bar (reused) */
.xpbar { height: 9px; border-radius: 6px; background: rgba(0,0,0,.3); overflow: hidden; border: 1px solid var(--card-line); }
.xpbar.small { height: 7px; margin-top: 4px; }
.xpbar-fill { height: 100%; width: 0%; border-radius: 6px;
  background: linear-gradient(90deg, var(--violet), var(--blue), var(--green));
  transition: width .9s cubic-bezier(.2,.9,.3,1); }

/* ----- badges shelf ----- */
.badges-shelf {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.badges-shelf::-webkit-scrollbar { display: none; }
.badge {
  flex: none; width: 58px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-align: center;
}
.badge-icon {
  width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 26px; background: var(--card); border: 1.5px solid var(--card-line);
}
.badge.earned .badge-icon {
  background: linear-gradient(160deg, rgba(255,176,32,.35), rgba(255,77,157,.25));
  border-color: var(--amber); box-shadow: 0 4px 14px rgba(255,176,32,.3);
}
.badge.locked .badge-icon { filter: grayscale(1); opacity: .35; }
.badge-name { font-size: 9px; font-weight: 800; color: var(--ink-dim); line-height: 1.1; }
.badge.earned .badge-name { color: var(--ink); }

/* ----- play: score tile + multiplier ----- */
.hud-stat.score { position: relative; overflow: visible; }
.hud-stat.score .hud-value { color: var(--amber); }
.score-pop {
  position: absolute; top: -2px; left: 50%; transform: translateX(-50%);
  font-size: 18px; font-weight: 900; color: var(--green); opacity: 0; pointer-events: none;
}
.score-pop.show { animation: score-pop .7s ease-out; }
@keyframes score-pop { 0% { opacity: 0; transform: translate(-50%, 4px) scale(.7); } 25% { opacity: 1; transform: translate(-50%, -10px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -26px) scale(1); } }

.combo-row { display: flex; align-items: center; gap: 10px; }
.solved-pill { font-size: 14px; font-weight: 800; color: var(--ink-dim); white-space: nowrap; }
.solved-pill b { color: var(--green); font-size: 16px; }
.combo-row .combo-bar { flex: 1; }
.mult-chip {
  flex: none; min-width: 44px; text-align: center; padding: 4px 10px; border-radius: 999px;
  font-size: 15px; font-weight: 900; color: var(--ink-dim);
  background: var(--card); border: 1.5px solid var(--card-line); transition: transform .15s;
}
.mult-chip.hot {
  color: #2a1500; background: linear-gradient(90deg, var(--amber), var(--pink));
  border-color: transparent; box-shadow: 0 4px 16px rgba(255,77,157,.4);
}
.mult-chip.bump { animation: bump .35s ease-out; }
@keyframes bump { 50% { transform: scale(1.35) rotate(-4deg); } }

/* ----- end screen rewards ----- */
.rewards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reward { background: rgba(255,255,255,.05); border: 1.5px solid var(--card-line); border-radius: 16px; padding: 12px 4px; display: flex; flex-direction: column; }
.reward-num { font-size: 28px; font-weight: 900; color: var(--green); font-variant-numeric: tabular-nums; }
.reward:last-child .reward-num { color: var(--amber); }
.reward-label { font-size: 11px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .6px; }

.level-strip { text-align: left; }
.level-strip-top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; margin-bottom: 5px; }
.level-strip-top #end-xpnext { color: var(--ink-dim); }

.new-badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; min-height: 0; }
.new-badges:empty { display: none; }
.new-badges .nb {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  animation: badge-in .5s cubic-bezier(.2,.9,.3,1.4) both;
}
.new-badges .nb-icon {
  width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 28px;
  background: linear-gradient(160deg, rgba(255,176,32,.4), rgba(255,77,157,.3));
  border: 1.5px solid var(--amber); box-shadow: 0 6px 18px rgba(255,176,32,.4);
}
.new-badges .nb-name { font-size: 10px; font-weight: 800; color: var(--amber); }
.new-badges .nb-tag { font-size: 9px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .5px; }
@keyframes badge-in { 0% { opacity: 0; transform: scale(.2) rotate(-30deg); } 100% { opacity: 1; transform: none; } }

/* ----- level-up overlay ----- */
.levelup {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  background: rgba(11,16,38,.82); backdrop-filter: blur(6px);
}
.levelup-card { position: relative; text-align: center; animation: pop-num .7s ease-out; }
.levelup-rays {
  position: absolute; left: 50%; top: 42%; width: 120vmax; height: 120vmax; transform: translate(-50%,-50%);
  background: repeating-conic-gradient(from 0deg, rgba(255,176,32,.16) 0deg 8deg, transparent 8deg 16deg);
  animation: spin 12s linear infinite; z-index: -1; pointer-events: none;
}
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }
.levelup-emoji { font-size: 80px; animation: bob 2.4s ease-in-out infinite; }
.levelup-big {
  font-size: 44px; font-weight: 900; letter-spacing: 1px;
  background: linear-gradient(100deg, var(--amber), var(--pink), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.levelup-sub { font-size: 20px; font-weight: 900; color: var(--ink); margin-top: 2px; }

@media (max-height: 680px) {
  .logo { font-size: 48px; } .title { font-size: 38px; }
  .play-stage { gap: 10px; }
  .key { padding: 12px 0; min-height: 50px; font-size: 25px; }
  .profile-strip { padding: 8px 12px; }
}
