/* ZIRA — neon arcade, dark, chunky. Mobile-first, RTL. */
:root {
  --bg: #0B0620;
  --bg2: #150A35;
  --ink: #F6F3FF;
  --muted: #A99FD0;
  --line: rgba(255, 255, 255, .10);
  --glass: rgba(255, 255, 255, .06);
  --glass2: rgba(255, 255, 255, .10);
  --pink: #FF3D9A;
  --cyan: #22E4FF;
  --lime: #B6FF3B;
  --sun: #FFD23F;
  --violet: #8B5CFF;
  --dark: #160B2E;
  --r: 22px;
  --display: 'Fredoka', 'Rubik', system-ui, sans-serif;
  --body: 'Rubik', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .9, .25, 1.15);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--body);
  overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 10px; }

/* ---------- animated background ---------- */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0;
  background: radial-gradient(120% 80% at 50% -10%, #2A1170 0%, var(--bg) 60%); }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: drift 18s ease-in-out infinite alternate; }
.o1 { width: 420px; height: 420px; background: var(--pink); top: -120px; left: -140px; }
.o2 { width: 380px; height: 380px; background: var(--cyan); bottom: -140px; right: -120px; animation-delay: -6s; opacity: .35; }
.o3 { width: 300px; height: 300px; background: var(--violet); top: 40%; left: 50%; animation-delay: -12s; opacity: .4; }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.15); } }
.grain { position: absolute; inset: -50%; opacity: .07; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(4) infinite; }
@keyframes grain { 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); } }

/* ---------- app frame ---------- */
.app { position: relative; z-index: 1; height: 100%; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; }
@media (min-width: 560px) {
  .app { border-inline: 1px solid var(--line); background: rgba(11, 6, 32, .35); backdrop-filter: blur(6px); }
}

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.player-chip { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); }
.chip-avatar { width: 40px; height: 40px; display: grid; place-items: center; }
.chip-meta { display: flex; flex-direction: column; text-align: start; line-height: 1.15; min-width: 0; }
.chip-meta b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 96px; }
.chip-meta small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.xpbar { flex: 1; height: 12px; border-radius: 99px; background: rgba(255, 255, 255, .08); position: relative; overflow: hidden; min-width: 40px; }
.xpbar i { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--lime), var(--cyan)); box-shadow: 0 0 12px var(--cyan); transition: width .8s var(--ease); }
.xpbar span { position: absolute; inset: 0; font-size: 9px; display: grid; place-items: center; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; direction: ltr; }
.coins { display: flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: linear-gradient(180deg, #3A2A00, #241800); border: 1px solid #6B5100; }
.coins b { font-family: var(--display); color: var(--sun); font-size: 16px; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--line); font-size: 16px; }

/* ---------- screens ---------- */
.screens { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 16px 110px; scrollbar-width: none; }
.screens::-webkit-scrollbar { display: none; }
.screen { display: none; animation: screenIn .45s var(--ease); }
.screen.active { display: block; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.screen-title { font-family: var(--display); font-size: 30px; margin: 10px 0 16px; }
.sec-title { font-family: var(--display); font-size: 20px; margin: 22px 0 10px; color: var(--muted); font-weight: 600; }
.note { color: var(--muted); font-size: 13px; text-align: center; margin: 14px 0; line-height: 1.5; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 6px 0 2px; position: relative; }
.hero-char { height: 150px; display: grid; place-items: center; filter: drop-shadow(0 18px 30px rgba(255, 61, 154, .35)); }
.logo { font-family: var(--display); font-size: 64px; line-height: 1; margin: 4px 0 4px; letter-spacing: -1px;
  background: linear-gradient(180deg, #fff 30%, #FFB6E0); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(255, 61, 154, .35); }
.logo span { color: var(--pink); -webkit-text-fill-color: var(--pink); }
.hero-sub { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- character animations ---------- */
.char { overflow: visible; display: block; }
.char.bob .ch-body { animation: bob 2.4s ease-in-out infinite; transform-origin: 100px 180px; }
.char.bob.d1 .ch-body { animation-delay: -.8s; } .char.bob.d2 .ch-body { animation-delay: -1.6s; }
.char.jump .ch-body { animation: jump .7s var(--ease) 3; transform-origin: 100px 180px; }
.char .ch-eyes { animation: blink 4.5s infinite; transform-origin: 100px 94px; }
@keyframes bob { 50% { transform: translateY(-8px) scaleY(1.03) scaleX(.98); } }
@keyframes jump { 0% { transform: scale(1.15, .85); } 40% { transform: translateY(-30px) scale(.92, 1.08); } 100% { transform: none; } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.ch-twinkle { animation: tw 1.6s ease-in-out infinite alternate; } @keyframes tw { to { opacity: .2; } }
.ch-flame { animation: flame .5s ease-in-out infinite alternate; transform-origin: 100px 60px; } @keyframes flame { to { transform: scale(1.06, .94); } }
.ch-halo { animation: halo 2s ease-in-out infinite; } @keyframes halo { 50% { transform: translateY(-4px); } }
.ch-blink-light { animation: tw .8s infinite alternate; }

/* ---------- daily card ---------- */
.daily-card { position: relative; display: grid; gap: 4px; width: 100%; text-align: start; margin-top: 18px; padding: 18px 18px 16px;
  border-radius: var(--r); overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gc, var(--pink)) 40%, #1A0B4D), #1A0B4D 70%);
  border: 1px solid color-mix(in srgb, var(--gc, var(--pink)) 60%, transparent);
  box-shadow: 0 12px 40px -10px color-mix(in srgb, var(--gc, var(--pink)) 60%, transparent);
  transition: transform .2s var(--ease); }
.daily-card::after { content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .18) 50%, transparent 70%); transform: translateX(-100%); animation: shine 3.5s ease-in-out infinite; }
@keyframes shine { 60%, 100% { transform: translateX(100%); } }
.daily-card:active { transform: scale(.97); }
.daily-tag { font-size: 12px; font-weight: 700; color: var(--sun); letter-spacing: .3px; }
.daily-card b { font-family: var(--display); font-size: 26px; }
.daily-card small { color: rgba(255, 255, 255, .78); font-size: 14px; }
.daily-cta { justify-self: end; margin-top: 6px; font-weight: 700; background: #fff; color: var(--dark); padding: 7px 14px; border-radius: 999px; font-size: 14px; }

.challenge-banner { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px; border-radius: var(--r);
  background: linear-gradient(135deg, #3B0A2A, #1A0B4D); border: 1px dashed var(--pink); animation: pulse 1.8s ease-in-out infinite; }
.challenge-banner div { flex: 1; display: grid; } .challenge-banner small { color: var(--muted); font-size: 12px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 61, 154, .15); } }

/* ---------- game grid ---------- */
.game-grid { display: grid; gap: 12px; }
.game-card { position: relative; display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto auto; column-gap: 14px; text-align: start;
  padding: 16px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--line); overflow: hidden;
  transition: transform .2s var(--ease), border-color .2s, background .2s; }
.game-card::before { content: ''; position: absolute; inset-inline-start: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%;
  background: var(--gc); filter: blur(50px); opacity: .35; transition: opacity .3s; }
.game-card:hover { border-color: color-mix(in srgb, var(--gc) 70%, transparent); background: var(--glass2); }
.game-card:hover::before { opacity: .6; }
.game-card:active { transform: scale(.97); }
.gc-ico { grid-row: 1 / 4; width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 32px; position: relative;
  background: color-mix(in srgb, var(--gc) 22%, transparent); border: 1px solid color-mix(in srgb, var(--gc) 50%, transparent); }
.game-card b { font-family: var(--display); font-size: 21px; position: relative; }
.game-card small { color: var(--muted); font-size: 13px; position: relative; line-height: 1.35; }
.gc-best { font-size: 12px; color: var(--gc); font-weight: 700; margin-top: 4px; position: relative; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 13px 18px; border-radius: 16px; font-weight: 700;
  background: var(--glass2); border: 1px solid var(--line); transition: transform .15s var(--ease), filter .2s; white-space: nowrap; }
.btn:active:not(:disabled) { transform: scale(.94); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #FF6BB5, var(--pink)); border-color: #FF8CC6; color: #fff;
  box-shadow: 0 6px 0 #A3155C, 0 10px 24px -6px rgba(255, 61, 154, .7); }
.btn.primary:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #A3155C; }
.btn.ghost { background: transparent; }
.btn.danger { background: #5A0E1E; border-color: #A3243F; color: #FFC4CF; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 12px; }
.btn.big { padding: 16px 22px; font-size: 18px; width: 100%; }
.btn.on { background: rgba(182, 255, 59, .15); border-color: var(--lime); color: var(--lime); opacity: 1; }
.btn.plus { background: linear-gradient(135deg, #6A5CFF, #FF3D9A); border-color: transparent; }
.link-btn { display: block; margin: 26px auto 0; font-size: 13px; color: var(--muted); text-decoration: underline; }
.link-btn.danger { color: #FF8FA3; }

/* ---------- tab bar ---------- */
.tabbar { position: absolute; bottom: 0; inset-inline: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 8px calc(10px + var(--safe-b)); background: linear-gradient(180deg, rgba(11, 6, 32, 0), rgba(11, 6, 32, .92) 30%); }
.tabbar button { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 0; font-size: 11px; color: var(--muted); border-radius: 14px; transition: color .2s; }
.tabbar button span { font-size: 22px; transition: transform .3s var(--ease); filter: grayscale(.6); }
.tabbar button.on { color: #fff; background: var(--glass); }
.tabbar button.on span { transform: translateY(-3px) scale(1.15); filter: none; }
.dot { position: absolute; top: 6px; inset-inline-end: 22%; width: 9px; height: 9px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 8px var(--pink); }

/* ---------- missions ---------- */
.streak-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r); margin-bottom: 14px;
  background: linear-gradient(135deg, #4A1A00, #1A0B4D); border: 1px solid #9A4A00; }
.streak-card div { display: grid; } .streak-card b { font-family: var(--display); font-size: 22px; } .streak-card small { color: var(--muted); }
.streak-flame { font-size: 40px; animation: flicker 1s ease-in-out infinite alternate; } @keyframes flicker { to { transform: scale(1.12) rotate(-4deg); } }
.missions { display: grid; gap: 10px; }
.mission { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); }
.mission.ready { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(182, 255, 59, .12); }
.mission.done { opacity: .55; }
.m-text { flex: 1; display: grid; gap: 6px; } .m-text b { font-size: 14px; } .m-text small { color: var(--muted); font-size: 12px; }
.m-bar { height: 8px; border-radius: 9px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.m-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--sun), var(--lime)); border-radius: inherit; transition: width .6s var(--ease); }

/* ---------- shop ---------- */
.plus-card { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: var(--r); margin-bottom: 16px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #2B1B9A, #6A0F4F); border: 1px solid rgba(255, 255, 255, .25); }
.plus-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .15) 50%, transparent 70%); animation: shine 4s infinite; pointer-events: none; transform: translateX(-100%); }
.plus-chars { display: flex; margin-inline-end: -6px; } .plus-chars .char + .char { margin-inline-start: -26px; }
.plus-text { flex: 1; display: grid; gap: 2px; } .plus-text b { font-family: var(--display); font-size: 20px; } .plus-text small { font-size: 12px; color: rgba(255, 255, 255, .8); line-height: 1.35; }
.shop-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.shop-card { position: relative; display: grid; justify-items: center; gap: 4px; padding: 14px 10px 12px; border-radius: var(--r); text-align: center;
  background: var(--glass); border: 1px solid var(--line); transition: transform .2s var(--ease); }
.shop-card.sel { border-color: var(--lime); background: rgba(182, 255, 59, .07); }
.shop-card.locked .sc-char { filter: saturate(.55) brightness(.8); }
.shop-card b { font-family: var(--display); font-size: 18px; }
.shop-card small { color: var(--muted); font-size: 12px; min-height: 32px; line-height: 1.35; }
.sc-char { height: 100px; display: grid; place-items: center; }
.rarity { position: absolute; top: 10px; inset-inline-start: 10px; font-size: 10px; font-weight: 700; color: var(--rc); padding: 3px 8px; border-radius: 99px; border: 1px solid var(--rc); background: color-mix(in srgb, var(--rc) 12%, transparent); }

/* ---------- leaderboard ---------- */
.seg { display: flex; gap: 6px; padding: 4px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); margin-bottom: 10px; overflow-x: auto; }
.seg button { flex: 1; padding: 10px 8px; border-radius: 12px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg button.on { background: #fff; color: var(--dark); }
.seg-sm button { padding: 7px; font-size: 12px; }
.board { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.board li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); }
.board li.me { border-color: var(--cyan); background: rgba(34, 228, 255, .07); }
.board li.empty { justify-content: center; color: var(--muted); padding: 26px; }
.board .pos { width: 30px; text-align: center; font-family: var(--display); font-size: 18px; }
.board .nm { flex: 1; display: grid; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.board .nm small { color: var(--muted); font-size: 11px; font-weight: 400; }
.board b { font-family: var(--display); font-size: 18px; color: var(--sun); }

/* ---------- profile ---------- */
.profile-card { padding: 18px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--line); display: grid; gap: 14px; justify-items: center; }
.pc-char { filter: drop-shadow(0 14px 24px rgba(34, 228, 255, .3)); }
.name-field { width: 100%; display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.name-field input, .onboard input, .login input { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); color: #fff; font-size: 16px; }
.stats { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.stats div { display: grid; padding: 10px 4px; border-radius: 14px; background: rgba(0, 0, 0, .2); }
.stats b { font-family: var(--display); font-size: 17px; } .stats small { color: var(--muted); font-size: 11px; }
.account-card { margin-top: 12px; padding: 16px; border-radius: var(--r); display: grid; gap: 8px; background: linear-gradient(135deg, rgba(34, 228, 255, .1), rgba(139, 92, 255, .1)); border: 1px solid rgba(34, 228, 255, .3); }
.account-card small { color: var(--muted); line-height: 1.45; font-size: 13px; }
.login { display: flex; gap: 8px; }
.ranks { margin-top: 12px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.rank { display: grid; justify-items: center; padding: 10px 2px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); filter: grayscale(1); opacity: .5; }
.rank.got { filter: none; opacity: 1; border-color: var(--rk); }
.rank span { font-size: 24px; } .rank b { font-size: 12px; color: var(--rk); } .rank small { font-size: 10px; color: var(--muted); }

/* ---------- stage (game) ---------- */
.stage { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: var(--bg);
  opacity: 0; transform: scale(1.04); transition: opacity .25s, transform .35s var(--ease); }
.stage.open { opacity: 1; transform: none; }
.stage::before { content: ''; position: absolute; inset: 0; background: radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--gc) 30%, transparent), transparent 70%); pointer-events: none; }
.stage-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; max-width: 480px; width: 100%; margin: 0 auto; }
.stage-top b { font-family: var(--display); font-size: 20px; }
.stage-char { width: 42px; }
.stage-body { position: relative; flex: 1; max-width: 480px; width: 100%; margin: 0 auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }

/* timer game */
.g-timer { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 16px; }
.g-target { font-size: 18px; color: var(--muted); } .g-target b { font-family: var(--display); font-size: 34px; color: var(--cyan); direction: ltr; display: inline-block; }
.g-timer-dial { position: relative; width: min(78vw, 320px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; align-content: center;
  background: radial-gradient(circle at 50% 35%, #2A1570, #120833); box-shadow: 0 0 0 10px rgba(34, 228, 255, .06), 0 30px 80px -20px rgba(34, 228, 255, .5), inset 0 -10px 30px rgba(0, 0, 0, .5);
  transition: transform .15s; }
.g-timer-dial:active { transform: scale(.96); }
.dial-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .07); stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--cyan); stroke-width: 8; stroke-linecap: round; filter: drop-shadow(0 0 8px var(--cyan)); transition: opacity .4s; }
.g-timer-num { font-family: var(--display); font-size: clamp(64px, 20vw, 96px); font-weight: 700; direction: ltr; font-variant-numeric: tabular-nums; transition: filter .4s, opacity .4s; }
.g-timer-hint { color: var(--muted); font-size: 15px; margin-top: 4px; direction: rtl; }
.hidden-time .g-timer-num { filter: blur(3px); opacity: .5; animation: wobble 1.4s ease-in-out infinite; }
.hidden-time .ring-fg { opacity: 0; }
.hidden-time { animation: heartbeat 1s ease-in-out infinite; }
@keyframes heartbeat { 50% { box-shadow: 0 0 0 18px rgba(255, 61, 154, .1), 0 30px 80px -20px rgba(255, 61, 154, .6), inset 0 -10px 30px rgba(0, 0, 0, .5); } }
@keyframes wobble { 50% { transform: scale(1.05); } }
.revealed .g-timer-num { color: var(--sun); animation: reveal .5s var(--ease); }
.revealed .g-timer-hint { color: #fff; font-weight: 700; font-size: 20px; direction: ltr; }
@keyframes reveal { from { transform: scale(1.6); filter: blur(8px); } }
.g-sub { color: var(--muted); font-size: 13px; margin: 0; text-align: center; }

/* reflex game */
.g-reflex { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-radius: 28px 28px 0 0;
  transition: background .08s; background: #1D0F44; cursor: pointer; }
.g-reflex[data-s="go"] { background: var(--lime); color: var(--dark); }
.g-reflex[data-s="decoy"] { background: var(--pink); }
.g-reflex[data-s="fail"] { background: #5A0E1E; animation: shake .4s; }
.g-reflex[data-s="hit"] { background: #12324A; }
.g-reflex-top { position: absolute; top: 16px; inset-inline: 16px; display: flex; justify-content: space-between; font-weight: 700; }
.g-reflex-msg { font-family: var(--display); font-size: clamp(40px, 12vw, 64px); text-align: center; padding: 0 16px; }
.g-reflex-ms { font-family: var(--display); font-size: 30px; color: var(--cyan); direction: ltr; min-height: 40px; }
.g-reflex-list { position: absolute; bottom: 30px; display: flex; gap: 8px; direction: ltr; }
.g-reflex-list span { padding: 6px 10px; border-radius: 10px; background: rgba(0, 0, 0, .3); font-weight: 700; font-size: 14px; animation: pop .3s var(--ease); }
@keyframes shake { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* stack game */
.g-stack { position: absolute; inset: 0; cursor: pointer; }
.g-stack-cv { width: 100%; height: 100%; display: block; border-radius: 28px 28px 0 0; }
.g-stack-hud { position: absolute; top: 18px; inset-inline: 0; text-align: center; display: grid; pointer-events: none; }
.g-stack-hud b { font-family: var(--display); font-size: 64px; line-height: 1; text-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
.g-stack-hud span { color: rgba(255, 255, 255, .7); font-size: 14px; }
.g-stack-combo { position: absolute; top: 120px; inset-inline: 0; text-align: center; font-family: var(--display); font-size: 28px; color: var(--sun); opacity: 0; pointer-events: none; }
.g-stack-combo.pop { animation: comboPop .9s var(--ease); }
@keyframes comboPop { 0% { opacity: 0; transform: scale(.5); } 20% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0; transform: translateY(-30px); } }
.g-stack-hint { position: absolute; bottom: 40px; inset-inline: 0; text-align: center; font-weight: 700; font-size: 18px; animation: wobble 1.2s infinite; pointer-events: none; }
.g-stack-hint.gone { display: none; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(5, 2, 16, .7); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .22s; }
.modal.open { opacity: 1; }
.modal-card { width: 100%; max-width: 420px; max-height: 92vh; overflow-y: auto; padding: 22px 18px; border-radius: 28px; background: linear-gradient(180deg, #24125E, #120833);
  border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 30px 80px -20px #000; transform: translateY(30px) scale(.95); transition: transform .35s var(--ease); }
.modal.open .modal-card { transform: none; }

.result { display: grid; justify-items: center; text-align: center; gap: 6px; }
.badge-best { background: var(--sun); color: var(--dark); font-weight: 800; padding: 6px 14px; border-radius: 99px; animation: pop .5s var(--ease); }
.result-big { font-family: var(--display); font-size: 76px; line-height: 1; color: var(--gc); text-shadow: 0 0 30px color-mix(in srgb, var(--gc) 50%, transparent); animation: reveal .6s var(--ease); }
.result-big small { font-size: 22px; color: #fff; margin-inline-start: 6px; }
.result-sub { margin: 0; color: var(--muted); }
.result-gains { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 4px; }
.result-gains div { display: grid; padding: 10px 4px; border-radius: 16px; background: rgba(0, 0, 0, .25); }
.result-gains b { font-family: var(--display); font-size: 24px; } .result-gains small { color: var(--muted); font-size: 12px; }
.levelup { width: 100%; padding: 10px; border-radius: 14px; background: linear-gradient(90deg, rgba(182, 255, 59, .2), rgba(34, 228, 255, .2)); border: 1px solid var(--lime); font-weight: 700; animation: pop .5s var(--ease); }
.result-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.result-actions .primary { grid-column: 1 / -1; font-size: 18px; padding: 16px; }
.result-actions #rHome { grid-column: 1 / -1; padding: 10px; }
.onboard { display: grid; gap: 14px; text-align: center; }
.ob-chars { display: flex; justify-content: center; } .ob-chars .char:nth-child(2) { transform: translateY(-14px) scale(1.15); }
.onboard h2 { font-family: var(--display); font-size: 32px; margin: 0; } .onboard p { color: var(--muted); margin: 0; line-height: 1.5; }
.confirm { display: grid; gap: 8px; text-align: center; } .confirm b { font-size: 20px; } .confirm p { color: var(--muted); }

/* ---------- toast + fx ---------- */
.toast { position: fixed; z-index: 60; bottom: calc(96px + var(--safe-b)); left: 50%; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 16px; background: #fff; color: var(--dark); font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  transition: .3s var(--ease); max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.fx-canvas { position: fixed; inset: 0; z-index: 70; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
