/* =====================================================================
   איירם / AyReem — v2 UI styles.
   Bidirectional: logical properties only. The few physical things (bar
   fill origin, gradient sheen) read --origin / --to-start, which flip with
   <html dir>. Numbers live in .num[dir=ltr] nodes.
   ===================================================================== */

/* ---------------------------------------------------------------- */
/* 1. Tokens                                                         */
/* ---------------------------------------------------------------- */
:root {
  --o: #0b1030;                 /* outline */
  --ink: #ffffff;
  --ink-2: #dfe6ff;
  --ink-dim: #a9b6e6;
  --ink-faint: #7584bd;

  --glass: rgba(18, 24, 66, 0.72);
  --glass-2: rgba(32, 42, 104, 0.82);
  --panel-a: #2c3a8c;
  --panel-b: #1a2260;

  --yellow: #ffd23f; --yellow-d: #d98a00; --yellow-l: #fff1a0;
  --green: #45e06b;  --green-d: #149038;  --green-l: #b8ffb0;
  --blue: #3ea2ff;   --blue-d: #1652c4;   --blue-l: #b8e0ff;
  --red: #ff4d5e;    --red-d: #b3132c;    --red-l: #ffb3b8;
  --purple: #be6bff; --purple-d: #6a1fc4;
  --cyan: #46e6f0;
  --pink: #ff5bd0;

  --r-xl: 28px; --r-lg: 22px; --r-md: 16px; --r-sm: 11px; --r-pill: 999px;
  --bw: 3px;

  --font: ui-rounded, 'SF Pro Rounded', 'Arial Rounded MT Bold', system-ui, -apple-system,
    'Segoe UI', 'Arial Hebrew', 'Noto Sans Hebrew', 'Heebo', 'Rubik', Arial, sans-serif;

  /* chunky outlined game text */
  --ts-o: 0 2px 0 var(--o), 2px 0 0 var(--o), -2px 0 0 var(--o), 0 -2px 0 var(--o),
    1.6px 1.6px 0 var(--o), -1.6px 1.6px 0 var(--o), 1.6px -1.6px 0 var(--o), -1.6px -1.6px 0 var(--o),
    0 4px 0 var(--o), 0 6px 10px rgba(0, 0, 0, 0.35);
  --ts-o-sm: 0 1.5px 0 var(--o), 1.5px 0 0 var(--o), -1.5px 0 0 var(--o), 0 -1.5px 0 var(--o),
    1px 1px 0 var(--o), -1px 1px 0 var(--o), 1px -1px 0 var(--o), -1px -1px 0 var(--o), 0 3px 0 var(--o);

  --sh-card: 0 6px 0 rgba(5, 8, 30, 0.7), 0 14px 30px rgba(0, 0, 0, 0.4);
  --sh-pop: 0 24px 60px rgba(0, 0, 0, 0.55);
  --gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.08) 46%, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.12) 100%);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --dur-fast: 110ms; --dur: 260ms; --dur-slow: 560ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* direction-dependent physical helpers (RTL default) */
  --origin: right;
  --to-start: to left;    /* gradient whose first stop sits at the inline START */
  --flip: -1;
}
:root[dir='ltr'] { --origin: left; --to-start: to right; --flip: 1; }

/* ---------------------------------------------------------------- */
/* 2. Reset / page                                                   */
/* ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #0a0e2c; color: var(--ink);
  font-family: var(--font); font-size: 16px;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body { touch-action: none; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; }
canvas#game, canvas.game-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; touch-action: none; }
.layer { position: absolute; inset: 0; pointer-events: none; }
button { font-family: inherit; color: inherit; }
input { font-family: inherit; }

.fatal {
  position: fixed; inset-block-start: 50%; inset-inline-start: 50%;
  transform: translate(calc(50% * var(--flip) * -1), -50%);
  z-index: 999; width: min(520px, 90vw); padding: 26px 28px; text-align: center;
  border: 4px solid var(--o); border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--panel-a), var(--panel-b)); box-shadow: var(--sh-pop);
}
.fatal h1 { margin: 0 0 8px; font-size: 34px; font-weight: 900; color: var(--yellow); text-shadow: var(--ts-o); }
.fatal p { margin: 0 0 12px; font-weight: 700; }
.fatal pre { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: rgba(0,0,0,.45); color: var(--ink-dim); font-size: 12px; text-align: start; white-space: pre-wrap; word-break: break-word; unicode-bidi: isolate; }

.num, [dir='ltr'] { unicode-bidi: isolate; }
.num { direction: ltr; display: inline-block; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* icons */
.ico { display: inline-block; width: 1em; height: 1em; flex: 0 0 auto; vertical-align: -0.15em; overflow: visible; }
[dir='rtl'] .ico-back, [dir='rtl'] .ico-next { transform: scaleX(-1); }
.muted { color: var(--ink-dim); font-weight: 700; font-size: 14px; padding: 6px 2px; }
.spacer { flex: 1 1 auto; }

/* staggered entrance for anything marked .rise (screens.js sets --i) */
.screen.is-active .rise { animation: riseIn 520ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 45ms + 60ms); }
@keyframes riseIn { from { opacity: 0; transform: translateY(18px) scale(0.94); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- */
/* 3. Roots, backdrop, screen machinery                              */
/* ---------------------------------------------------------------- */
#ui-root, .ui-root { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.screens { position: absolute; inset: 0; z-index: 2; }

.ui-backdrop {
  position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  --bd1: #3b46d6; --bd2: #1b1f7a; --bd3: #0b0d3a; --bdr: rgba(160, 190, 255, 0.10);
  transition: opacity 400ms linear;
}
.ui-root.over-game .ui-backdrop { opacity: 0; }
.ui-root[data-screen='select'] .ui-backdrop { --bd1: #2d7dff; --bd2: #183aa8; --bd3: #091544; }
.ui-root[data-screen='campaign'] .ui-backdrop { --bd1: #20b37a; --bd2: #11655a; --bd3: #062a2e; }
.ui-root[data-screen='upgrade'] .ui-backdrop,
.ui-root[data-screen='roadmap'] .ui-backdrop { --bd1: #9a4cff; --bd2: #4a1ea8; --bd3: #170a44; }
.ui-root[data-screen='trophyroad'] .ui-backdrop { --bd1: #ff9a2e; --bd2: #b2361f; --bd3: #3a0c1c; }
.ui-root[data-screen='help'] .ui-backdrop { --bd1: #23b8e6; --bd2: #1855a8; --bd3: #0a1844; }
.ui-root[data-screen='players'] .ui-backdrop { --bd1: #ff5bb0; --bd2: #7a2ab8; --bd3: #1d0b44; }
.ui-root[data-screen='result'][data-result='win'] .ui-backdrop { --bd1: #ffc23d; --bd2: #e0611d; --bd3: #4a1208; --bdr: rgba(255, 240, 180, 0.16); }
.ui-root[data-screen='result'][data-result='lose'] .ui-backdrop { --bd1: #5866a8; --bd2: #2a2f68; --bd3: #0d0f2a; }

.bd-base { position: absolute; inset: 0; background: radial-gradient(120% 85% at 50% 38%, var(--bd1) 0%, var(--bd2) 48%, var(--bd3) 100%); transition: background 500ms; }
.bd-rays {
  position: absolute; left: 50%; top: 42%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax;
  background: repeating-conic-gradient(from 0deg, var(--bdr) 0deg 9deg, transparent 9deg 22deg);
  -webkit-mask: radial-gradient(closest-side, #000 15%, transparent 70%); mask: radial-gradient(closest-side, #000 15%, transparent 70%);
  animation: spin 90s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bd-pattern {
  position: absolute; inset: -40px;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.035) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.035) 75%),
    linear-gradient(45deg, rgba(255,255,255,.035) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.035) 75%);
  background-size: 64px 64px; background-position: 0 0, 32px 32px;
  animation: patternDrift 30s linear infinite;
  -webkit-mask: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); mask: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}
@keyframes patternDrift { to { transform: translate(64px, 64px); } }
.bd-shapes { position: absolute; inset: 0; }
.bd-s {
  position: absolute; left: var(--x); bottom: -80px; width: 46px; height: 46px; opacity: 0.16;
  animation: floatUp var(--d) linear infinite; animation-delay: var(--dl);
  --sc: var(--s);
}
.bd-sq { border-radius: 10px; background: #fff; }
.bd-ring { border-radius: 50%; border: 7px solid #fff; }
.bd-tri { clip-path: polygon(50% 0, 100% 100%, 0 100%); background: #fff; }
.bd-star { clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%); background: #fff; }
@keyframes floatUp {
  from { transform: translateY(0) rotate(var(--r)) scale(var(--sc)); }
  to { transform: translateY(-120vh) rotate(calc(var(--r) + 300deg)) scale(var(--sc)); }
}
.bd-sparks i {
  position: absolute; left: var(--x); top: var(--y); width: 4px; height: 4px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 8px 2px rgba(255,255,255,.7);
  animation: twinkle var(--d) ease-in-out infinite; animation-delay: var(--dl); opacity: 0;
}
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: .9; transform: scale(1.2); } }
.bd-vignette { position: absolute; inset: 0; background: radial-gradient(130% 100% at 50% 45%, transparent 55%, rgba(4, 6, 24, 0.75) 100%); }

.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; overflow: hidden; pointer-events: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), visibility 0s linear var(--dur);
  transform: scale(0.97);
}
.screen.is-active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; pointer-events: auto; }
.screen.is-active.nav-fwd { animation: scrFwd 420ms var(--ease-out) both; }
.screen.is-active.nav-back { animation: scrBack 420ms var(--ease-out) both; }
@keyframes scrFwd { from { opacity: 0; transform: translateX(calc(40px * var(--flip))) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes scrBack { from { opacity: 0; transform: translateX(calc(-40px * var(--flip))) scale(0.985); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- */
/* 4. Chrome: header, body, footer                                   */
/* ---------------------------------------------------------------- */
.scr-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: calc(14px + var(--safe-t)) calc(20px + var(--safe-r)) 10px calc(20px + var(--safe-l));
  position: relative; z-index: 3;
}
.head-txt { min-width: 0; }
.head-title {
  margin: 0; font-size: clamp(24px, 3.3vw, 38px); font-weight: 900; line-height: 1.05;
  letter-spacing: 0.2px; text-shadow: var(--ts-o);
}
.scr-head .sub { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); font-weight: 700; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.scr-head .sub:empty { display: none; }

.scr-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y;
  padding: 6px calc(20px + var(--safe-r)) calc(20px + var(--safe-b)) calc(20px + var(--safe-l));
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent;
}
.scr-body::-webkit-scrollbar { width: 10px; }
.scr-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 6px; }

.scr-foot {
  flex: 0 0 auto; display: flex; gap: 14px; justify-content: flex-end; align-items: center; flex-wrap: wrap;
  padding: 12px calc(22px + var(--safe-r)) calc(14px + var(--safe-b)) calc(22px + var(--safe-l));
  background: linear-gradient(to top, rgba(6, 9, 34, 0.9), rgba(6, 9, 34, 0));
  position: relative; z-index: 3;
}

.sec-title {
  display: flex; align-items: center; gap: 10px; margin: 18px 0 10px;
  font-size: 17px; font-weight: 900; color: #fff; text-shadow: var(--ts-o-sm); letter-spacing: 0.3px;
}
.sec-title .sec-ico { font-size: 24px; }
.sec-title::after { content: ''; flex: 1 1 auto; height: 4px; border-radius: 3px; background: linear-gradient(var(--to-start), rgba(255,255,255,.28), transparent); }

/* ---------------------------------------------------------------- */
/* 5. Buttons                                                        */
/* ---------------------------------------------------------------- */
.btn {
  --bt: #3d4fb8; --bb: #24308a; --bl: #24308a; --bfg: #fff;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 10px 26px 13px;
  border: var(--bw) solid var(--o); border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--bt), var(--bb));
  color: var(--bfg); font-size: 18px; font-weight: 900; letter-spacing: 0.2px;
  text-shadow: var(--ts-o-sm); cursor: pointer; white-space: nowrap;
  box-shadow: inset 0 -5px 0 var(--bl), inset 0 2px 0 rgba(255,255,255,.45), 0 4px 0 var(--o), 0 9px 18px rgba(0,0,0,.35);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), filter var(--dur-fast);
  touch-action: manipulation; isolation: isolate;
}
.btn::before { content: ''; position: absolute; inset: 3px 5px 50% 5px; border-radius: 12px 12px 40% 40% / 12px 12px 14px 14px; background: linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,.06)); pointer-events: none; z-index: -1; }
.btn:hover { filter: brightness(1.08) saturate(1.05); transform: translateY(-2px); }
.btn:active { transform: translateY(4px); box-shadow: inset 0 -2px 0 var(--bl), inset 0 2px 0 rgba(255,255,255,.35), 0 0 0 var(--o), 0 3px 8px rgba(0,0,0,.35); }
.btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.btn[disabled], .btn.is-disabled { filter: grayscale(0.8) brightness(0.7); cursor: not-allowed; pointer-events: none; }
.btn .btn-ico { font-size: 1.25em; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); }
.btn-primary { --bt: #ffe25c; --bb: #ffb81c; --bl: #d77d00; --bfg: #fff; }
.btn-green { --bt: #7ff59a; --bb: #2cc556; --bl: #128a34; }
.btn-blue { --bt: #6fc1ff; --bb: #2a7ff0; --bl: #1550b8; }
.btn-red { --bt: #ff8a92; --bb: #f03a4e; --bl: #a8102a; }
.btn-chip {
  --bt: rgba(40, 52, 130, .92); --bb: rgba(22, 30, 86, .92); --bl: rgba(10, 14, 50, .9);
  min-height: 46px; padding: 6px 14px 9px; font-size: 15px; border-radius: var(--r-sm);
}
.btn-square { width: 50px; padding: 0 0 3px; }
.btn-square .btn-ico { font-size: 26px; }
.btn-danger .btn-ico { filter: none; }
.btn-sm { min-height: 40px; padding: 5px 14px 8px; font-size: 14px; border-radius: var(--r-sm); }
.btn-md { min-height: 48px; padding: 7px 18px 10px; font-size: 16px; }
.btn-lg { min-height: 62px; padding: 10px 34px 14px; font-size: 21px; border-radius: var(--r-lg); }
.btn-xl { min-height: 76px; padding: 12px 44px 16px; font-size: 30px; border-radius: var(--r-xl); }
.btn-xl .btn-ico { font-size: 1.05em; }
.btn-back { --bt: #ffe25c; --bb: #ffb81c; --bl: #d77d00; width: 56px; min-height: 56px; padding: 0 0 4px; border-radius: 16px; }
.btn-back .btn-ico { font-size: 30px; }
.btn.can-buy { animation: canBuy 1.6s ease-in-out infinite; }
@keyframes canBuy { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.22) drop-shadow(0 0 12px rgba(120, 255, 150, .8)); } }
.btn.bump { animation: btnBump 520ms var(--ease-spring); }
@keyframes btnBump { 0% { transform: scale(1); } 35% { transform: scale(1.12); } 100% { transform: scale(1); } }
.btn.nope { animation: nope 420ms ease; }
@keyframes nope { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* ---------------------------------------------------------------- */
/* 6. Panels, chips, bars, pills                                     */
/* ---------------------------------------------------------------- */
.panel, .glass {
  position: relative; border: var(--bw) solid var(--o); border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(48, 62, 156, .94), rgba(24, 31, 96, .96));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.18), inset 0 -4px 0 rgba(0,0,0,.18), var(--sh-card);
  padding: 16px;
}
.glass { background: linear-gradient(180deg, rgba(36, 46, 124, .86), rgba(16, 22, 74, .9)); backdrop-filter: blur(6px); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border-radius: var(--r-pill); background: rgba(5, 8, 36, .5); border: 2px solid rgba(255,255,255,.14);
  font-size: 13px; font-weight: 800; color: var(--ink-2); white-space: nowrap;
}
.chip .chip-ico { font-size: 16px; }
.chip.is-gold { color: #3a2000; background: linear-gradient(180deg, #ffe680, #ffb81c); border-color: var(--o); text-shadow: none; }
.chip-strong { color: #fff; background: rgba(255,255,255,.12); }
.backend-chip { font-size: 12px; }

.bar { position: relative; height: 14px; border-radius: var(--r-pill); background: rgba(4, 6, 30, .6); border: 2.5px solid var(--o); overflow: hidden; box-shadow: inset 0 2px 3px rgba(0,0,0,.5); }
.bar > .fill {
  display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: var(--origin) center;
  will-change: transform; transition: transform var(--dur-slow) var(--ease-out);
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0) 55%), var(--fc, linear-gradient(180deg, #7bf59a, #22b14c));
  background-color: var(--fc, #2cc556);
}
.mini-bar { display: block; width: 92px; height: 10px; border-radius: 99px; background: rgba(0,0,0,.45); border: 2px solid var(--o); overflow: hidden; }
.mini-bar .fill { display: block; height: 100%; width: 100%; transform-origin: var(--origin) center; transform: scaleX(0); background: linear-gradient(180deg, #fff3a0, #ffb81c); transition: transform 700ms var(--ease-out); }

.lvl-pill, .tro-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 5px;
  border-radius: var(--r-pill); border: 2.5px solid var(--o); font-weight: 900; font-size: 15px;
  text-shadow: var(--ts-o-sm); white-space: nowrap; box-shadow: 0 3px 0 var(--o);
}
.lvl-pill { background: linear-gradient(180deg, color-mix(in srgb, var(--lc, #3ea2ff) 75%, #fff), var(--lc, #3ea2ff)); }
.lvl-pill .lv-ico { font-size: 15px; text-shadow: none; }
.tro-pill { background: linear-gradient(180deg, #4a3a10, #2a1e00); color: var(--yellow); }
.tro-pill .tp-ico { font-size: 18px; }

.rarity-chip {
  display: inline-flex; align-items: center; padding: 3px 12px 4px; border-radius: 8px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 70%, #fff), var(--rc) 55%, var(--rd));
  border: 2.5px solid var(--o); font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.6px;
  color: #fff; text-shadow: var(--ts-o-sm); box-shadow: 0 3px 0 var(--o); white-space: nowrap;
}

.pres-slot { display: inline-flex; align-items: center; gap: 6px; }
.pres-slot:not(.has-prestige):empty { display: none; }
.prestige-badge { width: 34px; height: 34px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.4)) drop-shadow(0 0 8px var(--pa)); flex: 0 0 auto; }
.prestige-badge.pb-xs { width: 22px; height: 22px; }
.prestige-badge.pb-sm { width: 30px; height: 30px; }
.prestige-badge.pb-md { width: 44px; height: 44px; }
.prestige-badge.pb-lg { width: 62px; height: 62px; }

.medal-badge { width: 46px; height: 46px; flex: 0 0 auto; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
.medal-badge.pop { animation: medalpop 560ms var(--ease-spring) both; }
@keyframes medalpop { 0% { transform: scale(.2) rotate(-30deg); opacity: 0; } 60% { transform: scale(1.15) rotate(6deg); opacity: 1; } 100% { transform: none; } }

/* resource strip */
.res-strip { display: flex; align-items: center; gap: 10px; }
.res {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding-inline: 6px 16px; border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(4, 6, 30, .72), rgba(4, 6, 30, .85));
  border: 2.5px solid var(--o); box-shadow: inset 0 2px 0 rgba(255,255,255,.12), 0 3px 0 var(--o);
  font-weight: 900; font-size: 19px; text-shadow: var(--ts-o-sm);
}
.res .res-ico { font-size: 32px; margin-inline-start: -10px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.res .num { min-width: 2.5ch; text-align: center; }
.res-trophy { color: var(--yellow); }
.res-coin { color: #fff3b0; }
.res.pulse { animation: resPulse 600ms var(--ease-spring); }
@keyframes resPulse { 40% { transform: scale(1.12); } }

/* portraits (card art + initial fallback) */
.portrait {
  position: relative; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(90% 80% at 50% 30%, color-mix(in srgb, var(--cc2, #fff) 55%, var(--cc)) 0%, var(--cc) 45%, color-mix(in srgb, var(--cc) 45%, #000) 100%);
}
.portrait .pt-initial { font-size: 2.2em; font-weight: 900; text-shadow: var(--ts-o); color: #fff; }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; opacity: 0; transition: opacity 300ms; }
.portrait.has-img img { opacity: 1; }
.portrait.has-img .pt-initial { opacity: 0; }

/* ---------------------------------------------------------------- */
/* 7. Stage slot (live 3D preview / fallback pedestal)               */
/* ---------------------------------------------------------------- */
.stage-slot { position: relative; width: 100%; height: 100%; min-height: 220px; touch-action: pan-y; cursor: grab; --cc: #3ea2ff; --cc2: #9fd0ff; }
.stage-slot:active { cursor: grabbing; }
.ss-beams {
  position: absolute; left: 50%; bottom: 14%; width: 140%; height: 120%; transform: translateX(-50%);
  background: conic-gradient(from 180deg at 50% 100%, transparent 0deg 140deg, color-mix(in srgb, var(--cc2) 40%, transparent) 160deg, transparent 172deg, color-mix(in srgb, #fff 24%, transparent) 180deg, transparent 188deg, color-mix(in srgb, var(--cc2) 40%, transparent) 200deg, transparent 220deg);
  -webkit-mask: linear-gradient(0deg, #000 10%, transparent 95%); mask: linear-gradient(0deg, #000 10%, transparent 95%);
  animation: beamSway 7s ease-in-out infinite alternate; opacity: .8; pointer-events: none;
}
@keyframes beamSway { from { transform: translateX(-50%) skewX(-4deg); } to { transform: translateX(-50%) skewX(4deg); } }
.ss-glow { position: absolute; left: 50%; bottom: 10%; width: 78%; aspect-ratio: 1; transform: translate(-50%, 30%); border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--cc) 75%, #fff) 0%, color-mix(in srgb, var(--cc) 40%, transparent) 40%, transparent 70%); opacity: .55; pointer-events: none; }
.ss-pedestal { position: absolute; left: 50%; bottom: 7%; width: min(72%, 380px); aspect-ratio: 3.4; transform: translateX(-50%); pointer-events: none; }
.ss-pedestal i { position: absolute; left: 0; right: 0; border-radius: 50%; }
.ss-pedestal .ped-side { top: 22%; bottom: 0; background: linear-gradient(180deg, #2a3478, #121848); border: 3px solid var(--o); }
.ss-pedestal .ped-top { top: 0; height: 64%; background: radial-gradient(60% 60% at 50% 40%, #6c7ad8, #3a46a8 70%, #2a3480); border: 3px solid var(--o); z-index: 1; }
.ss-pedestal .ped-ring { top: 10%; height: 44%; left: 9%; right: 9%; border: 3px solid color-mix(in srgb, var(--cc2) 80%, #fff); box-shadow: 0 0 18px 2px var(--cc2), inset 0 0 14px var(--cc2); z-index: 2; animation: ringPulse 2.4s ease-in-out infinite; }
@keyframes ringPulse { 50% { opacity: .55; } }
.ss-figure { position: absolute; left: 50%; bottom: 12%; height: 80%; aspect-ratio: 1; transform: translateX(-50%); perspective: 700px; pointer-events: none; z-index: 2; }
.ss-tilt { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 380ms var(--ease-out); animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 50% { translate: 0 -3%; } }
.ss-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 10px 16px rgba(0,0,0,.45)); opacity: 0; transition: opacity 260ms; }
.stage-slot.has-img .ss-img { opacity: 1; }
.ss-initial { position: absolute; inset: 15% 20% 6%; display: grid; place-items: center; border-radius: 36% 36% 24% 24%; background: radial-gradient(70% 70% at 40% 30%, color-mix(in srgb, var(--cc) 60%, #fff), var(--cc)); border: 4px solid var(--o); font-size: clamp(60px, 12vw, 140px); font-weight: 900; text-shadow: var(--ts-o); box-shadow: inset 0 -12px 0 rgba(0,0,0,.18); }
.stage-slot.has-img .ss-initial { opacity: 0; }
.ss-shadow { position: absolute; left: 50%; bottom: 11.5%; width: 34%; height: 5%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.55), transparent); z-index: 2; pointer-events: none; }
.stage-slot.swap .ss-tilt { animation: popIn 520ms var(--ease-spring), bob 3.2s ease-in-out 520ms infinite; }
@keyframes popIn { from { transform: scale(.55) translateY(14%); opacity: 0; } to { transform: none; opacity: 1; } }
.stage-slot.hop .ss-figure { animation: hop 560ms var(--ease-out); }
@keyframes hop { 30% { transform: translateX(-50%) translateY(-12%) scale(1.04, .96); } 60% { transform: translateX(-50%) translateY(0) scale(1.06, .92); } }
.live-host { position: absolute; inset: 0; z-index: 3; }
.live-host canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-slot.is-live .ss-figure, .stage-slot.is-live .ss-shadow, .stage-slot.is-live .ss-pedestal { display: none; }
.ss-sparks { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.ss-sparks i { position: absolute; left: var(--x); bottom: 12%; width: 6px; height: 6px; border-radius: 50%; background: var(--cc2); box-shadow: 0 0 10px 3px var(--cc2); opacity: 0; animation: sparkUp var(--d) ease-in infinite; animation-delay: var(--dl); scale: var(--s); }
@keyframes sparkUp { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: .9; } 100% { opacity: 0; transform: translateY(-260px); } }
.drag-hint { text-align: center; font-size: 13px; font-weight: 800; color: var(--ink-2); opacity: .8; margin-top: -6px; text-shadow: 0 2px 0 rgba(0,0,0,.4); }

/* level-up celebration on the turntable */
.ss-pop { position: absolute; left: 50%; top: 16%; transform: translateX(-50%); z-index: 6; text-align: center; pointer-events: none; animation: lvPop 1.8s var(--ease-spring) both; white-space: nowrap; }
.ss-pop .sp-k { font-size: clamp(30px, 4vw, 50px); font-weight: 900; color: var(--yellow); text-shadow: var(--ts-o); transform: rotate(-4deg); }
.ss-pop .sp-n { font-size: 22px; font-weight: 900; text-shadow: var(--ts-o); }
@keyframes lvPop { 0% { opacity: 0; transform: translateX(-50%) scale(.3); } 18% { opacity: 1; transform: translateX(-50%) scale(1.2); } 30% { transform: translateX(-50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-30px); } }
.stage-slot.celebrate::after {
  content: ''; position: absolute; left: 50%; bottom: 14%; width: 30%; aspect-ratio: 1; border-radius: 50%; z-index: 5; pointer-events: none;
  border: 8px solid var(--yellow); box-shadow: 0 0 30px 8px rgba(255, 210, 63, .8); animation: shock 900ms var(--ease-out) forwards;
}
@keyframes shock { from { transform: translate(-50%, 50%) scale(.2); opacity: 1; } to { transform: translate(-50%, 50%) scale(3.4); opacity: 0; } }
.stage-slot.celebrate .ss-glow { animation: glowBurst 1s var(--ease-out); }
@keyframes glowBurst { 30% { opacity: 1; transform: translate(-50%, 30%) scale(1.5); } }
.stage-slot.celebrate .ss-figure { animation: hop 700ms var(--ease-out); }

/* ---------------------------------------------------------------- */
/* 8. Title (lobby)                                                  */
/* ---------------------------------------------------------------- */
.top-bar {
  position: absolute; inset-inline: 0; top: 0; z-index: 4; display: flex; align-items: center; gap: 12px;
  padding: calc(14px + var(--safe-t)) calc(20px + var(--safe-r)) 0 calc(20px + var(--safe-l));
}
.prof-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; padding-inline: 5px 12px;
  border: 3px solid var(--o); border-radius: 16px; cursor: pointer; text-align: start;
  background: linear-gradient(180deg, rgba(40, 52, 130, .95), rgba(18, 24, 80, .95)); box-shadow: inset 0 2px 0 rgba(255,255,255,.15), 0 4px 0 var(--o);
  transition: transform var(--dur-fast);
}
.prof-chip:hover { transform: translateY(-2px); }
.prof-chip:active { transform: translateY(3px); }
.pc-av { position: relative; width: 50px; height: 50px; border-radius: 12px; overflow: hidden; border: 2.5px solid var(--o); display: grid; place-items: center; background: var(--cc, #556); font-size: 24px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.pc-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; opacity: 0; }
.pc-av.has-img img { opacity: 1; }
.pc-av.has-img .pt-initial { opacity: 0; }
.pc-name { font-size: 18px; font-weight: 900; text-shadow: var(--ts-o-sm); max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-kicker { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 900; color: var(--yellow); text-shadow: var(--ts-o-sm); }
.pc-kicker .pc-tro { font-size: 18px; }
.prof-chip .pc-swap { font-size: 20px; opacity: .8; }
.lang-btn .btn-lbl { font-size: 15px; }
.lang-btn .btn-ico { font-size: 22px; }

.screen-title { overflow: hidden; }
.lobby-stage { position: absolute; inset-block: 20% 14%; inset-inline: 24%; z-index: 1; }
.lobby-stage .stage-slot { height: 100%; }
.title-logo { position: absolute; top: calc(74px + var(--safe-t)); inset-inline: 0; margin-inline: auto; width: max-content; max-width: 46vw; text-align: center; z-index: 3; pointer-events: none; animation: logoIn 800ms var(--ease-spring) both; }
@keyframes logoIn { from { opacity: 0; transform: scale(.5) rotate(-6deg); } to { opacity: 1; transform: none; } }
.logo-text {
  margin: 0; font-size: clamp(44px, 5.4vw, 86px); font-weight: 900; line-height: .95; letter-spacing: 1px;
  color: #fff6c8; transform: rotate(-3deg);
  text-shadow: 0 3px 0 #b85a00, 3px 0 0 #b85a00, -3px 0 0 #b85a00, 0 -3px 0 #b85a00, 2px 2px 0 #b85a00, -2px 2px 0 #b85a00, 2px -2px 0 #b85a00, -2px -2px 0 #b85a00,
    0 6px 0 var(--o), 4px 6px 0 var(--o), -4px 6px 0 var(--o), 0 10px 0 var(--o), 0 16px 24px rgba(0,0,0,.5);
}
.logo-sub { margin: 10px 0 0; font-size: clamp(14px, 1.4vw, 19px); font-weight: 900; color: var(--cyan); text-shadow: var(--ts-o-sm); }

.title-side { position: absolute; inset-inline-start: calc(22px + var(--safe-l)); top: 50%; transform: translateY(-46%); display: flex; flex-direction: column; gap: 12px; z-index: 4; }
.side-btn {
  position: relative; display: flex; align-items: center; gap: 12px; min-width: 210px; padding: 6px 16px 6px 6px; padding-inline: 6px 16px;
  border: 3px solid var(--o); border-radius: 18px; cursor: pointer; text-align: start;
  background: linear-gradient(180deg, rgba(48, 62, 160, .95), rgba(22, 28, 92, .95)); box-shadow: inset 0 2px 0 rgba(255,255,255,.18), 0 5px 0 var(--o), 0 10px 20px rgba(0,0,0,.3);
  transition: transform var(--dur-fast) var(--ease-out);
}
.side-btn:hover { transform: translateX(calc(4px * var(--flip))) scale(1.02); }
.side-btn:active { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255,255,255,.18), 0 1px 0 var(--o); }
.sb-tile { width: 58px; height: 58px; border-radius: 13px; display: grid; place-items: center; border: 2.5px solid var(--o); background: linear-gradient(180deg, #ffe25c, #ffb81c); box-shadow: inset 0 -4px 0 rgba(0,0,0,.18), inset 0 2px 0 rgba(255,255,255,.5); }
.sb-camp .sb-tile { background: linear-gradient(180deg, #8ff5a8, #2cc556); }
.sb-up .sb-tile { background: linear-gradient(180deg, #d9a0ff, #8a3cf0); }
.sb-help .sb-tile { background: linear-gradient(180deg, #8fd6ff, #2a8ff0); }
.sb-ico { font-size: 38px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); }
.sb-txt { display: flex; flex-direction: column; gap: 4px; }
.sb-lbl { font-size: 18px; font-weight: 900; text-shadow: var(--ts-o-sm); white-space: nowrap; }
.sb-extra { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 900; color: var(--ink-2); }
.sb-extra:empty { display: none; }
.sb-stars { display: inline-flex; align-items: center; gap: 4px; color: var(--yellow); text-shadow: var(--ts-o-sm); }
.mini-star { font-size: 16px; }
.sb-dot { position: absolute; top: -9px; inset-inline-end: -9px; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; background: var(--red); border: 2.5px solid var(--o); font-weight: 900; font-size: 15px; text-shadow: var(--ts-o-sm); animation: dotBounce 1.2s ease-in-out infinite; }
.side-btn.can-buy .sb-dot { display: grid; }
@keyframes dotBounce { 50% { transform: translateY(-4px) scale(1.08); } }

.lobby-plate {
  position: absolute; bottom: calc(26px + var(--safe-b)); inset-inline: 0; margin-inline: auto; width: max-content; max-width: 46vw; z-index: 4;
  display: flex; align-items: center; gap: 12px; padding: 8px 20px 10px 10px; padding-inline: 10px 20px;
  border: 3px solid var(--o); border-radius: 20px; cursor: pointer; text-align: start;
  background: linear-gradient(180deg, rgba(36, 46, 124, .92), rgba(14, 20, 70, .94)); box-shadow: inset 0 2px 0 rgba(255,255,255,.15), 0 5px 0 var(--o), 0 14px 28px rgba(0,0,0,.4);
  transition: transform var(--dur-fast);
}
.lobby-plate:hover { transform: translateY(-3px); }
.lobby-plate .medal-badge { width: 60px; height: 60px; }
.lp-row { display: flex; align-items: center; gap: 10px; }
.lp-name { font-size: 30px; font-weight: 900; text-shadow: var(--ts-o); line-height: 1; }
.lp-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.lp-hint { margin-top: 5px; font-size: 12px; font-weight: 800; color: var(--ink-dim); }

.title-dock { position: absolute; inset-inline-end: calc(26px + var(--safe-r)); bottom: calc(24px + var(--safe-b)); z-index: 4; display: flex; flex-direction: column; align-items: stretch; gap: 12px; width: 300px; }
.dock-mode {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 14px 10px 8px; padding-inline: 8px 14px; cursor: pointer; text-align: start;
  border: 3px solid var(--o); border-radius: 18px; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--mode-hue, #3ea2ff) 80%, #fff) 0%, var(--mode-hue, #3ea2ff) 45%, color-mix(in srgb, var(--mode-hue, #3ea2ff) 55%, #000) 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 5px 0 var(--o), 0 10px 22px rgba(0,0,0,.35);
  transition: transform var(--dur-fast);
}
.screen-title .dock-mode { --mode-hue: inherit; }
.dock-mode::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, rgba(255,255,255,.08) 0 10px, transparent 10px 20px); pointer-events: none; }
.dock-mode:hover { transform: translateY(-2px); }
.dm-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 14px; background: rgba(0,0,0,.25); border: 2.5px solid var(--o); }
.dm-ico { font-size: 40px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
.dm-txt { flex: 1 1 auto; min-width: 0; }
.dm-kicker { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .6px; color: rgba(255,255,255,.85); text-shadow: var(--ts-o-sm); }
.dm-name { font-size: 22px; font-weight: 900; text-shadow: var(--ts-o); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-diff { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; border: 2px solid var(--o); background: rgba(0,0,0,.35); font-size: 13px; font-weight: 900; text-shadow: var(--ts-o-sm); color: color-mix(in srgb, var(--dc, #fff) 60%, #fff); z-index: 1; }
.dm-diff .dd-ico { font-size: 18px; }
.btn-play { width: 100%; font-size: 40px; min-height: 92px; animation: playGlow 2.4s ease-in-out infinite; }
.btn-play .btn-ico { font-size: 38px; }
@keyframes playGlow { 0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 210, 63, 0)); } 50% { filter: drop-shadow(0 0 18px rgba(255, 210, 63, .75)); } }

/* ---------------------------------------------------------------- */
/* 9. Players                                                        */
/* ---------------------------------------------------------------- */
.players-hint { text-align: center; font-weight: 800; color: var(--ink-2); margin: 4px 0 12px; }
.players-status { text-align: center; color: var(--ink-dim); font-weight: 800; margin: 14px 0; }
.players-status:empty { display: none; }
.players-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; max-width: 1180px; margin-inline: auto; padding-top: 8px; }
.players-grid.is-busy { opacity: .6; pointer-events: none; }
.player-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 16px 16px; text-align: center;
  border: 3px solid var(--o); border-radius: var(--r-lg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--cc, #556) 45%, #26307e), #161d5a 70%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.18), var(--sh-card);
}
.player-card.is-active { box-shadow: 0 0 0 4px var(--yellow), inset 0 2px 0 rgba(255,255,255,.18), var(--sh-card); }
.pl-flag { position: absolute; top: -14px; inset-inline: 0; margin-inline: auto; width: max-content; padding: 3px 12px 4px; border-radius: 99px; border: 2.5px solid var(--o); background: linear-gradient(180deg, #ffe25c, #ffb81c); font-size: 12px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.pl-avatar { width: 112px; height: 112px; border-radius: 22px; border: 3px solid var(--o); box-shadow: 0 5px 0 var(--o); font-size: 26px; }
.pl-name { font-size: 24px; font-weight: 900; text-shadow: var(--ts-o); }
.pl-pres { gap: 6px; font-size: 13px; font-weight: 900; color: var(--ink-2); }
.pl-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pl-stat { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; background: rgba(0,0,0,.35); border: 2px solid rgba(255,255,255,.12); font-weight: 900; font-size: 14px; }
.pl-stat .pls-ico { font-size: 18px; }
.pl-last { font-size: 12px; color: var(--ink-dim); font-weight: 700; }
.pl-actions { display: flex; gap: 8px; margin-top: 6px; width: 100%; }
.pl-actions .pl-play { flex: 1 1 auto; }
.player-card.is-new { border-style: dashed; border-color: rgba(255,255,255,.5); background: linear-gradient(180deg, rgba(40, 52, 130, .7), rgba(20, 26, 84, .8)); grid-column: span 1; }
.pn-plus { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); border: 3px solid var(--o); }
.pn-ico { font-size: 44px; }
.pn-title { font-size: 21px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.pn-sub { font-size: 13px; font-weight: 800; color: var(--ink-dim); }
.name-input { width: 100%; height: 50px; padding: 0 14px; border-radius: 14px; border: 3px solid var(--o); background: #f4f6ff; color: #121848; font-size: 18px; font-weight: 800; text-align: center; user-select: text; -webkit-user-select: text; box-shadow: inset 0 3px 0 rgba(0,0,0,.12); }
.name-input:focus { outline: 3px solid var(--cyan); }
.avatar-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.av-opt { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px; border-radius: 13px; border: 2.5px solid transparent; background: rgba(0,0,0,.2); cursor: pointer; }
.av-opt.is-sel { border-color: var(--yellow); background: rgba(255, 210, 63, .2); }
.av-port { width: 100%; aspect-ratio: 1; border-radius: 10px; border: 2px solid var(--o); font-size: 16px; }
.avn { font-size: 12px; font-weight: 800; }
.players-lang { margin-inline-start: 4px; }

/* ---------------------------------------------------------------- */
/* 10. Select                                                        */
/* ---------------------------------------------------------------- */
.sel-layout { display: grid; grid-template-columns: minmax(320px, 0.82fr) 1.4fr; gap: 22px; align-items: start; max-width: 1400px; margin-inline: auto; }
.sel-hero { position: relative; display: flex; flex-direction: column; gap: 8px; }
.sel-hero .stage-slot { height: clamp(260px, 36vh, 380px); }
.hero-card { padding: 14px 16px; }
.hc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hc-name { font-size: 34px; font-weight: 900; line-height: 1; text-shadow: var(--ts-o); }
.hc-role { margin-top: 6px; font-size: 15px; font-weight: 800; color: var(--ink-2); }
.hc-lvl { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cost-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; background: rgba(0,0,0,.3); font-size: 14px; }
.cost-tag .ct-ico { font-size: 18px; }
.sh-up.is-max .cost-tag { display: none; }
.hc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-top: 14px; }
.stat-row { display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'i l' 'i p'; column-gap: 8px; align-items: center; }
.stat-row .st-ico { grid-area: i; font-size: 30px; }
.stat-row .sl { grid-area: l; font-size: 13px; font-weight: 900; color: var(--ink-2); }
.stat-row .pips { grid-area: p; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.stat-row .pips i { height: 11px; border-radius: 4px; background: rgba(0,0,0,.45); border: 2px solid var(--o); }
.stat-row .pips i.on { background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 50%, #fff), var(--pc)); }
.hc-abils { display: grid; gap: 8px; margin-top: 14px; }
.abil { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 14px; background: rgba(0,0,0,.25); border: 2px solid rgba(255,255,255,.08); }
.abil .ab-ico { font-size: 34px; flex: 0 0 auto; }
.abil-super { background: linear-gradient(var(--to-start), rgba(255, 210, 63, .18), rgba(0,0,0,.25)); }
.ak { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .6px; color: var(--yellow); }
.an { font-size: 16px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.ad { font-size: 13px; font-weight: 600; color: var(--ink-2); line-height: 1.4; }

.sel-check { position: absolute; top: 8px; inset-inline-end: 8px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--green); border: 2.5px solid var(--o); font-size: 20px; opacity: 0; transform: scale(.3); transition: transform 300ms var(--ease-spring), opacity 200ms; z-index: 4; }
.is-sel > .sel-check { opacity: 1; transform: none; }

.diff-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.diff-card {
  position: relative; overflow: visible; cursor: pointer; text-align: start; display: flex; flex-direction: column; gap: 6px;
  padding: 14px; border: 3px solid var(--o); border-radius: var(--r-lg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--dc) 30%, #2a3486), #171e5e);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.15), 0 5px 0 var(--o); transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur);
}
.diff-card:hover { transform: translateY(-3px); }
.diff-card.is-sel { background: linear-gradient(180deg, color-mix(in srgb, var(--dc) 75%, #fff) 0%, var(--dc) 40%, color-mix(in srgb, var(--dc) 50%, #000) 100%); transform: translateY(-4px) scale(1.02); box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 6px 0 var(--o), 0 0 0 4px #fff, 0 14px 30px rgba(0,0,0,.35); }
.dc-flag { position: absolute; top: -13px; inset-inline-start: 14px; padding: 2px 10px 3px; border-radius: 99px; border: 2.5px solid var(--o); background: linear-gradient(180deg, #ffe25c, #ffb81c); font-size: 11.5px; font-weight: 900; text-shadow: var(--ts-o-sm); z-index: 3; white-space: nowrap; }
.dc-art { display: flex; align-items: center; gap: 10px; }
.dc-ico { font-size: 46px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
.dc-txt { margin-top: -4px; }
.dc-art + .dc-txt { margin-top: 0; }
.diff-card .dc-name { font-size: 26px; font-weight: 900; text-shadow: var(--ts-o); }
.diff-card .dc-tag { font-size: 13px; font-weight: 800; color: #fff; opacity: .9; }
.diff-card .dc-desc { font-size: 12.5px; font-weight: 600; line-height: 1.4; color: var(--ink-2); }
.diff-card.is-sel .dc-desc { color: #fff; }
.dc-perks { display: flex; flex-wrap: wrap; gap: 5px; }
.perk { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; background: rgba(0,0,0,.3); font-size: 11.5px; font-weight: 800; }
.perk .pk { font-size: 14px; }
.diff-grid.is-compact .diff-card { flex-direction: row; align-items: center; padding: 10px 12px; }
.diff-grid.is-compact .dc-ico { font-size: 36px; }
.diff-grid.is-compact .dc-name { font-size: 20px; }

.mode-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mode-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 0 0 12px; cursor: pointer; text-align: start; overflow: hidden;
  border: 3px solid var(--o); border-radius: var(--r-lg); background: #1a2163;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.15), 0 5px 0 var(--o); transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur);
}
.mode-card:hover { transform: translateY(-3px); }
.mc-art { height: 78px; display: grid; place-items: center; border-bottom: 3px solid var(--o); background: radial-gradient(80% 90% at 50% 40%, color-mix(in srgb, var(--mc) 70%, #fff), var(--mc) 55%, color-mix(in srgb, var(--mc) 50%, #000)); position: relative; overflow: hidden; }
.mc-art::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, rgba(255,255,255,.1) 0 9px, transparent 9px 18px); }
.mc-ico { font-size: 56px; position: relative; z-index: 1; filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); transition: transform 400ms var(--ease-spring); }
.mode-card:hover .mc-ico, .mode-card.is-sel .mc-ico { transform: scale(1.12) rotate(-6deg); }
.mc-txt { padding: 0 12px; }
.mc-name { font-size: 20px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.mc-tag { font-size: 13px; font-weight: 800; color: var(--yellow); }
.mc-meta { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px; }
.mc-meta .chip { font-size: 11px; padding: 2px 7px; }
.mc-desc { padding: 0 12px; font-size: 12px; font-weight: 600; color: var(--ink-2); line-height: 1.4; }
.mode-card.is-sel { box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 0 6px 0 var(--o), 0 0 0 4px #fff, 0 14px 30px rgba(0,0,0,.35); transform: translateY(-4px); background: color-mix(in srgb, var(--mc) 30%, #1a2163); }

.char-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.char-card {
  position: relative; display: flex; flex-direction: column; padding: 0; cursor: pointer; overflow: visible;
  border: 3px solid var(--o); border-radius: 16px; background: var(--rd);
  box-shadow: 0 5px 0 var(--o), 0 10px 20px rgba(0,0,0,.3); transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur);
}
.char-card:hover { transform: translateY(-4px) rotate(-1deg); }
.cc-art { aspect-ratio: 1 / 1.08; border-radius: 13px 13px 0 0; font-size: 22px; }
.cc-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 45%, transparent 60%); transform: translateX(-120%); transition: transform 700ms var(--ease-out); pointer-events: none; }
.char-card:hover .cc-art::after, .char-card.is-sel .cc-art::after { transform: translateX(120%); }
.cc-name {
  padding: 5px 4px 6px; text-align: center; font-size: 15px; font-weight: 900; text-shadow: var(--ts-o-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 70%, #fff), var(--rc) 50%, var(--rd)); border-top: 3px solid var(--o); border-radius: 0 0 13px 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cc-lv { position: absolute; top: 6px; inset-inline-start: 6px; min-width: 30px; height: 30px; padding: 0 6px; display: grid; place-items: center; border-radius: 9px; background: linear-gradient(180deg, #6fc1ff, #2a7ff0); border: 2.5px solid var(--o); font-size: 15px; font-weight: 900; text-shadow: var(--ts-o-sm); z-index: 2; }
.cc-tro { position: absolute; bottom: 5px; inset-inline-start: 5px; display: flex; align-items: center; gap: 2px; padding: 1px 7px 1px 3px; border-radius: 99px; background: rgba(5, 8, 36, .78); border: 2px solid var(--o); font-size: 13px; font-weight: 900; color: var(--yellow); text-shadow: var(--ts-o-sm); z-index: 2; }
.cc-tro .cct-ico { font-size: 17px; }
.cc-pres { position: absolute; top: 5px; inset-inline-end: 5px; z-index: 2; }
.cc-upflag { position: absolute; bottom: 5px; inset-inline-end: 5px; width: 28px; height: 28px; display: none; place-items: center; border-radius: 50%; background: var(--green); border: 2.5px solid var(--o); font-size: 18px; z-index: 2; animation: dotBounce 1.2s ease-in-out infinite; }
.cc-upflag.on { display: grid; }
.char-card.is-sel { transform: translateY(-6px) scale(1.04); box-shadow: 0 6px 0 var(--o), 0 0 0 4px #fff, 0 0 26px 6px color-mix(in srgb, var(--rc) 70%, transparent); z-index: 2; }
.char-card.is-sel .sel-check { top: auto; bottom: 38px; inset-inline-end: -8px; }
.char-card.is-sel .cc-pres { opacity: .25; }
.cc-lock { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; border-radius: 13px; background: rgba(6, 9, 34, .78); z-index: 5; }
.char-card.is-locked { cursor: not-allowed; }
.char-card.is-locked .cc-lock { display: flex; }
.char-card.is-locked .cc-art img { filter: grayscale(1) brightness(.5); }
.lk-ico { font-size: 40px; }
.lk-need { display: flex; align-items: center; gap: 4px; font-weight: 900; font-size: 16px; color: var(--yellow); text-shadow: var(--ts-o-sm); }
.lk-need .lkt-ico { font-size: 20px; }
.lk-bar { width: 80%; height: 11px; }
.lk-bar .fill { --fc: linear-gradient(180deg, #ffe25c, #ffb81c); }
.char-card.shake { animation: nope 420ms ease; }

.foot-sum { display: flex; gap: 8px; flex-wrap: wrap; margin-inline-end: auto; }
.fs-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 7px 8px; padding-inline: 8px 14px; border-radius: 99px; border: 2.5px solid var(--o); background: rgba(6, 9, 40, .8); font-weight: 900; font-size: 16px; text-shadow: var(--ts-o-sm); }
.fs-chip .fs-ico { font-size: 26px; }
.btn-start { min-width: 280px; }

/* ---------------------------------------------------------------- */
/* 11. Campaign                                                      */
/* ---------------------------------------------------------------- */
.camp-top { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; max-width: 1240px; margin-inline: auto; }
.char-strip { display: flex; gap: 10px; overflow-x: auto; padding: 6px 4px 12px; scrollbar-width: none; }
.char-strip::-webkit-scrollbar { display: none; }
.strip-char { position: relative; flex: 0 0 auto; width: 84px; padding: 0; border: 3px solid var(--o); border-radius: 14px; background: #161d5a; cursor: pointer; overflow: hidden; box-shadow: 0 4px 0 var(--o); transition: transform var(--dur) var(--ease-spring); }
.strip-char:hover { transform: translateY(-3px); }
.strip-char.is-sel { box-shadow: 0 4px 0 var(--o), 0 0 0 4px var(--yellow); transform: translateY(-3px); }
.strip-char.is-locked { filter: grayscale(.9) brightness(.55); cursor: not-allowed; }
.sc-port { width: 100%; aspect-ratio: 1; font-size: 18px; }
.scn { padding: 3px 2px 4px; font-size: 13px; font-weight: 900; text-align: center; text-shadow: var(--ts-o-sm); border-top: 2.5px solid var(--o); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-lv { position: absolute; top: 4px; inset-inline-start: 4px; padding: 0 6px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: linear-gradient(180deg, #6fc1ff, #2a7ff0); border: 2px solid var(--o); font-size: 12px; font-weight: 900; text-shadow: var(--ts-o-sm); }

.camp-path { position: relative; max-width: 900px; margin: 6px auto 20px; display: flex; flex-direction: column; gap: 16px; padding-block: 10px; }
.camp-trail { position: absolute; top: 0; bottom: 0; left: 50%; width: 10px; margin-left: -5px; border-radius: 6px; background: repeating-linear-gradient(180deg, rgba(255,255,255,.35) 0 14px, transparent 14px 26px); }
.stage-row { display: flex; }
.stage-row.side-a { justify-content: flex-start; }
.stage-row.side-b { justify-content: flex-end; }
.stage-node {
  position: relative; width: calc(50% + 40px); display: flex; align-items: center; gap: 14px; padding: 10px 14px; cursor: pointer; text-align: start;
  border: 3px solid var(--o); border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(36, 46, 124, .95), rgba(16, 22, 74, .95));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.15), 0 5px 0 var(--o); transition: transform var(--dur) var(--ease-spring);
}
.stage-row.side-b .stage-node { flex-direction: row-reverse; text-align: end; }
.stage-node:hover { transform: scale(1.02); }
.stage-medal { position: relative; flex: 0 0 auto; width: 82px; height: 82px; border-radius: 50%; display: grid; place-items: center; border: 3px solid var(--o); background: radial-gradient(70% 70% at 40% 30%, color-mix(in srgb, var(--mc) 60%, #fff), var(--mc) 60%, color-mix(in srgb, var(--mc) 50%, #000)); box-shadow: inset 0 -5px 0 rgba(0,0,0,.2), 0 4px 0 var(--o); }
.stage-num { font-size: 32px; font-weight: 900; text-shadow: var(--ts-o); margin-top: -8px; }
.stage-medal .stars { position: absolute; bottom: -10px; display: flex; gap: 1px; }
.stage-medal .stars .ico { font-size: 22px; }
.stage-node.is-boss .stage-medal { width: 96px; height: 96px; background: radial-gradient(70% 70% at 40% 30%, #ff9aa6, #f03a4e 60%, #7a0a1e); }
.boss-crown { position: absolute; top: -20px; font-size: 32px; }
.stage-info { flex: 1 1 auto; min-width: 0; }
.stage-name { font-size: 19px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.stage-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.stage-row.side-b .stage-meta { justify-content: flex-end; }
.boss-chip { background: rgba(240, 58, 78, .4); color: #fff; }
.stage-goals { margin-top: 6px; display: grid; gap: 2px; }
.goal-line { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.stage-row.side-b .goal-line { justify-content: flex-end; }
.goal-line .gm { font-size: 13px; }
.stage-lock { display: none; position: absolute; inset: 0; border-radius: inherit; place-items: center; background: rgba(6, 9, 34, .55); font-size: 40px; }
.stage-node.is-locked { cursor: not-allowed; filter: grayscale(.7) brightness(.75); }
.stage-node.is-locked .stage-lock { display: grid; }
.stage-node.is-current { box-shadow: inset 0 2px 0 rgba(255,255,255,.15), 0 5px 0 var(--o), 0 0 0 4px var(--yellow), 0 0 30px rgba(255,210,63,.5); animation: curPulse 1.8s ease-in-out infinite; }
@keyframes curPulse { 50% { transform: scale(1.025); } }

/* ---------------------------------------------------------------- */
/* 12. Upgrade                                                       */
/* ---------------------------------------------------------------- */
.screen-upgrade .char-strip, .screen-roadmap .char-strip { max-width: 1300px; margin-inline: auto; justify-content: center; }
.up-layout { display: grid; grid-template-columns: minmax(320px, 0.9fr) 1.2fr; gap: 22px; max-width: 1300px; margin-inline: auto; align-items: start; }
.up-hero { position: relative; display: flex; flex-direction: column; gap: 8px; }
.up-hero .stage-slot { height: clamp(260px, 38vh, 400px); }
.up-levelbadge {
  position: absolute; top: 6px; inset-inline-start: 6px; z-index: 6; width: 96px; padding: 6px 4px 8px; text-align: center;
  border: 3px solid var(--o); border-radius: 18px; background: linear-gradient(180deg, color-mix(in srgb, var(--tc, #3ea2ff) 70%, #fff), var(--tc, #3ea2ff) 55%, color-mix(in srgb, var(--tc, #3ea2ff) 55%, #000));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 5px 0 var(--o);
}
.ulb-k { font-size: 12px; font-weight: 900; text-transform: uppercase; text-shadow: var(--ts-o-sm); }
.ulb-n { font-size: 40px; font-weight: 900; line-height: 1; text-shadow: var(--ts-o); }
.ulb-n .num { font-size: clamp(22px, 2.6vw, 40px); }
.ulb-pres { display: flex; justify-content: center; margin-top: 4px; }
.ulb-pres:empty { display: none; }
.up-levelbadge.lvl-pop { animation: btnBump 600ms var(--ease-spring); }
.up-id { padding: 14px 16px; }
.up-tierrow { display: flex; gap: 8px; margin-top: 10px; }
.tier-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 5px; border-radius: 10px; border: 2.5px solid var(--o); background: linear-gradient(180deg, color-mix(in srgb, var(--tc, #888) 70%, #fff), var(--tc, #888)); font-weight: 900; text-shadow: var(--ts-o-sm); box-shadow: 0 3px 0 var(--o); }
.up-tierbar { margin-top: 10px; height: 16px; }
.up-next-tier, .up-next-pres { margin-top: 6px; font-size: 13px; font-weight: 800; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.up-next-pres:empty { display: none; }
.up-main { display: grid; gap: 16px; }
.up-buy { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'c b' 'm b' 'bal b'; align-items: center; gap: 4px 18px; padding: 18px 20px; background: linear-gradient(180deg, rgba(60, 40, 150, .95), rgba(28, 18, 86, .96)); }
.up-cost { grid-area: c; }
.tp-label { font-size: 13px; font-weight: 900; color: var(--ink-2); text-transform: uppercase; letter-spacing: .5px; }
.up-cost-val { display: flex; align-items: center; gap: 8px; font-size: clamp(30px, 3.4vw, 44px); font-weight: 900; color: #fff3b0; text-shadow: var(--ts-o); }
.up-cost-val .ucv-ico { font-size: 1.15em; }
.up-btn { grid-area: b; min-width: 220px; }
.up-btn.is-poor { filter: grayscale(.55) brightness(.85); }
.up-missing { grid-area: m; font-size: 14px; font-weight: 900; }
.up-missing.is-bad { color: var(--red-l); }
.up-missing.is-ok { color: var(--green-l); }
.up-missing.is-max { color: var(--yellow); }
.up-balance { grid-area: bal; display: flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 800; color: var(--ink-2); }
.up-balance .ub-ico { font-size: 18px; }
.cmp { display: grid; gap: 6px; }
.cmp-row { display: grid; grid-template-columns: 1.2fr 1fr 34px 1.3fr; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 14px; background: rgba(0,0,0,.25); border: 2px solid rgba(255,255,255,.06); }
.cmp-head { background: none; border: 0; padding-block: 0; font-size: 12px; font-weight: 900; text-transform: uppercase; color: var(--ink-dim); letter-spacing: .5px; }
.cmp-l { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 15px; }
.cmp-ico { font-size: 26px; }
.cmp-now { font-size: 22px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.cmp-next { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; font-size: 22px; font-weight: 900; color: var(--gc); text-shadow: var(--ts-o-sm); }
.cmp-delta { font-size: 14px; color: var(--green-l); }
.cmp-arrow { display: grid; place-items: center; font-size: 22px; color: var(--gc); }
.cmp-row.is-flat .cmp-arrow, .cmp-row.is-flat .cmp-next { opacity: .5; }
.cmp-row.flash { animation: cmpFlash 900ms ease; }
@keyframes cmpFlash { 0% { background: color-mix(in srgb, var(--gc) 55%, transparent); transform: scale(1.03); } 100% { background: rgba(0,0,0,.25); transform: none; } }
.cmp-now .num.landed { animation: btnBump 400ms var(--ease-spring); }
.gain-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.gain-list:empty { display: none; }
.gain-row { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: rgba(0,0,0,.3); border: 2px solid color-mix(in srgb, var(--gc) 60%, transparent); font-weight: 900; font-size: 14px; }
.gain-row .gr-ico { font-size: 20px; }
.gain-row .gv { color: var(--gc); }
.next-pu { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 14px; border-radius: 16px; background: linear-gradient(var(--to-start), rgba(190, 107, 255, .3), rgba(0,0,0,.2)); border: 2px dashed rgba(255,255,255,.25); }
.next-pu:empty { display: none; }
.np-ico { font-size: 36px; }
.np-txt { flex: 1 1 auto; }
.np-name { font-weight: 900; font-size: 16px; }
.np-desc { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.np-at { font-weight: 900; font-size: 14px; color: var(--yellow); white-space: nowrap; }
.pu-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pu-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 12px; background: linear-gradient(180deg, rgba(190, 107, 255, .5), rgba(106, 31, 196, .6)); border: 2.5px solid var(--o); font-weight: 900; font-size: 14px; text-shadow: var(--ts-o-sm); }
.pu-i { font-size: 18px; text-shadow: none; }

/* ---------------------------------------------------------------- */
/* 13. Roadmap + trophy road (vertical journeys)                     */
/* ---------------------------------------------------------------- */
.rm-top, .road-top { display: flex; align-items: center; gap: 18px; max-width: 760px; margin: 0 auto 18px; }
.rm-badge { width: 76px; height: 76px; flex: 0 0 auto; display: grid; place-items: center; font-size: 42px; border-radius: 20px; border: 3px solid var(--o); background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 70%, #fff), var(--tc)); box-shadow: 0 5px 0 var(--o); }
.rm-toptxt { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.rm-name { font-size: 28px; font-weight: 900; text-shadow: var(--ts-o); width: 100%; }
.rm-level { font-size: 18px; font-weight: 900; }
.rm-total { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 800; color: var(--ink-2); width: 100%; }
.rm-total .rt-ico { font-size: 18px; }

.rm, .road { position: relative; max-width: 760px; margin: 0 auto 30px; display: flex; flex-direction: column; gap: 12px; padding-inline-start: 74px; }
.rm-spine, .road-spine { position: absolute; top: 10px; bottom: 10px; inset-inline-start: 30px; width: 14px; border-radius: 8px; background: rgba(0,0,0,.45); border: 3px solid var(--o); overflow: hidden; }
.rm-fill, .road-fill { position: absolute; inset: 0; transform-origin: center bottom; transform: scaleY(0); transition: transform 1.2s var(--ease-out); background: linear-gradient(0deg, #ffb81c, #ffe25c, #fff6c8); }
.rm-band { display: flex; align-items: center; gap: 12px; margin-inline-start: -74px; padding: 10px 16px; border-radius: 16px; border: 3px solid var(--o); background: linear-gradient(var(--to-start), color-mix(in srgb, var(--tc) 55%, #1a2163), #1a2163 80%); box-shadow: 0 4px 0 var(--o); position: relative; z-index: 1; }
.rm-band:not(.is-reached) { filter: grayscale(.6) brightness(.8); }
.rb-ico { width: 52px; height: 52px; display: grid; place-items: center; font-size: 30px; border-radius: 14px; background: rgba(0,0,0,.3); border: 2.5px solid var(--o); }
.rb-name { font-size: 20px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.rb-range { font-size: 13px; font-weight: 800; color: var(--ink-2); }
.rm-node, .rm-pnode, .road-item { position: relative; display: flex; align-items: center; gap: 12px; }
.rn-dot, .road-dot { position: absolute; inset-inline-start: -58px; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; border: 3px solid var(--o); background: #2a3480; font-size: 22px; z-index: 1; box-shadow: 0 3px 0 var(--o); }
.rm-node.is-on .rn-dot, .rm-pnode.is-on .rn-dot { background: linear-gradient(180deg, #8ff5a8, #2cc556); }
.rn-card, .road-card { flex: 1 1 auto; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; border: 3px solid var(--o); background: linear-gradient(180deg, rgba(40, 52, 136, .95), rgba(20, 26, 86, .95)); box-shadow: 0 4px 0 var(--o); }
.rm-node.is-off .rn-card, .rm-pnode.is-off .rn-card { filter: grayscale(.7) brightness(.72); }
.rn-ico { font-size: 32px; width: 48px; text-align: center; }
.rn-txt, .road-txt { flex: 1 1 auto; min-width: 0; }
.rn-name, .road-name { font-size: 17px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.rn-desc { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.rn-at { font-weight: 900; font-size: 14px; color: var(--yellow); white-space: nowrap; text-shadow: var(--ts-o-sm); }
.rm-node.is-crown .rn-card { background: linear-gradient(180deg, rgba(255, 206, 61, .55), rgba(140, 80, 0, .7)); }
.rm-here { display: flex; align-items: center; gap: 10px; margin-inline-start: -74px; padding: 6px 16px 6px 6px; padding-inline: 6px 16px; border-radius: 99px; width: max-content; max-width: 100%; border: 3px solid var(--o); background: linear-gradient(180deg, #ffe25c, #ffb81c); box-shadow: 0 4px 0 var(--o), 0 0 24px rgba(255,210,63,.6); font-weight: 900; text-shadow: var(--ts-o-sm); z-index: 2; position: relative; animation: curPulse 1.8s ease-in-out infinite; }
.rh-port { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--o); font-size: 14px; }
.rm-start { display: flex; align-items: center; gap: 8px; margin-inline-start: -74px; font-weight: 900; font-size: 18px; text-shadow: var(--ts-o-sm); }
.rm-start .rs-ico { font-size: 40px; }
.rm-prestige-head { margin-inline-start: -74px; padding: 14px 18px; border-radius: 20px; border: 3px solid var(--o); text-align: center; background: linear-gradient(135deg, #ff5d8f, #b06bff 45%, #68e8e0); box-shadow: 0 5px 0 var(--o), 0 0 30px rgba(255, 93, 143, .4); position: relative; z-index: 1; }
.rph-title { font-size: 26px; font-weight: 900; text-shadow: var(--ts-o); }
.rph-sub { font-size: 14px; font-weight: 800; text-shadow: var(--ts-o-sm); }
.rm-pnode .rn-card { background: linear-gradient(var(--to-start), color-mix(in srgb, var(--tc) 50%, #1a2163), #161d5a 75%); }
.rm-pnode.is-on .rn-card { box-shadow: 0 4px 0 var(--o), 0 0 20px color-mix(in srgb, var(--ta) 60%, transparent); }
.rm-pnode .rn-name { color: color-mix(in srgb, var(--ta) 50%, #fff); }

.rt-badge .medal-badge { width: 76px; height: 76px; }
.rt-txt { flex: 1 1 auto; }
.rt-big { display: flex; align-items: center; gap: 8px; font-size: 44px; font-weight: 900; color: var(--yellow); text-shadow: var(--ts-o); line-height: 1.05; }
.rt-big .rtb-ico { font-size: 1em; }
.road-need { font-size: 14px; font-weight: 800; color: var(--ink-2); }
.road-nextbar { margin-top: 8px; }
.road-nextbar .fill { --fc: linear-gradient(180deg, #ffe25c, #ffb81c); }
.road-at { font-size: 11px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.road-dot { width: 52px; height: 52px; inset-inline-start: -63px; background: #2a3480; }
.road-item.is-reached .road-dot { background: linear-gradient(180deg, #ffe25c, #ffb81c); }
.road-ico { width: 60px; height: 60px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; background: rgba(0,0,0,.3); border: 2.5px solid var(--o); overflow: hidden; }
.road-big { font-size: 44px; }
.road-port { width: 100%; height: 100%; font-size: 16px; }
.road-card.is-char { background: linear-gradient(var(--to-start), color-mix(in srgb, var(--rc) 45%, #1a2163), #161d5a 80%); }
.road-kicker { font-size: 11.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; color: var(--yellow); }
.road-state { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 900; white-space: nowrap; }
.road-state .rs-ico { font-size: 20px; }
.road-item.is-locked .road-card { filter: grayscale(.55) brightness(.8); }
.road-item.is-next .road-card { filter: none; box-shadow: 0 4px 0 var(--o), 0 0 0 4px var(--yellow); animation: curPulse 1.8s ease-in-out infinite; }

/* ---------------------------------------------------------------- */
/* 14. Help                                                          */
/* ---------------------------------------------------------------- */
.help-hero { display: flex; justify-content: space-around; align-items: flex-end; flex-wrap: wrap; gap: 20px; max-width: 1100px; margin: 4px auto 18px; padding: 22px; background: linear-gradient(180deg, rgba(36, 150, 230, .9), rgba(18, 60, 150, .95)); }
.hh-key { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hh-lbl { font-size: 20px; font-weight: 900; text-shadow: var(--ts-o); }
.help-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 1300px; margin-inline: auto; }
.help-card .sec-title { margin-top: 2px; }
.help-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 2px solid rgba(255,255,255,.07); }
.help-row:last-child { border-bottom: 0; }
.help-key { flex: 0 0 auto; min-width: 64px; display: grid; place-items: center; }
.hk-ico { font-size: 40px; }
.ht { font-weight: 900; font-size: 16px; }
.hd { font-size: 13px; font-weight: 600; color: var(--ink-2); line-height: 1.4; }

/* keycaps — physical keyboard pictures; never mirrored */
.kc {
  display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 9px;
  border-radius: 9px; border: 2.5px solid var(--o); background: linear-gradient(180deg, #ffffff, #d9e0f5);
  color: #1a2050; font-weight: 900; font-size: 16px; box-shadow: inset 0 -5px 0 #a8b3d6, 0 3px 0 var(--o); text-shadow: none;
}
.kc-wide { min-width: 76px; }
.kc-space { min-width: 150px; }
.kc.is-big { min-width: 70px; height: 70px; font-size: 26px; border-radius: 14px; box-shadow: inset 0 -8px 0 #a8b3d6, 0 5px 0 var(--o); }
.kc-space.is-big { min-width: 230px; }
.kc-wide.is-big { min-width: 130px; }
.kc-super { background: linear-gradient(180deg, #fff6c8, #ffd23f); box-shadow: inset 0 -8px 0 #d98a00, 0 5px 0 var(--o); }
.keypad { display: grid; grid-template-columns: repeat(3, auto); grid-template-rows: auto auto; gap: 4px; }
.keypad .kc { min-width: 36px; height: 36px; padding: 0; font-size: 18px; }
.keypad .kc-up { grid-column: 2; grid-row: 1; }
.keypad .kc-left { grid-column: 1; grid-row: 2; }
.keypad .kc-down { grid-column: 2; grid-row: 2; }
.keypad .kc-right { grid-column: 3; grid-row: 2; }
.keypad.is-big .kc { min-width: 60px; height: 60px; font-size: 28px; border-radius: 12px; box-shadow: inset 0 -7px 0 #a8b3d6, 0 4px 0 var(--o); }

/* ---------------------------------------------------------------- */
/* 15. Modals: settings, pause, unlock pops                          */
/* ---------------------------------------------------------------- */
.screen.is-modal { align-items: center; justify-content: center; padding: 20px; }
.modal-dim { position: absolute; inset: 0; background: rgba(4, 6, 28, .55); backdrop-filter: blur(4px); }
.ui-root:not(.over-game) .modal-dim { background: rgba(4, 6, 28, .35); }
.modal { position: relative; width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; border: 3px solid var(--o); border-radius: var(--r-xl); background: linear-gradient(180deg, #2c3a96, #161d5c); box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 0 8px 0 var(--o), var(--sh-pop); overflow: hidden; }
.screen.is-modal.is-active .modal { animation: modalIn 420ms var(--ease-spring) both; }
@keyframes modalIn { from { transform: scale(.8) translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: linear-gradient(180deg, #ffe25c, #ffb81c); border-bottom: 3px solid var(--o); }
.modal-head h2 { margin: 0; flex: 1 1 auto; font-size: 28px; font-weight: 900; text-shadow: var(--ts-o); }
.mh-ico { font-size: 36px; }
.modal-x { min-height: 44px; width: 44px; }
.modal-body { padding: 16px 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.modal-pause { width: min(440px, 100%); }
.modal-pause .modal-body { gap: 14px; padding: 22px; }
.modal-pause .btn { width: 100%; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(0,0,0,.22); flex-wrap: wrap; }
.set-ico { font-size: 28px; }
.sname { flex: 1 1 auto; font-weight: 900; font-size: 17px; }
.toggle { position: relative; width: 66px; height: 36px; border-radius: 99px; border: 3px solid var(--o); background: #3a4372; cursor: pointer; padding: 0; box-shadow: inset 0 3px 0 rgba(0,0,0,.3); transition: background var(--dur); }
.toggle .knob { position: absolute; top: 2px; inset-inline-start: 2px; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(180deg, #fff, #d4dbf2); border: 2.5px solid var(--o); transition: inset-inline-start var(--dur) var(--ease-spring); }
.toggle.on { background: linear-gradient(180deg, #8ff5a8, #2cc556); }
.toggle.on .knob { inset-inline-start: 32px; }
.seg { display: inline-flex; border: 3px solid var(--o); border-radius: 12px; overflow: hidden; background: rgba(0,0,0,.35); }
.seg button { border: 0; background: transparent; padding: 7px 14px; font-weight: 900; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-inline-start: 2px solid rgba(0,0,0,.5); }
.seg button.on { background: linear-gradient(180deg, #ffe25c, #ffb81c); color: #fff; text-shadow: var(--ts-o-sm); }
.modal-acts { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-top: 10px; flex-wrap: wrap; }

.unlock-pop { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(4, 6, 28, .7); backdrop-filter: blur(5px); pointer-events: auto; animation: fadeIn 260ms ease both; padding: 20px; }
@keyframes fadeIn { from { opacity: 0; } }
.unlock-card { position: relative; width: min(420px, 100%); padding: 28px 24px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; border: 3px solid var(--o); border-radius: var(--r-xl); background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 60%, #2c3a96), #161d5c 75%); box-shadow: 0 8px 0 var(--o), var(--sh-pop); overflow: hidden; animation: modalIn 520ms var(--ease-spring) both; }
.uk-rays { position: absolute; left: 50%; top: 34%; width: 900px; height: 900px; margin: -450px 0 0 -450px; background: repeating-conic-gradient(rgba(255,255,255,.12) 0 10deg, transparent 10deg 24deg); animation: spin 18s linear infinite; pointer-events: none; }
.uk-kicker { position: relative; font-size: 22px; font-weight: 900; color: var(--yellow); text-shadow: var(--ts-o); }
.uk-art { position: relative; width: 150px; height: 150px; display: grid; place-items: center; font-size: 80px; border-radius: 30px; border: 3px solid var(--o); background: radial-gradient(circle, color-mix(in srgb, var(--cc) 50%, #fff), var(--cc)); box-shadow: 0 6px 0 var(--o), 0 0 40px var(--cc); animation: medalpop 700ms var(--ease-spring) 200ms both; overflow: hidden; }
.uk-port { position: absolute; inset: 0; font-size: 40px; }
.uk-ico { font-size: 100px; }
.uk-name { position: relative; font-size: 32px; font-weight: 900; text-shadow: var(--ts-o); }
.uk-sub { position: relative; font-size: 15px; font-weight: 800; color: var(--ink-2); }
.unlock-card .btn { margin-top: 8px; position: relative; }

/* toasts + fx */
.toast-layer { position: absolute; top: calc(80px + var(--safe-t)); inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 70; pointer-events: none; }
.toast { padding: 10px 22px 12px; border-radius: 16px; border: 3px solid var(--o); background: linear-gradient(180deg, #2c3a96, #161d5c); font-weight: 900; font-size: 17px; text-shadow: var(--ts-o-sm); box-shadow: 0 5px 0 var(--o), var(--sh-pop); animation: toastIn 360ms var(--ease-spring) both; max-width: 90vw; text-align: center; }
.toast.out { animation: toastOut 300ms ease forwards; }
@keyframes toastIn { from { transform: translateY(-20px) scale(.8); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-14px); opacity: 0; } }
.fx-canvas { position: absolute; inset: 0; z-index: 65; pointer-events: none; }

/* ---------------------------------------------------------------- */
/* 16. Result                                                        */
/* ---------------------------------------------------------------- */
.result-wrap { max-width: 1340px; margin-inline: auto; display: flex; flex-direction: column; gap: 16px; padding-top: calc(6px + var(--safe-t)); }
.banner { position: relative; text-align: center; padding: 14px 0 0; }
.bn-rays { position: absolute; left: 50%; top: 50%; width: 1200px; height: 1200px; margin: -600px 0 0 -600px; background: repeating-conic-gradient(rgba(255,255,255,.14) 0 8deg, transparent 8deg 20deg); -webkit-mask: radial-gradient(closest-side, #000, transparent 60%); mask: radial-gradient(closest-side, #000, transparent 60%); animation: spin 40s linear infinite; pointer-events: none; z-index: -1; }
.banner.lose .bn-rays { opacity: .3; }
.bn-ribbon { position: relative; display: inline-block; padding: 8px 60px 14px; background: linear-gradient(180deg, #ffe25c, #ffb81c 60%, #d77d00); border: 3px solid var(--o); border-radius: 14px; box-shadow: inset 0 3px 0 rgba(255,255,255,.5), 0 6px 0 var(--o), 0 18px 36px rgba(0,0,0,.35); animation: bannerIn 700ms var(--ease-spring) both; }
.bn-ribbon::before, .bn-ribbon::after { content: ''; position: absolute; top: 18px; width: 46px; height: 100%; background: #b85a00; border: 3px solid var(--o); z-index: -1; }
.bn-ribbon::before { left: -30px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 30% 50%); }
.bn-ribbon::after { right: -30px; clip-path: polygon(0 0, 100% 0, 70% 50%, 100% 100%, 0 100%); }
.banner.lose .bn-ribbon { background: linear-gradient(180deg, #a0aee0, #5866a8 60%, #333d78); }
.banner.lose .bn-ribbon::before, .banner.lose .bn-ribbon::after { background: #2a3168; }
.banner.draw .bn-ribbon { background: linear-gradient(180deg, #8fd6ff, #2a8ff0 60%, #1550b8); }
.banner .bt { margin: 0; font-size: clamp(44px, 6vw, 84px); font-weight: 900; line-height: 1; text-shadow: var(--ts-o); letter-spacing: 1px; }
@keyframes bannerIn { from { transform: scale(.3) rotate(-8deg); opacity: 0; } 60% { transform: scale(1.08) rotate(2deg); opacity: 1; } to { transform: none; } }
.banner .bs { margin-top: 12px; font-size: 18px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.res-layout { display: grid; grid-template-columns: 1fr minmax(260px, 0.9fr) 1fr; gap: 18px; align-items: start; }
.res-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.res-stage .stage-slot { height: clamp(280px, 42vh, 440px); }
.res-name { text-align: center; font-size: 30px; font-weight: 900; text-shadow: var(--ts-o); margin-top: -10px; }
.trophy-panel, .coin-panel { display: flex; align-items: center; gap: 14px; }
.tp-badge .medal-badge { width: 70px; height: 70px; }
.tp-main { flex: 1 1 auto; min-width: 0; }
.tp-nums { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; }
.tpn-ico { font-size: 34px; }
.tp-total { font-size: 36px; font-weight: 900; color: var(--yellow); text-shadow: var(--ts-o); }
.tp-delta { font-size: 22px; font-weight: 900; padding: 1px 10px; border-radius: 99px; border: 2.5px solid var(--o); text-shadow: var(--ts-o-sm); }
.tp-delta.up { background: var(--green); }
.tp-delta.down { background: var(--red); }
.tp-delta.flat { background: #5866a8; }
.tp-delta.bump { animation: btnBump 600ms var(--ease-spring) 300ms; }
.tp-bar .fill { --fc: linear-gradient(180deg, #ffe25c, #ffb81c); }
.tp-next { margin-top: 5px; font-size: 13px; font-weight: 800; color: var(--ink-2); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tp-next .tn-ico { font-size: 16px; }
.cp-ico { font-size: 64px; filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); animation: coinSpin 2.4s ease-in-out infinite; }
@keyframes coinSpin { 50% { transform: rotateY(180deg); } }
.cp-val { display: flex; align-items: baseline; gap: 2px; font-size: 40px; font-weight: 900; color: #fff3b0; text-shadow: var(--ts-o); }
.cp-plus { font-size: 28px; }
.coin-bonus { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.res-level { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.res-level-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.star-row { display: flex; justify-content: center; gap: 8px; margin: 4px 0 10px; }
.star-row .st { font-size: 56px; opacity: .35; transform: scale(.7); transition: transform 500ms var(--ease-spring), opacity 300ms; }
.star-row .st.on { opacity: 1; transform: scale(1.1) rotate(-6deg); }
.goal-check { display: grid; gap: 5px; }
.goal-check .g { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.goal-check .g.done { color: #fff; }
.goal-check .box { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; border: 2.5px solid var(--o); background: rgba(0,0,0,.35); font-size: 16px; flex: 0 0 auto; }
.goal-check .g.done .box { background: var(--green); }
.medal-list { display: grid; gap: 8px; }
.medal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: rgba(0,0,0,.25); opacity: 0; transform: translateX(calc(-30px * var(--flip))) scale(.9); transition: all 450ms var(--ease-spring); }
.medal-item.in { opacity: 1; transform: none; }
.mi-badge { width: 46px; height: 46px; flex: 0 0 auto; }
.mi-txt { flex: 1 1 auto; min-width: 0; }
.mi-name { font-weight: 900; font-size: 15px; }
.mi-desc { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.mi-coins { display: flex; align-items: center; gap: 3px; font-weight: 900; color: #fff3b0; text-shadow: var(--ts-o-sm); }
.mi-coins .mic-ico { font-size: 20px; }
.sb { display: grid; gap: 4px; }
.sb-row { display: grid; grid-template-columns: 2.4fr repeat(4, 1fr); align-items: center; gap: 6px; padding: 6px 10px; border-radius: 12px; background: rgba(0,0,0,.22); font-weight: 800; }
.sb-row.head { background: none; font-size: 12px; font-weight: 900; color: var(--ink-dim); text-transform: uppercase; }
.sb-row.ally { box-shadow: inset 4px 0 0 var(--blue); }
.sb-row.foe { box-shadow: inset 4px 0 0 var(--red); }
[dir='rtl'] .sb-row.ally { box-shadow: inset -4px 0 0 var(--blue); }
[dir='rtl'] .sb-row.foe { box-shadow: inset -4px 0 0 var(--red); }
.sb-row.me { background: linear-gradient(var(--to-start), rgba(255,210,63,.35), rgba(0,0,0,.2)); }
.sb-row .c { text-align: center; }
.sb-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sb-port { width: 34px; height: 34px; border-radius: 9px; border: 2px solid var(--o); flex: 0 0 auto; font-size: 11px; }
.sb-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-you { padding: 1px 8px; border-radius: 99px; background: var(--yellow); color: #3a2000; font-size: 11px; font-weight: 900; }

/* ---------------------------------------------------------------- */
/* 17. Loading screen                                                */
/* ---------------------------------------------------------------- */
.loading-screen { position: absolute; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; transition: opacity 600ms ease, transform 600ms ease; pointer-events: auto; }
.loading-screen.out { opacity: 0; transform: scale(1.06); pointer-events: none; }
.ld-bg { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 40%, #4a56e8 0%, #232a96 48%, #0b0d3a 100%); }
.ld-rays { position: absolute; left: 50%; top: 42%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; background: repeating-conic-gradient(rgba(170, 200, 255, .12) 0 9deg, transparent 9deg 22deg); -webkit-mask: radial-gradient(closest-side, #000 10%, transparent 65%); mask: radial-gradient(closest-side, #000 10%, transparent 65%); animation: spin 40s linear infinite; }
.ld-shapes i { position: absolute; left: var(--x); bottom: -60px; width: 40px; height: 40px; border-radius: 10px; background: hsl(var(--h) 90% 65%); border: 3px solid var(--o); opacity: .5; animation: floatUp var(--d) linear infinite; animation-delay: var(--dl); --sc: var(--s); --r: 20deg; }
.ld-mid { position: relative; z-index: 1; text-align: center; animation: logoIn 900ms var(--ease-spring) both; }
.ld-logo .logo-text { font-size: clamp(64px, 11vw, 140px); }
.ld-sub { margin-top: 16px; font-size: clamp(16px, 2vw, 22px); font-weight: 900; color: var(--cyan); text-shadow: var(--ts-o-sm); }
.ld-foot { position: absolute; bottom: calc(48px + var(--safe-b)); inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 24px; z-index: 1; }
.ld-tip { min-height: 2.6em; max-width: 640px; text-align: center; font-size: 17px; font-weight: 800; color: #fff; text-shadow: var(--ts-o-sm); opacity: 0; transform: translateY(6px); transition: opacity 300ms, transform 300ms; }
.ld-tip.in { opacity: 1; transform: none; }
.ld-bar { position: relative; width: min(560px, 86vw); height: 34px; border-radius: 99px; border: 3px solid var(--o); background: rgba(4, 6, 30, .7); box-shadow: inset 0 3px 4px rgba(0,0,0,.5), 0 5px 0 var(--o); overflow: hidden; }
.ld-fill { position: absolute; inset: 0; transform-origin: var(--origin) center; transform: scaleX(0); background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0) 50%), repeating-linear-gradient(-45deg, #ffd23f 0 14px, #ffb81c 14px 28px); background-size: auto, 40px 40px; animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 0 0, 40px 0; } }
.ld-shine { position: absolute; inset: 3px 10px auto; height: 7px; border-radius: 99px; background: rgba(255,255,255,.35); }
.ld-pct { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 18px; text-shadow: var(--ts-o-sm); }
.ld-label { font-size: 14px; font-weight: 800; color: var(--ink-2); text-shadow: 0 2px 0 rgba(0,0,0,.4); }

/* ---------------------------------------------------------------- */
/* 18. HUD                                                           */
/* ---------------------------------------------------------------- */
.hud { position: absolute; inset: 0; pointer-events: none; font-family: var(--font); transition: opacity 200ms; }
.hud.is-hidden { opacity: 0; visibility: hidden; }
.hud-layer { position: absolute; inset: 0; overflow: hidden; }
.hud-vig { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 50%, rgba(255, 20, 40, .55) 100%); }
.hud-poison-vig { position: absolute; inset: 0; opacity: 0; transition: opacity 600ms; background: radial-gradient(ellipse at center, transparent 55%, rgba(120, 255, 80, .3) 100%); }
.hud-poison-vig.on { opacity: 1; animation: poisonPulse 1.6s ease-in-out infinite; }
@keyframes poisonPulse { 50% { opacity: .55; } }

.hud-top { position: absolute; top: calc(10px + var(--safe-t)); inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hud-clock { display: flex; align-items: center; gap: 8px; padding: 4px 14px 5px 6px; padding-inline: 6px 14px; border-radius: 16px; border: 3px solid var(--o); background: linear-gradient(180deg, rgba(36, 46, 124, .92), rgba(14, 20, 70, .94)); box-shadow: 0 4px 0 var(--o); }
.hud-mode-ico { font-size: 30px; display: inline-flex; }
.hud-mode { font-size: 14px; font-weight: 900; color: var(--ink-2); text-shadow: var(--ts-o-sm); }
.hud-timer { font-size: 28px; font-weight: 900; text-shadow: var(--ts-o); font-variant-numeric: tabular-nums; min-width: 3.2ch; text-align: center; }
.hud-timer.low { color: #ff7a85; animation: timerPulse 1s ease-in-out infinite; }
@keyframes timerPulse { 50% { transform: scale(1.12); } }
.hud-diff { padding: 1px 9px 2px; border-radius: 99px; border: 2px solid var(--o); background: var(--dc, #46d160); font-size: 12px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.hud-score { display: flex; justify-content: center; }
.score-block { display: flex; align-items: center; gap: 10px; padding: 5px 14px; border-radius: 14px; border: 3px solid var(--o); background: rgba(10, 14, 50, .85); box-shadow: 0 3px 0 var(--o); font-weight: 900; text-shadow: var(--ts-o-sm); }
.score-block.pop-a, .score-block.pop-b { animation: btnBump 500ms var(--ease-spring); }
.sbk { display: flex; gap: 5px; }
.rp { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--o); background: rgba(255,255,255,.12); }
.sbk.ally .rp.on { background: radial-gradient(circle at 35% 30%, #b8e0ff, var(--blue)); box-shadow: 0 0 10px var(--blue); }
.sbk.enemy .rp.on { background: radial-gradient(circle at 35% 30%, #ffb3b8, var(--red)); box-shadow: 0 0 10px var(--red); }
.round-pips .lbl { font-size: 13px; color: var(--ink-2); }
.safe-bars { gap: 16px; }
.safe-b { display: flex; align-items: center; gap: 6px; }
.safe-b .sb-ico { font-size: 26px; display: inline-flex; }
.sb-col { display: flex; flex-direction: column; gap: 2px; }
.sfb-lbl { font-size: 11px; color: var(--ink-2); }
.safe-b .bar { width: 120px; height: 13px; }
.safe-b.ally .fill { --fc: linear-gradient(180deg, #b8e0ff, #2a7ff0); }
.safe-b.enemy .fill { --fc: linear-gradient(180deg, #ffb3b8, #f03a4e); }
.safe-b .pct { font-size: 14px; min-width: 3.6ch; }
.safe-b.low .pct { color: #ff7a85; }
.hud-alive { font-size: 16px; }
.hud-alive .al-ico { font-size: 24px; }
.hud-alive .n { font-size: 22px; color: var(--yellow); }
.hud-goals { gap: 12px; }
.gs { min-width: 46px; padding: 2px 10px; border-radius: 12px; border: 2.5px solid var(--o); text-align: center; font-size: 28px; }
.gs.ally { background: linear-gradient(180deg, #6fc1ff, #2a7ff0); }
.gs.enemy { background: linear-gradient(180deg, #ff8a92, #f03a4e); }
.gs.pop-a, .gs.pop-b { animation: btnBump 600ms var(--ease-spring); }
.gball { font-size: 30px; display: inline-flex; animation: spin 6s linear infinite; }
.gtarget { font-size: 12px; color: var(--ink-2); }
.hud-alert { display: none; padding: 6px 16px 7px; border-radius: 14px; border: 3px solid var(--o); font-weight: 900; font-size: 16px; text-shadow: var(--ts-o-sm); box-shadow: 0 3px 0 var(--o); }
.hud-alert.on { display: block; animation: toastIn 360ms var(--ease-spring); }
.hud-poison { background: linear-gradient(180deg, #8ff57a, #3aa82a); }
.hud-ball { background: linear-gradient(180deg, #ffe25c, #ffb81c); }

.hud-pausebtn { position: absolute; top: calc(12px + var(--safe-t)); inset-inline-end: calc(14px + var(--safe-r)); width: 52px; height: 52px; border-radius: 14px; border: 3px solid var(--o); background: linear-gradient(180deg, #6fc1ff, #2a7ff0); box-shadow: inset 0 -4px 0 #1550b8, 0 4px 0 var(--o); display: grid; place-items: center; font-size: 26px; pointer-events: auto; cursor: pointer; padding: 0; }
.hud-pausebtn:active { transform: translateY(3px); }

.hud-feed { position: absolute; top: calc(78px + var(--safe-t)); inset-inline-end: calc(14px + var(--safe-r)); display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.feed-row { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 10px; border: 2.5px solid var(--o); background: rgba(10, 14, 50, .85); font-weight: 900; font-size: 14px; text-shadow: var(--ts-o-sm); animation: feedIn 360ms var(--ease-spring); }
@keyframes feedIn { from { transform: translateX(calc(30px * var(--flip) * -1)); opacity: 0; } }
.feed-row.player { background: linear-gradient(var(--to-start), rgba(255, 210, 63, .5), rgba(10, 14, 50, .85)); }
.feed-row .k { color: #b8e0ff; }
.feed-row.enemy .k { color: #ffb3b8; }
.feed-row .mid { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); }
.feed-row .fm-ico { font-size: 18px; }
.feed-row .fm-txt:empty { display: none; }

.hud-announce { position: absolute; top: 26%; inset-inline: 0; text-align: center; font-size: clamp(40px, 6.5vw, 86px); font-weight: 900; text-shadow: var(--ts-o); opacity: 0; transform: scale(.4); color: #fff6c8; pointer-events: none; }
.hud-announce.show { animation: annIn 600ms var(--ease-spring) forwards; }
.hud-announce.hide { animation: annOut 300ms ease forwards; }
@keyframes annIn { 0% { opacity: 0; transform: scale(.3) rotate(-8deg); } 60% { opacity: 1; transform: scale(1.15) rotate(2deg); } 100% { opacity: 1; transform: scale(1) rotate(-2deg); } }
@keyframes annOut { from { opacity: 1; transform: scale(1) rotate(-2deg); } to { opacity: 0; transform: scale(1.3); } }

.hud-lvlbanner {
  position: absolute; top: calc(118px + var(--safe-t)); inset-inline: 0; margin-inline: auto; width: max-content; max-width: 94vw;
  display: flex; align-items: center; gap: 12px; padding: 6px 20px 6px 6px; padding-inline: 6px 20px; border-radius: 18px; border: 3px solid var(--o);
  background: linear-gradient(var(--to-start), color-mix(in srgb, var(--cc) 70%, #1a2163), #1a2163 85%); box-shadow: 0 5px 0 var(--o), 0 14px 30px rgba(0,0,0,.4);
  opacity: 0; transform: translateY(-20px) scale(.8); transition: opacity 300ms, transform 400ms var(--ease-spring);
}
.hud-lvlbanner.show { opacity: 1; transform: none; }
.lb-port { position: relative; width: 58px; height: 58px; border-radius: 14px; overflow: hidden; border: 3px solid var(--o); background: var(--cc); flex: 0 0 auto; }
.lb-port img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.lb-pres:empty { display: none; }
.lb-txt { display: flex; flex-direction: column; gap: 2px; }
.lb-name { font-size: 20px; font-weight: 900; text-shadow: var(--ts-o); }
.lb-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 900; font-size: 15px; text-shadow: var(--ts-o-sm); }
.lb-lv { padding: 1px 9px; border-radius: 8px; border: 2px solid var(--o); background: linear-gradient(180deg, #6fc1ff, #2a7ff0); }
.lb-sep { opacity: .6; }
.lb-b.lb-hp { color: #8ff5a8; }
.lb-b.lb-dmg { color: #ffb3b8; }
.lb-b.lb-spd { color: #9ffcff; }

.hud-dead { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: radial-gradient(circle, rgba(10, 6, 30, .3), rgba(10, 6, 30, .75)); }
.hud-dead.on { display: flex; animation: fadeIn 300ms; }
.hud-dead .dt { font-size: clamp(40px, 6vw, 72px); font-weight: 900; color: #ff7a85; text-shadow: var(--ts-o); }
.hud-dead .ds { font-size: 24px; font-weight: 900; text-shadow: var(--ts-o-sm); }

.hud-bottom { position: absolute; bottom: calc(14px + var(--safe-b)); inset-inline-start: calc(14px + var(--safe-l)); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hud-superready { display: none; padding: 4px 14px; border-radius: 12px; border: 3px solid var(--o); background: linear-gradient(180deg, #ffe25c, #ffb81c); font-weight: 900; font-size: 16px; text-shadow: var(--ts-o-sm); }
.hud-superready.on { display: block; animation: superPulse 1s ease-in-out infinite; }
@keyframes superPulse { 50% { transform: scale(1.08); filter: brightness(1.15); } }
.hud-player { display: flex; align-items: center; gap: 10px; padding: 6px 14px 8px 6px; padding-inline: 6px 14px; border-radius: 18px; border: 3px solid var(--o); background: linear-gradient(180deg, rgba(36, 46, 124, .92), rgba(14, 20, 70, .94)); box-shadow: 0 4px 0 var(--o); }
.hp-port { position: relative; width: 64px; height: 64px; border-radius: 14px; border: 3px solid var(--o); background: var(--cc); flex: 0 0 auto; box-shadow: 0 0 0 3px var(--pc, transparent); }
.hp-port img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; border-radius: 11px; }
.hp-lv { position: absolute; bottom: -8px; inset-inline-start: -8px; min-width: 28px; height: 28px; padding: 0 5px; display: grid; place-items: center; border-radius: 9px; border: 2.5px solid var(--o); background: linear-gradient(180deg, #6fc1ff, #2a7ff0); font-size: 14px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.hp-pres { position: absolute; top: -10px; inset-inline-end: -10px; }
.hp-col { display: flex; flex-direction: column; gap: 5px; min-width: 220px; }
.hp-namerow { display: flex; align-items: center; gap: 8px; }
.hp-name { font-size: 17px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.hp-lvtxt { font-size: 12px; font-weight: 900; color: #b8e0ff; text-shadow: var(--ts-o-sm); }
.hp-bar { position: relative; height: 22px; border-radius: 10px; border: 3px solid var(--o); background: rgba(4, 6, 30, .7); overflow: hidden; }
.hp-bar > i { display: block; height: 100%; transform-origin: var(--origin) center; transition: transform 160ms ease-out; background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0) 55%), linear-gradient(180deg, #8ff5a8, #22b14c); }
.hp-bar.hurt > i { background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0) 55%), linear-gradient(180deg, #ffe680, #f0a000); }
.hp-bar.crit > i { background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0) 55%), linear-gradient(180deg, #ff9aa2, #e02035); animation: timerPulse .8s ease-in-out infinite; }
.hp-txt { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.ammo-pips { display: flex; gap: 4px; }
.ap { flex: 1 1 0; height: 14px; border-radius: 6px; border: 2.5px solid var(--o); background: rgba(4, 6, 30, .7); overflow: hidden; }
.ap > i { display: block; height: 100%; transform-origin: var(--origin) center; transform: scaleX(0); background: linear-gradient(180deg, #ffe680, #ff9a1c); }
.ap.full > i { background: linear-gradient(180deg, #fff3a0, #ffb81c); }
.ammo-pips.is-infinite .ap { box-shadow: 0 0 8px rgba(255, 210, 63, .7); }

/* nameplates */
.plate { position: absolute; left: 0; top: 0; display: none; flex-direction: column; align-items: center; gap: 2px; will-change: transform; --tc: var(--red); }
.plate.on { display: flex; }
.plate.me { --tc: var(--green); }
.plate.ally { --tc: var(--blue); }
.plate.dim { opacity: .5; }
.p-row { display: flex; align-items: center; gap: 4px; }
.plv { display: none; min-width: 22px; height: 20px; padding: 0 4px; place-items: center; border-radius: 6px; border: 2px solid var(--o); background: linear-gradient(180deg, #6fc1ff, #2a7ff0); font-size: 11px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.plate.has-lv .plv { display: grid; }
.plate.prestige .plv { background: var(--prc); box-shadow: 0 0 8px var(--prc); }
.pn { font-size: 14px; font-weight: 900; text-shadow: var(--ts-o-sm); white-space: nowrap; color: #fff; }
.plate.enemy .pn { color: #ffd0d4; }
.php { position: relative; width: 96px; height: 15px; border-radius: 6px; border: 2.5px solid var(--o); background: rgba(4, 6, 30, .75); overflow: hidden; }
.php > i { display: block; height: 100%; transform-origin: var(--origin) center; background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0) 55%), var(--tc); transition: transform 140ms ease-out; }
.phpt { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; font-weight: 900; text-shadow: var(--ts-o-sm); line-height: 1; }
.psup { width: 72px; height: 6px; border-radius: 3px; background: rgba(4, 6, 30, .6); overflow: hidden; display: none; }
.plate.me .psup { display: block; }
.psup > i { display: block; height: 100%; transform-origin: var(--origin) center; background: linear-gradient(90deg, #ffe25c, #ffb81c); }
.plate.super-ready.me .psup > i { box-shadow: 0 0 6px #ffd23f; }
.pcrown { display: none; font-size: 22px; margin-bottom: -4px; }
.plate.crowned .pcrown { display: block; }
.dmg { position: absolute; left: 0; top: 0; display: none; font-size: 24px; font-weight: 900; text-shadow: var(--ts-o); will-change: transform, opacity; white-space: nowrap; }
.dmg.on { display: block; }

/* touch controls */
.hud-stick { position: absolute; left: 0; top: 0; width: 120px; height: 120px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); background: rgba(10, 14, 50, .35); display: none; }
.hud-stick.on { display: block; }
.hud-stick .knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: linear-gradient(180deg, #fff, #c9d2f0); border: 3px solid var(--o); }
.hud-actions { position: absolute; bottom: calc(26px + var(--safe-b)); inset-inline-end: calc(26px + var(--safe-r)); display: flex; align-items: flex-end; gap: 18px; pointer-events: auto; }
.act { position: relative; border-radius: 50%; display: grid; place-items: center; touch-action: none; }
.act-fire { width: 108px; height: 108px; }
.act-super { width: 86px; height: 86px; margin-bottom: 70px; }
.act-face { position: absolute; inset: 6px; border-radius: 50%; display: grid; place-items: center; border: 3px solid var(--o); background: linear-gradient(180deg, #ff8a92, #f03a4e); box-shadow: inset 0 -6px 0 #a8102a, 0 4px 0 var(--o); font-size: 44px; }
.act-super .act-face { background: linear-gradient(180deg, #8a90b8, #4a5080); box-shadow: inset 0 -6px 0 #2a2f58, 0 4px 0 var(--o); font-size: 36px; }
.act-super.ready .act-face { background: linear-gradient(180deg, #fff3a0, #ffb81c); box-shadow: inset 0 -6px 0 #d77d00, 0 4px 0 var(--o), 0 0 24px #ffd23f; animation: superPulse 1s ease-in-out infinite; }
.act-ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(#ffd23f calc(var(--p, 0) * 360deg), rgba(255,255,255,.15) 0); -webkit-mask: radial-gradient(closest-side, transparent 80%, #000 81%); mask: radial-gradient(closest-side, transparent 80%, #000 81%); }
.act .lbl { position: absolute; bottom: -22px; font-size: 13px; font-weight: 900; text-shadow: var(--ts-o-sm); white-space: nowrap; }

/* desktop key hints — big and friendly */
.hud-keys { position: absolute; bottom: calc(14px + var(--safe-b)); inset-inline-end: calc(14px + var(--safe-r)); display: flex; align-items: flex-end; gap: 14px; padding: 10px 14px 8px; border-radius: 20px; border: 3px solid var(--o); background: rgba(10, 14, 50, .72); box-shadow: 0 4px 0 var(--o); }
.kh { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.khl { font-size: 13px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.hud-keys .kc { height: 46px; min-width: 46px; font-size: 18px; }
.hud-keys .keypad .kc { height: 38px; min-width: 38px; font-size: 20px; }
.hud-keys .kc-space { min-width: 150px; background: linear-gradient(180deg, #ffd0d4, #ff8a92); box-shadow: inset 0 -5px 0 #c84050, 0 3px 0 var(--o); }
.kh-super .kc { position: relative; background: linear-gradient(90deg, #ffd23f calc(var(--p, 0) * 100%), #d9e0f5 0); box-shadow: inset 0 -5px 0 #a8b3d6, 0 3px 0 var(--o); }
.kh-super.ready .kc { background: linear-gradient(180deg, #fff3a0, #ffb81c); box-shadow: inset 0 -5px 0 #d77d00, 0 3px 0 var(--o), 0 0 18px #ffd23f; animation: superPulse 1s ease-in-out infinite; }
[dir='rtl'] .kh-super .kc { background: linear-gradient(270deg, #ffd23f calc(var(--p, 0) * 100%), #d9e0f5 0); }
[dir='rtl'] .kh-super.ready .kc { background: linear-gradient(180deg, #fff3a0, #ffb81c); }

/* ---------------------------------------------------------------- */
/* 19. Responsive                                                    */
/* ---------------------------------------------------------------- */
@media (max-width: 1180px) {
  .char-grid { grid-template-columns: repeat(3, 1fr); }
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
  .help-grid { grid-template-columns: 1fr 1fr; }
  .res-layout { grid-template-columns: 1fr 1fr; }
  .res-stage { grid-column: 1 / -1; order: -1; }
  .side-btn { min-width: 0; }
  .title-dock { width: 260px; }
}
@media (max-width: 860px) {
  .sel-layout, .up-layout, .camp-top { grid-template-columns: 1fr; }
  .sel-hero { position: relative; }
  .help-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .scr-head { gap: 10px; padding-inline: calc(12px + var(--safe-l)) calc(12px + var(--safe-r)); }
  .scr-head .res-strip { width: 100%; justify-content: flex-end; order: 5; }
  .scr-head .sub { font-size: 12.5px; }
  .head-title { font-size: 24px; }
  .btn-back { width: 48px; min-height: 48px; }
  .scr-body { padding-inline: calc(12px + var(--safe-l)) calc(12px + var(--safe-r)); }
  .scr-foot { padding-inline: 12px; justify-content: center; }
  .res { height: 36px; font-size: 16px; padding-inline: 4px 12px; }
  .res .res-ico { font-size: 28px; }

  /* lobby stacks vertically */
  .top-bar { gap: 8px; padding-inline: calc(10px + var(--safe-l)) calc(10px + var(--safe-r)); flex-wrap: wrap; }
  .top-bar .spacer { display: none; }
  .top-bar .res-strip { order: 5; width: 100%; justify-content: center; margin-top: 2px; }
  .prof-chip { flex: 1 1 auto; min-width: 0; }
  .pc-av { width: 40px; height: 40px; }
  .pc-name { font-size: 15px; }
  .lang-btn .btn-lbl { display: none; }
  .lang-btn { width: 46px; padding: 0 0 3px; }
  .title-logo { top: calc(112px + var(--safe-t)); max-width: 90vw; }
  .logo-text { font-size: 44px; }
  .logo-sub { font-size: 13px; margin-top: 6px; }
  .lobby-stage { inset-block: calc(150px + var(--safe-t)) calc(300px + var(--safe-b)); inset-inline: 4%; }
  .title-side { top: auto; transform: none; bottom: calc(108px + var(--safe-b)); inset-inline: 10px; flex-direction: row; justify-content: center; gap: 8px; }
  .side-btn { flex-direction: column; gap: 4px; padding: 5px 4px 6px; min-width: 0; flex: 1 1 0; border-radius: 15px; text-align: center; }
  .side-btn:hover { transform: none; }
  .sb-tile { width: 48px; height: 48px; }
  .sb-ico { font-size: 30px; }
  .sb-lbl { font-size: 11.5px; white-space: normal; line-height: 1.1; }
  .sb-extra { display: none; }
  .lobby-plate { bottom: calc(196px + var(--safe-b)); max-width: 92vw; padding: 6px 14px 7px 6px; padding-inline: 6px 14px; }
  .lobby-plate .medal-badge { width: 48px; height: 48px; }
  .lp-name { font-size: 22px; }
  .lp-hint { display: none; }
  .title-dock { inset-inline: 10px; bottom: calc(12px + var(--safe-b)); width: auto; flex-direction: row; align-items: stretch; gap: 8px; }
  .dock-mode { flex: 1 1 0; min-width: 0; padding: 6px 8px; gap: 8px; }
  .dm-icon { width: 46px; height: 46px; }
  .dm-ico { font-size: 32px; }
  .dm-name { font-size: 16px; }
  .dm-kicker { font-size: 10px; }
  .dm-diff { position: absolute; top: 4px; inset-inline-end: 4px; font-size: 10px; padding: 1px 6px; }
  .dm-diff .dd-ico { font-size: 13px; }
  .btn-play { width: auto; flex: 1.1 1 0; font-size: 28px; min-height: 80px; padding-inline: 12px; }
  .btn-play .btn-ico { font-size: 28px; }

  .hc-name { font-size: 28px; }
  .sel-hero .stage-slot { height: 240px; }
  .hc-stats { grid-template-columns: 1fr 1fr; }
  .diff-grid { grid-template-columns: 1fr; gap: 10px; }
  .diff-card { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .diff-card .dc-desc { width: 100%; }
  .diff-grid.is-compact { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .diff-grid.is-compact .diff-card { flex-direction: column; padding: 8px; text-align: center; }
  .diff-grid.is-compact .dc-name { font-size: 17px; }
  .diff-grid.is-compact .dc-tag { display: none; }
  .diff-grid.is-compact .dc-flag { font-size: 9.5px; inset-inline-start: 4px; }
  .mode-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mc-art { height: 64px; }
  .mc-ico { font-size: 44px; }
  .mc-desc { display: none; }
  .mc-name { font-size: 17px; }
  .char-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .cc-name { font-size: 13px; }
  .foot-sum { display: none; }
  .btn-start { width: 100%; min-width: 0; }
  .btn-xl { font-size: 26px; min-height: 68px; }

  .stage-node { width: 100%; }
  .stage-row.side-b .stage-node { flex-direction: row; text-align: start; }
  .stage-row.side-b .stage-meta, .stage-row.side-b .goal-line { justify-content: flex-start; }
  .camp-trail { left: 52px; }
  [dir='rtl'] .camp-trail { left: auto; right: 52px; margin: 0 -5px 0 0; }
  .stage-medal { width: 70px; height: 70px; }
  .stage-node.is-boss .stage-medal { width: 78px; height: 78px; }
  .stage-num { font-size: 26px; }

  .up-buy { grid-template-columns: 1fr; grid-template-areas: 'c' 'm' 'b' 'bal'; }
  .up-btn { width: 100%; min-width: 0; }
  .up-hero .stage-slot { height: 250px; }
  .up-levelbadge { width: 78px; }
  .cmp-row { grid-template-columns: 1.15fr 1fr 22px 1.2fr; padding: 7px 8px; gap: 4px; }
  .cmp-l { font-size: 13px; gap: 4px; }
  .cmp-ico { font-size: 20px; }
  .cmp-now, .cmp-next { font-size: 17px; }
  .cmp-delta { font-size: 12px; }

  .rm, .road { padding-inline-start: 58px; }
  .rm-band, .rm-here, .rm-start, .rm-prestige-head { margin-inline-start: -58px; }
  .rm-spine, .road-spine { inset-inline-start: 22px; }
  .rn-dot { inset-inline-start: -50px; width: 38px; height: 38px; }
  .road-dot { inset-inline-start: -54px; width: 46px; height: 46px; }
  .rn-card, .road-card { padding: 8px 10px; gap: 8px; flex-wrap: wrap; }
  .rn-desc { font-size: 12px; }
  .road-ico { width: 48px; height: 48px; }
  .road-big { font-size: 36px; }
  .rt-big { font-size: 34px; }
  .rm-top, .road-top { gap: 12px; }

  .help-hero { padding: 14px; gap: 14px; }
  .kc.is-big { min-width: 54px; height: 54px; font-size: 20px; }
  .kc-space.is-big { min-width: 160px; }
  .kc-wide.is-big { min-width: 96px; }
  .keypad.is-big .kc { min-width: 46px; height: 46px; font-size: 22px; }
  .hh-lbl { font-size: 16px; }

  .banner .bt { font-size: 46px; }
  .bn-ribbon { padding: 6px 34px 10px; }
  .res-layout { grid-template-columns: 1fr; }
  .res-stage .stage-slot { height: 250px; }
  .sb-row { grid-template-columns: 2fr repeat(3, 1fr); font-size: 13px; padding: 5px 6px; }
  .hide-sm { display: none; }
  .trophy-panel, .coin-panel { padding: 12px; }
  .tp-total { font-size: 30px; }
  .cp-val { font-size: 32px; }
  .cp-ico { font-size: 50px; }

  .players-grid { grid-template-columns: 1fr; gap: 16px; }
  .player-card { padding: 16px 10px 12px; }
  .pl-avatar { width: 84px; height: 84px; }
  .pl-name { font-size: 19px; }
  .player-card.is-new { grid-column: 1 / -1; }
  .modal-head h2 { font-size: 23px; }

  /* HUD on a phone */
  .hud-clock { padding-inline: 4px 10px; }
  .hud-mode { display: none; }
  .hud-timer { font-size: 22px; }
  .safe-b .bar { width: 70px; }
  .sfb-lbl { display: none; }
  .hp-col { min-width: 150px; }
  .hp-port { width: 50px; height: 50px; }
  .hud-feed { top: calc(110px + var(--safe-t)); }
  .feed-row { font-size: 12px; }
  .hud-lvlbanner { top: calc(100px + var(--safe-t)); }
  .lb-name { font-size: 16px; }
  .lb-line { font-size: 13px; }
  .lb-port { width: 46px; height: 46px; }
  .hud-keys { display: none; }
}
@media (max-height: 640px) and (min-width: 761px) {
  .title-logo { top: calc(60px + var(--safe-t)); }
  .logo-text { font-size: 48px; }
  .side-btn { padding-block: 3px; }
  .sb-tile { width: 46px; height: 46px; }
  .btn-play { min-height: 72px; font-size: 32px; }
}

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

/* v1 fallback portraits keep a little of their ground plane — feather it out */
.ss-img { -webkit-mask-image: radial-gradient(ellipse 50% 56% at 50% 44%, #000 66%, transparent 100%); mask-image: radial-gradient(ellipse 50% 56% at 50% 44%, #000 66%, transparent 100%); }
@media (max-width: 760px) {
  .is-lobby .ss-figure { height: 72%; bottom: 13%; }
  .is-lobby .ss-pedestal { width: 78%; }
}
/* grid tracks must never grow to a scrolling child's min-content width */
.sel-layout > *, .up-layout > *, .camp-top > *, .res-layout > *, .help-grid > * { min-width: 0; }
.char-strip { max-width: 100%; }
@media (max-width: 760px) {
  .hud-actions { flex-direction: column; align-items: center; gap: 30px; bottom: calc(30px + var(--safe-b)); inset-inline-end: calc(16px + var(--safe-r)); }
  .act-super { margin-bottom: 0; }
  .act-fire { width: 100px; height: 100px; }
  .hud.is-touch .hud-bottom { inset-inline-end: 130px; }
  .hud.is-touch .hp-col { min-width: 0; flex: 1 1 auto; }
  .hud.is-touch .hud-player { width: 100%; }
}

/* =====================================================================
   21. Navigation pass (kid-friendly lobby + split pickers)
   - entrances are opacity-only and short (<=200ms) so menus are usable
     at once and nothing is ever measured/drawn off-screen mid-slide;
   - staggered "rise" only on a screen's FIRST visit (.seen skips it).
   ===================================================================== */
.screen { transform: none; transition: opacity 160ms ease-out, visibility 0s linear 160ms; }
.screen.is-active { transform: none; }
.screen.is-active.nav-fwd, .screen.is-active.nav-back { animation: scrFade 180ms ease-out both; }
@keyframes scrFade { from { opacity: 0; } to { opacity: 1; } }
.screen.is-active .rise { animation: riseIn 260ms var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 6) * 30ms); }
.screen.seen.is-active .rise { animation: none; }
.title-logo { animation-duration: 300ms; }
.screen-title.seen .title-logo { animation: none; }
.ui-backdrop { transition: opacity 180ms linear; }
.loading-screen { transition: opacity 280ms ease, transform 280ms ease; }

/* ---------- lobby ---------- */
.lobby-stage { inset-block: 17% 23%; inset-inline: 27%; }
.stage-slot.is-tappable { cursor: pointer; }
.title-side { gap: 14px; }
.side-btn { min-width: 236px; padding-block: 8px; }
.sb-tile { width: 66px; height: 66px; }
.sb-ico { font-size: 44px; }
.sb-lbl { font-size: 19px; }

.lobby-who {
  position: absolute; bottom: calc(26px + var(--safe-b)); inset-inline: 0; margin-inline: auto;
  width: max-content; max-width: calc(100vw - 32px); z-index: 4;
  display: flex; align-items: center; gap: 12px;
}
.lobby-who .lobby-plate { position: static; margin: 0; max-width: none; width: auto; }
.btn-change { min-height: 74px; padding-inline: 22px; font-size: 20px; border-radius: 20px; }
.btn-change .btn-ico { font-size: 28px; }

.title-dock { width: 340px; gap: 10px; }
.dock-mode { min-height: 78px; }
.dm-go { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.28); border: 2.5px solid var(--o); font-size: 18px; z-index: 1; flex: 0 0 auto; }
.btn-play { min-height: 108px; font-size: 46px; }
.btn-play .btn-ico { font-size: 44px; }

@media (max-width: 1180px) and (min-width: 761px) {
  .lobby-who { bottom: calc(240px + var(--safe-b)); }
  .lobby-stage { inset-block: 15% 34%; }
}

/* ---------- character picker ---------- */
.br-layout { display: grid; grid-template-columns: minmax(340px, 0.85fr) 1.3fr; gap: 22px; max-width: 1360px; margin-inline: auto; align-items: start; }
.br-layout > * { min-width: 0; }
.screen-brawlers .sel-hero .stage-slot { height: clamp(220px, 33vh, 320px); }
.screen-brawlers .hc-abils { margin-top: 10px; }
.screen-brawlers .abil { padding: 8px 10px; }
.br-main .char-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
.br-main .char-card .cc-art { aspect-ratio: 1 / 0.98; }
.br-main .cc-name { font-size: 19px; padding: 7px 4px 8px; }
.br-main .cc-lv { min-width: 38px; height: 36px; font-size: 18px; }

/* ---------- mode picker ---------- */
.modes-wrap { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.mode-diff { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.md-label { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 900; text-shadow: var(--ts-o-sm); }
.md-ico { font-size: 30px; }
.diff-seg { display: flex; gap: 8px; padding: 6px; border-radius: 22px; border: 3px solid var(--o); background: rgba(6, 9, 40, .7); box-shadow: 0 4px 0 var(--o); }
.ds-opt { display: inline-flex; align-items: center; gap: 8px; min-height: 58px; padding: 6px 22px 8px; border-radius: 16px; border: 3px solid transparent; background: transparent; cursor: pointer; font-weight: 900; font-size: 20px; text-shadow: var(--ts-o-sm); color: var(--ink-2); transition: transform 120ms; }
.ds-opt:active { transform: translateY(2px); }
.ds-ico { font-size: 32px; }
.ds-opt.on { color: #fff; border-color: var(--o); background: linear-gradient(180deg, color-mix(in srgb, var(--dc) 70%, #fff), var(--dc) 55%, color-mix(in srgb, var(--dc) 55%, #000)); box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 3px 0 var(--o); }
.mode-grid.is-big { grid-template-columns: repeat(4, 1fr); gap: 16px; }
.mode-grid.is-big .mode-card { padding-bottom: 16px; }
.mode-grid.is-big .mc-art { height: 170px; }
.mode-grid.is-big .mc-ico { font-size: 104px; }
.mode-grid.is-big .mc-name { font-size: 26px; }
.mode-grid.is-big .mc-tag { font-size: 15px; }
.mode-grid.is-big .mc-desc { font-size: 13.5px; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .title-logo { top: calc(110px + var(--safe-t)); }
  .logo-text { font-size: 40px; }
  .lobby-stage { inset-block: calc(168px + var(--safe-t)) calc(332px + var(--safe-b)); inset-inline: 6%; }
  .title-side { bottom: calc(172px + var(--safe-b)); gap: 8px; }
  .side-btn { min-width: 0; padding-block: 6px; }
  .sb-tile { width: 50px; height: 50px; }
  .sb-ico { font-size: 32px; }
  .sb-lbl { font-size: 12px; }
  .lobby-who { bottom: calc(262px + var(--safe-b)); width: auto; inset-inline: 12px; gap: 8px; }
  .lobby-who .lobby-plate { flex: 1 1 auto; min-width: 0; }
  .lp-name { font-size: 20px; }
  .lobby-plate .medal-badge { width: 42px; height: 42px; }
  .btn-change { min-height: 64px; padding: 4px 12px 7px; font-size: 14px; flex-direction: column; gap: 2px; white-space: normal; line-height: 1.05; max-width: 112px; text-align: center; }
  .btn-change .btn-ico { font-size: 26px; }
  .title-dock { flex-direction: column; inset-inline: 12px; width: auto; bottom: calc(12px + var(--safe-b)); gap: 8px; }
  .dock-mode { min-height: 60px; flex: 0 0 auto; padding: 5px 10px 6px 6px; }
  .dm-diff { position: static; font-size: 12px; padding: 2px 8px; }
  .dm-icon { width: 46px; height: 46px; }
  .btn-play { min-height: 84px; font-size: 36px; flex: 0 0 auto; width: 100%; }

  .br-layout { grid-template-columns: 1fr; gap: 10px; }
  .screen-brawlers .sel-hero .stage-slot { height: 190px; min-height: 0; }
  .screen-brawlers .drag-hint { display: none; }
  .screen-brawlers .hero-card { padding: 10px 12px; }
  .screen-brawlers .hc-name { font-size: 24px; }
  .screen-brawlers .hc-role { margin-top: 2px; font-size: 13px; }
  .screen-brawlers .hc-lvl { margin-top: 6px; }
  .screen-brawlers .hc-stats, .screen-brawlers .hc-abils { display: none; }
  .br-main .char-grid { gap: 10px; }
  .br-main .cc-name { font-size: 14px; padding: 4px 2px 5px; }
  .br-main .cc-lv { min-width: 28px; height: 26px; font-size: 13px; }
  .br-main .cc-tro { display: none; }
  .screen-brawlers .scr-head .sub, .screen-modes .scr-head .sub { display: none; }

  .modes-wrap { gap: 12px; }
  .md-label { display: none; }
  .diff-seg { width: 100%; justify-content: space-between; gap: 4px; padding: 4px; }
  .ds-opt { flex: 1 1 0; justify-content: center; min-height: 52px; padding: 4px 6px 6px; font-size: 16px; gap: 4px; }
  .ds-ico { font-size: 24px; }
  .mode-grid.is-big { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mode-grid.is-big .mc-art { height: 112px; }
  .mode-grid.is-big .mc-ico { font-size: 72px; }
  .mode-grid.is-big .mc-name { font-size: 19px; }
  .mode-grid.is-big .mc-tag { font-size: 13px; }
  .mode-grid.is-big .mc-desc { display: none; }
  .mode-grid.is-big .mc-meta { display: none; }
}

/* Visibility must never depend on an animation running: if the page isn't
   producing frames yet (busy boot, asset parsing, backgrounded tab) an
   opacity-0 keyframe would leave the menu invisible. Entrances below are
   transform-only; an active screen is fully opaque from its first style. */
.screen.is-active { opacity: 1; visibility: visible; transition: none; }
.screen.is-active.nav-fwd, .screen.is-active.nav-back { animation: scrPop 180ms ease-out; }
@keyframes scrPop { from { transform: scale(0.992); } to { transform: none; } }
@keyframes riseIn { from { transform: translateY(10px) scale(0.96); } to { transform: none; } }
@keyframes logoIn { from { transform: scale(0.8) rotate(-4deg); } to { transform: none; } }
@keyframes modalIn { from { transform: scale(0.88) translateY(16px); } to { transform: none; } }
@keyframes bannerIn { from { transform: scale(0.5) rotate(-6deg); } 70% { transform: scale(1.06) rotate(1deg); } to { transform: none; } }
@keyframes popIn { from { transform: scale(0.8) translateY(6%); } to { transform: none; } }
@keyframes fadeIn { from { opacity: 0.6; } }
@keyframes toastIn { from { transform: translateY(-14px) scale(.9); } }
/* hiding is instant as well — a fading-out screen must never sit on top of the new one */
.screen { transition: none; }
.screen:not(.is-active) { opacity: 0; visibility: hidden; }
