/* SpotItAt app — design system and shell.
 * Look: sleek & sharp AA-game UI. Night navy, action teal, reward gold, pin coral.
 * Light and dark come from one token set; [data-theme] is set before first paint. */

/* ---------- fonts (self-hosted, OFL) ---------- */
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../fonts/barlow-condensed-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("../fonts/barlow-condensed-700.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url("../fonts/barlow-condensed-800.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("../fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("../fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("../fonts/inter-700.woff2") format("woff2"); }

/* ---------- tokens ---------- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0F1E;
  --panel: #121A30;
  --panel-2: #1E2946;
  --line: #26324F;
  --text: #EEF2FB;
  --muted: #A3ADC8;
  --teal: #2ED3C1;
  --teal-text: #2ED3C1;
  --teal-ink: #03201C;
  --gold: #F6BA3E;
  --gold-text: #F6BA3E;
  --gold-ink: #2A1C00;
  --coral: #FF5E54;
  --coral-text: #FF8A80;
  --blue: #7C9CFF;
  --blue-text: #9DB4FF;
  --danger: #FF8A80;
  --off: #3A4566;
  --me: #1E2946;
  --bar: #0D1326;
  --glass: rgba(10, 15, 30, .78);
  --scrim: rgba(5, 8, 18, .62);
  --atmo: rgba(46, 211, 193, .18);
  --glow: rgba(46, 211, 193, .35);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #EEF1F7;
  --panel: #FFFFFF;
  --panel-2: #DDE3EE;
  --line: #D3DAE8;
  --text: #0D1326;
  --muted: #3B4663;
  --teal: #14B8A6;
  --teal-text: #0A6C62;
  --teal-ink: #03201C;
  --gold: #F6BA3E;
  --gold-text: #8F5D00;
  --gold-ink: #2A1C00;
  --coral: #E5463C;
  --coral-text: #B42E26;
  --blue: #4F6FE0;
  --blue-text: #3550B8;
  --danger: #B42E26;
  --off: #B5BDCF;
  --me: #E3F5F2;
  --bar: #FFFFFF;
  --glass: rgba(255, 255, 255, .9);
  --scrim: rgba(13, 19, 38, .45);
  --atmo: rgba(20, 184, 166, .22);
  --glow: rgba(20, 184, 166, .25);
  --shadow: 0 10px 30px rgba(13, 19, 38, .15);
}
:root {
  --font-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease-pop: cubic-bezier(.2, 1.5, .4, 1);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.app-loading, .app-noscript { margin: 40vh 0 0; text-align: center; color: var(--muted); }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- type ---------- */
.display { font-family: var(--font-display); font-weight: 800; letter-spacing: .02em; line-height: .95; margin: 0; }
.h1 { font-size: 32px; }
.h2 { font-size: 24px; }
.kicker { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.gold { color: var(--gold-text); }
.teal { color: var(--teal-text); }
.coral { color: var(--coral-text); }

/* ---------- surfaces ---------- */
.cut { clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.cut-sm { clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.panel { background: var(--panel); padding: 12px 14px; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 10px); }
.row { display: flex; align-items: center; gap: var(--gap, 10px); }
.grow { flex: 1; min-width: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--panel); color: var(--text); font-weight: 700; text-decoration: none;
  transition: transform .15s ease, background-color .15s ease;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px) scale(.98); }
.icon-btn { width: 44px; height: 44px; padding: 0; flex: none; }
.cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 18px; border: 0; text-decoration: none;
  font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: .1em; text-transform: uppercase;
  background: var(--teal); color: var(--teal-ink);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: transform .15s ease, filter .15s ease;
}
.cta:hover { transform: translateY(-2px); filter: brightness(1.05); }
.cta:active { transform: translateY(1px) scale(.98); }
.cta.gold { background: var(--gold); color: var(--gold-ink); }
.cta.quiet { background: var(--panel-2); color: var(--text); }
.btn-link { border: 0; background: none; padding: 8px; min-height: 40px; color: var(--teal-text); font-weight: 600; }
.btn-danger { border-color: var(--danger); color: var(--danger); background: transparent; }

/* ---------- controls ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); }
.seg > button { min-height: 40px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-family: var(--font-display); font-weight: 800; font-size: 16px; letter-spacing: .06em; text-transform: uppercase; }
.seg > button[aria-selected="true"], .seg > button[aria-checked="true"] { background: var(--panel-2); color: var(--text); }
.seg.small > button { min-height: 34px; font-family: var(--font-body); font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.switch { width: 52px; height: 30px; flex: none; padding: 3px; border: 0; border-radius: 15px; background: var(--off); display: flex; }
.switch::after { content: ""; width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; transition: transform .18s ease; }
.switch[aria-checked="true"] { background: var(--teal); }
.switch[aria-checked="true"]::after { transform: translateX(22px); }
.chip { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 17px; background: transparent; color: var(--text); font-size: 13px; font-weight: 700; }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--panel-2); border-color: var(--teal); }
.input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--text); }
.tag { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 3px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line); color: var(--muted); }
.tag.gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--teal); border-radius: inherit; transition: width .6s ease; }
.badge-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--coral); color: #FFFFFF; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- avatar + level ring ---------- */
.ring { --p: 0; --size: 46px; width: var(--size); height: var(--size); flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--teal) calc(var(--p) * 1%), var(--panel-2) 0); text-decoration: none; }
.ring > span { width: calc(var(--size) - 8px); height: calc(var(--size) - 8px); border-radius: 50%; background: var(--panel); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: calc(var(--size) * .42); overflow: hidden; }
.ring img { width: 100%; height: 100%; object-fit: cover; }
.avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; color: #0A0F1E; }

/* ---------- shell ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.app-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.view { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 560px; margin: 0 auto;
  padding: calc(14px + var(--safe-t)) 16px calc(var(--tabbar-h) + var(--safe-b) + 16px); }
.view.full { max-width: none; padding: 0; }
.view-enter { animation: view-in .22s ease-out both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.screen-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--tabbar-h) + var(--safe-b)); padding: 6px 6px var(--safe-b);
  background: var(--bar); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted);
  font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.tabbar a[aria-current="page"] { color: var(--teal-text); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: -7px; width: 28px; height: 3px; border-radius: 0 0 2px 2px; background: var(--teal); }
.tabbar .dot { position: absolute; top: 4px; left: calc(50% + 8px); }
.app.no-tabs .tabbar { display: none; }
.app.no-tabs .view { padding-bottom: calc(16px + var(--safe-b)); }

@media (min-width: 900px) {
  :root { --tabbar-h: 0px; }
  .app { flex-direction: row; }
  .tabbar { position: sticky; top: 0; bottom: auto; width: 96px; height: 100dvh; padding: 24px 8px; border-top: 0; border-right: 1px solid var(--line);
    grid-template-columns: 1fr; grid-auto-rows: 72px; align-content: start; gap: 6px; }
  .tabbar a[aria-current="page"]::before { top: 18px; left: -8px; width: 3px; height: 36px; border-radius: 0 2px 2px 0; }
  .view { padding-top: 28px; }
}

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.topbar .xp { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.topbar .xp-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.topbar .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- toast ---------- */
.toasts { position: fixed; left: 50%; top: calc(12px + var(--safe-t)); z-index: 60; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 380px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: toast-in .4s var(--ease-pop) both; font-size: 14px; }
.toast.good { background: var(--teal); color: var(--teal-ink); border-color: transparent; }
.toast.out { animation: toast-out .25s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- bottom sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: flex; flex-direction: column; justify-content: flex-end; animation: fade-in .2s ease both; }
.scrim.out { animation: fade-out .2s ease both; }
.sheet { width: 100%; max-width: 560px; margin: 0 auto; max-height: 92dvh; overflow-y: auto; background: var(--panel); border-top: 2px solid var(--teal);
  border-radius: 12px 12px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px;
  animation: sheet-in .32s cubic-bezier(.2, 1.2, .4, 1) both; }
.scrim.out .sheet { animation: sheet-out .2s ease-in both; }
.sheet-handle { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@media (min-width: 900px) { .scrim { justify-content: center; } .sheet { border-radius: 12px; border-top-width: 2px; max-width: 460px; } }

/* ---------- Pin (mascot) ---------- */
.pin { display: block; background: none; border: 0; padding: 0; cursor: pointer; }
.pin svg { overflow: visible; }
.pin .pin-body { animation: pin-bob 2.6s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.pin .pin-eyes { animation: pin-blink 4.2s infinite; transform-origin: center; transform-box: fill-box; }
.pin.squish .pin-body { animation: pin-squish .45s var(--ease-pop) both; }
.pin.cheer .pin-body { animation: pin-cheer .7s var(--ease-pop) both; }
@keyframes pin-bob { 0%, 100% { transform: translateY(0) scaleY(1); } 40% { transform: translateY(-10px) scaleY(1.03); } 55% { transform: translateY(-10px); } 78% { transform: translateY(0) scaleY(.93); } 86% { transform: scaleY(1.02); } }
@keyframes pin-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes pin-squish { 0% { transform: scale(1.15, .8); } 60% { transform: scale(.92, 1.1); } 100% { transform: none; } }
@keyframes pin-cheer { 0% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-22px) rotate(-8deg); } 70% { transform: translateY(-22px) rotate(8deg); } 100% { transform: none; } }

/* ---------- Home: full-height stage with a photorealistic Earth ---------- */
.home { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }
.home-col { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }
.home > .home-col:first-child, .home > .home-bg + .home-col { padding-top: calc(14px + var(--safe-t)); }
.stage { position: relative; flex: 1 1 auto; min-height: 230px; overflow: hidden; margin-top: 4px;
  background: radial-gradient(120% 90% at 50% 100%, #12305A 0%, #0B1A36 45%, var(--bg) 100%); }
:root[data-theme="light"] .stage { background: linear-gradient(180deg, var(--bg) 0%, #CFE4F7 70%, #B6D6F2 100%); }
.stars { position: absolute; inset: 0; opacity: .7; pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 33% 42%, #cfe 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 58% 12%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 76% 34%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 8%, #dfe 50%, transparent 51%), radial-gradient(1.2px 1.2px at 6% 58%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 70%, #fff 50%, transparent 51%), radial-gradient(1.3px 1.3px at 92% 62%, #fff 50%, transparent 51%);
  background-size: 260px 220px; animation: twinkle 6s ease-in-out infinite alternate; }
:root[data-theme="light"] .stars { display: none; }
@keyframes twinkle { from { opacity: .45; } to { opacity: .85; } }
.bubble { position: absolute; left: 50%; top: 8px; z-index: 3; width: min(320px, calc(100% - 32px)); transform: translateX(-50%); padding: 10px 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); text-align: center; font-size: 14px; line-height: 1.4; box-shadow: var(--shadow); }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -6px; width: 12px; height: 12px; background: var(--panel); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg); }
.bubble.say { animation: say .35s var(--ease-pop) both; }
@keyframes say { from { opacity: 0; transform: translateX(-50%) scale(.85); } to { opacity: 1; transform: translateX(-50%); } }
.stage .pin { position: absolute; left: 50%; top: 78px; z-index: 2; width: 84px; height: 96px; margin-left: -42px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.stage .pin-shadow { position: absolute; left: 50%; top: 164px; z-index: 1; width: 40px; height: 8px; margin-left: -20px; border-radius: 50%; background: rgba(0, 0, 0, .45); filter: blur(1.5px); }
.earth { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); }
.earth-canvas { position: relative; display: block; opacity: 0; transition: opacity .8s ease; border-radius: 50% 50% 0 0 / calc(var(--d, 400px) / 2) calc(var(--d, 400px) / 2) 0 0; }
.earth.ready .earth-canvas { opacity: 1; }
.earth-glow { position: absolute; left: 0; top: 0; width: var(--d, 400px); height: var(--d, 400px); border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 3px rgba(150, 205, 255, .35), 0 -6px 50px 14px rgba(90, 170, 255, .38), 0 -2px 120px 30px rgba(60, 140, 255, .2); }
:root[data-theme="light"] .earth-glow { box-shadow: 0 0 0 3px rgba(255, 255, 255, .7), 0 -6px 50px 14px rgba(255, 255, 255, .55); }
.earth-shine { position: absolute; left: 0; top: 0; width: var(--d, 400px); height: var(--d, 400px); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 34% 14%, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 32%);
  box-shadow: inset 0 0 calc(var(--d, 400px) * .06) rgba(160, 215, 255, .55); }
.earth.failed { width: 340px; height: 140px; border-radius: 170px 170px 0 0; background: radial-gradient(circle at 40% 30%, #4fa3d9, #123f74); }
.modes { display: grid; grid-template-columns: 1fr 1.25fr 1fr; grid-template-rows: 58px 58px; grid-template-areas: "solo play room" "random play daily"; gap: 8px; margin-top: 12px; }
.mode { display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--panel); color: var(--text); text-decoration: none; border: 0;
  font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: .06em; text-transform: uppercase; transition: transform .15s ease; }
.mode:hover { transform: translateY(-1px); }
.mode.daily { flex-direction: column; gap: 2px; line-height: 1; }
.mode.daily small { font-family: var(--font-body); font-size: 11px; font-weight: 700; letter-spacing: 0; color: var(--muted); text-transform: none; }
.play { flex-direction: column; gap: 4px; min-height: 0; font-size: 36px; line-height: .9; animation: play-pulse 2s ease-out infinite; }
.play small { font-family: var(--font-body); font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: none; }
@keyframes play-pulse { 0% { box-shadow: 0 0 0 0 rgba(46, 211, 193, .5); } 100% { box-shadow: 0 0 0 16px rgba(46, 211, 193, 0); } }
.home-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.card-link { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); text-decoration: none; color: var(--text); border: 0; width: 100%; text-align: left; }
.segments { display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)); gap: 3px; }
.segments span { height: 5px; border-radius: 2px; background: var(--panel-2); }
.segments span.on { background: var(--teal); }
.install { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border: 1px solid var(--teal); border-radius: var(--r-md); background: var(--atmo); }
.app-icon { width: 34px; height: 34px; flex: none; border-radius: 8px; background: var(--coral); display: flex; align-items: center; justify-content: center; }

/* ---------- placeholder screens ---------- */
.soon { margin: auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 10px; }

/* ---------- the app backdrop: one Earth behind every screen ---------- */
body { background: var(--bg); }
.app-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(130% 75% at 50% 75%, #12305A 0%, #0B1A36 45%, var(--bg) 100%);
  transition: opacity .45s ease; view-transition-name: backdrop; }
:root[data-theme="light"] .app-bg { background: linear-gradient(180deg, var(--bg) 0%, #D7E8F8 45%, #BCD8F2 100%); }
.app-bg[data-mode="off"] { opacity: 0; }
.app-bg-veil { position: absolute; inset: 0; opacity: 0; transition: opacity .9s ease;
  background: linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 82%, transparent) 30%, color-mix(in srgb, var(--bg) 35%, transparent) 62%, color-mix(in srgb, var(--bg) 10%, transparent) 100%); }
.app-bg[data-mode="page"] .app-bg-veil { opacity: 1; }
/* the watermark on every page: above the veil there, a bit fainter than on Home */
.app-bg-veil { z-index: 1; }
.app-bg[data-mode="page"] .watermark { z-index: 2; opacity: .6; }
.app { position: relative; z-index: 1; }
.app-main, .view { background: transparent; }

/* glass surfaces over the planet */
:root { --surface: color-mix(in srgb, var(--panel) 88%, transparent); --surface-2: color-mix(in srgb, var(--panel-2) 90%, transparent); }
.view:not(.full) .panel, .view:not(.full) .player-row, .view:not(.full) .card-link, .view:not(.full) .bundle-card,
.view:not(.full) .tier, .view:not(.full) .stat-tile, .view:not(.full) .seg {
  background-color: var(--surface); -webkit-backdrop-filter: blur(18px) saturate(1.25); backdrop-filter: blur(18px) saturate(1.25); }
.view:not(.full) .list-row, .view:not(.full) .note { background-color: var(--surface-2); }
.tabbar { background: color-mix(in srgb, var(--bar) 84%, transparent); -webkit-backdrop-filter: blur(20px) saturate(1.3); backdrop-filter: blur(20px) saturate(1.3); view-transition-name: tabbar; }

/* ---------- premium motion ---------- */
:root { --ease-out: cubic-bezier(.16, 1, .3, 1); --ease-spring: cubic-bezier(.2, .9, .3, 1.35); }
/* first draw: blocks arrive one after another (ui/motion.js sets --i) */
.view-enter { animation: none; }
.enter { animation: enter-up .62s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 55ms); }
.home-bg.enter { animation: none; }
@keyframes enter-up { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
/* progress bars grow in on first draw */
.enter .bar > span, .enter.bar > span, .topbar .xp .bar > span { animation: grow-x .9s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 55ms + 180ms); transform-origin: left center; }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: none; } }
/* screen changes cross-fade; the backdrop and tab bar keep their place */
::view-transition-old(root) { animation: vt-out .22s ease both; }
::view-transition-new(root) { animation: vt-in .32s var(--ease-out) both; }
::view-transition-group(backdrop), ::view-transition-group(tabbar) { animation-duration: .01s; }
@keyframes vt-out { to { opacity: 0; transform: scale(.985); } }
@keyframes vt-in { from { opacity: 0; transform: scale(1.012); } }
/* tab bar: the indicator grows in, the icon pops */
.tabbar a { transition: color .2s ease; }
.tabbar a svg { transition: transform .25s var(--ease-spring); }
.tabbar a:active svg { transform: scale(.86); }
.tabbar a[aria-current="page"]::before { animation: tab-ind .4s var(--ease-spring) both; }
.tabbar a[aria-current="page"] svg { animation: tab-pop .5s var(--ease-spring) both; }
@keyframes tab-ind { from { transform: scaleX(0); opacity: 0; } }
@keyframes tab-pop { 0% { transform: scale(.72); } 55% { transform: scale(1.16); } 100% { transform: none; } }
@media (min-width: 900px) { @keyframes tab-ind { from { transform: scaleY(0); opacity: 0; } } }
/* press and hover: everything you can tap answers */
.card-link, .tier, .player-row, .mode, .list-row, .chip-inc, .stat-tile { transition: transform .18s var(--ease-out), box-shadow .25s ease, background-color .2s ease, filter .2s ease; }
a.card-link:active, button.card-link:active, .tier:active, .mode:active, button.player-row:active { transform: scale(.975); }
@media (hover: hover) and (pointer: fine) {
  a.card-link:hover, button.card-link:hover, .tier:hover, button.player-row:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, .28); }
  .btn:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
  .stat-tile:hover { filter: brightness(1.08); }
}
.btn, .cta, .link-btn, .switch { -webkit-tap-highlight-color: transparent; }
.btn { transition: transform .15s var(--ease-out), background-color .15s ease, box-shadow .2s ease, border-color .2s ease; }
:where(.btn, .cta, .mode, .card-link, .tier, .tabbar a, .switch, .link-btn):focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
/* sheets spring up a little softer */
.sheet { animation-timing-function: var(--ease-out) !important; }
/* the CTA shines once when it appears */
.enter .cta:not(.quiet), .enter.cta:not(.quiet) { position: relative; overflow: hidden; }
.enter .cta:not(.quiet)::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%); transform: translateX(-120%); animation: shine 1.1s .5s var(--ease-out) both; pointer-events: none; }
@keyframes shine { to { transform: translateX(120%); } }
@media (prefers-reduced-motion: reduce) { .enter, .enter .bar > span, .tabbar a[aria-current="page"]::before, .tabbar a[aria-current="page"] svg, .enter .cta::after { animation: none !important; } }
/* text that sits straight on the backdrop (not on a panel) gets a soft halo, so it stays readable over bright clouds */
.view:not(.full) :is(p, span, small, h1, h2, .kicker):not(:is(.panel, .card-link, .player-row, .tier, .sheet, .stat-tile, .bundle-card, .install, .note, .list-row, .btn, .cta, .tag) *) { text-shadow: 0 1px 2px color-mix(in srgb, var(--bg) 85%, transparent), 0 0 14px color-mix(in srgb, var(--bg) 70%, transparent); }
/* empty states */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 22px 16px; border: 1px dashed color-mix(in srgb, var(--line) 85%, var(--teal)); border-radius: var(--r-md);
  background: var(--surface, var(--panel)); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.empty-state p { margin: 0; max-width: 34ch; color: var(--muted); font-size: 14px; }
.empty-icon { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--teal-text);
  background: radial-gradient(circle, color-mix(in srgb, var(--teal) 22%, transparent) 0 55%, transparent 56%), color-mix(in srgb, var(--teal) 8%, transparent); animation: empty-float 4s ease-in-out infinite; }
@keyframes empty-float { 50% { transform: translateY(-4px); } }

/* ---------- visible game-feel effects ---------- */
/* stronger, springy entrances */
.enter { animation: enter-up .75s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes enter-up { 0% { opacity: 0; transform: translateY(28px) scale(.96); filter: blur(4px); } 60% { filter: blur(0); } 100% { opacity: 1; transform: none; filter: none; } }
/* tap ripple */
.has-ripple { overflow: hidden; isolation: isolate; }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .22; transform: scale(0); animation: ripple .6s var(--ease-out) forwards; z-index: 0; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
/* parallax: the planet and the stars follow the mouse a little, at different depths */
.app-bg .earth-layer { transform: translate3d(calc(var(--px, 0) * -14px), calc(var(--py, 0) * -10px), 0); }
.app-bg .stars { transform: translate3d(calc(var(--px, 0) * -5px), calc(var(--py, 0) * -4px), 0); }
.app-bg .watermark { transform: translate3d(calc(var(--px, 0) * 8px), 0, 0); }
/* the first arrival: stars and band fade in while the camera comes in from space */
.app-bg.intro .stars { animation: stars-in 2.2s ease-out both; }
.app-bg.intro .watermark { animation: fade-in 2.6s 1s ease-out both; }
@keyframes stars-in { from { opacity: 0; transform: scale(1.08); } }
/* Pin drops onto the planet and the bubble pops after him */
.home.intro .stage .pin { animation: pin-drop 1.1s 1.25s var(--ease-spring) both; }
.home.intro .stage .bubble { animation: bubble-in .55s 2.15s var(--ease-spring) both; }
.home.intro .pin-shadow { animation: shadow-in 1.1s 1.25s ease-out both; }
.home.intro .modes > * { animation: enter-up .8s var(--ease-out) both; }
.home.intro .modes > :nth-child(1) { animation-delay: 1.5s; } .home.intro .modes > :nth-child(2) { animation-delay: 1.35s; } .home.intro .modes > :nth-child(3) { animation-delay: 1.6s; }
.home.intro .modes > :nth-child(4) { animation-delay: 1.7s; } .home.intro .modes > :nth-child(5) { animation-delay: 1.8s; }
@keyframes pin-drop { 0% { opacity: 0; transform: translateY(-160px) scale(.9); } 55% { opacity: 1; transform: translateY(0) scale(1.12, .82); } 72% { transform: translateY(-14px) scale(.96, 1.06); } 86% { transform: translateY(0) scale(1.03, .97); } 100% { transform: none; } }
@keyframes bubble-in { from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.7); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes shadow-in { 0% { opacity: 0; transform: scale(.3); } 55% { opacity: 1; transform: scale(1.15); } 100% { transform: none; } }
/* call-to-action: a soft breathing glow, brighter on hover */
@media (hover: hover) and (pointer: fine) { .cta:not(.quiet):hover { box-shadow: 0 0 0 4px rgba(46, 211, 193, .22), 0 16px 40px rgba(10, 118, 107, .45); } }
@media (prefers-reduced-motion: reduce) {
  .ripple, .home.intro .stage .pin, .home.intro .stage .bubble, .home.intro .pin-shadow, .home.intro .modes > *, .app-bg.intro .stars, .app-bg.intro .watermark { animation: none !important; }
  .app-bg .earth-layer, .app-bg .stars, .app-bg .watermark { transform: none; }
}
/* before the arrival, Pin and his bubble wait out of sight */
.home.pre-intro .stage .pin, .home.pre-intro .stage .bubble, .home.pre-intro .pin-shadow { opacity: 0; }
