/* =====================================================================================
   GeroGame app shell + design system (frontend-core).
   Built on tokens.css. Screen-specific styles for meta screens live in screens.css.
   ===================================================================================== */

/* ---------- extra tokens (per theme) ---------- */
:root {
  --gutter: 16px;
  --page-top: calc(var(--topbar-h) + var(--safe-top) + 6px);
  --page-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --glass: rgba(255, 255, 255, .055);
  --glass-2: rgba(255, 255, 255, .09);
  --glass-hi: rgba(255, 255, 255, .16);
  --glass-border: rgba(255, 255, 255, .11);
  --card-sheen: linear-gradient(165deg, rgba(255, 255, 255, .11) 0%, rgba(255, 255, 255, .025) 45%, rgba(255, 255, 255, 0) 100%);
  --track: rgba(255, 255, 255, .10);
  --scrim: rgba(4, 3, 14, .62);
  --chrome-bg: rgba(11, 11, 26, .74);
  --ink-strong: #fff;
  --focus: var(--accent);
  --primary-ink: #fff;
  --btn-ghost-depth: rgba(0, 0, 0, .35);
  --hairline: rgba(255, 255, 255, .06);
  --text-glow: 0 0 18px rgba(124, 92, 255, .55);
}
[data-theme="sunset"] { --chrome-bg: rgba(26, 11, 18, .74); --text-glow: 0 0 18px rgba(255, 106, 61, .5); --focus: #FFD166; }
[data-theme="mint"] { --chrome-bg: rgba(6, 23, 20, .74); --text-glow: 0 0 18px rgba(25, 211, 162, .45); }
[data-theme="galaxy"] { --chrome-bg: rgba(5, 4, 15, .74); --text-glow: 0 0 20px rgba(91, 108, 255, .6); --fg-2: rgba(242, 240, 255, .72); --fg-3: rgba(242, 240, 255, .46); }
[data-theme="paper"] {
  --glass: rgba(255, 255, 255, .72);
  --glass-2: rgba(255, 255, 255, .92);
  --glass-hi: rgba(255, 255, 255, 1);
  --glass-border: rgba(40, 20, 120, .10);
  --card-sheen: linear-gradient(165deg, rgba(255, 255, 255, .9) 0%, rgba(255, 255, 255, .4) 60%);
  --track: rgba(40, 20, 120, .10);
  --scrim: rgba(27, 19, 64, .42);
  --chrome-bg: rgba(246, 243, 255, .84);
  --ink-strong: #1B1340;
  --btn-ghost-depth: rgba(40, 20, 120, .16);
  --hairline: rgba(40, 20, 120, .07);
  --text-glow: none;
  --focus: #6A45FF;
  --success: #12A86F;
  --warning: #C77A00;
  --danger: #E2334A;
  --gold: #E59A00;
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; height: 100%; background: var(--bg); }
body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5; font-weight: 500;
  letter-spacing: -0.01em;
  word-break: keep-all; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
input, textarea, [contenteditable], .prose, .selectable { -webkit-user-select: text; user-select: text; }
img { max-width: 100%; display: block; -webkit-user-drag: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 10px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kfont { font-family: var(--font-kdisplay); font-weight: 400; letter-spacing: 0; }
.muted { color: var(--fg-2); }
.dim { color: var(--fg-3); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { gap: 20px; }
.stack-sm { gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grad-text { background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gold-text { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.warn-text { color: var(--warning); }
.err-text { color: var(--danger); }
.ok-text { color: var(--success); }
.divider { height: 1px; background: var(--line); margin: 8px 0; border: 0; }
.ico { display: inline-grid; place-items: center; line-height: 0; flex: none; }
.ico svg { display: block; }

/* =====================================================================================
   SHELL LAYOUT
   ===================================================================================== */
.ambient { position: fixed; inset: 0; z-index: 0; background: var(--grad-hero); overflow: hidden; pointer-events: none; }
.ambient-img { position: absolute; inset: -4%; background: url('/assets/img/hero.webp') center / cover no-repeat; opacity: 0; transition: opacity .6s; }
.ambient-orb { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(80px); opacity: .0; }
.ambient-orb.o1 { left: -20vmax; top: -20vmax; background: var(--primary); }
.ambient-orb.o2 { right: -25vmax; bottom: -25vmax; background: var(--pink, #FF4D8D); }

.stage { position: relative; z-index: 1; height: 100%; display: flex; justify-content: center; align-items: stretch; }
.side { display: none; }

.app {
  position: relative; width: 100%; max-width: var(--app-max); height: 100%;
  overflow: hidden; isolation: isolate;
  background: var(--grad-hero);
  background-color: var(--bg);
}
.app::before { /* subtle noise-free sparkle field */
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255, 255, 255, .55), transparent 60%),
    radial-gradient(1px 1px at 78% 12%, rgba(255, 255, 255, .5), transparent 60%),
    radial-gradient(1.5px 1.5px at 62% 42%, rgba(255, 255, 255, .35), transparent 60%),
    radial-gradient(1px 1px at 28% 66%, rgba(255, 255, 255, .4), transparent 60%),
    radial-gradient(1.5px 1.5px at 88% 78%, rgba(255, 255, 255, .35), transparent 60%),
    radial-gradient(1px 1px at 42% 90%, rgba(255, 255, 255, .3), transparent 60%);
}
[data-theme="paper"] .app::before { opacity: 0; }

.view { position: absolute; inset: 0; overflow: hidden; }

.page {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: var(--page-top) calc(var(--gutter) + var(--safe-right)) var(--page-bottom) calc(var(--gutter) + var(--safe-left));
  scrollbar-width: none;
  outline: none;
}
.page::-webkit-scrollbar { display: none; }
.page.page-flush { padding-left: 0; padding-right: 0; }
.page-pad { max-width: 680px; margin-inline: auto; }
.app[data-chrome="back"] .page { --page-top: calc(var(--topbar-h) + var(--safe-top) + 4px); --page-bottom: calc(var(--safe-bottom) + 32px); }
.app[data-chrome="none"] .page { --page-top: 0px; --page-bottom: 0px; padding: 0; overflow: hidden; }
.seo-fallback { opacity: 0; }
.seo-fallback h1 { font-size: 22px; margin: 12px 0; }
.seo-fallback li { margin: 8px 0 8px 18px; }

/* page transitions */
@keyframes pg-in-right { from { transform: translate3d(32%, 0, 0); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pg-in-left { from { transform: translate3d(-32%, 0, 0); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pg-out-left { to { transform: translate3d(-18%, 0, 0); opacity: 0; } }
@keyframes pg-out-right { to { transform: translate3d(28%, 0, 0); opacity: 0; } }
@keyframes pg-in-up { from { transform: translate3d(0, 18px, 0) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pg-out-fade { to { opacity: 0; transform: scale(.985); } }
@keyframes pg-in-zoom { from { transform: scale(1.06); opacity: 0; } to { transform: none; opacity: 1; } }
.pg-in-right { animation: pg-in-right .38s var(--ease-out) both; }
.pg-in-left { animation: pg-in-left .38s var(--ease-out) both; }
.pg-out-left { animation: pg-out-left .3s var(--ease-out) both; pointer-events: none; }
.pg-out-right { animation: pg-out-right .3s var(--ease-out) both; pointer-events: none; }
.pg-in-up { animation: pg-in-up .34s var(--ease-out) both; }
.pg-in-zoom { animation: pg-in-zoom .36s var(--ease-out) both; }
.pg-out-fade { animation: pg-out-fade .22s ease both; pointer-events: none; }
.page > * { --i: 0; }
.stagger > * { animation: rise-in .5s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 55ms + 60ms); }
@keyframes rise-in { from { opacity: 0; transform: translate3d(0, 16px, 0) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- topbar ---------- */
.topbar, .backbar {
  position: absolute; z-index: 30; left: 0; right: 0; top: 0;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) calc(12px + var(--safe-right)) 0 calc(12px + var(--safe-left));
  display: flex; align-items: center; gap: 8px;
  background: var(--chrome-bg);
  -webkit-backdrop-filter: saturate(170%) blur(20px); backdrop-filter: saturate(170%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: transform .34s var(--ease-out), opacity .25s, border-color .25s, box-shadow .25s;
}
.app.scrolled .topbar, .app.scrolled .backbar { border-bottom-color: var(--hairline); box-shadow: 0 6px 22px rgba(0, 0, 0, .18); }
.app[data-chrome="tabs"] .backbar, .app[data-chrome="none"] .backbar { transform: translateY(-110%); opacity: 0; pointer-events: none; }
.app[data-chrome="back"] .topbar, .app[data-chrome="none"] .topbar { transform: translateY(-110%); opacity: 0; pointer-events: none; }

.tb-me { position: relative; display: flex; align-items: center; flex: none; margin-right: 2px; border-radius: 50%; }
.tb-ring { position: relative; width: 46px; height: 46px; display: grid; place-items: center; }
.tb-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.tb-ring .ring-bg { fill: none; stroke: var(--track); stroke-width: 3.5; }
.tb-ring .ring-fg { fill: none; stroke: url(#none) var(--accent); stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease-out); filter: drop-shadow(0 0 4px var(--accent)); }
.tb-ring img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--surface-solid); }
.tb-lv {
  position: absolute; right: -6px; bottom: -3px; min-width: 22px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--grad-primary); color: #fff; font-size: 10.5px; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); border: 2px solid var(--bg);
}
.tb-curs { display: flex; gap: 6px; flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
.tb-cur { min-height: 36px; padding: 0 10px 0 6px; transition: transform .2s var(--ease-spring); }
.tb-cur b { min-width: 2ch; }
.tb-plus { display: grid; place-items: center; width: 18px; height: 18px; margin-left: 2px; border-radius: 6px; background: var(--grad-primary); color: #fff; font-weight: 900; font-size: 14px; line-height: 1; }
.tb-btn { position: relative; flex: none; width: 42px; height: 42px; }
.tb-btn .badge { position: absolute; top: 2px; right: 2px; }
.bump { animation: bump .45s var(--ease-spring); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.22); } 100% { transform: scale(1); } }
.ring-bell .ico { animation: bell 1.6s ease-in-out 2; transform-origin: 50% 10%; }
@keyframes bell { 0%, 60%, 100% { transform: rotate(0); } 10% { transform: rotate(16deg); } 20% { transform: rotate(-14deg); } 30% { transform: rotate(10deg); } 40% { transform: rotate(-6deg); } }

/* ---------- backbar ---------- */
.backbar-title { flex: 1; min-width: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backbar-right { display: flex; gap: 6px; align-items: center; }

/* ---------- tabbar ---------- */
.tabbar {
  position: absolute; z-index: 30; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 6px calc(6px + var(--safe-right)) var(--safe-bottom) calc(6px + var(--safe-left));
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--chrome-bg);
  -webkit-backdrop-filter: saturate(170%) blur(22px); backdrop-filter: saturate(170%) blur(22px);
  border-top: 1px solid var(--hairline);
  transition: transform .36s var(--ease-out), opacity .25s;
}
.app[data-chrome="back"] .tabbar, .app[data-chrome="none"] .tabbar { transform: translateY(110%); opacity: 0; pointer-events: none; }
.tab {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; color: var(--fg-3); font-size: 11px; font-weight: 700; letter-spacing: -0.01em;
  transition: color .2s;
}
.tab-ico { display: grid; place-items: center; width: 28px; height: 28px; transition: transform .45s var(--ease-spring); }
.tab-ico svg { width: 25px; height: 25px; }
.tab.active { color: var(--fg); }
.tab.active .tab-ico { transform: translateY(-2px) scale(1.12); color: var(--primary-2); filter: drop-shadow(0 0 8px var(--primary)); }
.tab.pop .tab-ico { animation: tab-pop .5s var(--ease-spring); }
@keyframes tab-pop { 0% { transform: scale(.8); } 50% { transform: translateY(-4px) scale(1.25); } 100% { transform: translateY(-2px) scale(1.12); } }
.tab-indicator {
  position: absolute; z-index: 0; top: 6px; left: calc(6px + var(--safe-left)); height: 56px;
  width: calc((100% - 12px - var(--safe-left) - var(--safe-right)) / 5);
  transform: translateX(calc(var(--tab-i, 0) * 100%));
  transition: transform .5s var(--ease-spring), opacity .2s;
  pointer-events: none;
}
.tab-indicator span {
  position: absolute; left: 50%; top: 2px; width: 58px; height: 34px; margin-left: -29px; border-radius: 14px;
  background: var(--grad-primary); opacity: .22; box-shadow: var(--glow);
}
.tab-indicator::after { content: ''; position: absolute; left: 50%; bottom: 2px; width: 18px; height: 3px; margin-left: -9px; border-radius: 3px; background: var(--grad-primary); box-shadow: var(--glow); }
.tabbar.no-active .tab-indicator { opacity: 0; }
.tab-dot { position: absolute; top: 6px; left: calc(50% + 9px); width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg), 0 0 10px var(--danger); animation: pulse-dot 1.6s ease-in-out infinite; }
@keyframes pulse-dot { 50% { transform: scale(1.25); } }

/* ---------- boot splash ---------- */
.boot {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; align-content: center; gap: 10px;
  background: var(--grad-hero); background-color: var(--bg);
  transition: opacity .45s ease, visibility .45s;
}
.boot.done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-glow { position: absolute; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(124, 92, 255, .5), transparent 65%); filter: blur(20px); animation: breathe 2.4s ease-in-out infinite; }
.boot-mascot { position: relative; width: 150px; height: auto; animation: float 2.4s ease-in-out infinite; }
.boot-logo { position: relative; width: 220px; height: auto; }
.boot-bar { position: relative; width: 140px; height: 6px; border-radius: 6px; background: var(--track); overflow: hidden; margin-top: 10px; }
.boot-bar span { position: absolute; inset: 0; width: 40%; border-radius: 6px; background: var(--grad-primary); animation: boot-bar 1.1s ease-in-out infinite; }
@keyframes boot-bar { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-10px) rotate(2deg); } }
@keyframes breathe { 0%, 100% { transform: scale(.92); opacity: .8; } 50% { transform: scale(1.06); opacity: 1; } }

/* ---------- offline banner ---------- */
.offline-banner {
  position: fixed; z-index: 900; left: 50%; top: calc(var(--safe-top) + 8px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: rgba(30, 20, 40, .92); color: #fff; font-size: 13px; font-weight: 700;
  border: 1px solid rgba(255, 255, 255, .14); box-shadow: var(--shadow-1);
  animation: drop-in .4s var(--ease-spring);
  max-width: calc(100% - 24px); white-space: nowrap;
}
.ob-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 8px var(--warning); animation: pulse-dot 1.2s infinite; }
@keyframes drop-in { from { transform: translate(-50%, -140%); } to { transform: translate(-50%, 0); } }

/* =====================================================================================
   COMPONENTS
   ===================================================================================== */

/* ---------- buttons ---------- */
.btn {
  --d: 5px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; border-radius: 16px;
  font-weight: 800; font-size: 16px; letter-spacing: -0.015em; line-height: 1.15; white-space: nowrap;
  color: var(--fg); background: var(--glass-2);
  border: 0; cursor: pointer; isolation: isolate;
  transform: translateY(0);
  box-shadow: 0 var(--d) 0 var(--btn-ghost-depth), 0 calc(var(--d) + 8px) 18px rgba(0, 0, 0, .22);
  transition: transform .14s var(--ease-spring), box-shadow .14s ease, filter .2s, opacity .2s;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
  text-align: center;
}
.btn::after { /* gloss */
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: linear-gradient(180deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, .04) 48%, rgba(255, 255, 255, 0) 52%);
}
.btn:hover { filter: brightness(1.06); }
.btn:active, .btn.pressed { transform: translateY(calc(var(--d) - 1px)); box-shadow: 0 1px 0 var(--btn-ghost-depth), 0 3px 8px rgba(0, 0, 0, .25); }
.btn[disabled], .btn.is-disabled { opacity: .5; filter: grayscale(.35); cursor: not-allowed; }
.btn[disabled]:active { transform: none; }
.btn .ico svg { width: 20px; height: 20px; }
.btn-primary { background: var(--grad-primary); color: var(--primary-ink); box-shadow: 0 var(--d) 0 var(--btn-depth), 0 calc(var(--d) + 10px) 24px color-mix(in srgb, var(--primary) 45%, transparent); text-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.btn-primary:active, .btn-primary.pressed { box-shadow: 0 1px 0 var(--btn-depth), 0 4px 10px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-ghost { background: var(--glass-2); border: 1px solid var(--glass-border); }
.btn-danger { background: linear-gradient(180deg, #FF6577, #E2334A); color: #fff; box-shadow: 0 var(--d) 0 #9A1A2D, 0 calc(var(--d) + 8px) 20px rgba(226, 51, 74, .35); }
.btn-danger:active, .btn-danger.pressed { box-shadow: 0 1px 0 #9A1A2D; }
.btn-gold { background: var(--grad-gold); color: #3A1E00; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); box-shadow: 0 var(--d) 0 #B4501A, 0 calc(var(--d) + 10px) 24px rgba(255, 160, 40, .4); }
.btn-gold:active, .btn-gold.pressed { box-shadow: 0 1px 0 #B4501A; }
.btn-accent { background: var(--grad-accent); color: #fff; box-shadow: 0 var(--d) 0 color-mix(in srgb, var(--accent) 40%, #000), 0 calc(var(--d) + 10px) 22px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-success { background: linear-gradient(180deg, #45F0B0, #17C383); color: #032B1C; box-shadow: 0 var(--d) 0 #0B7F54, 0 calc(var(--d) + 8px) 20px rgba(46, 229, 157, .35); }
.btn-google { background: #fff; color: #1F1F1F; box-shadow: 0 var(--d) 0 #BDBDC9, 0 calc(var(--d) + 8px) 18px rgba(0, 0, 0, .25); font-weight: 700; }
.btn-google:active { box-shadow: 0 1px 0 #BDBDC9; }
.btn-flat { box-shadow: none; background: transparent; color: var(--fg-2); min-height: 44px; }
.btn-flat:active, .btn-flat.pressed { transform: scale(.96); box-shadow: none; }
.btn-flat::after { display: none; }
.btn-sm { --d: 3px; min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn-lg { --d: 6px; min-height: 60px; padding: 0 26px; font-size: 19px; border-radius: 20px; }
.btn-xl { --d: 7px; min-height: 70px; padding: 0 30px; font-size: 23px; border-radius: 24px; letter-spacing: -0.02em; }
.btn-block { display: flex; width: 100%; }
.btn.loading { color: transparent !important; text-shadow: none; pointer-events: none; }
.btn.loading::before { content: ''; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-glow { animation: btn-glow 1.8s ease-in-out infinite; }
@keyframes btn-glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.15) drop-shadow(0 0 14px color-mix(in srgb, var(--primary) 70%, transparent)); } }
.btn-pulse { animation: btn-pulse 1.4s var(--ease-spring) infinite; }
@keyframes btn-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.btn-pulse:active { animation: none; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--glass-2); border: 1px solid var(--glass-border); color: var(--fg);
  transition: transform .2s var(--ease-spring), background .2s;
  touch-action: manipulation;
}
.icon-btn:active, .icon-btn.pressed { transform: scale(.9); }
.icon-btn .ico svg { width: 22px; height: 22px; }
.icon-btn.round { border-radius: 50%; }
.icon-btn.ghost { background: transparent; border-color: transparent; }
.icon-btn.on { background: var(--grad-primary); color: #fff; border-color: transparent; box-shadow: var(--glow); }
.link-btn { color: var(--primary-2); font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; gap: 4px; }
[data-theme="paper"] .link-btn { color: var(--primary); }

/* ---------- cards ---------- */
.card {
  position: relative; border-radius: var(--radius-l);
  background: var(--card-sheen), var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, .07);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
}
.card-pad { padding: 16px; }
.card-pad-lg { padding: 20px; }
.card-solid { background: var(--surface-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
.card-glow { box-shadow: var(--shadow-1), var(--glow); }
.card-hero { background: var(--grad-primary); color: #fff; border: 0; box-shadow: 0 14px 34px color-mix(in srgb, var(--primary) 40%, transparent); }
.card-link { display: block; transition: transform .25s var(--ease-spring); }
.card-link:active, .card-link.pressed { transform: scale(.975); }

.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 2px 10px; }
.section-title { font-size: 18px; font-weight: 800; letter-spacing: -0.03em; display: flex; align-items: center; gap: 6px; }
.section-more { font-size: 13px; font-weight: 700; color: var(--fg-2); display: inline-flex; align-items: center; gap: 2px; min-height: 36px; }
.section-more .ico svg { width: 16px; height: 16px; }
.h1 { font-family: var(--font-kdisplay); font-size: 30px; line-height: 1.15; letter-spacing: 0; font-weight: 400; }
.h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.25; }
.h3 { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }

/* ---------- chips / tags / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--glass-2); border: 1px solid var(--glass-border); font-size: 13.5px; font-weight: 700; color: var(--fg-2);
  transition: transform .2s var(--ease-spring), background .2s, color .2s; white-space: nowrap;
}
button.chip:active, .chip.pressed { transform: scale(.94); }
.chip.active, .chip[aria-pressed="true"] { background: var(--grad-primary); color: #fff; border-color: transparent; box-shadow: var(--glow); }
.chip-sm { min-height: 26px; padding: 0 10px; font-size: 12px; }
.chip-ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); background: color-mix(in srgb, var(--success) 12%, transparent); }
.chip-gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, transparent); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px; }
.chips::-webkit-scrollbar { display: none; }
.tag {
  display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 8px; border-radius: 8px;
  font-family: var(--font-display); font-size: 10.5px; font-weight: 800; letter-spacing: .02em; color: #fff;
  background: rgba(0, 0, 0, .45); text-transform: uppercase; white-space: nowrap;
}
.tag-hot { background: linear-gradient(135deg, #FF7A3C, #FF2E63); box-shadow: 0 0 14px rgba(255, 60, 80, .55); }
.tag-new { background: linear-gradient(135deg, #2EE59D, #00B3FF); box-shadow: 0 0 14px rgba(0, 200, 255, .5); }
.tag-daily { background: linear-gradient(135deg, #FFC93C, #FF8A00); color: #3A1E00; }
.badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 1; font-family: var(--font-display);
  box-shadow: 0 0 0 2px var(--bg), 0 2px 8px rgba(255, 77, 94, .5);
  animation: pop-in .4s var(--ease-spring);
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 10px var(--danger); display: inline-block; }

/* ---------- segmented control / tabs ---------- */
.seg { display: flex; padding: 4px; gap: 4px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-border); }
.seg-btn {
  flex: 1; min-height: 40px; padding: 0 12px; border-radius: 12px; font-weight: 800; font-size: 14px; color: var(--fg-2);
  transition: background .25s, color .25s, transform .2s var(--ease-spring), box-shadow .25s; white-space: nowrap;
}
.seg-btn:active { transform: scale(.95); }
.seg-btn[aria-pressed="true"], .seg-btn.on, .seg-btn[aria-selected="true"] { background: var(--grad-primary); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 40%, transparent); }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs > button, .tabs > a { position: relative; min-height: 44px; font-weight: 800; color: var(--fg-3); white-space: nowrap; }
.tabs > .on, .tabs > [aria-selected="true"] { color: var(--fg); }
.tabs > .on::after, .tabs > [aria-selected="true"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px; background: var(--grad-primary); }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 800; color: var(--fg-2); padding-left: 2px; }
.field-hint { font-size: 12px; color: var(--fg-3); padding-left: 2px; }
.field-error { font-size: 12.5px; color: var(--danger); font-weight: 700; padding-left: 2px; min-height: 0; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .ico { position: absolute; left: 14px; color: var(--fg-3); pointer-events: none; }
.input-wrap > .ico svg { width: 20px; height: 20px; }
.input-wrap > .input { padding-left: 44px; }
.input-wrap > .input-suffix { position: absolute; right: 4px; }
.input {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: 16px;
  background: var(--glass); border: 1.5px solid var(--glass-border); color: var(--fg);
  font-size: 16px; font-weight: 600; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: var(--fg-3); font-weight: 500; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent); background: var(--glass-2); }
.input.invalid, .field.invalid .input { border-color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); }
.input-code { font-family: var(--font-display); letter-spacing: .18em; text-align: center; font-size: 22px; text-transform: uppercase; }
.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }

/* ---------- toggle switch ---------- */
.switch { position: relative; display: inline-block; width: 54px; height: 32px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--track); border: 1px solid var(--glass-border); transition: background .25s; }
.switch span::after {
  content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35); transition: transform .35s var(--ease-spring), width .2s;
}
.switch input:checked + span { background: var(--grad-primary); border-color: transparent; box-shadow: 0 0 14px color-mix(in srgb, var(--primary) 45%, transparent); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:active + span::after { width: 30px; }
.switch input:checked:active + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + span { opacity: .45; }

/* ---------- list rows ---------- */
.list { border-radius: var(--radius-l); background: var(--card-sheen), var(--glass); border: 1px solid var(--glass-border); overflow: hidden; box-shadow: var(--shadow-1); }
.list-row {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 16px; width: 100%; text-align: left;
  transition: background .15s;
}
.list-row + .list-row::before { content: ''; position: absolute; top: 0; left: 60px; right: 0; height: 1px; background: var(--hairline); }
a.list-row:active, button.list-row:active, .list-row.pressed { background: var(--glass-2); }
.list-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--glass-2); color: var(--fg); font-size: 18px; }
.list-ico svg { width: 20px; height: 20px; }
.list-ico.c-primary { background: color-mix(in srgb, var(--primary) 22%, transparent); color: var(--primary-2); }
.list-ico.c-accent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.list-ico.c-pink { background: rgba(255, 77, 141, .18); color: #FF6FA5; }
.list-ico.c-gold { background: rgba(255, 201, 60, .16); color: var(--gold); }
.list-ico.c-green { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.list-ico.c-red { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.list-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.list-title { font-weight: 700; font-size: 15.5px; letter-spacing: -0.02em; }
.list-sub { font-size: 12.5px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; }
.list-trail { display: flex; align-items: center; gap: 6px; color: var(--fg-3); flex: none; font-size: 14px; font-weight: 700; }
.list-trail .ico svg { width: 18px; height: 18px; }
.list-row.danger .list-title { color: var(--danger); }
.list-head { font-size: 12.5px; font-weight: 800; color: var(--fg-3); padding: 18px 6px 8px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- progress ---------- */
.progress { position: relative; height: 12px; border-radius: 999px; background: var(--track); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); }
.progress-bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit;
  background: var(--grad-primary); box-shadow: 0 0 12px color-mix(in srgb, var(--primary) 60%, transparent);
  transition: width 1s var(--ease-out);
}
.progress-bar::after { /* gloss */ content: ''; position: absolute; left: 4px; right: 4px; top: 2px; height: 35%; border-radius: 999px; background: rgba(255, 255, 255, .35); }
.progress.striped .progress-bar { background-image: linear-gradient(45deg, rgba(255, 255, 255, .22) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .22) 50%, rgba(255, 255, 255, .22) 75%, transparent 75%), var(--grad-primary); background-size: 22px 22px, 100% 100%; animation: stripes .9s linear infinite; }
@keyframes stripes { to { background-position: 22px 0, 0 0; } }
.progress.gold .progress-bar { background-color: transparent; background-image: var(--grad-gold); box-shadow: 0 0 12px rgba(255, 180, 60, .6); }
.progress.gold.striped .progress-bar { background-image: linear-gradient(45deg, rgba(255, 255, 255, .25) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .25) 50%, rgba(255, 255, 255, .25) 75%, transparent 75%), var(--grad-gold); }
.progress.ok .progress-bar { background: linear-gradient(90deg, #2EE59D, #00D4FF); box-shadow: 0 0 12px rgba(46, 229, 157, .6); }
.progress-sm { height: 7px; }
.progress-lg { height: 18px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--fg-3); margin-top: 6px; }

/* ---------- level ring (generic) ---------- */
.lvl-ring { position: relative; display: inline-grid; place-items: center; }
.lvl-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.lvl-ring .ring-bg { fill: none; stroke: var(--track); }
.lvl-ring .ring-fg { fill: none; stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease-out); filter: drop-shadow(0 0 4px var(--accent)); }

/* ---------- currency pills (.cur from ui.js) ---------- */
.cur {
  display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 12px 0 6px; border-radius: 999px;
  background: var(--glass-2); border: 1px solid var(--glass-border); font-weight: 800; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.cur i { font-style: normal; font-size: 17px; line-height: 1; width: 22px; height: 22px; display: grid; place-items: center; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }
.cur b { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.cur-coins b { color: var(--coin); }
.cur-gems b { color: var(--gem); }
.cur-tickets b { color: var(--ticket); }
.cur-xp b { color: var(--accent); }
[data-theme="paper"] .cur-coins b { color: #C77700; }
[data-theme="paper"] .cur-gems b { color: #0089B8; }
[data-theme="paper"] .cur-xp b { color: var(--primary); }
.cur-big { min-height: 44px; padding: 0 16px 0 8px; }
.cur-big i { font-size: 24px; width: 30px; height: 30px; }
.cur-big b { font-size: 18px; }
.cur.plain { background: none; border: 0; box-shadow: none; padding: 0; min-height: 0; }

/* ---------- avatar + frames ---------- */
.avatar { position: relative; flex: none; border-radius: 50%; padding: 3px; isolation: isolate; }
.avatar > img { position: relative; z-index: 1; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--surface-solid); }
.avatar::before { content: ''; position: absolute; inset: 0; border-radius: 50%; z-index: 0; }
.avatar::after { content: ''; position: absolute; inset: 0; border-radius: 50%; z-index: 2; pointer-events: none; }
.frame-none::before { background: var(--glass-hi); }
.frame-neon::before { background: conic-gradient(from var(--fa, 0deg), #00E5FF, #7C5CFF, #FF4D8D, #00E5FF); animation: frame-spin 4s linear infinite; }
.frame-neon::after { box-shadow: 0 0 12px rgba(0, 229, 255, .6), 0 0 24px rgba(124, 92, 255, .4); animation: neon-pulse 2s ease-in-out infinite; }
.frame-gold::before { background: conic-gradient(from var(--fa, 0deg), #FFF1B0, #FFC93C, #B8860B, #FFE27A, #FFF6D0, #C9931A, #FFF1B0); animation: frame-spin 5s linear infinite; }
.frame-gold::after { box-shadow: 0 0 14px rgba(255, 201, 60, .55), inset 0 0 0 1px rgba(255, 255, 255, .5); }
.frame-fire { padding: 3.5px; }
.frame-fire::before { background: conic-gradient(from var(--fa, 0deg), #FF2E00, #FF8A00, #FFE600, #FF5A00, #FF0040, #FF8A00, #FF2E00); animation: frame-spin 1.8s linear infinite; }
.frame-fire::after { box-shadow: 0 0 14px rgba(255, 110, 0, .8), 0 -4px 22px rgba(255, 60, 0, .55); animation: fire-flicker .35s ease-in-out infinite alternate; }
.frame-rainbow::before { background: conic-gradient(from var(--fa, 0deg), #FF3B3B, #FF9F1C, #FFE600, #2EE59D, #00C2FF, #7C5CFF, #FF4DCE, #FF3B3B); animation: frame-spin 3s linear infinite; }
.frame-rainbow::after { box-shadow: 0 0 16px rgba(255, 255, 255, .3); }
.frame-crystal::before { background: conic-gradient(from var(--fa, 0deg), #E0FBFF, #8FE9FF, #FFFFFF, #B9A8FF, #E0FBFF, #7FD8FF, #FFFFFF, #E0FBFF); animation: frame-spin 6s linear infinite; }
.frame-crystal::after { box-shadow: 0 0 16px rgba(160, 235, 255, .7), inset 0 0 0 1px rgba(255, 255, 255, .8); background: radial-gradient(circle at 25% 20%, rgba(255, 255, 255, .9) 0 2px, transparent 3px), radial-gradient(circle at 80% 70%, rgba(255, 255, 255, .8) 0 1.5px, transparent 2.5px); animation: crystal-sparkle 2.4s ease-in-out infinite; }
@property --fa { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes frame-spin { to { --fa: 360deg; } }
@keyframes neon-pulse { 50% { box-shadow: 0 0 18px rgba(0, 229, 255, .85), 0 0 34px rgba(255, 77, 141, .45); } }
@keyframes fire-flicker { from { box-shadow: 0 0 12px rgba(255, 110, 0, .7), 0 -3px 18px rgba(255, 60, 0, .45); } to { box-shadow: 0 0 18px rgba(255, 150, 0, .9), 0 -7px 26px rgba(255, 40, 0, .65); } }
@keyframes crystal-sparkle { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }

/* ---------- mascot ---------- */
.mascot { width: 140px; height: auto; margin-inline: auto; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .35)); }
.mascot-sm { width: 96px; }
.mascot-lg { width: 200px; }
.mascot.float { animation: float 2.8s ease-in-out infinite; }

/* ---------- toast ---------- */
.toast-host { position: fixed; z-index: 1200; left: 0; right: 0; top: calc(var(--safe-top) + 10px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  max-width: min(440px, 100%); padding: 12px 16px; border-radius: 18px;
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent); color: var(--fg);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-2);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  font-size: 14.5px; font-weight: 700; letter-spacing: -0.02em;
  transform: translateY(-24px) scale(.92); opacity: 0;
  transition: transform .45s var(--ease-spring), opacity .25s;
}
.toast.in { transform: none; opacity: 1; }
.toast.out { transform: translateY(-14px) scale(.96); opacity: 0; transition-duration: .25s; }
.toast-ico { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 900; color: #fff; background: var(--primary); }
.toast-success .toast-ico { background: var(--success); color: #03261A; }
.toast-error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.toast-error .toast-ico { background: var(--danger); }
.toast-warn .toast-ico { background: var(--warning); color: #2A1800; }
.toast-row { display: flex; align-items: center; gap: 12px; }
.toast-action { flex: none; min-height: 36px; padding: 0 14px; border-radius: 12px; background: var(--grad-primary); color: #fff; font-weight: 800; font-size: 13.5px; }

/* ---------- modal / sheet ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px);
  background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .25s ease;
}
.modal-backdrop.in { opacity: 1; }
.modal-backdrop.out { opacity: 0; transition-duration: .28s; }
.modal {
  position: relative; width: 100%; max-width: 400px; max-height: 100%; overflow-y: auto; scrollbar-width: none;
  padding: 26px 20px 20px; border-radius: 30px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-solid) 100%, transparent), color-mix(in srgb, var(--surface-solid) 94%, var(--bg)));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255, 255, 255, .1);
  text-align: center;
  transform: translateY(26px) scale(.86); opacity: 0;
  transition: transform .5s var(--ease-spring), opacity .22s;
}
.modal::-webkit-scrollbar { display: none; }
.modal-backdrop.in .modal { transform: none; opacity: 1; }
.modal-backdrop.out .modal { transform: translateY(14px) scale(.94); opacity: 0; transition: transform .25s ease, opacity .22s; }
.modal-icon { font-size: 54px; line-height: 1; margin: -4px auto 10px; animation: pop-in .6s var(--ease-spring) .08s both; }
.modal-title { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 8px; line-height: 1.3; }
.modal-text { color: var(--fg-2); font-size: 15px; line-height: 1.55; margin-bottom: 4px; white-space: pre-line; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; padding: 0 12px; }
.modal-actions.vertical { flex-direction: column; }
.modal-x { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 12px; color: var(--fg-3); font-size: 16px; display: grid; place-items: center; }
.modal-x:hover { background: var(--glass-2); }
.modal-backdrop.is-sheet { place-items: end center; padding: 0; }
.modal.sheet {
  max-width: var(--app-max); border-radius: 30px 30px 0 0; padding: 12px 20px calc(var(--safe-bottom) + 20px);
  max-height: 92%; transform: translateY(100%); opacity: 1;
  transition: transform .5s cubic-bezier(.2, 1.2, .3, 1);
}
.modal-backdrop.in .modal.sheet { transform: none; }
.modal-backdrop.out .modal.sheet { transform: translateY(100%); transition: transform .3s ease-in; }
.sheet-grip { width: 44px; height: 5px; border-radius: 5px; background: var(--fg-3); opacity: .5; margin: 0 auto 16px; }
.modal.sheet .modal-title { margin-top: 2px; }
@keyframes pop-in { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }

/* ---------- skeleton / spinner / empty ---------- */
.skeleton-wrap { display: flex; flex-direction: column; gap: 10px; }
.skeleton {
  height: 16px; border-radius: 10px;
  background: linear-gradient(90deg, var(--glass) 0%, var(--glass-hi) 40%, var(--glass) 80%);
  background-size: 220% 100%; animation: shimmer 1.3s ease-in-out infinite;
}
.skeleton:nth-child(3n+1) { width: 92%; }
.skeleton:nth-child(3n+2) { width: 74%; }
.skeleton:nth-child(3n) { width: 58%; }
.skeleton.block { width: 100% !important; border-radius: var(--radius-l); }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--track); border-top-color: var(--primary); border-right-color: var(--accent); animation: spin .75s linear infinite; margin: 24px auto; }
.spinner.sm { width: 20px; height: 20px; border-width: 3px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 34px 16px; color: var(--fg-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-emoji { font-size: 52px; line-height: 1; animation: float 3s ease-in-out infinite; }
.empty p { max-width: 280px; }

/* ---------- fx overlays ---------- */
.fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1300; pointer-events: none; }
.fly-icon { position: fixed; left: 0; top: 0; z-index: 1300; font-size: 24px; line-height: 1; pointer-events: none; margin: -12px 0 0 -12px; will-change: transform; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .45)); }
.pressed { transform: scale(.96); }
.float-text { position: fixed; z-index: 1300; pointer-events: none; font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--gold); text-shadow: 0 2px 10px rgba(0, 0, 0, .5); animation: float-up 1.1s var(--ease-out) forwards; }
@keyframes float-up { from { transform: translateY(0) scale(.8); opacity: 0; } 20% { opacity: 1; transform: translateY(-10px) scale(1.15); } to { transform: translateY(-60px) scale(1); opacity: 0; } }

/* ---------- prose (legal / long text) ---------- */
.prose { font-size: 15px; line-height: 1.75; color: var(--fg-2); font-weight: 450; }
.prose h2 { font-size: 19px; color: var(--fg); font-weight: 800; margin: 28px 0 10px; letter-spacing: -0.02em; line-height: 1.35; }
.prose h3 { font-size: 16px; color: var(--fg); font-weight: 800; margin: 20px 0 8px; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose strong, .prose b { color: var(--fg); font-weight: 800; }
.prose a { color: var(--primary-2); text-decoration: underline; text-underline-offset: 3px; }
[data-theme="paper"] .prose a { color: var(--primary); }
.prose table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 10px 0 18px; font-size: 13.5px; line-height: 1.5; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); min-width: 110px; }
.prose th { background: var(--glass-2); color: var(--fg); font-weight: 800; }
.prose tr:last-child td { border-bottom: 0; }
.prose details { margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-border); }
.prose summary { cursor: pointer; font-weight: 800; color: var(--fg); }
.prose code { font-size: 13px; padding: 1px 6px; border-radius: 6px; background: var(--glass-2); }
.legal-meta { font-size: 12.5px; color: var(--fg-3); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--fg-3); font-weight: 700; }
.kv dd { margin: 0; font-weight: 700; text-align: right; }

/* =====================================================================================
   SCREENS (frontend-core: home, play, auth, settings, link, download, onboarding)
   ===================================================================================== */

/* ---------- home: greeting ---------- */
.home-hello { display: flex; align-items: center; gap: 14px; padding: 6px 2px 4px; }
.home-hello .avatar { width: 64px; height: 64px; }
.home-hello-text { flex: 1; min-width: 0; }
.home-hello-hi { font-size: 13.5px; color: var(--fg-2); font-weight: 700; }
.home-hello-name { font-family: var(--font-kdisplay); font-size: 25px; line-height: 1.15; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-hello-name small { font-family: var(--font-body); font-size: 13px; color: var(--fg-3); font-weight: 700; margin-left: 4px; }
.home-xp { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.home-xp .progress { flex: 1; height: 10px; }
.lv-pill { flex: none; display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 9px; border-radius: 9px; background: var(--grad-primary); color: #fff; font-family: var(--font-display); font-size: 11.5px; font-weight: 800; box-shadow: var(--glow); }
.home-xp-num { font-family: var(--font-display); font-size: 11px; color: var(--fg-3); font-weight: 600; flex: none; }

/* banners carousel */
.carousel { position: relative; }
.carousel-track { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 4px var(--gutter) 8px; scroll-padding: 0 var(--gutter); }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-dots { display: flex; justify-content: center; gap: 6px; margin-top: 2px; }
.carousel-dots i { width: 7px; height: 7px; border-radius: 7px; background: var(--fg-3); opacity: .45; transition: width .35s var(--ease-spring), opacity .3s, background .3s; }
.carousel-dots i.on { width: 22px; opacity: 1; background: var(--grad-primary); }
.banner {
  position: relative; flex: 0 0 100%; scroll-snap-align: center; min-height: 118px; border-radius: var(--radius-l); overflow: hidden;
  padding: 18px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; color: #fff;
  background: var(--grad-primary); box-shadow: var(--shadow-1); isolation: isolate;
}
.banner-img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.banner::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .05) 75%); }
.banner-title { font-size: 19px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.25; text-shadow: 0 2px 10px rgba(0, 0, 0, .35); max-width: 78%; }
.banner-body { font-size: 13px; opacity: .9; max-width: 80%; font-weight: 600; }
.banner-kicker { align-self: flex-start; margin-bottom: auto; }
.banner.alt1 { background: linear-gradient(135deg, #00C2FF, #7C5CFF); }
.banner.alt2 { background: linear-gradient(135deg, #FFB547, #FF4D8D); }

/* quick cards (daily / spin) */
.quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.quick {
  position: relative; overflow: hidden; border-radius: var(--radius-l); padding: 14px 14px 14px; min-height: 132px;
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  background: var(--card-sheen), var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow-1);
  transition: transform .3s var(--ease-spring);
}
.quick:active, .quick.pressed { transform: scale(.96); }
.quick-emoji { font-size: 34px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35)); }
.quick-title { font-weight: 800; font-size: 15.5px; letter-spacing: -0.03em; }
.quick-sub { font-size: 12px; color: var(--fg-3); font-weight: 700; }
.quick-cta { margin-top: auto; align-self: stretch; }
.quick-cta .btn { width: 100%; }
.quick.ready { border-color: color-mix(in srgb, var(--gold) 55%, transparent); box-shadow: var(--shadow-1), 0 0 26px rgba(255, 190, 60, .25); }
.quick.ready::after { content: ''; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 70%, rgba(255, 220, 120, .25) 80%, transparent 90%); animation: spin 4s linear infinite; z-index: -1; }
.quick.ready .quick-emoji { animation: wiggle 1.6s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0) scale(1); } 15% { transform: rotate(-12deg) scale(1.1); } 30% { transform: rotate(10deg) scale(1.1); } 45% { transform: rotate(-6deg); } 60% { transform: rotate(0); } }
.streak { display: inline-flex; align-items: center; gap: 3px; color: #FF8A3C; font-family: var(--font-display); font-weight: 800; font-size: 13px; }
.streak .ico { color: #FF7A1A; filter: drop-shadow(0 0 6px rgba(255, 110, 0, .7)); animation: flame 1s ease-in-out infinite alternate; }
.streak .ico svg { width: 18px; height: 18px; }
@keyframes flame { from { transform: scale(1) rotate(-4deg); } to { transform: scale(1.15) rotate(4deg); } }
.quick-timer { font-family: var(--font-display); font-size: 12px; color: var(--fg-2); font-weight: 600; }

/* install card */
.install-card { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; margin-top: 14px; }
.install-card img { width: 46px; height: 46px; border-radius: 12px; flex: none; box-shadow: var(--shadow-1); }
.install-card .grow b { display: block; font-size: 14.5px; letter-spacing: -0.02em; }
.install-card .grow span { font-size: 12px; color: var(--fg-3); }

/* game cards carousel */
.games-track { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 6px var(--gutter) 18px; scroll-padding: 0 var(--gutter); }
.games-track::-webkit-scrollbar { display: none; }
.gcard {
  --gc: #7C5CFF;
  position: relative; flex: 0 0 84%; scroll-snap-align: center; border-radius: 28px; overflow: hidden; isolation: isolate;
  background: var(--surface-solid);
  border: 1px solid color-mix(in srgb, var(--gc) 45%, transparent);
  box-shadow: 0 16px 40px color-mix(in srgb, var(--gc) 32%, transparent), 0 6px 18px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .1);
  transform: scale(var(--gs, 1)); transform-origin: center; transition: transform .2s ease-out, opacity .2s;
  opacity: var(--go, 1);
}
.gcard-art { position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--gc) 70%, #fff 0%), color-mix(in srgb, var(--gc) 30%, #000)); }
.gcard-art img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); transition: transform .6s var(--ease-out); }
.gcard:active .gcard-art img { transform: scale(1.07); }
.gcard-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, color-mix(in srgb, var(--surface-solid) 96%, transparent) 100%); }
.gcard-art-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 80px; }
.gcard-tags { position: absolute; z-index: 2; left: 12px; top: 12px; display: flex; gap: 6px; }
.gcard-best { position: absolute; z-index: 2; right: 12px; top: 12px; display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 10px; background: rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #fff; font-size: 11px; font-weight: 800; }
.gcard-best b { font-family: var(--font-display); font-size: 12.5px; color: #FFE27A; }
.gcard-body { position: relative; padding: 0 16px 16px; margin-top: -34px; z-index: 1; }
.gcard-name { font-family: var(--font-kdisplay); font-size: 28px; line-height: 1.1; color: var(--fg); text-shadow: 0 2px 14px color-mix(in srgb, var(--gc) 70%, transparent); }
.gcard-desc { font-size: 13px; color: var(--fg-2); margin: 4px 0 14px; min-height: 2.9em; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gcard-actions { display: flex; gap: 10px; }
.gcard-actions .btn-play { flex: 1.5; }
.gcard-actions .btn-daily { flex: 1; padding: 0 10px; font-size: 14px; }
.btn-play { background: linear-gradient(135deg, color-mix(in srgb, var(--gc) 100%, #fff 0%), color-mix(in srgb, var(--gc) 70%, #FF4D8D)); color: #fff; box-shadow: 0 var(--d) 0 color-mix(in srgb, var(--gc) 50%, #000), 0 calc(var(--d) + 10px) 24px color-mix(in srgb, var(--gc) 45%, transparent); text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.btn-play:active, .btn-play.pressed { box-shadow: 0 1px 0 color-mix(in srgb, var(--gc) 50%, #000); }
.gcard.soon .gcard-art img { filter: grayscale(.7) brightness(.6); }
.gcard-soon { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; }
.gcard-soon span { padding: 8px 16px; border-radius: 14px; background: rgba(0, 0, 0, .6); color: #fff; font-weight: 800; }
.games-dots { margin-top: -6px; }
.games-dots i.on { background: var(--gdot, var(--primary)); }

/* missions mini / teasers */
.teaser { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.teaser-ico { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-size: 24px; flex: none; background: var(--glass-2); }
.teaser-body { flex: 1; min-width: 0; }
.teaser-title { font-weight: 800; font-size: 15px; letter-spacing: -0.02em; }
.teaser-sub { font-size: 12.5px; color: var(--fg-3); font-weight: 600; }
.teaser .progress { margin-top: 8px; }
.teaser-trail { color: var(--fg-3); }
.mission-mini { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.mission-mini-row { display: flex; align-items: center; gap: 10px; }
.mission-mini-row .progress { flex: 1; height: 8px; }
.mission-mini-t { font-size: 13px; font-weight: 700; flex: 1.4; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mission-mini-n { font-family: var(--font-display); font-size: 11px; color: var(--fg-3); min-width: 42px; text-align: right; }
.mission-mini-row.done .mission-mini-t { color: var(--success); }
.podium { display: flex; align-items: flex-end; gap: 8px; }
.podium .avatar { width: 34px; height: 34px; padding: 2px; }
.podium .p1 .avatar { width: 42px; height: 42px; }
.podium-col { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 800; color: var(--fg-3); }
.avatars-stack { display: flex; }
.avatars-stack .avatar { width: 34px; height: 34px; padding: 2px; margin-left: -10px; box-shadow: 0 0 0 2px var(--bg); }
.avatars-stack .avatar:first-child { margin-left: 0; }
.home-footer { margin: 28px 0 4px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 12px; color: var(--fg-3); }
.home-footer a { min-height: 32px; display: inline-flex; align-items: center; }

/* ---------- onboarding ---------- */
.onboard { position: fixed; inset: 0; z-index: 1050; display: flex; flex-direction: column; background: var(--grad-hero); background-color: var(--bg); animation: fade-in .4s ease both; }
.onboard.out { animation: onboard-out .45s var(--ease-out) forwards; }
@keyframes onboard-out { to { opacity: 0; transform: scale(1.05); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.onboard-skip { position: absolute; z-index: 2; top: calc(var(--safe-top) + 10px); right: 14px; min-height: 44px; padding: 0 14px; border-radius: 14px; color: var(--fg-2); font-weight: 700; }
.onboard-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.onboard-track::-webkit-scrollbar { display: none; }
.onboard-slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: calc(var(--safe-top) + 60px) 28px 20px; text-align: center; position: relative; overflow: hidden; }
.onboard-glow { position: absolute; width: 380px; height: 380px; border-radius: 50%; top: 18%; left: 50%; margin-left: -190px; filter: blur(30px); opacity: .55; z-index: 0; }
.onboard-art { position: relative; z-index: 1; width: min(68vw, 290px); height: min(68vw, 290px); display: grid; place-items: center; }
.onboard-art img.mascot { width: 100%; height: 100%; object-fit: contain; animation: float 2.8s ease-in-out infinite; }
.onboard-art .orbit-emoji { position: absolute; font-size: 38px; animation: float 3.2s ease-in-out infinite; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .4)); }
.onboard-title { position: relative; z-index: 1; font-family: var(--font-kdisplay); font-size: 40px; line-height: 1.1; letter-spacing: 0; }
.onboard-text { position: relative; z-index: 1; font-size: 16px; color: var(--fg-2); max-width: 320px; line-height: 1.6; font-weight: 600; }
.onboard-foot { padding: 12px 24px calc(var(--safe-bottom) + 24px); display: flex; flex-direction: column; gap: 18px; align-items: stretch; max-width: 460px; width: 100%; margin: 0 auto; }
.onboard-dots { display: flex; justify-content: center; gap: 8px; }
.onboard-dots i { width: 9px; height: 9px; border-radius: 9px; background: var(--fg-3); opacity: .4; transition: width .4s var(--ease-spring), opacity .3s; }
.onboard-dots i.on { width: 28px; opacity: 1; background: var(--grad-primary); }
.onboard-slide.s-in .onboard-title, .onboard-slide.s-in .onboard-text { animation: rise-in .6s var(--ease-spring) both; }
.onboard-slide.s-in .onboard-text { animation-delay: .08s; }

/* ---------- play: stage + HUD ---------- */
.play { position: absolute; inset: 0; background: #05040F; overflow: hidden; touch-action: none; }
.play-root { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.hud {
  position: absolute; z-index: 10; left: 0; right: 0; top: 0;
  height: calc(64px + var(--safe-top)); padding: var(--safe-top) calc(12px + var(--safe-right)) 0 calc(16px + var(--safe-left));
  display: flex; align-items: center; gap: 12px; pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 4, 15, .72), rgba(5, 4, 15, 0));
  color: #fff; transition: opacity .3s;
}
.hud.hidden { opacity: 0; }
.hud-score-wrap { display: flex; flex-direction: column; min-width: 0; }
.hud-score { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1.05; letter-spacing: -0.03em; text-shadow: 0 2px 12px rgba(0, 0, 0, .5); transform-origin: left center; font-variant-numeric: tabular-nums; }
.hud-score.bump { animation: score-bump .32s var(--ease-spring); }
.hud-score.bump-big { animation: score-bump-big .5s var(--ease-spring); }
@keyframes score-bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); color: #FFE27A; } 100% { transform: scale(1); } }
@keyframes score-bump-big { 0% { transform: scale(1); } 35% { transform: scale(1.4) rotate(-3deg); color: #FFE27A; text-shadow: 0 0 22px rgba(255, 210, 80, .9); } 100% { transform: scale(1); } }
.hud-label { font-size: 13px; font-weight: 900; color: #FFC93C; letter-spacing: .02em; min-height: 16px; text-shadow: 0 0 10px rgba(255, 180, 60, .6); font-family: var(--font-display); }
.hud-label.pop { animation: pop-in .4s var(--ease-spring); }
.hud-mid { flex: 1; display: flex; justify-content: center; }
.hud-best { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 10px; background: rgba(255, 255, 255, .1); font-family: var(--font-display); font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .8); }
.hud-best.beaten { background: linear-gradient(135deg, #FFE27A, #FF8A00); color: #3A1E00; animation: pop-in .5s var(--ease-spring); }
.hud-pause { pointer-events: auto; width: 46px; height: 46px; border-radius: 15px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .16); color: #fff; display: grid; place-items: center; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hud-pause:active { transform: scale(.9); }
.hud-mode { position: absolute; left: 50%; top: calc(var(--safe-top) + 52px); transform: translateX(-50%); }

/* countdown */
.countdown { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; pointer-events: none; background: radial-gradient(circle, rgba(5, 4, 15, .35), rgba(5, 4, 15, .75)); transition: opacity .3s; }
.countdown.done { opacity: 0; }
.countdown-n { font-family: var(--font-display); font-weight: 900; font-size: 140px; line-height: 1; color: #fff; text-shadow: 0 0 40px var(--cd-glow, rgba(124, 92, 255, .9)), 0 8px 0 rgba(0, 0, 0, .25); animation: cd-pop .8s var(--ease-spring) both; }
.countdown-n.go { font-size: 110px; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 0 30px rgba(255, 190, 60, .8)); }
@keyframes cd-pop { 0% { transform: scale(2.4); opacity: 0; } 30% { transform: scale(.9); opacity: 1; } 55% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
.countdown-sub { position: absolute; bottom: calc(var(--safe-bottom) + 18%); left: 0; right: 0; text-align: center; color: rgba(255, 255, 255, .8); font-weight: 800; font-size: 15px; }
.play-loading { position: absolute; inset: 0; z-index: 25; display: grid; place-items: center; align-content: center; gap: 8px; color: #fff; }

/* pause */
.pause-ov { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(5, 4, 15, .62); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: fade-in .2s ease; }
.pause-card { width: 100%; max-width: 360px; padding: 26px 20px 20px; border-radius: 30px; text-align: center; background: color-mix(in srgb, var(--surface-solid) 96%, transparent); border: 1px solid var(--glass-border); box-shadow: var(--shadow-2); animation: pop-in .45s var(--ease-spring); color: var(--fg); }
.pause-title { font-family: var(--font-kdisplay); font-size: 34px; margin-bottom: 4px; }
.pause-score { font-family: var(--font-display); font-size: 15px; color: var(--fg-2); margin-bottom: 18px; }
.pause-toggles { display: flex; justify-content: center; gap: 12px; margin: 18px 0 6px; }
.pause-toggles .icon-btn { width: 56px; height: 56px; border-radius: 18px; position: relative; }
.pause-toggles .icon-btn.off { color: var(--fg-3); }
.pause-toggles .icon-btn.off::after { content: ''; position: absolute; width: 30px; height: 3px; border-radius: 3px; background: var(--danger); transform: rotate(-45deg); }
.pause-toggles .icon-btn .ico svg { width: 24px; height: 24px; }

/* revive */
.revive { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.revive-ring { position: relative; width: 132px; height: 132px; display: grid; place-items: center; margin: 2px auto 8px; }
.revive-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.revive-ring .rr-bg { fill: none; stroke: var(--track); stroke-width: 9; }
.revive-ring .rr-fg { fill: none; stroke: url(#rr-grad); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; animation: rr-drain var(--rr-ms, 5000ms) linear forwards; filter: drop-shadow(0 0 6px rgba(255, 77, 141, .8)); }
@keyframes rr-drain { to { stroke-dashoffset: 100; } }
.revive-heart { font-size: 52px; animation: heartbeat 1s ease-in-out infinite; }
.revive-n { position: absolute; bottom: 16px; font-family: var(--font-display); font-weight: 800; font-size: 16px; color: var(--fg-2); }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.2); } 30% { transform: scale(1); } 45% { transform: scale(1.12); } }
.revive-cost { display: flex; justify-content: center; gap: 8px; align-items: center; font-weight: 700; color: var(--fg-2); font-size: 14px; }

/* result */
.result { position: absolute; inset: 0; z-index: 50; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; background: var(--grad-hero); background-color: var(--bg); color: var(--fg); animation: fade-in .3s ease both; touch-action: pan-y; }
.result::-webkit-scrollbar { display: none; }
.result-inner { min-height: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: calc(var(--safe-top) + 10px) calc(18px + var(--safe-right)) calc(var(--safe-bottom) + 22px) calc(18px + var(--safe-left)); max-width: 520px; margin: 0 auto; }
.result-top { display: flex; align-items: center; gap: 8px; min-height: 52px; }
.result-top .grow { display: flex; justify-content: flex-end; gap: 6px; }
.result-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.result-game { font-weight: 800; color: var(--fg-2); font-size: 15px; display: flex; align-items: center; gap: 8px; }
.result-mascot { width: 150px; height: 150px; object-fit: contain; margin: -4px auto -10px; animation: pop-in .7s var(--ease-spring) .1s both; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .4)); }
.result-mascot.trophy { width: 180px; height: 180px; animation: pop-in .7s var(--ease-spring) both, float 3s ease-in-out .7s infinite; }
.result-score-label { font-size: 13px; font-weight: 800; letter-spacing: .12em; color: var(--fg-3); font-family: var(--font-display); }
.result-score { font-family: var(--font-display); font-weight: 900; font-size: clamp(54px, 17vw, 80px); line-height: 1; letter-spacing: -0.04em; text-shadow: var(--text-glow); font-variant-numeric: tabular-nums; }
.result-score.final { animation: score-bump-big .6s var(--ease-spring); }
.result-best { font-size: 14px; color: var(--fg-2); font-weight: 700; display: flex; gap: 6px; align-items: center; }
.result-best b { font-family: var(--font-display); color: var(--fg); }
.newbest-ribbon {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 999px; margin-bottom: 2px;
  background: var(--grad-gold); color: #3A1E00; font-family: var(--font-display); font-weight: 900; font-size: 16px; letter-spacing: .04em;
  box-shadow: 0 8px 26px rgba(255, 170, 40, .55); animation: ribbon-in .7s var(--ease-spring) both, ribbon-shine 2s ease-in-out 1s infinite;
}
@keyframes ribbon-in { 0% { transform: scale(0) rotate(-12deg); } 70% { transform: scale(1.15) rotate(3deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes ribbon-shine { 50% { filter: brightness(1.18); box-shadow: 0 8px 36px rgba(255, 200, 60, .85); } }
.result-rank { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border-radius: 16px; background: var(--glass-2); border: 1px solid var(--glass-border); font-weight: 800; font-size: 14px; text-align: center; animation: rise-in .5s var(--ease-spring) both; }
.result-rank .num { color: var(--accent); }
.result-rank.top { background: linear-gradient(135deg, rgba(255, 201, 60, .2), rgba(255, 120, 60, .14)); border-color: rgba(255, 201, 60, .45); }
.result-rewards { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.reward-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 16px 0 10px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--glass-border); font-family: var(--font-display); font-weight: 800; font-size: 17px; animation: pop-in .5s var(--ease-spring) both; }
.reward-pill i { font-style: normal; font-size: 22px; }
.reward-pill.coins b { color: var(--coin); }
.reward-pill.gems b { color: var(--gem); }
.reward-pill.xp b { color: var(--accent); }
.result-xp { padding: 14px 16px; }
.result-xp-row { display: flex; align-items: center; justify-content: space-between; font-weight: 800; margin-bottom: 8px; font-size: 14px; }
.result-xp-row .num { font-size: 12px; color: var(--fg-3); }
.result-missions { display: flex; flex-direction: column; gap: 8px; }
.mchip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-border); font-size: 13.5px; font-weight: 700; animation: rise-in .5s var(--ease-spring) both; }
.mchip .progress { width: 70px; height: 7px; flex: none; }
.mchip-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mchip-n { font-family: var(--font-display); font-size: 11px; color: var(--fg-3); flex: none; }
.mchip.done { border-color: color-mix(in srgb, var(--success) 50%, transparent); background: color-mix(in srgb, var(--success) 12%, transparent); }
.mchip.done .mchip-n { color: var(--success); }
.result-actions { display: flex; flex-direction: column; gap: 12px; margin-top: auto; padding-top: 6px; }
.result-actions .row .btn { flex: 1; }
.btn-retry { font-size: 24px; min-height: 74px; }
.btn-retry .ico svg { width: 26px; height: 26px; }
.result-offline { text-align: center; font-size: 13px; color: var(--warning); font-weight: 700; }
.result-flagged { text-align: center; font-size: 12.5px; color: var(--fg-3); }

/* not ready / error card in play */
.play-msg { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: var(--grad-hero); background-color: var(--bg); color: var(--fg); }
.play-msg-card { max-width: 360px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 26px 20px; }

/* ---------- auth ---------- */
.auth { max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; padding-top: 4px; }
.auth-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 4px; }
.auth-hero .mascot { width: 112px; }
.auth-title { font-family: var(--font-kdisplay); font-size: 30px; line-height: 1.15; }
.auth-sub { color: var(--fg-2); font-size: 14.5px; max-width: 320px; }
.auth-perks { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--fg-3); font-size: 12.5px; font-weight: 700; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-switch { text-align: center; font-size: 14px; color: var(--fg-2); }
.gsi-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 50px; }
.gsi-btn-host { display: flex; justify-content: center; width: 100%; min-height: 44px; }
.device-code { font-family: var(--font-display); font-size: 34px; font-weight: 800; letter-spacing: .12em; padding: 14px 18px; border-radius: 18px; background: var(--glass-2); border: 1px dashed var(--glass-border); text-align: center; }
.pw-toggle { width: 44px; height: 44px; display: grid; place-items: center; color: var(--fg-3); border-radius: 12px; }

/* ---------- settings ---------- */
.settings { max-width: 640px; margin: 0 auto; }
.settings .list { margin-bottom: 4px; }
.acct-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.acct-card .avatar { width: 56px; height: 56px; }
.acct-card .grow b { display: block; font-size: 17px; letter-spacing: -0.02em; }
.acct-card .grow span { font-size: 12.5px; color: var(--fg-3); }
.save-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: linear-gradient(135deg, rgba(255, 181, 71, .14), rgba(255, 77, 141, .08)), var(--glass); }
.save-card-head { display: flex; gap: 12px; align-items: center; }
.save-card-head .mascot { width: 64px; margin: 0; }
.theme-swatches { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.theme-swatches::-webkit-scrollbar { display: none; }
.swatch { flex: none; width: 74px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--fg-2); }
.swatch-chip { width: 64px; height: 64px; border-radius: 20px; position: relative; overflow: hidden; border: 2px solid var(--glass-border); transition: transform .3s var(--ease-spring), box-shadow .3s; }
.swatch-chip i { position: absolute; inset: 0; }
.swatch.on .swatch-chip { border-color: transparent; box-shadow: 0 0 0 3px var(--primary), var(--glow); transform: scale(1.05); }
.swatch.locked .swatch-chip { opacity: .45; }
.swatch.locked .swatch-chip::after { content: '🔒'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; }
.swatch:active .swatch-chip { transform: scale(.92); }
.version-line { text-align: center; color: var(--fg-3); font-size: 12px; margin: 22px 0 6px; font-family: var(--font-display); }

/* ---------- link (device approve) ---------- */
.link-screen { max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; text-align: center; align-items: stretch; padding-top: 8px; }
.link-ok { font-size: 64px; animation: pop-in .6s var(--ease-spring); }

/* ---------- download ---------- */
.dl { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.dl-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 4px; }
.dl-hero img.dl-icon { width: 92px; height: 92px; border-radius: 24px; box-shadow: 0 14px 34px color-mix(in srgb, var(--primary) 45%, transparent); }
.dl-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.dl-item.rec { border-color: color-mix(in srgb, var(--primary) 60%, transparent); box-shadow: var(--shadow-1), var(--glow); }
.dl-item .dl-os { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--glass-2); flex: none; }
.dl-item .dl-os svg { width: 26px; height: 26px; }
.dl-item .grow b { display: block; font-size: 15.5px; }
.dl-item .grow span { font-size: 12px; color: var(--fg-3); }
.dl-qr { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px; }
.dl-qr canvas { border-radius: 16px; background: #fff; padding: 0; box-shadow: var(--shadow-1); }
.dl-url { font-family: var(--font-display); font-weight: 700; font-size: 15px; word-break: break-all; text-align: center; }
.ios-steps { list-style: none; display: flex; flex-direction: column; gap: 10px; text-align: left; margin-top: 12px; }
.ios-step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-border); font-weight: 700; font-size: 14.5px; }
.ios-step-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-primary); color: #fff; font-family: var(--font-display); font-size: 12px; flex: none; }
.ios-step-ico { color: var(--accent); display: grid; place-items: center; }
.ios-install .mascot { margin-bottom: 6px; }

/* maintenance / fatal */
.fullmsg { position: fixed; inset: 0; z-index: 1040; display: grid; place-items: center; padding: 24px; background: var(--grad-hero); background-color: var(--bg); text-align: center; }
.fullmsg-card { max-width: 380px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.fullmsg-title { font-family: var(--font-kdisplay); font-size: 30px; }

/* =====================================================================================
   DESKTOP / LARGE SCREENS
   ===================================================================================== */
@media (min-width: 560px) {
  .ambient-img { opacity: .55; }
  [data-theme="paper"] .ambient-img { opacity: .12; }
  .app { box-shadow: 0 0 0 1px var(--hairline), 0 30px 80px rgba(0, 0, 0, .55); }
  .gcard { flex-basis: 78%; }
}
@media (min-width: 900px) and (min-height: 640px) {
  .ambient-orb { opacity: .35; }
  .stage { align-items: center; gap: 48px; padding: 24px; }
  .app { height: min(100%, 940px); max-width: 440px; border-radius: 40px; flex: none; width: 440px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 0 0 10px rgba(255, 255, 255, .03), 0 40px 120px rgba(0, 0, 0, .7), 0 0 120px color-mix(in srgb, var(--primary) 25%, transparent); }
  .side { display: flex; flex-direction: column; gap: 18px; width: 300px; flex: none; }
  .side-left { align-items: flex-start; }
  .side-logo { width: 240px; height: auto; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .5)); }
  .side-title { font-family: var(--font-kdisplay); font-size: 40px; line-height: 1.15; font-weight: 400; }
  .side-sub { color: var(--fg-2); font-size: 15px; }
  .side-games { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
  .side-games li { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 3 / 2; background: var(--glass); box-shadow: var(--shadow-1); }
  .side-games li img { width: 100%; height: 100%; object-fit: cover; }
  .side-games li span { position: absolute; left: 8px; bottom: 6px; font-weight: 800; font-size: 12.5px; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
  .side-feats { list-style: none; display: flex; flex-direction: column; gap: 8px; color: var(--fg-2); font-weight: 700; font-size: 14px; }
  .side-feats b { margin-right: 6px; }
  .side-right { align-items: stretch; }
  .side-card { padding: 22px; border-radius: 28px; background: var(--card-sheen), var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow-2); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
  .side-card-title { font-weight: 800; font-size: 17px; }
  .side-card-sub { font-size: 13px; color: var(--fg-3); }
  .side-qr { width: 196px; height: 196px; border-radius: 20px; background: #fff; display: grid; place-items: center; padding: 10px; }
  .side-qr canvas { width: 176px !important; height: 176px !important; }
  .side-qr-url { color: #222; font-weight: 800; font-size: 12px; word-break: break-all; text-align: center; }
  .toast-host { top: 24px; }
  .modal-backdrop.is-sheet { place-items: center; padding: 16px; }
  .modal.sheet { border-radius: 30px; max-width: 420px; padding-bottom: 20px; }
  .onboard { background-color: transparent; background: rgba(5, 4, 15, .6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  .onboard-inner-desktop { max-width: 440px; }
}
@media (min-width: 900px) and (max-width: 1179px) { .side-right { display: none; } }
@media (min-width: 900px) and (max-width: 979px) { .side-left { display: none; } }
html.is-desktop-app .side-right { display: none; }
html.is-standalone .side-right { display: none; }
@media (hover: hover) {
  .gcard:hover { --gs: 1.01; }
  .list-row:hover { background: var(--glass); }
  .icon-btn:hover { background: var(--glass-hi); }
  .chip:hover { color: var(--fg); }
}

/* =====================================================================================
   THEME TWEAKS
   ===================================================================================== */
[data-theme="paper"] .btn-ghost, [data-theme="paper"] .btn:not([class*="btn-"]) { background: #fff; color: var(--fg); }
[data-theme="paper"] .gcard-art::after { background: linear-gradient(180deg, rgba(255, 255, 255, 0) 45%, #fff 100%); }
[data-theme="paper"] .gcard { box-shadow: 0 16px 40px color-mix(in srgb, var(--gc) 22%, transparent), 0 6px 18px rgba(60, 30, 160, .12); }
[data-theme="paper"] .tb-lv { border-color: var(--bg); }
[data-theme="paper"] .hud, [data-theme="paper"] .play { color: #fff; }
[data-theme="paper"] .toast { background: rgba(255, 255, 255, .96); }
[data-theme="paper"] .offline-banner { background: rgba(27, 19, 64, .92); }
[data-theme="paper"] .modal { background: #fff; }
[data-theme="paper"] .tab.active .tab-ico { color: var(--primary); filter: none; }
[data-theme="paper"] .tab-indicator span { opacity: .14; box-shadow: none; }
[data-theme="paper"] .result-score { color: var(--fg); }
[data-theme="paper"] .home-hello-name { color: var(--fg); }
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: background-color .4s ease, color .4s ease, border-color .4s ease !important; }

/* =====================================================================================
   MOTION PREFERENCES
   ===================================================================================== */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

/* =====================================================================================
   ADDICTION LOOP EXTRAS (best chase, near-miss, chest, first-win, quick play)
   ===================================================================================== */
.hud-best.chase { background: linear-gradient(135deg, rgba(255, 138, 0, .9), rgba(255, 77, 141, .9)); color: #fff; animation: chase-pulse .9s ease-in-out infinite; }
@keyframes chase-pulse { 50% { transform: scale(1.07); box-shadow: 0 0 16px rgba(255, 120, 60, .7); } }
.hud-flash {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(var(--safe-top) + 92px); text-align: center; pointer-events: none;
  font-family: var(--font-display); font-weight: 900; font-size: 44px; letter-spacing: -0.02em;
  background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 190, 60, .9)) drop-shadow(0 4px 0 rgba(0, 0, 0, .3));
  animation: hud-flash 1.4s var(--ease-spring) forwards;
}
@keyframes hud-flash { 0% { transform: scale(.2) rotate(-8deg); opacity: 0; } 25% { transform: scale(1.2) rotate(2deg); opacity: 1; } 40% { transform: scale(1); } 80% { opacity: 1; } 100% { transform: translateY(-30px) scale(.9); opacity: 0; } }

.result-near { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; font-weight: 800; font-size: 16px; text-align: center; color: var(--fg); animation: rise-in .5s var(--ease-spring) .2s both; }
.result-near b { color: #FF9A3C; font-size: 18px; }
.result-near.hot { font-size: 18px; animation: rise-in .5s var(--ease-spring) .2s both, near-wobble 1.6s ease-in-out 1s infinite; }
.result-near.hot b { color: #FF5A5A; font-size: 21px; }
@keyframes near-wobble { 0%, 100% { transform: rotate(0); } 10% { transform: rotate(-2deg) scale(1.04); } 20% { transform: rotate(2deg) scale(1.04); } 30% { transform: none; } }
.reward-pill.tickets b { color: var(--ticket); }
.reward-pill.firstwin { background: linear-gradient(135deg, #FFE27A, #FF8A00); color: #3A1E00; border: 0; box-shadow: 0 6px 20px rgba(255, 150, 0, .45); }
.reward-pill.firstwin b { font-size: 14px; }
.result-xp-next { margin-top: 8px; font-size: 12.5px; color: var(--fg-2); font-weight: 700; text-align: right; }
.result.out { animation: pg-out-fade .22s ease forwards; pointer-events: none; }
.btn-breathe { animation: breathe-btn 1.8s ease-in-out infinite; }
@keyframes breathe-btn { 0%, 100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.035); filter: brightness(1.12) drop-shadow(0 0 18px color-mix(in srgb, var(--primary) 65%, transparent)); } }
.btn-breathe:active, .btn-breathe.pressed { animation: none; }
html.is-touch .kbd-hint { display: none; }

/* chest progress bar */
.chest { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-l); background: linear-gradient(135deg, rgba(255, 201, 60, .14), rgba(180, 92, 255, .10)), var(--glass); border: 1px solid rgba(255, 201, 60, .28); box-shadow: var(--shadow-1); animation: rise-in .5s var(--ease-spring) both; }
.chest-ico { font-size: 34px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(255, 180, 60, .45)); flex: none; }
.chest.ready .chest-ico { animation: chest-jiggle .5s ease-in-out infinite; }
.chest-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.chest-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 800; font-size: 14px; }
.chest-label { font-size: 12px; color: var(--fg-2); font-weight: 700; text-align: right; }
.chest-segs { display: flex; gap: 6px; }
.chest-seg { flex: 1; height: 10px; border-radius: 6px; background: var(--track); transition: background .4s, box-shadow .4s, transform .4s var(--ease-spring); }
.chest-seg.on { background: var(--grad-gold); box-shadow: 0 0 10px rgba(255, 180, 60, .7); transform: scaleY(1.15); }
@keyframes chest-jiggle { 0%, 100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-10deg) scale(1.08); } 75% { transform: rotate(10deg) scale(1.08); } }
.chest-ov { position: fixed; inset: 0; z-index: 1150; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(4, 3, 14, .82); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade-in .25s ease; overflow: hidden; }
.chest-ov.closing { animation: pg-out-fade .3s ease forwards; }
.chest-rays { position: absolute; width: 160vmax; height: 160vmax; left: 50%; top: 45%; margin: -80vmax 0 0 -80vmax; opacity: 0; transform: scale(.3);
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 55%, transparent) 0deg 9deg, transparent 9deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 55%); mask: radial-gradient(circle, #000 0%, transparent 55%);
  transition: opacity .5s, transform .8s var(--ease-out); }
.chest-ov.opened .chest-rays { opacity: 1; transform: scale(1); animation: spin 14s linear infinite; }
.chest-box { position: relative; font-size: 120px; line-height: 1; filter: drop-shadow(0 0 30px var(--rc)); }
.chest-box.shake-1 { animation: chest-shake 1.1s ease-in both; }
.chest-box.burst { animation: chest-burst .6s var(--ease-spring) forwards; }
@keyframes chest-shake { 0% { transform: rotate(0) scale(1); } 10% { transform: rotate(-6deg); } 20% { transform: rotate(6deg); } 30% { transform: rotate(-9deg) scale(1.04); } 40% { transform: rotate(9deg) scale(1.04); } 50% { transform: rotate(-12deg) scale(1.08); } 60% { transform: rotate(12deg) scale(1.08); } 70% { transform: rotate(-15deg) scale(1.12); } 80% { transform: rotate(15deg) scale(1.14); } 90% { transform: rotate(-18deg) scale(1.18); } 100% { transform: rotate(0) scale(1.25); } }
@keyframes chest-burst { 0% { transform: scale(1.25); } 30% { transform: scale(1.7); filter: brightness(2.4) drop-shadow(0 0 60px var(--rc)); } 100% { transform: scale(.9) translateY(-10px); filter: drop-shadow(0 0 30px var(--rc)); } }
.chest-reveal { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; opacity: 0; transform: translateY(20px) scale(.8); transition: opacity .4s .25s, transform .6s var(--ease-spring) .25s; }
.chest-ov.opened .chest-reveal { opacity: 1; transform: none; }
.chest-rarity { font-family: var(--font-display); font-weight: 900; font-size: 26px; letter-spacing: .06em; color: var(--rc); text-shadow: 0 0 22px var(--rc); text-transform: uppercase; }
.chest-ov .btn { position: relative; opacity: 0; transition: opacity .3s .7s; }
.chest-ov.opened .btn { opacity: 1; }
.chest-ov .reward-pill { font-size: 22px; min-height: 52px; }

/* home extras */
.home-wrap { display: flex; flex-direction: column; }
.home-hello { position: relative; }
.home-save { position: absolute; right: 0; top: 4px; }
.home-xp-next { margin-top: 5px; font-size: 11.5px; font-weight: 700; color: var(--fg-3); }
.home-chest:not(:empty) { margin-top: 12px; }
.quick-row { margin-top: 16px; }
.quick.ready .spin-emoji { animation: spin 3s linear infinite; }
.tag-x2 { background: linear-gradient(135deg, #FFE27A, #FF8A00); color: #3A1E00; box-shadow: 0 0 14px rgba(255, 170, 40, .6); animation: chase-pulse 1.4s ease-in-out infinite; }
.gcard.has-x2 { border-color: rgba(255, 190, 60, .6); }
.mission-mini.ready { border-color: color-mix(in srgb, var(--gold) 50%, transparent); box-shadow: var(--shadow-1), 0 0 24px rgba(255, 190, 60, .18); }
.quickplay-wrap { position: sticky; z-index: 6; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px); margin-top: 18px; pointer-events: none; }
.quickplay { pointer-events: auto; justify-content: center; gap: 10px; font-size: 20px; animation: breathe-btn 2.2s ease-in-out infinite; }
.quickplay-game { font-size: 14px; font-weight: 800; opacity: .9; padding: 4px 10px; border-radius: 10px; background: rgba(0, 0, 0, .2); }
.quickplay:active { animation: none; }
.home-footer { margin-bottom: 0; }
