/* Искра-Арена v5 — полностью пересобранная чистая 9:16 Brawl Stars + Duolingo верстка */
@import url('https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,700;0,800;0,900;1,900&display=swap');

:root {
  --ink: #050918;
  --deep: #081026;
  --text: #FFFFFF;
  --muted: #B6CCE8;
  --cyan: #1DB4FF;
  --violet: #9B5CFF;
  --pink: #FF4D94;
  --gold: #FFC833;
  --orange: #FF8210;
  --green: #24E066;
  --red: #FF3E62;
  --common: #C5D0E6;
  --rare: #22BCFF;
  --legendary: #FFC833;
  --font: 'Rubik', 'SF Pro Rounded', system-ui, -apple-system, sans-serif;
}

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

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: #040714; color: var(--text);
  font-family: var(--font); user-select: none; touch-action: manipulation;
}

/* ---------- Размытый атмосферный фон на ПК ---------- */
#ambient-bg {
  position: fixed; inset: -40px; z-index: 0;
  background: #050918 center / cover no-repeat;
  filter: blur(36px) saturate(1.4) brightness(0.42);
  transform: scale(1.1); transition: background-image 0.5s ease;
}
#ambient-bg::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(29,180,255,0.14), rgba(4,7,20,0.88) 72%);
}
#sparks-cv { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#fx-cv { position: fixed; inset: 0; z-index: 950; pointer-events: none; }

/* ---------- Вертикальная 9:16 мобильная консоль по центру ---------- */
body { display: flex; align-items: center; justify-content: center; }

#stage {
  position: relative; z-index: 2;
  width: 100vw; height: 100dvh; max-width: 100%; max-height: 100dvh;
  overflow: hidden; background: var(--deep);
}
@media (min-width: 560px) {
  #stage {
    width: min(444px, 56.25dvh);
    height: min(94dvh, 876px);
    min-width: 390px;
    border-radius: 34px;
    border: 4px solid #1B2D60;
    box-shadow:
      0 0 0 2px rgba(120, 215, 255, 0.35),
      0 34px 100px rgba(0, 0, 0, 0.85),
      0 0 80px rgba(29, 180, 255, 0.18);
  }
}

#stage-bg {
  position: absolute; inset: 0; z-index: 0;
  background: var(--deep) center / cover no-repeat;
  scale: 1.06;
  translate: calc(var(--px, 0) * -9px) calc(var(--py, 0) * -7px);
  transition: background-image 0.35s ease, translate 0.14s ease-out;
}
#stage-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(5,9,24,0.52) 0%, rgba(5,9,24,0.06) 36%, rgba(5,9,24,0.68) 100%);
}

/* Состояния камеры и глитча */
#stage.hitstop { filter: contrast(1.22) brightness(1.1); transform: scale(1.04); transition: transform 0.04s; }
#stage.quake { animation: stageQuake 0.36s cubic-bezier(.36,.07,.19,.97); }
@keyframes stageQuake {
  0%, 100% { transform: translate(0,0); }
  20% { transform: translate(-7px, 4px); }
  45% { transform: translate(7px, -5px); }
  70% { transform: translate(-4px, -2px); }
}
#stage.boss-glitch { animation: bossGlitch 0.32s steps(3) both; }
@keyframes bossGlitch {
  0%   { filter: hue-rotate(80deg) contrast(1.5); transform: translate(-7px, 2px); }
  50%  { filter: hue-rotate(-65deg) saturate(2); transform: translate(7px, -3px); }
  100% { filter: none; transform: none; }
}
body.on-fire #stage::after {
  content: ''; position: absolute; inset: 0; z-index: 45; pointer-events: none;
  border-radius: inherit; box-shadow: inset 0 0 38px rgba(255, 136, 16, 0.65);
  animation: fireGlow 0.8s ease-in-out infinite alternate;
}
@keyframes fireGlow { from { opacity: 0.45; } to { opacity: 1; } }

/* Глобальные слои поверх экранов */
#flash { position: absolute; inset: 0; z-index: 150; pointer-events: none; opacity: 0; }
#flash.on { animation: flashOut 0.4s ease-out forwards; }
@keyframes flashOut { 0% { opacity: 0.9; } 100% { opacity: 0; } }

#wipe-curtain { position: absolute; inset: 0; z-index: 170; pointer-events: none; overflow: hidden; opacity: 0; }
#wipe-curtain::before {
  content: ''; position: absolute; top: -15%; bottom: -15%; left: -145%; width: 135%;
  transform: skewX(-18deg);
  background: linear-gradient(90deg, #060B1E 0%, #1DB4FF 48%, #FFE866 54%, #9B5CFF 60%, #060B1E 100%);
}
#wipe-curtain.go { opacity: 1; }
#wipe-curtain.go::before { animation: wipeGo 0.3s cubic-bezier(.7,0,.25,1) forwards; }
@keyframes wipeGo { 0% { left: -145%; } 100% { left: 125%; } }

#toast {
  position: absolute; left: 50%; top: 68px; z-index: 190;
  transform: translate(-50%, -14px) scale(0.92); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 15px; max-width: 88%; text-align: center;
  background: #13224F; border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px var(--cyan), 0 5px 0 var(--ink), 0 14px 28px rgba(0,0,0,0.65);
  font-size: 13.5px; font-weight: 800; transition: 0.22s cubic-bezier(.2,1.3,.4,1);
}
#toast.on { opacity: 1; transform: translate(-50%, 0) scale(1); }

#fever-banner {
  position: absolute; left: -10%; right: -10%; top: 36%; z-index: 165; pointer-events: none;
  padding: 12px 16px; text-align: center; opacity: 0;
  background: linear-gradient(90deg, #FF3B1F, #FF9900, #FFE047, #FF9900, #FF3B1F);
  border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink);
  font-size: 25px; font-weight: 900; font-style: italic;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  box-shadow: 0 12px 34px rgba(255, 110, 10, 0.7);
}
#fever-banner.show { animation: feverFly 1.1s cubic-bezier(.15,1.25,.3,1) forwards; }
@keyframes feverFly {
  0%   { opacity: 0; transform: rotate(-6deg) translateX(-65%) scale(0.75); }
  20%  { opacity: 1; transform: rotate(-6deg) translateX(0) scale(1.06); }
  80%  { opacity: 1; transform: rotate(-6deg) translateX(0) scale(1); }
  100% { opacity: 0; transform: rotate(-6deg) translateX(65%) scale(0.92); }
}

#ko-stamp {
  position: absolute; left: 50%; top: 42%; z-index: 185; pointer-events: none;
  opacity: 0; padding: 14px 26px; border-radius: 18px; border: 5px solid var(--ink);
  background: linear-gradient(180deg, #FFE854, #FF7F00);
  font-size: 30px; font-weight: 900; font-style: italic; white-space: nowrap;
  -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill;
  box-shadow: 0 10px 0 var(--ink), 0 0 55px rgba(255, 200, 50, 0.9);
}
#ko-stamp.on { animation: koSlam 1.45s cubic-bezier(.15,1.3,.3,1) forwards; }
@keyframes koSlam {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(3.2) rotate(-18deg); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(0.94) rotate(-6deg); }
  76%  { opacity: 1; transform: translate(-50%, -50%) scale(1.03) rotate(-7deg); }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(1.14) rotate(-4deg); }
}

/* VS-заставка перед боссом */
#vs-splash { position: absolute; inset: 0; z-index: 180; pointer-events: none; display: none; overflow: hidden; background: #050918; }
#vs-splash.on { display: block; animation: vsFade 1.6s ease forwards; }
@keyframes vsFade { 0%, 78% { opacity: 1; } 100% { opacity: 0; } }
.vs-half {
  position: absolute; left: -12%; right: -12%; height: 54%;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink);
}
.vs-top { top: -4%; transform: skewY(-6deg); background: linear-gradient(135deg, #4B107D, #A428EA, #FF2F80); animation: vsInR 0.34s cubic-bezier(.15,1.25,.3,1) both; }
.vs-bot { bottom: -4%; transform: skewY(-6deg); background: linear-gradient(135deg, #0D5BD6, #1DB4FF, #34E8B0); animation: vsInL 0.34s cubic-bezier(.15,1.25,.3,1) both; }
@keyframes vsInR { from { transform: translateX(110%) skewY(-6deg); } to { transform: translateX(0) skewY(-6deg); } }
@keyframes vsInL { from { transform: translateX(-110%) skewY(-6deg); } to { transform: translateX(0) skewY(-6deg); } }
.vs-half img { width: 150px; height: 150px; object-fit: contain; transform: skewY(6deg); filter: drop-shadow(0 12px 22px rgba(0,0,0,0.7)); }
.vs-lbl {
  transform: skewY(6deg); font-size: 22px; font-weight: 900; font-style: italic; text-transform: uppercase;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink);
}
.vs-lbl small { display: block; font-size: 12px; color: #FFE866; -webkit-text-stroke: 1px var(--ink); }
.vs-mark {
  position: absolute; left: 50%; top: 50%; z-index: 4;
  font-size: 76px; font-weight: 900; font-style: italic; color: #FFE854;
  -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill;
  text-shadow: 0 8px 0 var(--ink), 0 0 40px rgba(255,210,60,0.95);
  animation: vsSlam 0.48s 0.2s cubic-bezier(.2,1.5,.35,1) both;
}
@keyframes vsSlam {
  0% { transform: translate(-50%,-50%) scale(3.2) rotate(-25deg); opacity: 0; }
  70% { transform: translate(-50%,-50%) scale(0.92) rotate(-8deg); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(1.04) rotate(-10deg); opacity: 1; }
}

/* ---------- Базовые экраны и компоненты ---------- */
.screen {
  position: absolute; inset: 0; z-index: 2;
  display: none; flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
}
.screen.on { display: flex; }

.plate {
  background: linear-gradient(180deg, rgba(24, 38, 82, 0.94), rgba(11, 18, 42, 0.97));
  border: 3px solid var(--ink); border-radius: 22px; padding: 15px;
  box-shadow: inset 0 2px 0 rgba(160,220,255,0.28), 0 6px 0 var(--ink), 0 12px 26px rgba(0,0,0,0.5);
}

.arcade-h {
  margin: 0; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: 0.03em;
  color: #FFE866; -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink); text-align: center;
}
.arcade-h.lg { font-size: 27px; }
.arcade-h.xl { font-size: 38px; line-height: 1.02; }

/* Мощные 3D Brawl-кнопки */
.btn3d {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 3.5px solid var(--ink); border-radius: 18px; cursor: pointer;
  font-family: inherit; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: 0.04em;
  color: #fff; -webkit-text-stroke: 1.2px var(--ink); paint-order: stroke fill;
  text-shadow: 0 3px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}
.btn3d::before {
  content: ''; position: absolute; left: 6px; right: 6px; top: 3px; height: 42%;
  border-radius: 12px 12px 6px 6px;
  background: linear-gradient(180deg, rgba(255,255,255,0.46), rgba(255,255,255,0.03));
  pointer-events: none;
}
.btn3d.xl { height: 56px; padding: 0 20px; font-size: 18px; width: 100%; }
.btn3d.md { height: 44px; padding: 0 16px; font-size: 14px; width: 100%; }
.btn3d.sm { height: 40px; padding: 0 14px; font-size: 13px; border-radius: 14px; }
.btn3d:hover:not(:disabled) { filter: brightness(1.07); }
.btn3d:active:not(:disabled) { transform: translateY(4px) scale(0.98); }
.btn3d:disabled { opacity: 0.42; filter: grayscale(0.65); cursor: not-allowed; }

.btn3d.orange { background: linear-gradient(180deg, #FFD33B 0%, #FF8C00 58%, #EE6000 100%); box-shadow: 0 6px 0 #8A3300, 0 10px 22px rgba(0,0,0,0.5); }
.btn3d.orange:active:not(:disabled) { box-shadow: 0 1px 0 #8A3300; }
.btn3d.green  { background: linear-gradient(180deg, #62FF8F 0%, #1ED75A 58%, #10B246 100%); box-shadow: 0 6px 0 #096326, 0 10px 22px rgba(0,0,0,0.5); }
.btn3d.green:active:not(:disabled)  { box-shadow: 0 1px 0 #096326; }
.btn3d.cyan   { background: linear-gradient(180deg, #5CE4FF 0%, #16A0FF 58%, #0A7AE4 100%); box-shadow: 0 6px 0 #07468C, 0 10px 22px rgba(0,0,0,0.5); }
.btn3d.cyan:active:not(:disabled)   { box-shadow: 0 1px 0 #07468C; }
.btn3d.violet { background: linear-gradient(180deg, #C796FF 0%, #8344FF 58%, #6324DC 100%); box-shadow: 0 6px 0 #3A158A, 0 10px 22px rgba(0,0,0,0.5); }
.btn3d.violet:active:not(:disabled) { box-shadow: 0 1px 0 #3A158A; }
.btn3d.red    { background: linear-gradient(180deg, #FF6E88 0%, #E82348 58%, #BD1032 100%); box-shadow: 0 6px 0 #6B081B; }
.btn3d.ghost  { background: rgba(255,255,255,0.09); border-color: rgba(150,200,255,0.34); box-shadow: none; font-style: normal; text-transform: none; -webkit-text-stroke: 0; text-shadow: none; color: #D8ECFF; }
.btn3d.ghost::before { display: none; }

/* Верхняя панель HUD */
.topbar { display: flex; align-items: center; gap: 7px; padding-bottom: 10px; flex-shrink: 0; z-index: 6; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 38px; padding: 0 12px;
  border-radius: 13px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, #1E3168, #0D1636);
  font-size: 13.5px; font-weight: 900; color: #fff; white-space: nowrap;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.16), 0 4px 0 var(--ink);
}
.qual-pill { background: linear-gradient(180deg, #523596, #281758); color: #FFE878; cursor: pointer; transform: skewX(-6deg); }
.spark-pill { color: var(--gold); margin-left: auto; }
.spark-pill.pop { animation: pillPop 0.22s cubic-bezier(.2,1.6,.4,1); }
@keyframes pillPop { 0% { transform: scale(1); } 45% { transform: scale(1.24); } 100% { transform: scale(1); } }
.timer-pill { color: #CBEBFF; }
.timer-pill.warn { background: #A81C38; color: #fff; }
.shield-pill { color: #7EEBFF; margin-left: auto; }

.sq-btn {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 13px;
  border: 3px solid var(--ink); background: linear-gradient(180deg, #3D74DC, #1C3E92);
  color: #fff; font-size: 17px; font-weight: 900; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.3), 0 4px 0 var(--ink);
}
.sq-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.sq-btn.off { opacity: 0.48; filter: grayscale(0.8); }

.chip-btn {
  padding: 8px 14px; border-radius: 999px; border: 2.5px solid var(--ink);
  background: rgba(11,18,40,0.88); color: #fff; font-weight: 800; font-size: 13px; cursor: pointer;
}
.top-banner {
  flex: 1; text-align: center; font-size: 16px; font-weight: 900; font-style: italic;
  color: #FFE866; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill;
  text-shadow: 0 3px 0 var(--ink);
}

/* ---------- 1. Загрузка и 2. Вход ---------- */
#s-pre { align-items: center; justify-content: center; }
.pre-wrap { width: 88%; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.logo-hero { width: 92%; max-width: 350px; filter: drop-shadow(0 10px 22px rgba(0,0,0,0.75)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.pre-track { width: 100%; height: 22px; border-radius: 99px; border: 3px solid var(--ink); background: #060B1E; padding: 3px; overflow: hidden; box-shadow: 0 4px 0 var(--ink); }
#pre-fill { height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, var(--cyan), var(--violet), var(--gold)); transition: width 0.16s; }
.pre-meta { width: 100%; display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 800; color: var(--muted); }

.login-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.login-plate { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; color: #8AEBFF; }
.field input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 14px;
  border: 3px solid rgba(120,190,255,0.34); background: #060B1E;
  color: #fff; font-size: 16px; font-weight: 800; outline: none; font-family: inherit;
}
.field input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(29,180,255,0.28); }
.form-err { min-height: 18px; font-size: 13px; font-weight: 800; color: #FF7892; text-align: center; }

/* ---------- 3. Интро ---------- */
#s-intro { padding: 0; }
.intro-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.intro-grad { position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(5,9,24,0.5) 0%, transparent 32%, rgba(5,9,24,0.96) 72%); }
.intro-top { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 0; }
.intro-dots { display: flex; gap: 6px; }
.intro-dots i { width: 22px; height: 8px; border-radius: 99px; border: 2px solid var(--ink); background: rgba(255,255,255,0.3); transition: 0.24s; }
.intro-dots i.on { width: 40px; background: var(--gold); }
.intro-foot { position: relative; z-index: 2; margin-top: auto; padding: 20px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.intro-foot h2 { font-size: 26px; text-align: left; }
.intro-foot p { margin: 0 0 6px; font-size: 15px; font-weight: 700; line-height: 1.48; color: #EDF5FF; }

/* ---------- 4. ЛОББИ (Просторный Brawl Stars Hero Hub!) ---------- */
.lobby-arena {
  position: relative; flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 14px;
}

.side-rail {
  position: absolute; top: 14px; z-index: 8;
  display: flex; flex-direction: column; gap: 10px;
}
.side-rail.left { left: 0; }
.side-rail.right { right: 0; }

.rail-btn {
  position: relative; width: 66px; height: 68px; border-radius: 18px;
  border: 3px solid var(--ink); color: #fff; cursor: pointer; padding: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-family: inherit; font-size: 11px; font-weight: 900; text-shadow: 0 2px 0 var(--ink);
  transition: transform 0.08s ease;
}
.rail-btn::before {
  content: ''; position: absolute; left: 5px; right: 5px; top: 3px; height: 38%;
  border-radius: 11px 11px 4px 4px; background: linear-gradient(180deg, rgba(255,255,255,0.38), transparent);
}
.rail-btn.blue   { background: linear-gradient(180deg, #4385FF, #1D4AB5); box-shadow: 0 5px 0 #0D235C, 0 8px 18px rgba(0,0,0,0.45); }
.rail-btn.cyan   { background: linear-gradient(180deg, #3AD6FF, #0F84DC); box-shadow: 0 5px 0 #074378, 0 8px 18px rgba(0,0,0,0.45); }
.rail-btn.purple { background: linear-gradient(180deg, #B852FF, #631EB0); box-shadow: 0 5px 0 #340C63, 0 8px 18px rgba(0,0,0,0.45); }
.rail-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.rail-ico { font-size: 24px; line-height: 1; }
.alert-dot { position: absolute; top: -3px; right: -3px; width: 14px; height: 14px; border-radius: 50%; background: #FF3366; border: 2.5px solid #fff; }

/* Крупный Спарки + Подиум качества */
.hero-showcase { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pedestal {
  position: relative; width: 266px; height: 266px;
  display: flex; align-items: center; justify-content: center;
}
.pedestal.lg { width: 256px; height: 256px; }
.pedestal::before {
  content: ''; position: absolute; bottom: 10px; width: 215px; height: 44px; border-radius: 50%;
  border: 4px solid var(--aura, var(--cyan));
  background: radial-gradient(ellipse at center, var(--aura-bg, rgba(29,180,255,0.55)), rgba(7,12,29,0.12) 72%);
  box-shadow: 0 0 38px var(--aura, var(--cyan)), inset 0 0 20px var(--aura, var(--cyan));
}
.pedestal::after {
  content: ''; position: absolute; bottom: 28px; width: 185px; height: 195px; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, var(--aura-bg, rgba(29,180,255,0.22)) 100%);
  clip-path: polygon(16% 0%, 84% 0%, 100% 100%, 0% 100%); opacity: 0.72; z-index: 1;
}
.pedestal.q-bronze  { --aura: #F09B48; --aura-bg: rgba(240,155,72,0.44); }
.pedestal.q-silver  { --aura: #C6E0FF; --aura-bg: rgba(198,224,255,0.46); }
.pedestal.q-gold    { --aura: #FFC833; --aura-bg: rgba(255,200,51,0.52); }
.pedestal.q-diamond { --aura: #4CEBFF; --aura-bg: rgba(76,235,255,0.56); }
.pedestal.q-jade    { --aura: #34F5B8; --aura-bg: rgba(52,245,184,0.56); }

.sparky-doll {
  position: relative; z-index: 2; cursor: pointer;
  animation: heroBreathe 2.8s ease-in-out infinite;
  filter: drop-shadow(0 16px 24px rgba(0,0,0,0.68));
  translate: calc(var(--px, 0) * 8px) calc(var(--py, 0) * 6px);
  transition: translate 0.14s ease-out;
}
.sparky-doll.xl { width: 248px; height: 248px; }
.sparky-doll.md { width: 158px; height: 158px; }
.sparky-doll.hop { animation: heroHop 0.44s cubic-bezier(.2,1.4,.4,1) !important; }
.sparky-doll img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
@keyframes heroBreathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes heroHop { 0% { transform: scale(1); } 30% { transform: translateY(-26px) scale(1.1, 0.94); } 70% { transform: translateY(4px) scale(0.95, 1.05); } 100% { transform: scale(1); } }

/* Косметика прямо на Спарки */
.sparky-crown-fx {
  position: absolute !important; left: 50% !important; top: -15% !important; inset: auto !important;
  width: 68px !important; height: 68px !important; transform: translateX(-50%); z-index: 10;
  filter: drop-shadow(0 0 16px rgba(255,205,56,0.95));
  animation: crownBob 2s ease-in-out infinite;
}
@keyframes crownBob { 0%, 100% { transform: translateX(-50%) translateY(0) rotate(-4deg); } 50% { transform: translateX(-50%) translateY(-9px) rotate(4deg); } }
.sparky-doll.fx-gold-aura::after {
  content: ''; position: absolute; inset: -14px; border-radius: 50%; z-index: 1; pointer-events: none;
  background: radial-gradient(circle, rgba(255,212,70,0.44) 0%, rgba(255,155,20,0.12) 48%, transparent 72%);
}

.say-bubble {
  position: absolute; bottom: calc(100% - 14px); left: 50%; z-index: 20;
  transform: translateX(-50%) scale(0.7); opacity: 0; pointer-events: none;
  padding: 9px 14px; border-radius: 15px; border: 3px solid var(--ink); white-space: nowrap;
  background: linear-gradient(180deg, #253F82, #121F47);
  box-shadow: inset 0 0 0 2px var(--cyan), 0 4px 0 var(--ink), 0 10px 24px rgba(0,0,0,0.65);
  font-size: 13px; font-weight: 800; transition: 0.22s cubic-bezier(.2,1.4,.4,1);
}
.say-bubble.on { opacity: 1; transform: translateX(-50%) scale(1); }

.power-bar {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 999px;
  border: 3px solid var(--ink); background: linear-gradient(180deg, #20346C, #0D1634);
  box-shadow: 0 4px 0 var(--ink); font-size: 13.5px; font-weight: 900; color: #E4F2FF;
}
.power-bar .sep { color: var(--cyan); }

/* Нижняя панель Лобби: Карточка зоны + В БОЙ! */
.brawl-bottom {
  display: grid; grid-template-columns: 1fr 142px; gap: 10px; align-items: stretch;
  padding-top: 4px; flex-shrink: 0;
}
.event-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 18px; border: 3.5px solid var(--ink); cursor: pointer; text-align: left; color: #fff;
  background: linear-gradient(180deg, #263E82, #12204B);
  box-shadow: inset 0 2px 0 rgba(160,220,255,0.28), 0 6px 0 var(--ink), 0 10px 20px rgba(0,0,0,0.45);
  min-width: 0;
}
.event-card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.event-card img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6)); }
.ev-meta { min-width: 0; flex: 1; }
.ev-kicker { display: block; font-size: 10px; font-weight: 900; letter-spacing: 0.06em; color: #7EEBFF; }
.ev-meta b { display: block; font-size: 15px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 5px; }
.ev-bar { height: 8px; border-radius: 99px; border: 2px solid var(--ink); background: #060B1E; overflow: hidden; }
.ev-bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #FFD33B, #24E066); transition: width 0.4s; }

.play-cta { height: auto; min-height: 76px; font-size: 24px; letter-spacing: 0.05em; }
.play-cta::after {
  content: ''; position: absolute; top: -20%; bottom: -20%; left: -45%; width: 32%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.55), transparent);
  transform: skewX(-22deg); animation: sweep 2.6s ease-in-out infinite;
}
@keyframes sweep { 0%, 55% { left: -45%; } 100% { left: 130%; } }

/* ---------- 5. Полноэкранная Карта Острова ---------- */
.map-stage { position: relative; flex: 1; min-height: 0; margin: 4px 0 10px; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.map-line-bg { fill: none; stroke: rgba(5,9,24,0.82); stroke-width: 7; stroke-linecap: round; }
.map-line-live { fill: none; stroke: #39D4FF; stroke-width: 3.4; stroke-linecap: round; stroke-dasharray: 7 7; animation: dashMove 1.4s linear infinite; }
.map-line-gold { fill: none; stroke: #FFD33B; stroke-width: 4.5; stroke-linecap: round; filter: drop-shadow(0 0 6px #FFC833); }
@keyframes dashMove { to { stroke-dashoffset: -28; } }

.map-nodes-layer { position: absolute; inset: 0; z-index: 2; }
.island-pin {
  position: absolute; transform: translate(-50%, -50%);
  width: 82px; height: 82px; border-radius: 50%; padding: 0;
  border: 4px solid var(--ink); cursor: pointer;
  background: radial-gradient(circle at 35% 28%, #3458B5, #0E183D 76%);
  box-shadow: inset 0 0 0 3px rgba(130,220,255,0.5), 0 7px 0 var(--ink), 0 12px 24px rgba(0,0,0,0.68);
  display: grid; place-items: center; transition: transform 0.12s cubic-bezier(.2,1.4,.4,1);
}
.island-pin:hover { transform: translate(-50%, -54%) scale(1.08); z-index: 6; }
.island-pin:active { transform: translate(-50%, -46%) scale(0.95); }
.island-pin img { width: 58px; height: 58px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.65)); }
.island-pin.done { border-color: var(--green); box-shadow: 0 7px 0 #095C24, 0 0 22px rgba(36,224,102,0.55); }
.island-pin.current { border-color: var(--gold); box-shadow: 0 7px 0 #8A4F00, 0 0 28px rgba(255,200,51,0.85); }
.island-pin.current::before {
  content: ''; position: absolute; inset: -11px; border-radius: 50%;
  border: 3.5px solid var(--gold); animation: pingRing 1.4s ease-out infinite; pointer-events: none;
}
@keyframes pingRing { 0% { transform: scale(0.88); opacity: 0.95; } 100% { transform: scale(1.38); opacity: 0; } }

.pin-caption {
  position: absolute; top: calc(100% + 5px); left: 50%; transform: translateX(-50%);
  padding: 3px 9px; border-radius: 10px; border: 2.5px solid var(--ink);
  background: rgba(7,12,30,0.95); box-shadow: 0 3px 0 var(--ink);
  white-space: nowrap; text-align: center; pointer-events: none;
}
.pin-caption b { display: block; font-size: 11.5px; color: #fff; line-height: 1.1; }
.pin-caption span { font-size: 10.5px; font-weight: 900; color: var(--gold); }
.pin-here {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  padding: 3px 9px; border-radius: 9px; border: 2.5px solid var(--ink);
  background: linear-gradient(180deg, #FFE047, #FF8E00); color: var(--ink);
  font-size: 10px; font-weight: 900; white-space: nowrap; box-shadow: 0 3px 0 var(--ink);
  animation: bob 1.1s ease-in-out infinite;
}
.map-foot { flex-shrink: 0; }

/* ---------- 6. Экран зоны (уровни) ---------- */
.zone-head-info { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.zone-head-info img { width: 40px; height: 40px; object-fit: contain; }
.zone-head-info b { display: block; font-size: 16px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-head-info span { font-size: 12px; font-weight: 700; color: var(--muted); }

.upgrade-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; margin-bottom: 12px; border-radius: 18px;
  border: 3px solid var(--gold); background: linear-gradient(135deg, rgba(255,200,51,0.3), rgba(29,180,255,0.22));
  box-shadow: 0 5px 0 var(--ink);
}
.upgrade-strip b { display: block; font-size: 14px; color: #FFE878; }
.upgrade-strip span { font-size: 11.5px; color: #ECF4FF; font-weight: 700; }

.levels-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 11px; padding-bottom: 12px; }
.lvl-card {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  border-radius: 20px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, rgba(28,44,92,0.94), rgba(12,20,46,0.97));
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.16), 0 6px 0 var(--ink);
  color: #fff; cursor: pointer; text-align: left;
}
.lvl-card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.lvl-card.passed { border-color: var(--green); }
.lvl-badge {
  width: 48px; height: 48px; border-radius: 15px; border: 3px solid var(--ink); flex-shrink: 0;
  background: linear-gradient(180deg, #FFD33B, #FF8400);
  display: grid; place-items: center; font-size: 20px; font-weight: 900; text-shadow: 0 2px 0 var(--ink);
}
.lvl-card.passed .lvl-badge { background: linear-gradient(180deg, #62FF8F, #16BA4C); }
.lvl-info { flex: 1; min-width: 0; }
.lvl-info b { display: block; font-size: 16px; font-weight: 900; }
.lvl-info span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.lvl-sp { font-size: 14.5px; font-weight: 900; color: var(--gold); }

/* ---------- 7. Экран задания (Duolingo + Brawl) ---------- */
.task-prog-wrap { flex: 1; min-width: 0; }
.task-prog-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 800; color: #D4E6FF; margin-bottom: 5px; }
.fire-tag {
  padding: 2px 8px; border-radius: 99px; background: linear-gradient(180deg, #FF9421, #E02C18);
  border: 2px solid var(--ink); color: #fff; font-size: 11.5px; font-weight: 900;
}
.seg-track { display: flex; gap: 6px; }
.seg-track i { flex: 1; height: 11px; border-radius: 99px; border: 2.5px solid var(--ink); background: rgba(6,11,28,0.8); }
.seg-track i.done { background: linear-gradient(90deg, #FFE047, #FF8E00); }
.seg-track i.cur  { background: linear-gradient(90deg, #5CE4FF, #1698FF); }

.task-main {
  flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
  padding: 4px 0 12px; scrollbar-width: none;
}
.task-main::-webkit-scrollbar { display: none; }

.q-stage {
  padding: 15px 16px; border-radius: 22px; border: 3.5px solid var(--ink);
  background: linear-gradient(180deg, rgba(26, 42, 88, 0.95), rgba(13, 21, 48, 0.97));
  box-shadow: inset 0 2px 0 rgba(165,225,255,0.34), 0 6px 0 var(--ink);
}
.q-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.q-meta img { width: 28px; height: 28px; object-fit: contain; }
.type-badge {
  display: inline-block; padding: 4px 10px; border-radius: 9px; border: 2px solid var(--ink);
  background: linear-gradient(180deg, #2BA6FF, #1162D4); color: #fff;
  font-size: 11.5px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; transform: skewX(-6deg);
}
.type-badge.purple { background: linear-gradient(180deg, #B56BFF, #6C24DB); }
.q-counter { margin-left: auto; font-size: 13px; font-weight: 900; color: var(--gold); }
.q-title { font-size: 17.5px; font-weight: 800; line-height: 1.38; color: #fff; }

.task-body { display: flex; flex-direction: column; gap: 10px; }

/* Крупные тактильные плитки ответов */
.opts-list { display: flex; flex-direction: column; gap: 11px; }
.opt-btn {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px;
  padding: 12px 15px; border-radius: 18px; border: 3.5px solid var(--ink);
  color: #fff; text-align: left; font-family: inherit; font-size: 15.5px; font-weight: 800;
  line-height: 1.3; cursor: pointer; text-shadow: 0 2px 0 rgba(5,9,24,0.85);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.opt-btn::before {
  content: ''; position: absolute; left: 6px; right: 6px; top: 3px; height: 36%;
  border-radius: 12px 12px 5px 5px; background: linear-gradient(180deg, rgba(255,255,255,0.32), transparent);
}
.opt-btn.c0 { background: linear-gradient(180deg, #FF666B, #D8243A); box-shadow: 0 6px 0 #7E1120; }
.opt-btn.c1 { background: linear-gradient(180deg, #34BDFF, #0E78E6); box-shadow: 0 6px 0 #074285; }
.opt-btn.c2 { background: linear-gradient(180deg, #FFD23F, #E68800); box-shadow: 0 6px 0 #8A4D00; }
.opt-btn.c3 { background: linear-gradient(180deg, #BE75FF, #7A2DE6); box-shadow: 0 6px 0 #421487; }
.opt-btn:active:not(:disabled) { transform: translateY(4px); }
.opt-btn.selected { outline: 4px solid #fff; transform: scale(1.02); filter: brightness(1.08); }
.opt-btn.ok  { background: linear-gradient(180deg, #5EFF8C, #14BD4D) !important; box-shadow: 0 6px 0 #096326 !important; }
.opt-btn.err { opacity: 0.45; filter: saturate(0.35); }
.opt-key {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  background: rgba(5,9,24,0.34); border: 2.5px solid rgba(255,255,255,0.48);
  display: grid; place-items: center; font-size: 18px; font-weight: 900; font-style: italic;
}

/* ПОРЯДОК / КАРТОЧКИ / ТЕРМИН / ОШИБКА */
.order-slots { display: flex; flex-direction: column; gap: 9px; }
.order-slot {
  display: flex; align-items: center; gap: 11px; min-height: 54px; padding: 10px 13px;
  border-radius: 16px; border: 3px dashed rgba(125,200,255,0.5);
  background: rgba(8,14,34,0.82); font-size: 14.5px; font-weight: 800; cursor: pointer;
}
.order-slot.filled { border-style: solid; border-color: var(--ink); background: linear-gradient(180deg, #2D59B5, #173270); box-shadow: 0 4px 0 var(--ink); }
.order-slot.drop-hot { border-color: var(--gold); background: rgba(255,200,51,0.24); }
.order-slot.ok  { border-color: var(--green); background: #158C40; }
.order-slot.err { border-color: var(--red); background: #A8203D; }
.slot-num {
  width: 30px; height: 30px; border-radius: 10px; border: 2px solid var(--ink);
  background: linear-gradient(180deg, #FFE054, #FF9900); color: var(--ink);
  display: grid; place-items: center; font-weight: 900; font-size: 15px; flex-shrink: 0;
}

.order-pool, .cards-pool, .bank-row { display: flex; flex-wrap: wrap; gap: 9px; }
.chip, .card-chip {
  padding: 11px 14px; border-radius: 15px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, #3C5AA8, #20346E); color: #fff;
  font-family: inherit; font-size: 14.5px; font-weight: 800; cursor: grab;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.24), 0 4px 0 var(--ink); text-align: left;
}
.chip.used, .card-chip.used { display: none; }
.drag-source { opacity: 0.28; }
.drag-ghost { box-shadow: 0 18px 36px rgba(0,0,0,0.7); border-color: var(--gold) !important; }

.bins-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.bin {
  border-radius: 18px; border: 3px solid rgba(120,195,255,0.45);
  background: rgba(10,18,44,0.9); padding: 11px; min-height: 110px; cursor: pointer;
  box-shadow: 0 5px 0 var(--ink);
}
.bin.sel, .bin.drop-hot { border-color: var(--gold); background: rgba(255,200,51,0.18); }
.bin-head { font-size: 12.5px; font-weight: 900; color: #FFE878; margin-bottom: 7px; text-transform: uppercase; }
.bin-body { display: flex; flex-direction: column; gap: 6px; }
.placed-tag {
  font-size: 13px; font-weight: 800; padding: 7px 10px; border-radius: 11px;
  background: linear-gradient(180deg, #2759A8, #193B78); border: 2px solid var(--ink); cursor: pointer;
}
.placed-tag.ok  { background: #179A44; border-color: var(--green); }
.placed-tag.err { background: #B82542; border-color: var(--red); }

.term-text, .mistake-wrap {
  padding: 15px; border-radius: 18px; border: 3px solid var(--ink);
  background: rgba(10,18,44,0.94); font-size: 16px; line-height: 1.85; font-weight: 800;
  box-shadow: 0 5px 0 var(--ink);
}
.gap-slot {
  display: inline-block; min-width: 82px; text-align: center; padding: 2px 11px; margin: 0 3px;
  border-radius: 10px; border: 2.5px dashed var(--cyan); background: rgba(29,180,255,0.18);
  color: #8AEBFF; font-weight: 900; cursor: pointer;
}
.gap-slot.sel { border-style: solid; border-color: var(--gold); background: rgba(255,200,51,0.3); color: #FFE878; }
.gap-slot.filled { border-style: solid; border-color: var(--cyan); color: #fff; }
.gap-slot.ok  { border-color: var(--green); background: rgba(36,224,102,0.35); }
.gap-slot.err { border-color: var(--red); background: rgba(255,62,98,0.35); }

.frag { display: inline; padding: 3px 6px; border-radius: 9px; cursor: pointer; }
.frag.sel { background: rgba(255,200,51,0.34); box-shadow: 0 0 0 2.5px var(--gold); color: #FFE878; }
.frag.ok  { background: rgba(36,224,102,0.36); box-shadow: 0 0 0 2.5px var(--green); }
.frag.err { background: rgba(255,62,98,0.36); box-shadow: 0 0 0 2.5px var(--red); }

.hint-pop {
  display: flex; align-items: center; gap: 10px; padding: 10px 13px; margin-bottom: 8px;
  border-radius: 16px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, #322473, #1B1345);
  box-shadow: inset 0 0 0 2px var(--violet), 0 4px 0 var(--ink);
  font-size: 13.5px; font-weight: 800; line-height: 1.35;
}
.hint-pop[hidden] { display: none; }
.hint-pop img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; }

.task-footer { display: flex; gap: 10px; padding-top: 6px; flex-shrink: 0; }
.hint-btn { width: 76px; flex-shrink: 0; height: 56px; font-size: 15px; }

/* Выезжающая шторка разбора (Duolingo) */
.result-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 18px 16px max(16px, env(safe-area-inset-bottom));
  border-top: 4px solid var(--ink); border-radius: 26px 26px 0 0;
  box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.72);
  transform: translateY(115%); transition: transform 0.28s cubic-bezier(.18,1.15,.35,1);
}
.result-sheet.on { transform: translateY(0); }
.result-sheet.good { background: linear-gradient(180deg, #169848, #0D592B); }
.result-sheet.bad  { background: linear-gradient(180deg, #B82344, #6B1126); }
.sheet-buddy {
  position: absolute; right: 16px; top: -68px; width: 108px; height: 108px; object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.65)); pointer-events: none;
}
.sheet-content { display: flex; flex-direction: column; gap: 8px; }
.sheet-content b { font-size: 20px; font-weight: 900; text-shadow: 0 2px 0 var(--ink); padding-right: 100px; }
.sheet-content p { margin: 0 0 6px; font-size: 14px; font-weight: 700; line-height: 1.4; color: #F2FAFF; }

/* ---------- 8. Полноэкранный Сундук Starr Drop + 3D-карты ---------- */
#s-chest { --chest-zoom: 1; --chest-dim: 0; }
#s-chest::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(circle at 50% 60%, transparent 20%, rgba(3,6,18,var(--chest-dim)) 82%);
  transition: background 0.24s;
}
.chest-top { position: relative; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 8px; }
.chest-arena {
  flex: 1; position: relative; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 14px;
}
.sun-rays {
  position: absolute; top: 46%; left: 50%; width: 440px; height: 440px; margin: -220px 0 0 -220px;
  border-radius: 50%; pointer-events: none; z-index: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255,216,88,0.34) 0 12deg, transparent 12deg 24deg);
  animation: spinRays 12s linear infinite;
}
@keyframes spinRays { to { transform: rotate(360deg); } }
.chest-bolts { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }

.chest-btn {
  position: relative; z-index: 2; background: none; border: none; padding: 0; cursor: pointer;
  width: 264px; height: 264px; transform: scale(var(--chest-zoom));
  transition: transform 0.22s cubic-bezier(.2,1.3,.4,1), width 0.3s, height 0.3s;
}
#s-chest.opened .chest-btn { width: 185px; height: 185px; }
.chest-btn img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 28px rgba(0,0,0,0.75)); }
.chest-btn.bounce img { animation: cSquash 0.34s cubic-bezier(.2,1.4,.4,1); }
.chest-btn.rumble img { animation: cRumble 0.22s linear infinite; filter: drop-shadow(0 0 32px rgba(255,215,80,0.9)); }
@keyframes cSquash { 0% { transform: scale(1,1); } 30% { transform: scale(1.2,0.8) translateY(10px); } 65% { transform: scale(0.9,1.14) translateY(-18px); } 100% { transform: scale(1,1); } }
@keyframes cRumble { 0%, 100% { transform: rotate(-4deg) scale(1.06); } 50% { transform: rotate(4deg) scale(1.09); } }

.tap-pips { display: flex; gap: 8px; z-index: 3; margin: 4px 0 6px; }
.tap-pips i { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--ink); background: rgba(255,255,255,0.22); transition: 0.2s; }
.tap-pips i.on { background: var(--gold); transform: scale(1.2); box-shadow: 0 0 12px var(--gold); }
.tap-call {
  z-index: 3; font-size: 16px; font-weight: 900; font-style: italic; color: #FFE866;
  -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; animation: bob 0.9s infinite;
}

/* 3D-карты лута с Balatro-наклоном */
.loot-fan {
  position: relative; z-index: 5; width: 100%; perspective: 950px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 12px;
}
.loot-card { background: none; border: none; padding: 0; cursor: pointer; transform-style: preserve-3d; }
.card-3d {
  position: relative; width: 100%; min-height: 166px; transform-style: preserve-3d;
  transition: transform 0.56s cubic-bezier(.2,1.25,.35,1); transform: rotateY(180deg);
}
.loot-card.revealed .card-3d { transform: rotateY(0deg) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.loot-card.tilting .card-3d  { transition: transform 0.06s linear; }
.c-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 18px; border: 3.5px solid var(--ink); padding: 10px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; overflow: hidden;
}
.c-back {
  transform: rotateY(180deg);
  background: radial-gradient(circle at 50% 42%, rgba(255,212,70,0.36), transparent 60%), repeating-linear-gradient(45deg, #1A2D64 0 10px, #111F4A 10px 20px);
  border-color: #6EA8FF; box-shadow: 0 6px 0 var(--ink);
}
.c-back::before { content: '⚡'; font-size: 40px; filter: drop-shadow(0 0 14px var(--gold)); }
.c-front { background: linear-gradient(180deg, #2A3F7A, #121D42); color: #fff; text-align: center; box-shadow: 0 6px 0 var(--ink); }
.loot-card.rar-common .c-front    { border-color: var(--common); }
.loot-card.rar-rare .c-front      { border-color: var(--rare); background: linear-gradient(180deg, #1660A4, #0C2654); box-shadow: 0 6px 0 #073B75, 0 0 20px rgba(34,188,255,0.55); }
.loot-card.rar-legendary .c-front { border-color: var(--legendary); background: linear-gradient(180deg, #AD6208, #4D2404); box-shadow: 0 6px 0 #6E3900, 0 0 28px rgba(255,200,51,0.8); }
.loot-card.picked .c-front { outline: 4px solid #fff; transform: translateY(-6px); }
.holo-glare {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: color-dodge;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(255,255,255,0.7), transparent 55%),
              linear-gradient(125deg, rgba(255,77,148,0.28), rgba(29,180,255,0.32), rgba(255,200,51,0.35));
}
.loot-card.rar-rare.revealed .holo-glare,
.loot-card.rar-legendary.revealed .holo-glare { opacity: 0.72; }
.c-front img { width: 78px; height: 78px; object-fit: contain; filter: drop-shadow(0 5px 8px rgba(0,0,0,0.55)); }
.c-front b { font-size: 12px; font-weight: 900; line-height: 1.15; }
.c-front span { font-size: 10.5px; font-weight: 800; color: #E2EEFF; }
.chest-foot { position: relative; z-index: 4; display: flex; flex-direction: column; gap: 8px; }
.chest-note { text-align: center; font-size: 14px; font-weight: 900; color: #7EEBFF; min-height: 20px; }

/* ---------- 9. Гардероб-Ангар ---------- */
.wr-hangar {
  flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.holo-scan {
  position: absolute; left: 8%; right: 8%; top: 88%; height: 14px; z-index: 15; pointer-events: none;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, #4CEBFF 22%, #fff 50%, #4CEBFF 78%, transparent);
  box-shadow: 0 0 24px #1DB4FF; animation: scanUp 0.55s cubic-bezier(.2,.9,.3,1) forwards;
}
@keyframes scanUp { 0% { top: 88%; opacity: 0.2; } 25% { opacity: 1; } 100% { top: 6%; opacity: 0; } }

.wr-tray {
  flex-shrink: 0; display: flex; flex-direction: column; gap: 9px;
  padding: 11px; border-radius: 22px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, rgba(20,33,74,0.94), rgba(9,16,38,0.97));
  box-shadow: inset 0 2px 0 rgba(160,220,255,0.22), 0 6px 0 var(--ink);
}
.combat-slots-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.wr-slot {
  aspect-ratio: 1; border-radius: 15px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, #2A468E, #12204B);
  box-shadow: 0 4px 0 var(--ink); cursor: pointer; padding: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff;
}
.wr-slot:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.wr-slot.filled.rar-common    { border-color: var(--common); }
.wr-slot.filled.rar-rare      { border-color: var(--rare); box-shadow: 0 4px 0 #074285, 0 0 14px rgba(34,188,255,0.5); }
.wr-slot.filled.rar-legendary { border-color: var(--legendary); box-shadow: 0 4px 0 #8A4D00, 0 0 18px rgba(255,200,51,0.65); }
.wr-slot img { width: 42px; height: 42px; object-fit: contain; }
.wr-slot span { font-size: 9.5px; font-weight: 900; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wr-sub-row { display: grid; grid-template-columns: 1fr 86px; gap: 8px; align-items: stretch; }
.cos-slots-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.cos-btn {
  padding: 8px 10px; border-radius: 14px; border: 2.5px solid var(--ink);
  background: linear-gradient(180deg, #213672, #101C40); color: #fff; font-family: inherit;
  font-size: 12px; font-weight: 800; text-align: left; cursor: pointer; box-shadow: 0 4px 0 var(--ink);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.cos-btn small { display: block; font-size: 9.5px; color: #7EEBFF; text-transform: uppercase; }
.col-btn { height: auto; flex-direction: column; gap: 0; line-height: 1.05; font-size: 12px; }
.col-btn small { font-size: 10px; opacity: 0.9; }

.drawer-backdrop { position: absolute; inset: 0; z-index: 80; background: rgba(3,6,18,0.82); display: flex; align-items: flex-end; padding: 10px; }
.drawer-backdrop[hidden] { display: none; }
.drawer-sheet { width: 100%; max-height: 78%; display: flex; flex-direction: column; gap: 10px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 900; color: #FFE878; }
.drawer-grid { overflow-y: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-bottom: 6px; }
.m-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 5px;
  border-radius: 15px; border: 2.5px solid var(--ink); background: linear-gradient(180deg, #223770, #111D42);
  color: #fff; cursor: pointer; text-align: center; box-shadow: 0 4px 0 var(--ink);
}
.m-item.locked { opacity: 0.32; filter: grayscale(1); cursor: default; }
.m-item.eq { border-color: var(--green); box-shadow: 0 4px 0 #095C24, 0 0 14px rgba(36,224,102,0.55); }
.m-item img { width: 58px; height: 58px; object-fit: contain; }
.m-item b { font-size: 11.5px; font-weight: 900; line-height: 1.15; }
.m-item span { font-size: 10px; color: var(--muted); font-weight: 700; }

/* ---------- 10. Бой с Боссом «Шум» ---------- */
.boss-hp-box { flex: 1; min-width: 0; }
.boss-hp-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 900; color: #FFE878; margin-bottom: 4px; text-shadow: 0 2px 0 var(--ink); }
.boss-hp-track { height: 17px; border-radius: 99px; border: 3px solid var(--ink); background: #070A1C; overflow: hidden; box-shadow: 0 3px 0 var(--ink); }
#boss-hp-fill { height: 100%; width: 100%; background: linear-gradient(180deg, #FF6688, #E61942 60%, #AE0A2A); transition: width 0.36s cubic-bezier(.2,1.2,.4,1); }

.boss-stage {
  flex: 1; min-height: 220px; position: relative;
  display: flex; flex-direction: column; justify-content: space-between; padding: 2px 4px 8px;
}
.boss-vfx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.boss-enemy-zone { position: relative; display: flex; justify-content: center; z-index: 2; }
.boss-sprite {
  width: 190px; height: 142px; object-fit: contain;
  filter: drop-shadow(0 0 28px rgba(176,80,255,0.75));
  animation: bossBob 2.3s ease-in-out infinite;
  translate: calc(var(--px, 0) * -6px) calc(var(--py, 0) * -4px);
}
.boss-sprite.hit { animation: bossHit 0.38s ease !important; }
@keyframes bossBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes bossHit {
  0% { filter: brightness(3.2) drop-shadow(0 0 34px #fff); transform: scale(1.16) rotate(-6deg); }
  50% { transform: scale(0.92) rotate(4deg); }
  100% { filter: drop-shadow(0 0 28px rgba(176,80,255,0.75)); transform: scale(1); }
}

.dmg-layer { position: absolute; inset: 0; pointer-events: none; }
.dmg-pop {
  position: absolute; left: 54%; top: 26%; font-size: 34px; font-weight: 900; font-style: italic;
  color: #FF5526; -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill;
  animation: dmgUp 0.85s ease-out forwards;
}
@keyframes dmgUp { 0% { opacity: 1; transform: translateY(0) scale(0.5); } 30% { transform: translateY(-24px) scale(1.3); } 100% { opacity: 0; transform: translateY(-66px); } }

.boss-player-zone { position: relative; z-index: 3; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 6px; }
.boss-hero {
  width: 148px; height: 148px; object-fit: contain;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,0.75));
  translate: calc(var(--px, 0) * 8px) calc(var(--py, 0) * 6px);
  transition: transform 0.16s ease, translate 0.14s ease-out;
}
.boss-hero.shoot { transform: translateY(-14px) scale(1.1) rotate(-3deg); }

.shields-bar { display: flex; gap: 7px; padding-bottom: 12px; }
.sh-pip {
  width: 38px; height: 42px; border-radius: 11px 11px 18px 18px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, #6DF0FF, #1084EB);
  display: grid; place-items: center; font-size: 17px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 4px 0 #073973, 0 0 16px rgba(29,180,255,0.7);
  transition: 0.3s;
}
.sh-pip.broken { opacity: 0.2; filter: grayscale(1); transform: scale(0.75) rotate(12deg); box-shadow: none; }

.boss-deck {
  flex-shrink: 0; display: flex; flex-direction: column; gap: 8px;
  padding: 12px; border-radius: 22px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, rgba(22,34,74,0.95), rgba(10,16,38,0.98));
  box-shadow: inset 0 2px 0 rgba(165,220,255,0.22), 0 6px 0 var(--ink);
}
.boss-q-txt { font-size: 14.5px; font-weight: 800; line-height: 1.35; margin-top: 6px; }
.boss-fb {
  padding: 9px 12px; border-radius: 13px; border: 2.5px solid var(--ink); font-size: 13px; font-weight: 800;
}
.boss-fb.good { background: #169445; border-color: var(--green); }
.boss-fb.bad  { background: #B02040; border-color: var(--red); }
.boss-opts { display: flex; flex-direction: column; gap: 8px; }
.boss-opts .opt-btn { min-height: 48px; padding: 9px 12px; font-size: 14px; }

/* ---------- 11. Итог ---------- */
.res-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 11px; padding: 10px 0; scrollbar-width: none; }
.res-sub { font-size: 14.5px; font-weight: 900; color: #E2F0FF; text-shadow: 0 2px 0 var(--ink); text-align: center; }
.res-stage { display: flex; align-items: center; justify-content: center; gap: 10px; }
.res-medal { width: 96px; height: 96px; object-fit: contain; filter: drop-shadow(0 10px 18px rgba(0,0,0,0.65)); animation: bob 2.4s infinite; }
.res-badges { display: flex; gap: 10px; justify-content: center; }
.res-badges img { width: 50px; height: 50px; object-fit: contain; }
.res-plate { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.res-meter { position: relative; height: 30px; border-radius: 99px; border: 3px solid var(--ink); background: #060B1E; overflow: hidden; }
#res-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #FFC833, #3CF27A); transition: width 0.8s cubic-bezier(.2,1.2,.4,1); }
#res-pct-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; font-weight: 900; text-shadow: 0 2px 0 var(--ink); }
.res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.res-stat { padding: 10px 4px; border-radius: 14px; border: 2px solid var(--ink); background: rgba(255,255,255,0.08); }
.res-stat b { display: block; font-size: 18px; color: var(--gold); }
.res-stat span { font-size: 11px; font-weight: 800; color: var(--muted); }
.res-plan { font-size: 13px; font-weight: 700; line-height: 1.45; color: #E0EEFF; text-align: center; }
.res-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 8px; flex-shrink: 0; }

/* Комикс-выкрики и перелёт Искр */
.fly-spark {
  position: fixed; z-index: 980; pointer-events: none; width: 15px; height: 15px; border-radius: 50%;
  background: radial-gradient(circle, #fff 15%, #FFE047 55%, #FF8A00 100%);
  box-shadow: 0 0 18px #FFC833;
}
.comic-pop {
  position: fixed; z-index: 985; pointer-events: none;
  font-size: 24px; font-weight: 900; font-style: italic; text-transform: uppercase; white-space: nowrap;
  color: var(--pop-c, #FFE854); -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--ink); animation: cPop 0.9s cubic-bezier(.18,1.35,.35,1) forwards;
}
@keyframes cPop {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(0.35) rotate(var(--pop-r,-6deg)); }
  22%  { opacity: 1; transform: translate(-50%, -26px) scale(1.22) rotate(var(--pop-r,-6deg)); }
  75%  { opacity: 1; transform: translate(-50%, -52px) scale(1) rotate(var(--pop-r,-6deg)); }
  100% { opacity: 0; transform: translate(-50%, -78px) scale(0.88) rotate(var(--pop-r,-6deg)); }
}

body.no-motion *, body.no-motion *::before, body.no-motion *::after {
  animation: none !important; transition: none !important;
}