:root {
  color-scheme: dark;
  --bg: #050506;
  --surface: rgba(13, 14, 16, 0.78);
  --surface-strong: rgba(23, 24, 27, 0.82);
  --surface-soft: rgba(255, 255, 255, 0.055);
  --glass-line: rgba(255, 255, 255, 0.16);
  --glass-glow: rgba(255, 255, 255, 0.28);
  --text: #f7f7f2;
  --muted: rgba(247, 247, 242, 0.62);
  --dim: rgba(247, 247, 242, 0.42);
  --ink: #050506;
  --white: #f7f7f2;
  --accent-a: #5ee7ff;
  --accent-b: #8b5cf6;
  --accent-c: #ff6bc8;
  --accent-d: #ffb454;
  --accent-e: #42f59a;
  --glow-a: rgba(94, 231, 255, 0.26);
  --glow-b: rgba(139, 92, 246, 0.24);
  --glow-c: rgba(255, 107, 200, 0.18);
  --shadow-strong: rgba(0, 0, 0, 0.5);
  --bad: #ad4d4d;
  --good: #f7f7f2;
  --radius-lg: 30px;
  --radius-md: 22px;
  --radius-sm: 16px;
}

body.theme-light {
  color-scheme: light;
  --bg: #eef5ff;
  --surface: rgba(248, 252, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(8, 18, 34, 0.055);
  --glass-line: rgba(44, 86, 132, 0.26);
  --glass-glow: rgba(95, 150, 255, 0.24);
  --text: #101827;
  --muted: rgba(16, 24, 39, 0.66);
  --dim: rgba(16, 24, 39, 0.45);
  --ink: #050506;
  --white: #ffffff;
  --glow-a: rgba(31, 170, 255, 0.28);
  --glow-b: rgba(139, 92, 246, 0.2);
  --glow-c: rgba(255, 107, 200, 0.16);
  --shadow-strong: rgba(57, 86, 128, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
}

html {
  scroll-padding-top: 96px;
  scroll-padding-bottom: 112px;
}

body {
  color: var(--text);
  background: var(--bg);
  font-family: "Manrope", sans-serif;
  transition: color 0.22s ease, background 0.22s ease;
}

.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--text);
  background:
    radial-gradient(520px 220px at 50% 48%, rgba(94, 231, 255, 0.18), transparent 68%),
    radial-gradient(460px 260px at 58% 46%, rgba(139, 92, 246, 0.17), transparent 72%),
    var(--bg);
  transition: opacity 0.42s ease, transform 0.42s ease, visibility 0.42s ease;
}

.boot-splash.hidden-splash {
  animation: splashOut 0.42s ease forwards;
}

.boot-beam {
  position: relative;
  width: min(560px, 74vw);
  height: 34px;
  border-radius: 999px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.98) 0%, rgba(94, 231, 255, 0.92) 22%, rgba(139, 92, 246, 0.66) 48%, transparent 76%),
    linear-gradient(90deg, transparent, var(--accent-a), var(--accent-b), transparent);
  box-shadow:
    0 0 28px rgba(94, 231, 255, 0.7),
    0 0 64px rgba(139, 92, 246, 0.45),
    0 0 110px rgba(255, 107, 200, 0.24);
  transform-origin: center;
  animation: beamPulse 1.35s ease-in-out infinite alternate;
}

.boot-beam::before {
  content: "";
  position: absolute;
  inset: -70% auto -70% -24%;
  width: 34%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), rgba(94, 231, 255, 0.5), transparent);
  filter: blur(3px);
  transform: translateX(-120%) skewX(-18deg);
  animation: beamTravel 1.05s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

.boot-title {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: clamp(22px, 5vw, 42px);
  letter-spacing: -0.04em;
}

.boot-caption {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.action-loader {
  position: fixed;
  inset: 0;
  z-index: 115;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #f7f7f2;
  background:
    radial-gradient(420px 220px at 50% 48%, rgba(94, 231, 255, 0.2), transparent 70%),
    radial-gradient(520px 260px at 58% 46%, rgba(139, 92, 246, 0.18), transparent 72%),
    rgba(3, 3, 5, 0.76);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.action-loader.leaving {
  animation: splashOut 0.34s ease forwards;
}

.action-loader-card {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  min-height: 240px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.025)),
    rgba(8, 9, 14, 0.78);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 90px rgba(94, 231, 255, 0.17),
    0 30px 90px rgba(0, 0, 0, 0.5);
  animation: loaderCardIn 0.36s ease both;
}

.action-loader-card::before {
  content: "";
  position: absolute;
  inset: 24% 16%;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 48% 50%, rgba(94, 231, 255, 0.38), transparent 58%),
    radial-gradient(ellipse at 58% 50%, rgba(139, 92, 246, 0.3), transparent 62%);
  opacity: 0.7;
  filter: blur(30px);
  animation: beamPulse 1.18s ease-in-out infinite alternate;
}

.action-loader-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 18% 48%, rgba(255, 107, 200, 0.2) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 38%, rgba(94, 231, 255, 0.2) 0 1px, transparent 2px),
    radial-gradient(circle at 48% 72%, rgba(255, 180, 84, 0.18) 0 1px, transparent 2px);
  animation: particleFlicker 1.8s ease-in-out infinite alternate;
}

.action-loader-card > * {
  position: relative;
  z-index: 1;
}

.action-loader .boot-title,
.action-loader .boot-caption {
  max-width: min(620px, calc(100vw - 72px));
  text-align: center;
}

.action-loader .boot-title {
  font-size: clamp(24px, 3.7vw, 38px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.action-loader .boot-caption {
  line-height: 1.35;
}

.action-beam {
  width: min(460px, 72vw);
  height: 20px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.9) 0%, rgba(94, 231, 255, 0.72) 28%, transparent 68%),
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(94, 231, 255, 0.18) 14%,
      rgba(94, 231, 255, 0.95) 36%,
      rgba(255, 255, 255, 0.98) 50%,
      rgba(139, 92, 246, 0.76) 68%,
      rgba(139, 92, 246, 0.16) 86%,
      transparent 100%
    );
  box-shadow:
    0 0 18px rgba(94, 231, 255, 0.54),
    0 0 42px rgba(139, 92, 246, 0.28);
}

.action-beam::before {
  display: none;
}

.action-beam::after {
  content: "";
  position: absolute;
  inset: -36px -30px;
  z-index: -1;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 42% 50%, rgba(94, 231, 255, 0.34), transparent 56%),
    radial-gradient(ellipse at 68% 50%, rgba(139, 92, 246, 0.24), transparent 62%);
  filter: blur(24px);
  opacity: 0.62;
  animation: beamPulse 1.35s ease-in-out infinite alternate;
}

button,
input {
  font-family: inherit;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(94, 231, 255, 0.84);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes auraDrift {
  0% {
    transform: translate3d(-2%, -1%, 0) scale(1);
    opacity: 0.42;
  }
  100% {
    transform: translate3d(2%, 1%, 0) scale(1.04);
    opacity: 0.72;
  }
}

@keyframes softFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes glowSweep {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

@keyframes cardRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes crystalGlow {
  0%, 100% {
    filter: saturate(1) brightness(1);
    transform: scale(0.94);
  }
  50% {
    filter: saturate(1.25) brightness(1.1);
    transform: scale(1);
  }
}

@keyframes crystalImageFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
    filter:
      drop-shadow(0 0 9px rgba(94, 231, 255, 0.34))
      drop-shadow(0 0 14px rgba(139, 92, 246, 0.26));
  }
  50% {
    transform: translateY(-1px) scale(1.04);
    filter:
      drop-shadow(0 0 11px rgba(94, 231, 255, 0.44))
      drop-shadow(0 0 18px rgba(255, 107, 200, 0.28));
  }
}

@keyframes energyFlash {
  0%, 100% {
    filter: saturate(1) brightness(1);
    transform: translateY(0);
  }
  48% {
    filter: saturate(1.35) brightness(1.16);
    transform: translateY(-1px);
  }
}

@keyframes beamPulse {
  0% {
    opacity: 0.45;
    transform: translateX(-6%) scaleX(0.72);
    filter: blur(0);
  }
  50% {
    opacity: 1;
    transform: translateX(3%) scaleX(1.08);
    filter: blur(0.4px);
  }
  100% {
    opacity: 0.62;
    transform: translateX(6%) scaleX(0.86);
    filter: blur(0);
  }
}

@keyframes beamTravel {
  0% {
    opacity: 0;
    transform: translateX(-120%) skewX(-18deg);
  }
  18% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translateX(420%) skewX(-18deg);
  }
}

@keyframes loaderCardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sphereSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes orbSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes sphereAura {
  0%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.72;
  }
  50% {
    transform: translateY(-3px) scale(1.035);
    opacity: 1;
  }
}

@keyframes particleFlicker {
  0%, 100% {
    opacity: 0.52;
  }
  50% {
    opacity: 0.95;
  }
}

@keyframes pulseRing {
  0%, 100% {
    box-shadow: 0 0 0 rgba(94, 231, 255, 0), 0 0 34px rgba(255, 255, 255, 0.16);
  }
  50% {
    box-shadow: 0 0 28px var(--glow-a), 0 0 58px var(--glow-b);
  }
}

@keyframes splashOut {
  to {
    opacity: 0;
    transform: scale(1.015);
    visibility: hidden;
  }
}

.pixel-backdrop,
.orb {
  position: fixed;
  pointer-events: none;
}

.pixel-backdrop {
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(780px 420px at 50% -8%, var(--glow-a), transparent 72%),
    radial-gradient(520px 300px at 84% 18%, var(--glow-b), transparent 70%),
    radial-gradient(520px 280px at 10% 74%, var(--glow-c), transparent 72%);
  background-size: 34px 34px, 34px 34px, auto, auto;
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.82) 48%, rgba(0, 0, 0, 0.2) 100%);
  animation: glowSweep 14s ease-in-out infinite alternate;
}

.orb {
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.24;
  background: radial-gradient(circle, var(--accent-a), transparent 68%);
  animation: softFloat 8s ease-in-out infinite;
}

.orb-a {
  top: -160px;
  right: -120px;
}

.orb-b {
  left: -180px;
  bottom: -180px;
  background: radial-gradient(circle, var(--accent-c), transparent 68%);
  animation-delay: -3s;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) calc(112px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.glass {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(420px 180px at 16% 0%, var(--glow-a), transparent 68%),
    radial-gradient(320px 160px at 100% 100%, var(--glow-b), transparent 66%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035) 38%, rgba(255, 255, 255, 0.07)),
    linear-gradient(145deg, var(--surface-strong), var(--surface));
  box-shadow:
    0 24px 70px var(--shadow-strong),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.18), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.08));
  opacity: 0.55;
}

.glass::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  pointer-events: none;
  background:
    radial-gradient(220px 70px at 18% 100%, var(--glow-a), transparent 72%),
    radial-gradient(240px 78px at 82% 100%, var(--glow-c), transparent 74%);
  opacity: 0.62;
  animation: auraDrift 9s ease-in-out infinite alternate;
}

.glass > * {
  position: relative;
  z-index: 1;
}

body.theme-light .pixel-backdrop {
  background:
    linear-gradient(rgba(16, 24, 39, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 24, 39, 0.045) 1px, transparent 1px),
    radial-gradient(780px 420px at 50% -8%, var(--glow-a), transparent 72%),
    radial-gradient(520px 300px at 84% 18%, var(--glow-b), transparent 70%),
    radial-gradient(520px 280px at 10% 74%, var(--glow-c), transparent 72%);
  background-size: 34px 34px, 34px 34px, auto, auto, auto;
}

body.theme-light .glass {
  background:
    radial-gradient(420px 180px at 16% 0%, rgba(31, 170, 255, 0.18), transparent 68%),
    radial-gradient(320px 160px at 100% 100%, rgba(139, 92, 246, 0.13), transparent 66%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(248, 252, 255, 0.7) 46%, rgba(235, 244, 255, 0.82)),
    linear-gradient(145deg, var(--surface-strong), var(--surface));
  border-color: rgba(44, 86, 132, 0.32);
  box-shadow:
    0 0 0 1px rgba(54, 104, 152, 0.1),
    0 24px 70px rgba(57, 86, 128, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.72) inset,
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -1px 0 rgba(16, 24, 39, 0.06);
}

body.theme-light .glass::before {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.86), transparent 30%, transparent 70%, rgba(45, 90, 145, 0.12));
  opacity: 0.92;
}

body.theme-light .glass::after {
  opacity: 0.36;
}

.topbar,
.view,
.footer-panel,
.modal-card {
  isolation: isolate;
}

.topbar {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 44;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-radius: 28px;
}

.topbar.glass,
.top-actions {
  overflow: visible;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-button {
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  text-align: left;
  font: inherit;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.brand-button:focus-visible {
  outline: 2px solid rgba(151, 208, 255, 0.9);
  outline-offset: 6px;
  border-radius: 22px;
}

.brand-button .pixel-mark {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.brand-button:hover .pixel-mark {
  transform: translateY(-1px) scale(1.03);
  border-color: rgba(151, 208, 255, 0.48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 34px rgba(151, 208, 255, 0.24);
}

.pixel-mark {
  display: grid;
  grid-template-columns: repeat(3, 8px);
  grid-template-rows: repeat(3, 8px);
  gap: 3px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 28px rgba(255, 255, 255, 0.12);
}

.pixel-mark span {
  width: 8px;
  height: 8px;
  background: var(--white);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.72);
}

.pixel-mark span:nth-child(1) { grid-column: 1; grid-row: 1; }
.pixel-mark span:nth-child(2) { grid-column: 2; grid-row: 1; }
.pixel-mark span:nth-child(3) { grid-column: 3; grid-row: 1; }
.pixel-mark span:nth-child(4) { grid-column: 1; grid-row: 2; }
.pixel-mark span:nth-child(5) { grid-column: 2; grid-row: 3; }
.pixel-mark span:nth-child(6) { grid-column: 3; grid-row: 2; }

.eyebrow,
.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
}

h1,
h2 {
  font-family: "Unbounded", "Manrope", sans-serif;
}

h1 {
  margin-top: 3px;
  font-size: 18px;
  line-height: 1.1;
  white-space: nowrap;
}

h2 {
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.06;
}

h3 {
  font-size: 16px;
}

.subtitle,
.muted,
small {
  color: var(--muted);
  line-height: 1.45;
}

.subtitle {
  max-width: 560px;
  margin-top: 14px;
  font-size: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.exam-switch,
.pill-row,
.hero-actions,
.answer-row,
.draw-toolbar,
.width-row,
.chips,
.formula-row {
  display: flex;
  gap: 8px;
}

.exam-switch {
  padding: 5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.tab-btn,
.icon-tab,
.theme-toggle,
.help-toggle,
.profile-avatar-btn,
.pill-btn,
.tool-btn,
.ghost-btn,
.cta-btn,
.footer-btn,
.formula-btn,
.primary-action,
.secondary-action,
.mode-card,
.battle-card,
.option-btn,
.chip {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-size: 13px;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.tab-btn:hover,
.icon-tab:hover,
.theme-toggle:hover,
.help-toggle:hover,
.profile-avatar-btn:hover,
.pill-btn:hover,
.ghost-btn:hover,
.footer-btn:hover,
.mode-card:hover,
.battle-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.28);
}

.tab-btn:active,
.icon-tab:active,
.theme-toggle:active,
.help-toggle:active,
.profile-avatar-btn:active,
.pill-btn:active,
.tool-btn:active,
.formula-btn:active,
.chip:active,
.option-btn:active {
  transform: translateY(1px) scale(0.985);
}

.tab-btn.active,
.icon-tab.active,
.theme-toggle.active,
.profile-avatar-btn.active,
.pill-btn.active,
.tool-btn.active,
.footer-btn.active,
.cta-btn,
.primary-action {
  color: var(--ink);
  background: var(--white);
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 34px rgba(255, 255, 255, 0.16);
}

.theme-toggle {
  min-width: 46px;
  min-height: 42px;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  align-items: center;
  padding: 5px;
  overflow: hidden;
}

.help-toggle {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
  line-height: 1;
  background:
    radial-gradient(80px 44px at 24% 0%, rgba(94, 231, 255, 0.2), transparent 72%),
    rgba(255, 255, 255, 0.07);
}

.profile-avatar-btn {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 18px;
  overflow: visible;
  background:
    radial-gradient(circle at 35% 18%, rgba(255, 255, 255, 0.62), transparent 36%),
    linear-gradient(135deg, rgba(94, 231, 255, 0.22), rgba(139, 92, 246, 0.18)),
    rgba(255, 255, 255, 0.075);
}

.profile-avatar-btn > span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 14px;
  color: #f7f7f2;
  background: transparent;
  box-shadow: none;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 19px;
  line-height: 1;
  font-weight: 900;
}

.profile-avatar-btn small {
  position: absolute;
  right: -4px;
  bottom: -4px;
  z-index: 5;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.72);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 900;
}

.theme-toggle span {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 999px;
  font-size: 14px;
  transition: transform 0.22s ease, opacity 0.22s ease, background 0.22s ease;
}

.theme-toggle .theme-moon {
  background: rgba(255, 255, 255, 0.12);
}

.theme-toggle .theme-sun {
  opacity: 0.45;
  transform: scale(0.82);
}

.theme-toggle.active .theme-sun {
  opacity: 1;
  transform: scale(1);
  background: rgba(255, 180, 84, 0.22);
}

.theme-toggle.active .theme-moon {
  opacity: 0.45;
  transform: scale(0.82);
  background: transparent;
}

body.theme-light .tab-btn,
body.theme-light .icon-tab,
body.theme-light .theme-toggle,
body.theme-light .help-toggle,
body.theme-light .profile-avatar-btn,
body.theme-light .pill-btn,
body.theme-light .tool-btn,
body.theme-light .ghost-btn,
body.theme-light .footer-btn,
body.theme-light .formula-btn,
body.theme-light .secondary-action,
body.theme-light .battle-card,
body.theme-light .option-btn,
body.theme-light .chip {
  border-color: rgba(44, 86, 132, 0.22);
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    0 10px 28px rgba(57, 86, 128, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

body.theme-light .tab-btn.active,
body.theme-light .icon-tab.active,
body.theme-light .theme-toggle.active,
body.theme-light .profile-avatar-btn.active,
body.theme-light .pill-btn.active,
body.theme-light .tool-btn.active,
body.theme-light .footer-btn.active,
body.theme-light .cta-btn,
body.theme-light .primary-action {
  color: #ffffff;
  background: #101827;
  border-color: rgba(16, 24, 39, 0.86);
  box-shadow: 0 14px 38px rgba(31, 74, 135, 0.18);
}

body.theme-light .primary-action small {
  color: rgba(255, 255, 255, 0.66);
}

body.theme-light .exam-switch,
body.theme-light .footer-panel,
body.theme-light .pixel-mark,
body.theme-light .liquid-card,
body.theme-light .selector-block,
body.theme-light .mini-metrics div,
body.theme-light .stat-tile,
body.theme-light .stat-box,
body.theme-light .list-row,
body.theme-light .result-item,
body.theme-light .ladder-row,
body.theme-light .league-rule-card,
body.theme-light .task-row,
body.theme-light .battle-status,
body.theme-light .live-result-wait,
body.theme-light .arena-result-hero,
body.theme-light .arena-score-card,
body.theme-light .achievement-card,
body.theme-light .friend-row,
body.theme-light .friend-request-column,
body.theme-light .friend-search-card,
body.theme-light .friend-search-results,
body.theme-light .friend-list-head,
body.theme-light .profile-identity-card,
body.theme-light .profile-identity-form input,
body.theme-light .friend-search-row input,
body.theme-light .reminder-hour select,
body.theme-light .economy-status-card,
body.theme-light .subscription-card,
body.theme-light .subscription-status,
body.theme-light .shop-card,
body.theme-light .shop-section,
body.theme-light .shop-tabs,
body.theme-light .shop-rules,
body.theme-light .shop-history-row,
body.theme-light .weak-card,
body.theme-light .weak-row,
body.theme-light .analytics-card,
body.theme-light .reminder-toggle,
body.theme-light .reminder-hour,
body.theme-light .question-card,
body.theme-light .answer-card,
body.theme-light .notes-preview,
body.theme-light .result-summary,
body.theme-light .empty-state,
body.theme-light .arena-history-row,
body.theme-light .friend-profile-grid div,
body.theme-light .friend-profile-thought,
body.theme-light .friend-profile-subject,
body.theme-light .friend-profile-recent-row,
body.theme-light .activity-chart {
  border-color: rgba(36, 79, 126, 0.34);
  background-color: rgba(255, 255, 255, 0.78);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.64) inset,
    0 12px 32px rgba(57, 86, 128, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

body.theme-light .mode-card,
body.theme-light .battle-card,
body.theme-light .shop-card,
body.theme-light .weak-card {
  border-color: rgba(44, 86, 132, 0.24);
}

body.theme-light .mode-card:hover,
body.theme-light .battle-card:hover,
body.theme-light .shop-card:hover {
  border-color: rgba(31, 122, 190, 0.42);
}

body.theme-light .footer-panel {
  background:
    radial-gradient(220px 90px at 10% 0%, rgba(31, 170, 255, 0.18), transparent 74%),
    radial-gradient(240px 90px at 92% 100%, rgba(139, 92, 246, 0.14), transparent 76%),
    rgba(255, 255, 255, 0.86);
  border-color: rgba(44, 86, 132, 0.28);
}

body.theme-light .shop-tab.active {
  color: #101827;
  border-color: rgba(44, 86, 132, 0.22);
  background:
    radial-gradient(140px 70px at 16% 0%, rgba(31, 170, 255, 0.2), transparent 72%),
    radial-gradient(140px 70px at 90% 100%, rgba(255, 107, 200, 0.18), transparent 72%),
    rgba(255, 255, 255, 0.92);
}

body.theme-light .shop-status.pending {
  color: #155e75;
  border-color: rgba(14, 116, 144, 0.24);
  background: rgba(14, 116, 144, 0.08);
}

body.theme-light .shop-status.success {
  color: #166534;
  border-color: rgba(22, 163, 74, 0.24);
  background: rgba(22, 163, 74, 0.08);
}

body.theme-light .pixel-mark span {
  background: #101827;
  box-shadow: 0 0 14px rgba(31, 122, 190, 0.36);
}

body.theme-light .profile-avatar-btn > span {
  color: #101827;
}

body.theme-light .shop-status.bad {
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.26);
  background: rgba(220, 38, 38, 0.08);
}

body.theme-light .empty-state {
  border-color: rgba(44, 86, 132, 0.3);
  color: rgba(16, 24, 39, 0.68);
}

body.theme-light .empty-state::before {
  background: #101827;
  box-shadow: 0 0 16px rgba(31, 170, 255, 0.34);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.view {
  display: none;
  margin-top: 14px;
  gap: 14px;
  min-width: 0;
}

.view.active {
  display: grid;
  animation: viewIn 0.34s ease both;
}

.view.active > * {
  animation: cardRise 0.32s ease both;
}

.view.active > *:nth-child(2) { animation-delay: 0.035s; }
.view.active > *:nth-child(3) { animation-delay: 0.07s; }
.view.active > *:nth-child(4) { animation-delay: 0.105s; }
.view.active > *:nth-child(5) { animation-delay: 0.14s; }

.hero-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 16px;
  padding: 18px;
  min-height: 310px;
  overflow: hidden;
}

.hero-stage::before {
  background:
    linear-gradient(90deg, transparent 0%, rgba(94, 231, 255, 0.22) 24%, rgba(255, 255, 255, 0.34) 50%, rgba(255, 107, 200, 0.2) 76%, transparent 100%);
  height: 2px;
  inset: 0 10% auto 10%;
  opacity: 0.9;
  animation: beamPulse 2.8s ease-in-out infinite alternate;
}

.hero-stage::after {
  height: 62%;
  background:
    radial-gradient(420px 120px at 28% 92%, var(--glow-a), transparent 72%),
    radial-gradient(460px 120px at 72% 92%, var(--glow-c), transparent 74%);
}

.hero-copy,
.player-card,
.section-head,
.setup-flow,
.start-dock,
.battle-grid,
.league-ladder,
.profile-layout,
.solver-progress-row,
.answer-title,
.list,
.stats-summary,
.stats-subjects,
.stats-recent,
.result-details {
  position: relative;
  z-index: 1;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 270px;
}

.hero-actions {
  margin-top: 26px;
  flex-wrap: wrap;
}

.primary-action,
.secondary-action {
  min-height: 62px;
  border-radius: 22px;
  padding: 14px 18px;
  text-align: left;
}

.primary-action {
  animation: pulseRing 4.8s ease-in-out infinite;
}

.primary-action span,
.primary-action small,
.mode-card strong,
.mode-card small,
.battle-card strong,
.battle-card small {
  display: block;
}

.primary-action span {
  font-size: 15px;
}

.primary-action small {
  color: rgba(5, 5, 6, 0.62);
  margin-top: 4px;
}

.secondary-action {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.liquid-card {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 26px;
  background:
    radial-gradient(180px 120px at 28% 0%, var(--glow-a), transparent 72%),
    radial-gradient(180px 110px at 90% 100%, var(--glow-c), transparent 74%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.045));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 18px 48px rgba(0, 0, 0, 0.26);
}

.player-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 16px;
  animation: softFloat 7s ease-in-out infinite;
}

.card-topline,
.section-head,
.notes-head,
.answer-title,
.modal-head,
.row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.answer-tools {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill,
.timer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.ok {
  color: var(--ink);
  background: var(--white);
}

.status-pill[data-league-tier="bronze"] {
  color: #ffd6a3;
  border-color: rgba(255, 180, 84, 0.28);
  background: rgba(255, 180, 84, 0.08);
}

.status-pill[data-league-tier="silver"] {
  color: #eef7ff;
  border-color: rgba(210, 230, 246, 0.34);
  background: rgba(210, 230, 246, 0.1);
}

.status-pill[data-league-tier="gold"] {
  color: #ffe792;
  border-color: rgba(255, 215, 98, 0.36);
  background: rgba(255, 215, 98, 0.1);
}

.status-pill[data-league-tier="platinum"] {
  color: #d8ccff;
  border-color: rgba(176, 145, 255, 0.36);
  background: rgba(176, 145, 255, 0.1);
}

.status-pill[data-league-tier="diamond"] {
  color: #c9fbff;
  border-color: rgba(94, 231, 255, 0.42);
  background: rgba(94, 231, 255, 0.1);
}

.status-pill.bad,
.timer-badge.danger,
.ghost-btn.danger {
  color: #fff;
  background: var(--bad);
}

.timer-badge.warn {
  color: var(--ink);
  background: #d9d6c8;
}

.level-orb {
  --orb-top: rgba(255, 180, 84, 0.42);
  --orb-bottom: rgba(247, 247, 242, 0.34);
  --orb-flare: rgba(255, 255, 255, 0.42);
  --orb-base: rgba(5, 5, 6, 0.58);
  --orb-glow-a: rgba(255, 180, 84, 0.14);
  --orb-glow-b: rgba(94, 231, 255, 0.16);
  --orb-border: rgba(255, 255, 255, 0.2);
  position: relative;
  align-self: center;
  justify-self: center;
  width: min(190px, 70vw);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 18%, var(--orb-top), transparent 32%),
    radial-gradient(circle at 50% 78%, var(--orb-bottom), transparent 38%),
    radial-gradient(circle at 38% 34%, var(--orb-flare), transparent 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02)),
    var(--orb-base);
  border: 1px solid var(--orb-border);
  box-shadow:
    0 0 34px var(--orb-glow-a),
    0 0 68px var(--orb-glow-b),
    inset 0 0 42px rgba(255, 255, 255, 0.08),
    inset 0 -42px 54px rgba(0, 0, 0, 0.44);
  animation: sphereAura 4.2s ease-in-out infinite;
}

.level-orb[data-league-tier="bronze"] {
  --orb-top: rgba(255, 164, 86, 0.52);
  --orb-bottom: rgba(166, 96, 45, 0.42);
  --orb-flare: rgba(255, 235, 188, 0.5);
  --orb-base: rgba(30, 19, 12, 0.72);
  --orb-glow-a: rgba(255, 164, 86, 0.22);
  --orb-glow-b: rgba(255, 210, 150, 0.1);
  --orb-border: rgba(255, 180, 84, 0.3);
}

.level-orb[data-league-tier="silver"] {
  --orb-top: rgba(229, 239, 248, 0.62);
  --orb-bottom: rgba(132, 162, 190, 0.48);
  --orb-flare: rgba(255, 255, 255, 0.62);
  --orb-base: rgba(24, 31, 42, 0.72);
  --orb-glow-a: rgba(219, 237, 255, 0.24);
  --orb-glow-b: rgba(94, 231, 255, 0.18);
  --orb-border: rgba(229, 239, 248, 0.36);
}

.level-orb[data-league-tier="gold"] {
  --orb-top: rgba(255, 224, 105, 0.66);
  --orb-bottom: rgba(255, 180, 84, 0.48);
  --orb-flare: rgba(255, 255, 218, 0.7);
  --orb-base: rgba(36, 25, 5, 0.72);
  --orb-glow-a: rgba(255, 215, 98, 0.3);
  --orb-glow-b: rgba(255, 180, 84, 0.2);
  --orb-border: rgba(255, 224, 105, 0.4);
}

.level-orb[data-league-tier="platinum"] {
  --orb-top: rgba(176, 145, 255, 0.62);
  --orb-bottom: rgba(94, 231, 255, 0.3);
  --orb-flare: rgba(255, 255, 255, 0.62);
  --orb-base: rgba(25, 21, 46, 0.76);
  --orb-glow-a: rgba(176, 145, 255, 0.28);
  --orb-glow-b: rgba(94, 231, 255, 0.18);
  --orb-border: rgba(176, 145, 255, 0.4);
}

.level-orb[data-league-tier="diamond"] {
  --orb-top: rgba(94, 231, 255, 0.7);
  --orb-bottom: rgba(255, 107, 200, 0.34);
  --orb-flare: rgba(255, 255, 255, 0.76);
  --orb-base: rgba(7, 23, 39, 0.78);
  --orb-glow-a: rgba(94, 231, 255, 0.34);
  --orb-glow-b: rgba(255, 107, 200, 0.22);
  --orb-border: rgba(94, 231, 255, 0.46);
}

.level-orb::before {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background-image:
    radial-gradient(circle at 48% 9%, rgba(255, 213, 130, 0.95) 0 1.5px, transparent 2.6px),
    radial-gradient(circle at 58% 13%, rgba(255, 164, 86, 0.9) 0 1.4px, transparent 2.5px),
    radial-gradient(circle at 40% 17%, rgba(255, 235, 170, 0.9) 0 1.2px, transparent 2.4px),
    radial-gradient(circle at 68% 25%, rgba(255, 207, 98, 0.85) 0 1.2px, transparent 2.5px),
    radial-gradient(circle at 28% 30%, rgba(255, 164, 86, 0.8) 0 1.2px, transparent 2.4px),
    radial-gradient(circle at 46% 38%, rgba(255, 255, 255, 0.72) 0 1.2px, transparent 2.4px),
    radial-gradient(circle at 62% 45%, rgba(94, 231, 255, 0.7) 0 1.1px, transparent 2.3px),
    radial-gradient(circle at 35% 56%, rgba(255, 255, 255, 0.82) 0 1.4px, transparent 2.5px),
    radial-gradient(circle at 70% 62%, rgba(255, 255, 255, 0.7) 0 1.3px, transparent 2.5px),
    radial-gradient(circle at 50% 72%, rgba(247, 247, 242, 0.86) 0 1.5px, transparent 2.7px),
    radial-gradient(circle at 36% 78%, rgba(247, 247, 242, 0.72) 0 1.2px, transparent 2.4px),
    radial-gradient(circle at 64% 82%, rgba(247, 247, 242, 0.78) 0 1.2px, transparent 2.5px);
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
  opacity: 0.9;
  animation: sphereSpin 16s linear infinite;
}

.level-orb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 22%, rgba(255, 255, 255, 0.42), transparent 16%),
    linear-gradient(180deg, transparent 0 42%, rgba(0, 0, 0, 0.32) 58%, rgba(0, 0, 0, 0.76) 100%),
    radial-gradient(circle at 50% 110%, rgba(247, 247, 242, 0.32), transparent 44%);
  pointer-events: none;
}

.level-orb span {
  position: relative;
  z-index: 1;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: rgba(247, 247, 242, 0.72);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-shadow: 0 0 12px rgba(94, 231, 255, 0.32);
}

.level-orb b {
  position: relative;
  z-index: 1;
  color: #f7f7f2;
  font-family: "Unbounded", sans-serif;
  font-size: 46px;
  line-height: 1;
  text-shadow:
    0 0 18px rgba(255, 255, 255, 0.18),
    0 0 32px rgba(94, 231, 255, 0.22);
}

.mini-metrics,
.game-stats,
.quick-grid,
.battle-grid {
  display: grid;
  gap: 10px;
}

.mini-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-metrics div,
.stat-tile,
.stat-box,
.list-row,
.result-item,
.ladder-row {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.065);
  padding: 12px;
}

.result-item.correct {
  border-color: rgba(137, 255, 180, 0.34);
}

.result-item.wrong {
  border-color: rgba(255, 107, 107, 0.42);
}

.result-item.unanswered {
  border-color: rgba(255, 255, 255, 0.24);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(151, 208, 255, 0.06)),
    rgba(255, 255, 255, 0.055);
}

.result-item.manual {
  border-color: rgba(255, 219, 119, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 219, 119, 0.12), rgba(151, 208, 255, 0.1)),
    rgba(255, 255, 255, 0.065);
}

.result-item.unscored {
  border-color: rgba(151, 208, 255, 0.5);
  background:
    linear-gradient(135deg, rgba(151, 208, 255, 0.14), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.065);
}

.mini-metrics span,
.stat-tile span,
.stat-label,
.league-score span {
  display: block;
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
}

.mini-metrics b,
.stat-tile b,
.stat-val,
.league-score b {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.metric-comet {
  min-height: 78px;
}

.comet-widget {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  position: relative;
  display: inline-grid;
  grid-template-columns: 42px auto;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 0;
  cursor: pointer;
}

.comet-widget b {
  margin: 0;
  font-size: 22px;
}

.comet-orb {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 42px;
  transform: rotate(0deg);
  border-radius: 18%;
  clip-path: polygon(50% 0%, 62% 35%, 100% 50%, 62% 65%, 50% 100%, 38% 65%, 0% 50%, 38% 35%);
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.98), transparent 10%),
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.96), transparent 17%),
    linear-gradient(135deg, #b9f7ff 0%, #edf7ff 25%, #a8b0ff 54%, #ff74c7 100%);
  filter:
    drop-shadow(0 0 12px rgba(94, 231, 255, 0.54))
    drop-shadow(0 0 24px rgba(255, 107, 200, 0.24));
  animation: cometFloat 3.2s ease-in-out infinite;
}

.comet-orb::before,
.comet-orb::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
}

.comet-widget::before,
.comet-showcase::before,
.gift-comet::before {
  content: "";
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  filter: blur(10px);
  top: 0;
  left: 0;
  transform: translate(-6px, -6px);
}

.comet-showcase::before,
.gift-comet::before {
  top: 50%;
  left: 50%;
  width: 104px;
  height: 104px;
  transform: translate(-50%, -50%);
}

.comet-showcase,
.gift-comet {
  position: relative;
}

.comet-widget.is-fire .comet-orb::before,
.comet-showcase.is-fire .comet-orb::before,
.gift-comet .comet-orb::before {
  background:
    radial-gradient(circle at 42% 44%, rgba(255, 255, 255, 0.72), transparent 13%),
    conic-gradient(from 20deg, #ffe66d, #ff8c42, #ff3d81, #8bdcff, #fff7bf, #ffe66d);
  mix-blend-mode: screen;
  opacity: 0.86;
  animation: cometFire 1.22s ease-in-out infinite;
}

.comet-widget.is-fire::before,
.comet-showcase.is-fire::before,
.gift-comet::before {
  background:
    radial-gradient(circle at 38% 58%, rgba(255, 225, 93, 0.96), transparent 20%),
    radial-gradient(circle at 62% 42%, rgba(255, 72, 114, 0.74), transparent 24%),
    radial-gradient(circle at 50% 50%, rgba(94, 231, 255, 0.42), transparent 46%);
  opacity: 0.88;
  animation: cometFlameHalo 1.05s ease-in-out infinite;
}

.comet-widget.is-ice .comet-orb,
.comet-showcase.is-ice .comet-orb {
  background:
    radial-gradient(circle at 45% 42%, rgba(255, 255, 255, 0.98), transparent 13%),
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.98), transparent 18%),
    linear-gradient(135deg, #e7fdff 0%, #82d9ff 42%, #9d96ff 100%);
  filter:
    saturate(1.18)
    brightness(1.08)
    drop-shadow(0 0 14px rgba(159, 238, 255, 0.6))
    drop-shadow(0 0 28px rgba(139, 161, 255, 0.34));
}

.comet-widget.is-ice .comet-orb::before,
.comet-showcase.is-ice .comet-orb::before {
  background:
    linear-gradient(120deg, transparent 0 35%, rgba(255, 255, 255, 0.72) 46%, transparent 58%),
    radial-gradient(circle at 72% 26%, rgba(199, 249, 255, 0.66), transparent 28%);
  opacity: 0.82;
  filter: blur(2px);
  animation: cometIce 2s ease-in-out infinite;
}

.comet-widget.is-broken .comet-orb,
.comet-showcase.is-broken .comet-orb {
  background: linear-gradient(135deg, #9aa2ac 0%, #5d626b 48%, #343842 100%);
  box-shadow:
    0 0 12px rgba(148, 163, 184, 0.22),
    inset 0 0 0 2px rgba(255, 255, 255, 0.16);
  animation: cometBreak 2.6s ease-in-out infinite;
}

.comet-widget.is-broken .comet-orb::after,
.comet-showcase.is-broken .comet-orb::after {
  inset: 7px 18px;
  width: 2px;
  background: rgba(15, 23, 42, 0.58);
  opacity: 1;
  transform: rotate(-18deg);
}

.comet-widget.is-dim .comet-orb,
.comet-showcase.is-dim .comet-orb {
  filter: grayscale(0.35) saturate(0.8);
  opacity: 0.76;
}

.comet-widget:hover .comet-orb {
  transform: scale(1.06);
}

.home-gift-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: clamp(16px, 3vw, 22px);
  border-color: rgba(94, 231, 255, 0.28);
  background:
    radial-gradient(circle at 10% 20%, rgba(94, 231, 255, 0.16), transparent 34%),
    radial-gradient(circle at 84% 62%, rgba(255, 107, 200, 0.12), transparent 28%),
    rgba(255, 255, 255, 0.06);
}

.home-gift-panel h3 {
  margin: 0 0 4px;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.045em;
}

.home-gift-panel p {
  margin: 0;
  color: var(--dim);
  font-weight: 800;
}

.gift-comet .comet-orb {
  width: 62px;
  height: 62px;
  animation: cometGift 2.6s ease-in-out infinite;
}

@keyframes cometFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.03); }
}

@keyframes cometFire {
  0%, 100% { transform: scale(0.96) rotate(0deg); opacity: 0.74; }
  45% { transform: scale(1.16) rotate(8deg); opacity: 0.98; }
  70% { transform: scale(1.06) rotate(-5deg); opacity: 0.86; }
}

@keyframes cometFlameHalo {
  0%, 100% { transform: translate(-6px, -5px) scale(0.96); opacity: 0.58; }
  38% { transform: translate(-7px, -8px) scale(1.22); opacity: 0.96; }
  72% { transform: translate(-5px, -4px) scale(1.05); opacity: 0.72; }
}

.comet-showcase.is-fire::before,
.gift-comet::before {
  animation-name: cometFlameHaloLarge;
}

@keyframes cometFlameHaloLarge {
  0%, 100% { transform: translate(-50%, -50%) scale(0.94); opacity: 0.54; }
  42% { transform: translate(-50%, -54%) scale(1.18); opacity: 0.94; }
  72% { transform: translate(-50%, -49%) scale(1.04); opacity: 0.72; }
}

@keyframes cometIce {
  0%, 100% { transform: translateX(-8px) scale(0.96); opacity: 0.45; }
  50% { transform: translateX(9px) scale(1.08); opacity: 0.92; }
}

@keyframes cometBreak {
  0%, 100% { transform: translate(0, 0); }
  42% { transform: translate(-1px, 1px) rotate(-2deg); }
  48% { transform: translate(1px, -1px) rotate(2deg); }
  54% { transform: translate(0, 0); }
}

@keyframes cometGift {
  0%, 100% { transform: scale(1); filter: hue-rotate(0deg); }
  50% { transform: scale(1.08); filter: hue-rotate(24deg); }
}

.quick-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.mode-card {
  --card-accent: var(--accent-a);
  --card-glow: rgba(94, 231, 255, 0.26);
  --card-glow-soft: rgba(94, 231, 255, 0.16);
  min-height: 138px;
  border-radius: 26px;
  padding: 18px;
  text-align: left;
  background:
    radial-gradient(180px 90px at 16% 0%, var(--card-glow), transparent 74%),
    radial-gradient(240px 80px at 100% 100%, var(--card-glow-soft), transparent 76%),
    linear-gradient(145deg, var(--surface-strong), var(--surface));
  animation: cardRise 0.34s ease both;
}

.mode-card:nth-child(2) {
  --card-accent: var(--accent-b);
  --card-glow: rgba(139, 92, 246, 0.3);
  --card-glow-soft: rgba(139, 92, 246, 0.17);
  animation-delay: 0.04s;
}

.mode-card:nth-child(3) {
  --card-accent: var(--accent-c);
  --card-glow: rgba(255, 107, 200, 0.26);
  --card-glow-soft: rgba(255, 107, 200, 0.15);
  animation-delay: 0.08s;
}

.mode-card:nth-child(4) {
  --card-accent: var(--accent-d);
  --card-glow: rgba(255, 180, 84, 0.26);
  --card-glow-soft: rgba(255, 180, 84, 0.15);
  animation-delay: 0.12s;
}

.mode-card:nth-child(5) {
  --card-accent: var(--accent-e);
  --card-glow: rgba(66, 245, 154, 0.22);
  --card-glow-soft: rgba(66, 245, 154, 0.12);
  animation-delay: 0.16s;
}

.mode-card::after,
.battle-card::after,
.shop-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 0 36%, rgba(255, 255, 255, 0.14) 46%, transparent 57% 100%);
  opacity: 0;
  transform: translateX(-48%);
  transition: opacity 0.18s ease, transform 0.42s ease;
}

.mode-card:hover::after,
.battle-card:hover::after,
.shop-card:hover::after {
  opacity: 1;
  transform: translateX(48%);
}

.mode-icon {
  display: inline-flex;
  margin-bottom: 18px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--card-accent);
  text-shadow: 0 0 18px var(--card-glow);
}

.mode-card strong,
.battle-card strong {
  font-size: 17px;
}

.mode-card,
.battle-card,
.shop-card,
.subscription-card,
.wallet-card,
.economy-status-card,
.friend-row,
.ladder-row,
.achievement-card,
.weak-card,
.analytics-row,
.task-row {
  position: relative;
  overflow: hidden;
  will-change: transform;
}

.mode-card:active,
.battle-card:active,
.shop-card:active,
.footer-btn:active,
.primary-action:active,
.secondary-action:active,
.cta-btn:active,
.ghost-btn:active {
  transform: translateY(1px) scale(0.99);
}

.mode-card small,
.battle-card small {
  margin-top: 8px;
}

.progress-panel,
.sessions-panel,
.quick-resume,
.config-panel,
.arena-screen,
.boss-panel,
.league-panel,
.shop-panel,
.weak-panel,
.profile-panel,
.friends-panel,
.stats-panel,
.solver-head-panel,
.nav-panel,
.question-panel,
.notes-panel,
.answer-panel,
.result-panel {
  padding: 16px;
}

.quick-resume {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: -4px;
  overflow: hidden;
}

.quick-resume::before {
  background:
    radial-gradient(180px 90px at 14% 24%, rgba(94, 231, 255, 0.2), transparent 72%),
    radial-gradient(220px 110px at 88% 100%, rgba(255, 107, 200, 0.14), transparent 76%);
}

.quick-resume h3 {
  margin: 2px 0 4px;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.04;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

.quick-resume small {
  color: var(--muted);
  font-weight: 800;
}

.quick-resume .primary-action.compact {
  min-width: 180px;
  padding: 14px 18px;
}

.resume-progress {
  width: min(360px, 100%);
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.resume-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5ee7ff, #b78cff, #ff6bc8);
  box-shadow: 0 0 22px rgba(94, 231, 255, 0.34);
}

.compact-panel {
  border-radius: var(--radius-md);
}

.fold-panel {
  min-width: 0;
}

.fold-panel > summary {
  list-style: none;
}

.fold-panel > summary::-webkit-details-marker {
  display: none;
}

.fold-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.fold-summary h2,
.fold-summary h3 {
  margin-top: 2px;
}

.fold-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  font-weight: 900;
}

.fold-panel[open] .fold-chevron {
  color: var(--ink);
  background: var(--white);
}

.fold-panel[open] .fold-chevron::before {
  content: "Скрыть";
}

.fold-panel[open] .fold-chevron {
  font-size: 0;
}

.fold-panel[open] .fold-chevron::before {
  font-size: 11px;
}

.fold-panel:not([open]) {
  padding-bottom: 16px;
}

.activity-chart {
  position: relative;
  z-index: 1;
  min-height: 92px;
  margin-top: 14px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.055);
}

.activity-bar {
  flex: 1 1 0;
  min-width: 8px;
  max-width: 40px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(to top, var(--accent-b), var(--accent-a), var(--white));
  box-shadow: 0 0 22px var(--glow-a);
  transform-origin: bottom;
  animation: cardRise 0.32s ease both;
}

.list {
  margin-top: 12px;
  gap: 8px;
}

.list-row {
  color: var(--text);
}

.empty-state {
  position: relative;
  z-index: 1;
  min-height: 76px;
  display: grid;
  align-items: center;
  margin-top: 12px;
  padding: 16px 16px 16px 44px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: var(--muted);
  background:
    radial-gradient(140px 80px at 8% 0%, var(--glow-a), transparent 74%),
    rgba(255, 255, 255, 0.045);
  font-size: 13px;
  font-weight: 700;
}

.empty-state::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--white);
  box-shadow: 0 0 18px var(--glow-a);
  transform: translateY(-50%) rotate(45deg);
}

.setup-flow {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.selector-block {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.115);
  border-radius: 22px;
  background:
    radial-gradient(180px 80px at 12% 0%, rgba(94, 231, 255, 0.08), transparent 72%),
    rgba(255, 255, 255, 0.035);
}

.selector-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pill-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, max-content));
  align-items: start;
  justify-content: start;
}

.pill-btn {
  min-height: 46px;
  max-width: 100%;
  border-radius: 16px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.18;
}

.task-pills .pill-btn {
  min-width: 54px;
}

.task-pills {
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  width: 100%;
}

.muted {
  margin-top: 8px;
  font-size: 13px;
}

.start-dock {
  position: relative;
  z-index: 1;
  margin-top: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.start-dock > div {
  min-width: 0;
}

.start-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.cta-btn.big {
  min-height: 54px;
  min-width: 150px;
  border-radius: 18px;
}

.battle-grid {
  margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.battle-config {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  display: grid;
  gap: 16px;
}

.battle-card {
  --card-accent: var(--accent-a);
  --card-glow: rgba(94, 231, 255, 0.24);
  min-height: 170px;
  border-radius: 28px;
  padding: 18px;
  text-align: left;
  background:
    radial-gradient(190px 110px at 18% 0%, var(--card-glow), transparent 74%),
    rgba(255, 255, 255, 0.07);
  animation: cardRise 0.34s ease both;
}

.battle-card:nth-child(2) {
  --card-accent: var(--accent-b);
  --card-glow: rgba(139, 92, 246, 0.24);
  animation-delay: 0.04s;
}

.battle-card:nth-child(3) {
  --card-accent: var(--accent-c);
  --card-glow: rgba(255, 107, 200, 0.22);
  animation-delay: 0.08s;
}

.battle-card:nth-child(4) {
  --card-accent: var(--accent-d);
  --card-glow: rgba(255, 180, 84, 0.22);
  animation-delay: 0.12s;
}

.battle-card.active {
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2), 0 20px 54px rgba(255, 255, 255, 0.08);
}

.primary-battle {
  color: var(--ink);
  background:
    radial-gradient(200px 110px at 24% 0%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.48) 48%, rgba(255, 255, 255, 0.16)),
    var(--white);
}

.primary-battle small,
.primary-battle .mono {
  color: rgba(5, 5, 6, 0.58);
}

.battle-options {
  padding: 16px;
}

.battle-scope-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1.3fr) minmax(220px, 1fr);
  gap: 12px;
}

.battle-start {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.friend-invite,
.live-match {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background:
    radial-gradient(180px 110px at 20% 0%, rgba(255, 255, 255, 0.14), transparent 72%),
    rgba(255, 255, 255, 0.055);
}

.friend-invite input {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.friend-actions,
.live-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.live-match {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background:
    radial-gradient(180px 110px at 18% 0%, rgba(255, 255, 255, 0.22), transparent 72%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035));
}

.score-note {
  margin-top: 6px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.45;
}

.battle-status {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.battle-status div {
  border-radius: 16px;
  padding: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.battle-status span {
  display: block;
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
}

.battle-status b {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.live-result-wait {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(160px 90px at 20% 0%, rgba(255, 255, 255, 0.18), transparent 72%),
    rgba(255, 255, 255, 0.055);
}

.live-result-wait span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.result-stack {
  display: grid;
  gap: 12px;
}

.arena-result-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr);
  gap: 14px;
  align-items: stretch;
  padding: 16px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(240px 160px at 18% 0%, rgba(255, 255, 255, 0.22), transparent 72%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  animation: resultRise 420ms ease both;
}

.arena-result-hero.win {
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 52px rgba(255, 255, 255, 0.14);
}

.arena-result-hero.lose {
  border-color: rgba(173, 77, 77, 0.62);
}

.arena-result-copy {
  display: grid;
  align-content: center;
  gap: 8px;
}

.arena-result-copy h3 {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: clamp(26px, 5vw, 54px);
  line-height: 1;
}

.arena-versus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.arena-versus div,
.result-reward-grid div {
  min-width: 0;
  border-radius: 20px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.06);
}

.arena-versus strong {
  font-family: "IBM Plex Mono", monospace;
  color: var(--dim);
}

.arena-versus span,
.arena-versus small,
.result-reward-grid span {
  display: block;
  color: var(--dim);
  font-size: 11px;
  font-weight: 900;
}

.arena-versus b {
  display: block;
  margin-top: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(28px, 6vw, 52px);
  line-height: 1;
}

.arena-versus small {
  margin-top: 8px;
}

.result-reward-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.result-progress-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px;
  border-radius: 24px;
  animation: cardRise 0.38s ease both;
}

.result-orb {
  width: 96px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, rgba(10, 12, 18, 0.92) 0 48%, transparent 49%),
    conic-gradient(from -90deg, #5ee7ff 0 var(--score), rgba(255, 255, 255, 0.12) var(--score) 360deg);
  box-shadow:
    0 0 42px rgba(94, 231, 255, 0.18),
    inset 0 0 22px rgba(255, 255, 255, 0.08);
  animation: orbFloat 4.8s ease-in-out infinite;
}

.result-orb span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 20px;
  font-weight: 900;
}

.result-progress-copy {
  display: grid;
  gap: 8px;
}

.result-progress-copy h3 {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: clamp(20px, 4vw, 30px);
  line-height: 1.05;
}

.result-progress-line {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.result-progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5ee7ff, #a78bfa, #ff6bc8);
  box-shadow: 0 0 24px rgba(94, 231, 255, 0.28);
  animation: progressGlow 2.8s ease-in-out infinite;
}

.result-reward-grid b {
  display: block;
  margin-top: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 24px;
}

.result-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@keyframes resultRise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes progressGlow {
  0%, 100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.35) brightness(1.14);
  }
}

.arena-score-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.arena-score-grid div {
  border-radius: 16px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.055);
}

.arena-score-grid span,
.arena-history-score span,
.arena-history-row small {
  display: block;
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
}

.arena-score-grid b {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.arena-history {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  padding: 16px;
}

.arena-history-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.arena-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background:
    radial-gradient(160px 90px at 16% 0%, rgba(255, 255, 255, 0.14), transparent 72%),
    rgba(255, 255, 255, 0.055);
}

.arena-history-row.win {
  border-color: rgba(255, 255, 255, 0.34);
}

.arena-history-row.lose {
  border-color: rgba(173, 77, 77, 0.55);
}

.arena-history-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.arena-history-main b,
.arena-history-main small {
  min-width: 0;
}

.arena-history-main small,
.arena-history-score span {
  margin-top: 5px;
}

.arena-history-score {
  min-width: 104px;
  text-align: right;
}

.arena-history-score b {
  display: block;
  margin-top: 5px;
  font-family: "IBM Plex Mono", monospace;
}

.outcome-pill {
  white-space: nowrap;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--white);
  font-size: 11px;
  font-weight: 900;
}

.outcome-pill.lose {
  color: var(--text);
  background: rgba(173, 77, 77, 0.72);
}

.outcome-pill.draw,
.outcome-pill.pending {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.boss-grid {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.boss-card {
  padding: 16px;
  min-height: 132px;
}

.boss-card span,
.boss-card small {
  display: block;
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
}

.boss-card b {
  display: block;
  margin-top: 12px;
  color: var(--text);
  font-size: clamp(26px, 5vw, 42px);
  line-height: 1;
}

.boss-card small {
  margin-top: 12px;
  line-height: 1.4;
}

.boss-status,
.boss-recent {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.league-score {
  min-width: 118px;
  padding: 14px;
  text-align: center;
}

.league-rules-grid {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.league-rule-card {
  min-height: 104px;
  padding: 14px;
  border-radius: 22px;
}

.league-rule-card span,
.league-rule-card small {
  display: block;
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
}

.league-rule-card b {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: clamp(20px, 4vw, 30px);
  line-height: 1;
}

.league-rule-card small {
  margin-top: 10px;
  line-height: 1.35;
}

.league-reward-card {
  display: grid;
  align-content: start;
}

.league-reward-card .cta-btn {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  border-radius: 16px;
  font-size: 14px;
}

.league-reward-card .cta-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.league-subject-head {
  margin-top: 18px;
}

.economy-status-grid {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.economy-status-card {
  min-height: 106px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  background:
    radial-gradient(140px 90px at 18% 0%, rgba(94, 231, 255, 0.14), transparent 74%),
    rgba(255, 255, 255, 0.06);
}

.economy-status-card.attention {
  background:
    radial-gradient(140px 90px at 18% 0%, rgba(255, 180, 84, 0.18), transparent 74%),
    rgba(255, 255, 255, 0.06);
}

.economy-status-card.full {
  background:
    radial-gradient(140px 90px at 18% 0%, rgba(66, 245, 154, 0.16), transparent 74%),
    rgba(255, 255, 255, 0.06);
}

.economy-status-card span,
.economy-status-card small {
  display: block;
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
}

.economy-status-card b {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: clamp(22px, 5vw, 34px);
  line-height: 1;
}

.economy-status-card .economy-status-value .currency-value {
  justify-content: flex-start;
}

.economy-status-card .economy-status-value .currency-value.large {
  gap: 12px;
}

.economy-status-card .economy-status-value .currency-value.large .energy-icon {
  width: clamp(34px, 6vw, 46px);
  height: clamp(34px, 6vw, 46px);
}

.economy-status-card small {
  margin-top: 10px;
  line-height: 1.35;
}

.subscription-head {
  margin-top: 14px;
}

.subscription-grid {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.subscription-card {
  min-height: 248px;
  display: grid;
  gap: 12px;
  align-content: space-between;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  background:
    radial-gradient(180px 120px at 14% 0%, rgba(94, 231, 255, 0.18), transparent 74%),
    radial-gradient(210px 110px at 100% 100%, rgba(139, 92, 246, 0.14), transparent 76%),
    rgba(255, 255, 255, 0.06);
  animation: cardRise 0.34s ease both;
}

.subscription-card:nth-child(2) {
  background:
    radial-gradient(210px 120px at 14% 0%, rgba(255, 107, 200, 0.2), transparent 74%),
    radial-gradient(230px 120px at 100% 100%, rgba(94, 231, 255, 0.18), transparent 76%),
    rgba(255, 255, 255, 0.065);
}

.subscription-card.active {
  border-color: rgba(94, 231, 255, 0.38);
}

.subscription-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.subscription-card-top span,
.subscription-card p,
.subscription-features span {
  color: var(--dim);
  font-size: 12px;
  font-weight: 800;
}

.subscription-card-top b {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
}

.subscription-card h3 {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: 22px;
  line-height: 1.08;
}

.subscription-card p {
  line-height: 1.45;
}

.subscription-features {
  display: grid;
  gap: 7px;
}

.subscription-status {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
}

.subscription-status.active {
  border-color: rgba(94, 231, 255, 0.32);
  box-shadow: inset 0 0 22px rgba(94, 231, 255, 0.08);
}

.subscription-status span,
.subscription-status b {
  display: block;
}

.subscription-status span {
  color: var(--dim);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.subscription-status b {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.subscription-features span {
  position: relative;
  padding-left: 18px;
}

.subscription-features span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--white);
  box-shadow: 0 0 14px var(--glow-a);
  transform: translateY(-50%) rotate(45deg);
}

.subscription-card .cta-btn {
  width: 100%;
}

.league-ladder {
  margin-top: 18px;
  display: grid;
  gap: 9px;
}

.ladder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}

.ladder-row.active {
  color: var(--ink);
  background: var(--white);
}

.ladder-row span,
.ladder-row small,
.ladder-row b {
  min-width: 0;
}

.ladder-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ladder-row small {
  color: var(--dim);
}

.ladder-row.active small {
  color: rgba(5, 5, 6, 0.58);
}

.weak-summary {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.weak-card {
  min-height: 92px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 20px;
  padding: 14px;
  background:
    radial-gradient(120px 80px at 18% 0%, rgba(255, 255, 255, 0.18), transparent 72%),
    rgba(255, 255, 255, 0.06);
}

.weak-card span,
.weak-card small {
  display: block;
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
}

.weak-card b {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1;
}

.weak-card small {
  margin-top: 6px;
}

.weak-list {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.weak-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.weak-row b,
.weak-row small {
  display: block;
  min-width: 0;
}

.weak-row small {
  margin-top: 6px;
  color: var(--muted);
}

.weak-bar {
  height: 8px;
  margin-top: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.weak-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.9), rgba(173, 77, 77, 0.92));
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.14);
}

.shop-wallet {
  width: max-content;
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: start;
  gap: 6px 12px;
  padding: 12px 14px;
  text-align: left;
  border-radius: 22px;
}

.currency-value {
  display: inline-flex;
  align-items: center;
  justify-content: inherit;
  gap: 8px;
  white-space: nowrap;
}

.currency-value.large {
  gap: 11px;
}

.crystal-icon,
.energy-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 1.34em;
  height: 1.34em;
  vertical-align: -0.25em;
  isolation: isolate;
}

.crystal-icon::before,
.crystal-icon::after,
.energy-icon::before,
.energy-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.crystal-icon::before {
  inset: 3%;
  clip-path: polygon(
    50% 2%,
    61% 32%,
    94% 16%,
    72% 47%,
    96% 72%,
    62% 66%,
    50% 98%,
    38% 66%,
    4% 72%,
    28% 47%,
    6% 16%,
    39% 32%
  );
  border-radius: 18%;
  background:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.96), transparent 15%),
    radial-gradient(circle at 72% 72%, rgba(255, 107, 200, 0.42), transparent 31%),
    linear-gradient(135deg, #f5fbff 0%, #6fe8ff 28%, #7d79ff 58%, #ff74d8 100%);
  box-shadow:
    inset 0 0 10px rgba(255, 255, 255, 0.75),
    inset -4px -5px 14px rgba(68, 53, 190, 0.34),
    inset 4px 4px 14px rgba(255, 255, 255, 0.28),
    0 0 14px rgba(139, 92, 246, 0.54),
    0 0 28px rgba(94, 231, 255, 0.28);
  animation: crystalGlow 2.4s ease-in-out infinite;
}

.crystal-icon::after {
  inset: 9%;
  clip-path: polygon(
    50% 4%,
    57% 35%,
    89% 22%,
    67% 48%,
    88% 69%,
    59% 62%,
    50% 91%,
    41% 62%,
    12% 69%,
    33% 48%,
    11% 22%,
    43% 35%
  );
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.75), transparent 28%),
    radial-gradient(circle at 74% 32%, rgba(255, 255, 255, 0.46), transparent 18%);
  opacity: 0.72;
  mix-blend-mode: screen;
}

.crystal-icon {
  background: url("/assets/crystal-star.png?v=20260524-friend-duel-1") center / contain no-repeat;
  filter:
    drop-shadow(0 0 9px rgba(94, 231, 255, 0.34))
    drop-shadow(0 0 14px rgba(139, 92, 246, 0.26));
  animation: crystalImageFloat 3.2s ease-in-out infinite;
}

.crystal-icon::before,
.crystal-icon::after {
  display: none;
}

.energy-icon::before {
  inset: 4% 18% 2% 14%;
  clip-path: polygon(48% 0, 96% 0, 62% 43%, 88% 43%, 31% 100%, 43% 55%, 9% 55%);
  border-radius: 12px;
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.96), transparent 20%),
    linear-gradient(135deg, #f6fdff 0%, #5ee7ff 26%, #8b5cf6 54%, #ffb454 76%, #ff6bc8 100%);
  box-shadow:
    inset 0 0 10px rgba(255, 255, 255, 0.72),
    inset -4px -5px 14px rgba(0, 0, 0, 0.24),
    0 0 18px rgba(94, 231, 255, 0.48),
    0 0 28px rgba(255, 107, 200, 0.22);
  animation: energyFlash 2.1s ease-in-out infinite;
}

.energy-icon::after {
  inset: 10% 24%;
  clip-path: polygon(45% 0, 70% 0, 48% 44%, 66% 44%, 27% 100%, 37% 54%, 20% 54%);
  background: rgba(255, 255, 255, 0.5);
  filter: blur(1px);
}

.crystal-icon.big,
.energy-icon.big {
  width: 58px;
  height: 58px;
}

.crystal-icon.mini,
.energy-icon.mini {
  width: 22px;
  height: 22px;
  margin-right: 6px;
}

.currency-value.large .crystal-icon,
.currency-value.large .energy-icon {
  width: 44px;
  height: 44px;
}

.freeze-icon {
  position: relative;
  display: inline-block;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  background: url("/assets/freeze-crystal.svg?v=20260526-prep-subjects-1") center / contain no-repeat;
  filter:
    drop-shadow(0 0 10px rgba(94, 231, 255, 0.42))
    drop-shadow(0 0 20px rgba(139, 92, 246, 0.28))
    drop-shadow(0 0 16px rgba(255, 107, 200, 0.18));
  animation: crystalImageFloat 3.4s ease-in-out infinite;
}

.freeze-icon.big {
  width: 66px;
  height: 66px;
}

.shop-wallet span,
.wallet-card span,
.shop-card-top span,
.shop-card p,
.shop-status,
.rule-row p {
  color: var(--dim);
  font-size: 12px;
  font-weight: 800;
}

.shop-wallet b {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 24px;
  line-height: 1;
}

.shop-wallet b .currency-value {
  justify-content: flex-start;
  gap: 9px;
}

.shop-wallet .currency-value.large .crystal-icon {
  width: 48px;
  height: 48px;
}

.wallet-grid,
.shop-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

.wallet-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.wallet-card,
.shop-card {
  padding: 16px;
}

.wallet-card b {
  display: block;
  margin-top: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 24px;
}

.wallet-card span {
  display: inline-flex;
  align-items: center;
}

.shop-tabs {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 5;
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px) saturate(1.18);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
}

.shop-tab {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 18px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.shop-tab:hover {
  transform: translateY(-1px);
  color: var(--text);
}

.shop-tab.active {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.6);
  background:
    radial-gradient(140px 70px at 16% 0%, rgba(94, 231, 255, 0.42), transparent 72%),
    radial-gradient(140px 70px at 90% 100%, rgba(255, 107, 200, 0.32), transparent 72%),
    var(--white);
  box-shadow:
    0 12px 32px rgba(94, 231, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.shop-sections {
  position: relative;
  z-index: 1;
  margin-top: 14px;
}

.shop-section {
  display: none;
  min-height: 310px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 30px;
  background:
    radial-gradient(300px 150px at 10% 0%, rgba(94, 231, 255, 0.14), transparent 74%),
    radial-gradient(320px 160px at 100% 100%, rgba(139, 92, 246, 0.13), transparent 76%),
    rgba(255, 255, 255, 0.052);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 18px 54px rgba(0, 0, 0, 0.12);
}

.shop-section.active {
  display: block;
  animation: cardRise 0.28s ease both;
}

.shop-section-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.shop-section-head h3 {
  margin-top: 2px;
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: clamp(22px, 4.6vw, 34px);
  line-height: 1.06;
}

.shop-section-icon {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.035)),
    rgba(255, 255, 255, 0.055);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 32px rgba(139, 92, 246, 0.16);
}

.shop-section-icon.pro-icon {
  color: var(--white);
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.04em;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.58), transparent 24%),
    linear-gradient(135deg, rgba(255, 107, 200, 0.86), rgba(139, 92, 246, 0.82), rgba(94, 231, 255, 0.72));
}

.wallet-card small,
.shop-card p {
  display: block;
  margin-top: 8px;
  line-height: 1.45;
}

.shop-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.crystal-pack-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.boost-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.shop-card {
  --card-accent: var(--accent-a);
  --card-glow: rgba(94, 231, 255, 0.24);
  --card-glow-soft: rgba(94, 231, 255, 0.14);
  min-height: 210px;
  display: grid;
  gap: 12px;
  align-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(150px 110px at 20% 0%, var(--card-glow), transparent 74%),
    radial-gradient(170px 90px at 100% 100%, var(--card-glow-soft), transparent 76%),
    rgba(255, 255, 255, 0.055);
  animation: cardRise 0.34s ease both;
}

.case-source-label {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 4px;
  padding: 6px 10px;
  border: 1px solid rgba(94, 231, 255, 0.24);
  border-radius: 999px;
  color: var(--dim);
  background: rgba(94, 231, 255, 0.08);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.shop-card:nth-child(2) {
  --card-accent: var(--accent-b);
  --card-glow: rgba(139, 92, 246, 0.25);
  --card-glow-soft: rgba(139, 92, 246, 0.15);
  animation-delay: 0.04s;
}

.shop-card:nth-child(3) {
  --card-accent: var(--accent-c);
  --card-glow: rgba(255, 107, 200, 0.23);
  --card-glow-soft: rgba(255, 107, 200, 0.14);
  animation-delay: 0.08s;
}

.shop-card:nth-child(4) {
  --card-accent: var(--accent-d);
  --card-glow: rgba(255, 180, 84, 0.24);
  --card-glow-soft: rgba(255, 180, 84, 0.14);
  animation-delay: 0.12s;
}

.shop-card.disabled {
  opacity: 0.6;
}

.shop-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.shop-card-icon {
  min-width: 66px;
  display: inline-flex;
  align-items: center;
  color: var(--text);
}

.shop-card-top b {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  font-family: "IBM Plex Mono", monospace;
  font-size: 17px;
  line-height: 1;
  min-width: 54px;
}

.shop-card-top b .currency-value {
  gap: 9px;
}

.shop-card-top b .crystal-icon {
  width: 24px;
  height: 24px;
}

.shop-card h3 {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: 18px;
  line-height: 1.12;
}

.shop-card .cta-btn {
  width: 100%;
}

.shop-card .cta-btn:disabled {
  cursor: not-allowed;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.08);
}

.case-card {
  overflow: hidden;
  position: relative;
}

.case-card::before {
  content: "";
  position: absolute;
  inset: auto 18px 18px auto;
  width: 110px;
  height: 110px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(108, 240, 255, 0.3), rgba(160, 98, 255, 0.08) 56%, transparent 70%);
  filter: blur(6px);
  pointer-events: none;
}

.rarity-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 12px;
}

.rarity-chip {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 7px 9px;
  text-transform: uppercase;
}

.rarity-chip.rare {
  color: #9de7ff;
  border-color: rgba(93, 213, 255, 0.42);
}

.rarity-chip.epic {
  color: #d9b5ff;
  border-color: rgba(188, 122, 255, 0.44);
}

.rarity-chip.legendary {
  color: #ffd18a;
  border-color: rgba(255, 184, 88, 0.46);
}

.case-xp-icon {
  align-items: center;
  background: linear-gradient(135deg, rgba(132, 232, 255, 0.9), rgba(175, 106, 255, 0.85));
  border-radius: 18px;
  box-shadow: 0 0 18px rgba(103, 220, 255, 0.34);
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 950;
  height: 38px;
  justify-content: center;
  letter-spacing: -0.04em;
  width: 38px;
}

.case-xp-icon.cosmetic {
  background: linear-gradient(135deg, rgba(255, 208, 112, 0.92), rgba(255, 90, 190, 0.88), rgba(87, 221, 255, 0.82));
}

.case-xp-icon.empty {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.62);
}

.case-history-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  grid-column: 1 / -1;
  padding: 22px;
}

.case-history-card h3 {
  margin: 0;
}

.case-history-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.case-history-item {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  display: grid;
  gap: 4px 10px;
  grid-template-columns: auto 1fr;
  padding: 12px;
}

.case-history-item > span {
  grid-row: span 2;
}

.case-history-item b {
  font-size: 14px;
}

.case-history-item small {
  color: var(--muted);
  font-weight: 800;
}

body.theme-light .rarity-chip {
  border-color: rgba(19, 31, 49, 0.16);
  color: rgba(19, 31, 49, 0.68);
}

body.theme-light .case-xp-icon.empty {
  background: rgba(15, 27, 45, 0.08);
  color: rgba(15, 27, 45, 0.58);
}

body.theme-light .case-history-item {
  border-color: rgba(25, 47, 74, 0.14);
}

.case-roll-overlay,
.league-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 38%, rgba(94, 231, 255, 0.12), transparent 34%),
    rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(18px);
}

.case-roll-card,
.league-transition-card {
  width: min(680px, 100%);
  border-radius: 34px;
  padding: clamp(22px, 5vw, 42px);
  text-align: center;
  overflow: hidden;
}

.case-roll-card h2,
.league-transition-card h2 {
  margin: 0 0 10px;
  font-size: clamp(34px, 8vw, 70px);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.case-roll-card > p,
.league-transition-card > p {
  margin: 0 auto 20px;
  max-width: 520px;
  color: var(--dim);
  font-weight: 800;
}

.case-roll-window {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.64), transparent 15%, transparent 85%, rgba(0, 0, 0, 0.64)),
    rgba(255, 255, 255, 0.04);
  padding: 16px 0;
}

.case-roll-pointer {
  position: absolute;
  inset: 8px auto 8px 50%;
  z-index: 2;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, rgba(247, 247, 242, 0.9), transparent);
  box-shadow: 0 0 22px rgba(94, 231, 255, 0.54);
}

.case-roll-track {
  display: flex;
  width: max-content;
  gap: 12px;
  padding-inline: 18px;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.case-roll-overlay.revealed .case-roll-track {
  opacity: 0.32;
  filter: blur(1px);
}

.case-roll-item {
  width: 140px;
  min-height: 128px;
  display: grid;
  place-items: center;
  gap: 8px;
  flex: 0 0 auto;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.055);
  padding: 12px;
}

.case-roll-item.rare {
  border-color: rgba(94, 231, 255, 0.36);
}

.case-roll-item.epic {
  border-color: rgba(139, 92, 246, 0.48);
}

.case-roll-item.legendary {
  border-color: rgba(255, 180, 84, 0.62);
  box-shadow: 0 0 26px rgba(255, 180, 84, 0.14);
}

.case-roll-item b {
  font-size: 15px;
  line-height: 1.05;
}

.case-roll-item small {
  color: var(--dim);
  font-weight: 900;
  text-transform: uppercase;
}

.case-roll-result {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 0;
  margin-top: 0;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.24s ease, transform 0.24s ease, margin-top 0.24s ease;
}

.case-roll-overlay.revealed .case-roll-result {
  min-height: 190px;
  margin-top: 18px;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.case-roll-overlay.settling .case-roll-track {
  filter: saturate(1.18);
}

.case-roll-overlay.revealed .case-roll-card {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    0 0 80px rgba(94, 231, 255, 0.22),
    0 0 110px rgba(255, 107, 200, 0.16);
}

.case-roll-result > span {
  color: var(--dim);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.streak-modal {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 36%, rgba(94, 231, 255, 0.14), transparent 34%),
    rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.streak-modal-card {
  position: relative;
  width: min(520px, 100%);
  padding: clamp(24px, 6vw, 42px);
  text-align: center;
  overflow: hidden;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: var(--text);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.24), transparent 35%),
    rgba(255, 255, 255, 0.08);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.modal-close:hover {
  border-color: rgba(94, 231, 255, 0.36);
  background: rgba(255, 255, 255, 0.12);
}

body.theme-light .modal-close {
  color: #172033;
  border-color: rgba(44, 86, 132, 0.22);
  background: rgba(255, 255, 255, 0.78);
}

.streak-modal-card h2 {
  margin: 8px 0 10px;
  font-size: clamp(34px, 8vw, 64px);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.comet-showcase {
  width: 136px;
  height: 136px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent 68%);
}

.comet-showcase .comet-orb {
  width: 82px;
  height: 82px;
}

.streak-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.streak-modal-grid div {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.streak-modal-grid span {
  display: block;
  color: var(--dim);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.streak-modal-grid b {
  display: block;
  margin-top: 4px;
  font-family: "Unbounded", sans-serif;
  font-size: 30px;
}

.streak-hint {
  margin: 16px 0 0;
  color: var(--dim);
  font-weight: 800;
}

.reward-notice-stack {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 91;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.reward-notice {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(circle at 10% 20%, rgba(94, 231, 255, 0.16), transparent 34%),
    rgba(18, 18, 20, 0.92);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.28);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.24s ease, opacity 0.24s ease;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.reward-notice.visible {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.reward-notice-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.78), transparent 22%),
    linear-gradient(135deg, rgba(94, 231, 255, 0.42), rgba(255, 107, 200, 0.34));
  font-size: 22px;
}

.reward-notice b,
.reward-notice small {
  display: block;
}

.reward-notice b {
  font-size: 15px;
}

.reward-notice small {
  margin-top: 2px;
  color: var(--dim);
  font-weight: 800;
}

body.theme-light .reward-notice {
  background:
    radial-gradient(circle at 10% 20%, rgba(33, 150, 243, 0.14), transparent 34%),
    rgba(255, 255, 255, 0.92);
  border-color: rgba(44, 86, 132, 0.2);
}

.league-transition-card {
  position: relative;
}

.league-orbit {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 52%, rgba(247, 247, 242, 0.9), transparent 18%),
    radial-gradient(circle at 48% 50%, rgba(94, 231, 255, 0.24), transparent 54%);
  filter: drop-shadow(0 0 28px rgba(94, 231, 255, 0.24));
}

.league-orbit span {
  position: absolute;
  inset: 28px;
  border: 2px solid rgba(94, 231, 255, 0.38);
  border-radius: 50%;
  animation: leagueOrbit 3.5s linear infinite;
}

.league-orbit span:nth-child(2) {
  border-color: rgba(255, 107, 200, 0.34);
  transform: rotate(60deg);
  animation-duration: 4.2s;
}

.league-orbit span:nth-child(3) {
  border-color: rgba(255, 180, 84, 0.32);
  transform: rotate(-60deg);
  animation-duration: 5s;
}

.league-transition-path {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 20px auto;
  max-width: 520px;
}

.league-transition-path span,
.league-transition-path b {
  min-height: 58px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.06);
  font-size: 18px;
  font-weight: 950;
}

.league-transition-path b {
  width: 58px;
  color: #050506;
  background: var(--text);
}

@keyframes leagueOrbit {
  from { transform: rotate(0deg) rotateX(68deg); }
  to { transform: rotate(360deg) rotateX(68deg); }
}

.shop-status {
  position: relative;
  z-index: 1;
  min-height: 20px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.shop-status:empty {
  display: none;
}

.shop-status.pending {
  color: #dbeafe;
  border-color: rgba(94, 231, 255, 0.22);
  background: rgba(94, 231, 255, 0.08);
}

.shop-status.success {
  color: #d1fae5;
  border-color: rgba(72, 255, 176, 0.24);
  background: rgba(72, 255, 176, 0.08);
}

.shop-status.bad {
  color: #fee2e2;
  border-color: rgba(255, 92, 122, 0.28);
  background: rgba(255, 92, 122, 0.1);
}

.shop-history-panel,
.shop-rules-panel {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background:
    radial-gradient(220px 110px at 18% 0%, rgba(255, 255, 255, 0.12), transparent 72%),
    rgba(255, 255, 255, 0.045);
}

.shop-history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.shop-history-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
}

.shop-history-row.invoice_failed,
.shop-history-row.invoice_unconfigured {
  border-color: rgba(173, 77, 77, 0.45);
}

.shop-history-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.18), transparent 38%),
    rgba(255, 255, 255, 0.07);
}

.shop-history-main,
.shop-history-meta {
  min-width: 0;
}

.shop-history-main b,
.shop-history-main small,
.shop-history-meta b,
.shop-history-meta span {
  display: block;
}

.shop-history-main b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-history-main small,
.shop-history-meta span {
  margin-top: 4px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
}

.shop-history-meta {
  text-align: right;
}

.shop-history-meta b {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.history-freeze,
.history-pro,
.history-dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 9px;
}

.history-freeze {
  background: url("/assets/freeze-crystal.svg?v=20260526-prep-subjects-1") center / 120% 120% no-repeat;
  filter:
    drop-shadow(0 0 7px rgba(94, 231, 255, 0.38))
    drop-shadow(0 0 10px rgba(139, 92, 246, 0.22));
}

.history-pro {
  color: var(--white);
  background: linear-gradient(135deg, var(--accent-c), var(--accent-b), var(--accent-a));
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  font-weight: 900;
}

.history-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--white);
  box-shadow: 0 0 14px var(--glow-a);
}

.shop-rules {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.rule-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.rule-row span {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--white);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.58);
}

.achievement-panel {
  padding: 16px;
}

.reminders-panel {
  padding: 16px;
}

.friends-panel {
  padding: 16px;
}

.profile-identity-card {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  width: min(860px, 100%);
  margin-left: auto;
  margin-right: auto;
  padding: 18px;
  overflow: visible;
}

.prep-settings-card {
  width: min(860px, 100%);
  margin: 16px auto 0;
  padding: 18px;
}

.prep-settings-grid,
.onboarding-flow {
  display: grid;
  gap: 12px;
}

.prep-subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: 9px;
}

.prep-subject-chip {
  min-height: 60px;
  border-radius: 18px;
  padding: 11px 12px;
  text-align: left;
  color: var(--text);
  background:
    radial-gradient(120px 70px at 16% 0%, rgba(94, 231, 255, 0.1), transparent 72%),
    rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.13);
}

.prep-subject-chip span,
.prep-variant-row b {
  display: block;
  font-weight: 900;
}

.prep-subject-chip small,
.prep-variant-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.prep-subject-chip.active {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.78);
  background:
    radial-gradient(130px 80px at 14% 0%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.5) 48%, rgba(255, 255, 255, 0.18)),
    var(--white);
  box-shadow: 0 18px 44px rgba(94, 231, 255, 0.1);
}

.prep-subject-chip.active small {
  color: rgba(5, 5, 6, 0.6);
}

.prep-variant-list {
  display: grid;
  gap: 10px;
}

.prep-variant-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.compact-pills {
  grid-template-columns: repeat(auto-fit, minmax(120px, max-content));
}

.compact-empty {
  min-height: 54px;
  padding: 18px 18px 18px 42px;
}

.prep-save-row {
  margin-top: 14px;
}

.onboarding-overlay {
  z-index: 95;
  overflow: hidden;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}

.onboarding-card {
  width: min(760px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(16px, 2.4vw, 24px);
  scrollbar-gutter: stable;
}

.onboarding-card h2 {
  font-size: clamp(30px, 4.6vw, 42px);
}

.onboarding-card .muted {
  margin-top: 8px;
  font-size: 14px;
}

.onboarding-flow {
  margin-top: 12px;
  grid-template-columns: minmax(136px, 0.48fr) minmax(0, 1.52fr);
  align-items: start;
  gap: 10px;
}

.onboarding-flow .selector-block {
  padding: 12px;
  border-radius: 22px;
}

.onboarding-flow .prep-subject-grid {
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 8px;
  max-height: min(420px, calc(100vh - 320px));
  max-height: min(420px, calc(100dvh - 320px));
  overflow-y: auto;
  padding-right: 2px;
}

.onboarding-flow .prep-subject-chip {
  min-height: 52px;
  border-radius: 16px;
  padding: 9px 10px;
}

.onboarding-flow .prep-subject-chip small,
.onboarding-flow .prep-variant-row small {
  font-size: 10px;
}

.onboarding-flow .pill-btn {
  min-height: 42px;
  padding: 9px 12px;
}

.onboarding-flow .prep-variant-row {
  padding: 8px;
  grid-template-columns: minmax(116px, 0.72fr) minmax(0, 1.28fr);
}

.onboarding-flow .prep-variants-block {
  grid-column: 1 / -1;
}

.onboarding-card .tutorial-actions {
  position: sticky;
  bottom: -1px;
  z-index: 3;
  margin: 12px -4px 0;
  padding-top: 10px;
  background: linear-gradient(180deg, transparent, rgba(16, 17, 20, 0.9) 34%, rgba(16, 17, 20, 0.96));
  border-radius: 0 0 24px 24px;
}

.onboarding-card .tutorial-actions .cta-btn {
  width: 100%;
}

body.theme-light .prep-subject-chip,
body.theme-light .prep-variant-row {
  border-color: rgba(44, 86, 132, 0.18);
  background:
    radial-gradient(130px 70px at 16% 0%, rgba(94, 231, 255, 0.11), transparent 72%),
    rgba(255, 255, 255, 0.76);
}

body.theme-light .onboarding-card .tutorial-actions {
  background: linear-gradient(180deg, transparent, rgba(247, 251, 255, 0.9) 34%, rgba(247, 251, 255, 0.96));
}

.profile-avatar-large,
.friend-avatar {
  display: grid;
  place-items: center;
  color: #f7f7f2;
  background:
    radial-gradient(circle at 36% 18%, rgba(255, 255, 255, 0.48), transparent 40%),
    linear-gradient(135deg, var(--accent-a), var(--accent-b) 58%, var(--accent-c));
  box-shadow: 0 0 34px var(--glow-a), inset 0 1px 0 rgba(255, 255, 255, 0.42);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  line-height: 1;
  font-weight: 900;
}

.profile-avatar-large[data-avatar="pixel"],
.profile-avatar-btn[data-avatar="pixel"],
.friend-avatar[data-avatar="pixel"] {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.48), transparent 40%),
    linear-gradient(135deg, #ffb454, #ff6bc8 58%, #8b5cf6);
}

.profile-avatar-large[data-avatar="orbit"],
.profile-avatar-btn[data-avatar="orbit"],
.friend-avatar[data-avatar="orbit"] {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.48), transparent 40%),
    linear-gradient(135deg, #42f59a, #5ee7ff 58%, #8b5cf6);
}

.profile-avatar-large[data-avatar="sigma"],
.profile-avatar-btn[data-avatar="sigma"],
.friend-avatar[data-avatar="sigma"] {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.48), transparent 40%),
    linear-gradient(135deg, #f7f7f2, #5ee7ff 54%, #050506);
}

.profile-avatar-large[data-avatar="delta"],
.profile-avatar-btn[data-avatar="delta"],
.friend-avatar[data-avatar="delta"] {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.48), transparent 40%),
    linear-gradient(135deg, #8b5cf6, #5ee7ff 54%, #42f59a);
}

.profile-avatar-large[data-avatar="pulse"],
.profile-avatar-btn[data-avatar="pulse"],
.friend-avatar[data-avatar="pulse"] {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.48), transparent 40%),
    linear-gradient(135deg, #ffb454, #f7f7f2 48%, #5ee7ff);
}

.profile-avatar-large[data-avatar="quark"],
.profile-avatar-btn[data-avatar="quark"],
.friend-avatar[data-avatar="quark"] {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.48), transparent 40%),
    linear-gradient(135deg, #050506, #8b5cf6 58%, #ff6bc8);
}

.profile-avatar-large[data-avatar="comet"],
.profile-avatar-btn[data-avatar="comet"],
.friend-avatar[data-avatar="comet"] {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.48), transparent 40%),
    linear-gradient(135deg, #5ee7ff, #f7f7f2 46%, #ffb454);
}

.profile-avatar-large:not([data-bg]),
.profile-avatar-large[data-bg=""],
.profile-avatar-btn:not([data-bg]),
.profile-avatar-btn[data-bg=""],
.friend-avatar:not([data-bg]),
.friend-avatar[data-bg=""] {
  color: #172033;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.96), transparent 30%),
    radial-gradient(circle at 76% 82%, rgba(255, 210, 246, 0.42), transparent 42%),
    linear-gradient(135deg, #ffffff, #eef8ff 42%, #f7ecff 72%, #fff8e8);
  box-shadow:
    0 0 28px rgba(94, 231, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.profile-avatar-large[data-bg="bg_neon_glass"],
.profile-avatar-btn[data-bg="bg_neon_glass"],
.friend-avatar[data-bg="bg_neon_glass"] {
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.62), transparent 34%),
    radial-gradient(circle at 68% 82%, rgba(255, 107, 200, 0.72), transparent 42%),
    linear-gradient(135deg, rgba(94, 231, 255, 0.92), rgba(139, 92, 246, 0.92) 56%, rgba(255, 107, 200, 0.9));
}

.profile-avatar-large[data-bg="bg_deep_space"],
.profile-avatar-btn[data-bg="bg_deep_space"],
.friend-avatar[data-bg="bg_deep_space"] {
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.42), transparent 34%),
    radial-gradient(circle at 68% 78%, rgba(94, 231, 255, 0.42), transparent 38%),
    linear-gradient(135deg, #050506, #18223a 46%, #5f3c99);
}

.profile-avatar-large[data-bg="bg_sunrise"],
.profile-avatar-btn[data-bg="bg_sunrise"],
.friend-avatar[data-bg="bg_sunrise"] {
  background:
    radial-gradient(circle at 26% 16%, rgba(255, 255, 255, 0.64), transparent 34%),
    radial-gradient(circle at 70% 82%, rgba(255, 107, 200, 0.34), transparent 42%),
    linear-gradient(135deg, #fff2d8, #ffb454 42%, #ff6bc8 72%, #8b5cf6);
}

.profile-avatar-large[data-frame="frame_comet"],
.profile-avatar-btn[data-frame="frame_comet"],
.friend-avatar[data-frame="frame_comet"] {
  box-shadow:
    0 0 0 2px rgba(94, 231, 255, 0.64),
    0 0 34px rgba(94, 231, 255, 0.3),
    0 0 54px rgba(255, 107, 200, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.44);
}

.profile-avatar-large[data-frame="frame_comet"]::after,
.profile-avatar-btn[data-frame="frame_comet"]::after,
.friend-avatar[data-frame="frame_comet"]::after {
  border-color: rgba(247, 247, 242, 0.48);
  box-shadow: inset 0 0 18px rgba(94, 231, 255, 0.22);
}

.profile-avatar-large[data-frame="frame_aurora"],
.profile-avatar-btn[data-frame="frame_aurora"],
.friend-avatar[data-frame="frame_aurora"] {
  box-shadow:
    0 0 0 2px rgba(139, 92, 246, 0.58),
    0 0 34px rgba(94, 231, 255, 0.22),
    0 0 60px rgba(255, 107, 200, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.44);
}

.profile-avatar-large[data-frame="frame_ice"],
.profile-avatar-btn[data-frame="frame_ice"],
.friend-avatar[data-frame="frame_ice"] {
  box-shadow:
    0 0 0 2px rgba(168, 236, 255, 0.68),
    0 0 30px rgba(94, 231, 255, 0.3),
    inset 0 0 22px rgba(255, 255, 255, 0.18);
}

.profile-avatar-large[data-frame="frame_gold"],
.profile-avatar-btn[data-frame="frame_gold"],
.friend-avatar[data-frame="frame_gold"] {
  box-shadow:
    0 0 0 2px rgba(255, 180, 84, 0.78),
    0 0 34px rgba(255, 180, 84, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

body.theme-light .profile-avatar-large:not([data-bg]),
body.theme-light .profile-avatar-large[data-bg=""],
body.theme-light .profile-avatar-btn:not([data-bg]),
body.theme-light .profile-avatar-btn[data-bg=""],
body.theme-light .friend-avatar:not([data-bg]),
body.theme-light .friend-avatar[data-bg=""] {
  color: #172033;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.96), transparent 30%),
    radial-gradient(circle at 76% 82%, rgba(255, 210, 246, 0.42), transparent 42%),
    linear-gradient(135deg, #ffffff, #eef8ff 42%, #f7ecff 72%, #fff8e8);
}

body.theme-light .profile-avatar-large[data-bg="bg_neon_glass"],
body.theme-light .profile-avatar-btn[data-bg="bg_neon_glass"],
body.theme-light .friend-avatar[data-bg="bg_neon_glass"] {
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.62), transparent 34%),
    radial-gradient(circle at 68% 82%, rgba(255, 107, 200, 0.72), transparent 42%),
    linear-gradient(135deg, rgba(94, 231, 255, 0.92), rgba(139, 92, 246, 0.92) 56%, rgba(255, 107, 200, 0.9));
}

body.theme-light .profile-avatar-large[data-bg="bg_deep_space"],
body.theme-light .profile-avatar-btn[data-bg="bg_deep_space"],
body.theme-light .friend-avatar[data-bg="bg_deep_space"] {
  color: #f7f7f2;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.42), transparent 34%),
    radial-gradient(circle at 68% 78%, rgba(94, 231, 255, 0.42), transparent 38%),
    linear-gradient(135deg, #050506, #18223a 46%, #5f3c99);
}

body.theme-light .profile-avatar-large[data-bg="bg_sunrise"],
body.theme-light .profile-avatar-btn[data-bg="bg_sunrise"],
body.theme-light .friend-avatar[data-bg="bg_sunrise"] {
  background:
    radial-gradient(circle at 26% 16%, rgba(255, 255, 255, 0.64), transparent 34%),
    radial-gradient(circle at 70% 82%, rgba(255, 107, 200, 0.34), transparent 42%),
    linear-gradient(135deg, #fff2d8, #ffb454 42%, #ff6bc8 72%, #8b5cf6);
}

body.theme-light .profile-avatar-large[data-frame="frame_comet"],
body.theme-light .profile-avatar-btn[data-frame="frame_comet"],
body.theme-light .friend-avatar[data-frame="frame_comet"] {
  box-shadow:
    0 0 0 2px rgba(94, 231, 255, 0.64),
    0 0 34px rgba(94, 231, 255, 0.3),
    0 0 54px rgba(255, 107, 200, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.44);
}

body.theme-light .profile-avatar-large[data-frame="frame_aurora"],
body.theme-light .profile-avatar-btn[data-frame="frame_aurora"],
body.theme-light .friend-avatar[data-frame="frame_aurora"] {
  box-shadow:
    0 0 0 2px rgba(139, 92, 246, 0.58),
    0 0 34px rgba(94, 231, 255, 0.22),
    0 0 60px rgba(255, 107, 200, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.44);
}

body.theme-light .profile-avatar-large[data-frame="frame_ice"],
body.theme-light .profile-avatar-btn[data-frame="frame_ice"],
body.theme-light .friend-avatar[data-frame="frame_ice"] {
  box-shadow:
    0 0 0 2px rgba(168, 236, 255, 0.68),
    0 0 30px rgba(94, 231, 255, 0.3),
    inset 0 0 22px rgba(255, 255, 255, 0.18);
}

body.theme-light .profile-avatar-large[data-frame="frame_gold"],
body.theme-light .profile-avatar-btn[data-frame="frame_gold"],
body.theme-light .friend-avatar[data-frame="frame_gold"] {
  box-shadow:
    0 0 0 2px rgba(255, 180, 84, 0.78),
    0 0 34px rgba(255, 180, 84, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.avatar-bubble-label {
  display: none !important;
}

.profile-avatar-btn small {
  z-index: 10;
}

.profile-avatar-large > span,
.profile-avatar-btn > span,
.friend-avatar > span,
.avatar-option > span {
  background: transparent !important;
  box-shadow: none !important;
}

.profile-avatar-large {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 2px auto 0;
  border-radius: 32px;
  font-size: 44px;
  overflow: visible;
}

.profile-avatar-large::after,
.profile-avatar-btn::after {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 2;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  pointer-events: none;
}

.profile-avatar-btn::after {
  inset: 5px;
  border-radius: 13px;
}

.profile-identity-form {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 640px;
}

.profile-identity-form label {
  display: grid;
  gap: 7px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-identity-form input,
.friend-search-row input {
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  padding: 0 14px;
  font-size: 15px;
  font-weight: 800;
  outline: none;
}

.profile-identity-form input:focus,
.friend-search-row input:focus {
  border-color: rgba(94, 231, 255, 0.52);
  box-shadow: 0 0 0 4px rgba(94, 231, 255, 0.08);
}

.profile-thought-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background:
    radial-gradient(120px 62px at 18% 0%, rgba(94, 231, 255, 0.14), transparent 72%),
    rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.profile-thought-status span {
  color: var(--dim);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.profile-thought-status b {
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 96px));
  justify-content: start;
  gap: 10px;
  max-width: 430px;
}

.avatar-option {
  min-width: 0;
  min-height: 58px;
  border-radius: 18px;
  padding: 8px 6px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.avatar-option.active {
  border-color: rgba(94, 231, 255, 0.58);
  box-shadow: 0 0 28px rgba(94, 231, 255, 0.16);
  background:
    radial-gradient(90px 50px at 50% 20%, rgba(94, 231, 255, 0.18), transparent 74%),
    rgba(255, 255, 255, 0.075);
}

.avatar-option small {
  color: var(--dim);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.avatar-option span,
.avatar-option small {
  display: block;
}

.avatar-option span {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 26px;
  line-height: 1;
  font-weight: 900;
}

.cosmetic-picker {
  display: grid;
  gap: 10px;
}

.cosmetic-group {
  display: grid;
  gap: 8px;
}

.cosmetic-group > b {
  color: var(--dim);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.cosmetic-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cosmetic-option {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  padding: 0 14px;
  font-weight: 900;
  cursor: pointer;
}

.cosmetic-option.rare {
  border-color: rgba(94, 231, 255, 0.34);
}

.cosmetic-option.epic {
  border-color: rgba(139, 92, 246, 0.42);
}

.cosmetic-option.legendary {
  border-color: rgba(255, 180, 84, 0.5);
}

.cosmetic-option.active {
  color: #050506;
  background: var(--text);
  box-shadow: 0 0 24px rgba(94, 231, 255, 0.18);
}

body.theme-light .avatar-option {
  color: #101827;
  border-color: rgba(44, 86, 132, 0.22);
  background:
    radial-gradient(120px 70px at 20% 0%, rgba(94, 231, 255, 0.12), transparent 72%),
    rgba(255, 255, 255, 0.76);
  box-shadow:
    0 10px 24px rgba(31, 76, 120, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

body.theme-light .avatar-option.active {
  color: #101827;
  border-color: rgba(94, 231, 255, 0.72);
  background:
    radial-gradient(130px 76px at 42% 0%, rgba(94, 231, 255, 0.2), transparent 74%),
    rgba(255, 255, 255, 0.92);
  box-shadow:
    0 0 0 1px rgba(94, 231, 255, 0.22) inset,
    0 14px 32px rgba(31, 170, 255, 0.14);
}

body.theme-light .profile-thought-status {
  border-color: rgba(44, 86, 132, 0.2);
  background:
    radial-gradient(120px 62px at 18% 0%, rgba(94, 231, 255, 0.12), transparent 72%),
    rgba(255, 255, 255, 0.78);
  box-shadow:
    0 10px 28px rgba(57, 86, 128, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

body.theme-light .avatar-option small {
  color: rgba(16, 24, 39, 0.52);
}

body.theme-light .cosmetic-option {
  color: #101827;
  border-color: rgba(44, 86, 132, 0.24);
  background: rgba(255, 255, 255, 0.76);
}

body.theme-light .cosmetic-option.active {
  color: #f7fbff;
  background:
    radial-gradient(100px 54px at 18% 0%, rgba(94, 231, 255, 0.22), transparent 72%),
    linear-gradient(135deg, #101827, #1e2a44);
  border-color: rgba(94, 231, 255, 0.34);
  box-shadow:
    0 10px 24px rgba(16, 24, 39, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.profile-save-row {
  display: grid;
  grid-template-columns: minmax(220px, auto) 120px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 2px 0 4px;
}

.profile-logout-btn {
  min-height: 48px;
  padding-inline: 20px;
}

.profile-save-row .cta-btn,
.profile-save-row .profile-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.profile-save-row .muted {
  margin: 0;
  line-height: 1.35;
}

body.theme-light .ghost-btn.danger,
body.theme-light .profile-logout-btn {
  color: #8f2f37;
  background:
    radial-gradient(120px 60px at 22% 0%, rgba(255, 105, 125, 0.18), transparent 72%),
    rgba(255, 245, 246, 0.88);
  border-color: rgba(170, 65, 78, 0.28);
  box-shadow:
    0 10px 26px rgba(170, 65, 78, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.profile-privacy-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.privacy-toggle {
  min-height: 78px;
}

.reminder-settings {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.reminder-toggle,
.reminder-hour {
  min-width: 0;
  min-height: 86px;
  display: grid;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  padding: 14px;
  background:
    radial-gradient(140px 90px at 20% 0%, rgba(94, 231, 255, 0.12), transparent 72%),
    rgba(255, 255, 255, 0.055);
}

.reminder-toggle {
  grid-template-columns: auto minmax(0, 1fr);
  cursor: pointer;
}

.reminder-toggle input {
  appearance: none;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.reminder-toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--white);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.24);
  transition: transform 0.2s ease;
}

.reminder-toggle input:checked {
  border-color: rgba(94, 231, 255, 0.52);
  background: linear-gradient(90deg, rgba(94, 231, 255, 0.42), rgba(167, 139, 250, 0.42));
}

.reminder-toggle input:checked::after {
  transform: translateX(18px);
}

.reminder-toggle b,
.reminder-toggle small,
.reminder-hour {
  display: block;
}

.reminder-toggle b {
  font-size: 15px;
}

.reminder-toggle small,
.reminder-hour {
  color: var(--dim);
  font-size: 12px;
  font-weight: 800;
}

.reminder-hour select {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  padding: 0 12px;
  font-weight: 900;
  outline: none;
}

.reminder-actions {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.goal-strip {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.goal-card,
.achievement-card {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  padding: 14px;
  background:
    radial-gradient(140px 90px at 20% 0%, rgba(255, 255, 255, 0.16), transparent 72%),
    rgba(255, 255, 255, 0.055);
}

.goal-card.complete,
.achievement-card.complete {
  border-color: rgba(255, 255, 255, 0.46);
  background:
    radial-gradient(160px 100px at 24% 0%, rgba(255, 255, 255, 0.28), transparent 72%),
    rgba(255, 255, 255, 0.085);
  box-shadow: 0 0 34px rgba(255, 255, 255, 0.08);
}

.goal-card span,
.goal-card small,
.achievement-card span,
.achievement-card small,
.achievement-card p {
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
}

.goal-card b {
  display: block;
  margin-top: 7px;
  font-size: 16px;
}

.goal-card small {
  display: block;
  margin-top: 6px;
  line-height: 1.4;
}

.achievement-grid {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.achievement-card {
  min-height: 168px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.achievement-card.epic {
  border-color: rgba(255, 255, 255, 0.24);
}

.achievement-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.achievement-top b {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.achievement-card h3 {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: 17px;
  line-height: 1.12;
}

.achievement-card p {
  line-height: 1.4;
}

.friend-connect,
.friend-request-column,
.friend-search-card,
.friend-search-results,
.friend-list-head,
.friend-row {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background:
    radial-gradient(160px 100px at 18% 0%, rgba(255, 255, 255, 0.16), transparent 72%),
    rgba(255, 255, 255, 0.055);
}

.friend-connect {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 22px;
}

.friend-requests-panel {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.friend-request-column {
  min-width: 0;
  padding: 12px;
  border-radius: 24px;
}

.friend-request-column .friend-list-head {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.friend-request-column .friend-list {
  margin-top: 10px;
}

.friend-search-card {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.friend-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.friend-search-results {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 22px;
}

.friend-list-head {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 20px;
}

.friend-list {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.friend-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 20px;
}

.request-row {
  grid-template-columns: auto minmax(0, 1fr);
}

.request-row .friend-actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.friend-leaderboard .ladder-row {
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.friend-leaderboard .ladder-row:hover {
  transform: translateY(-1px);
  border-color: rgba(94, 231, 255, 0.34);
  background:
    radial-gradient(140px 80px at 12% 0%, rgba(94, 231, 255, 0.16), transparent 74%),
    rgba(255, 255, 255, 0.075);
}

.friend-leaderboard .ladder-row.active {
  cursor: default;
}

.friend-leaderboard .ladder-row.active:hover {
  transform: none;
  border-color: rgba(255, 255, 255, 0.13);
  background: var(--white);
}

.friend-ladder-main {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.friend-ladder-main b,
.friend-ladder-main small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-avatar.mini {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 17px;
  box-shadow: 0 0 18px var(--glow-a), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.friend-avatar {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  font-size: 21px;
}

.friend-avatar.large {
  width: 88px;
  height: 88px;
  border-radius: 28px;
  font-size: 42px;
}

.friend-main b,
.friend-main small,
.friend-score b,
.friend-score small {
  display: block;
}

.friend-main small,
.friend-score small {
  margin-top: 5px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
}

.friend-score {
  text-align: right;
}

.friend-score b {
  font-family: "IBM Plex Mono", monospace;
}

.compact-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.friend-profile-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.friend-profile-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.friend-profile-thought {
  width: fit-content;
  max-width: 100%;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  background:
    radial-gradient(130px 70px at 12% 0%, rgba(94, 231, 255, 0.13), transparent 72%),
    rgba(255, 255, 255, 0.06);
}

.friend-profile-thought span,
.friend-profile-thought b {
  display: block;
}

.friend-profile-thought span {
  color: var(--dim);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.friend-profile-thought b {
  margin-top: 3px;
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
}

.friend-profile-grid {
  margin: 16px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.friend-profile-grid div {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.friend-profile-grid .friend-profile-private {
  grid-column: 1 / -1;
  min-height: 88px;
  background:
    radial-gradient(180px 120px at 12% 0%, rgba(94, 231, 255, 0.14), transparent 72%),
    rgba(255, 255, 255, 0.055);
}

.friend-profile-private small {
  display: block;
  margin-top: 8px;
  color: var(--dim);
  font-size: 12px;
  font-weight: 800;
}

.friend-profile-grid span,
.friend-profile-grid b {
  display: block;
}

.friend-profile-grid span {
  color: var(--dim);
  font-size: 11px;
  font-weight: 900;
}

.friend-profile-grid b {
  margin-top: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
}

.friend-profile-section {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.section-mini-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.section-mini-head span,
.section-mini-head b {
  display: block;
}

.section-mini-head span {
  color: var(--dim);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-mini-head b {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: 15px;
}

.friend-profile-subjects,
.friend-profile-recent {
  display: grid;
  gap: 8px;
}

.friend-profile-subject,
.friend-profile-recent-row {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  padding: 12px;
  background:
    radial-gradient(150px 80px at 18% 0%, rgba(94, 231, 255, 0.12), transparent 72%),
    rgba(255, 255, 255, 0.055);
}

.friend-profile-subject b,
.friend-profile-subject small,
.friend-profile-recent-row b,
.friend-profile-recent-row small,
.friend-profile-recent-row strong {
  display: block;
}

.friend-profile-subject small,
.friend-profile-recent-row small {
  margin-top: 5px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.friend-profile-subject .bar-line {
  margin-top: 9px;
}

.friend-profile-recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.friend-profile-recent-row strong {
  font-family: "IBM Plex Mono", monospace;
}

.profile-layout {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.profile-orb {
  width: 200px;
}

.profile-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.level-progress {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  padding: 14px;
}

.level-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.level-progress-top b {
  color: var(--text);
}

.level-bar,
.bar-line {
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.level-bar {
  height: 10px;
  margin-top: 12px;
}

.level-bar span,
.bar-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b), var(--accent-c));
  background-size: 180% 100%;
  box-shadow: 0 0 22px var(--glow-a);
  transition: width 0.35s ease;
  animation: glowSweep 4.5s ease-in-out infinite alternate;
}

.solver-progress-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
  gap: 9px;
  align-items: center;
}

.progress-label,
.task-label {
  font-weight: 900;
}

.task-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-nav {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 8px;
}

.nav-btn {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-weight: 900;
  cursor: pointer;
}

.nav-btn.active {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.nav-btn.answered {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.nav-btn.correct {
  color: var(--ink);
  background: var(--white);
}

.nav-btn.wrong {
  color: #fff;
  background: var(--bad);
}

.nav-btn.unanswered {
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(151, 208, 255, 0.1)),
    rgba(255, 255, 255, 0.06);
}

.nav-btn.manual {
  color: var(--ink);
  background: linear-gradient(135deg, rgba(255, 219, 119, 0.9), rgba(151, 208, 255, 0.78));
}

.nav-btn.unscored {
  color: var(--ink);
  background: linear-gradient(135deg, rgba(151, 208, 255, 0.9), rgba(255, 255, 255, 0.78));
}

.question-media {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 22px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #fff;
}

.question-media img {
  display: block;
  width: auto;
  height: auto;
  max-height: 420px;
  max-width: 100%;
  object-fit: contain;
  background: #fff;
}

.question-text {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  color: var(--text);
  line-height: 1.62;
  font-size: 15px;
}

.question-copy {
  white-space: pre-wrap;
}

.question-table-wrap {
  width: 100%;
  margin-top: 14px;
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid var(--glass-line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.045);
}

.question-table {
  width: max-content;
  min-width: min(100%, 520px);
  border-collapse: collapse;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.question-table th,
.question-table td {
  min-width: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  text-align: center;
  vertical-align: middle;
  white-space: pre-wrap;
}

.question-table th,
.question-table tr:first-child td,
.question-table tr:nth-child(2) td {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-weight: 900;
}

body.theme-light .question-table-wrap {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(235, 244, 255, 0.58)),
    rgba(255, 255, 255, 0.68);
}

body.theme-light .question-table th,
body.theme-light .question-table td {
  border-color: rgba(44, 86, 132, 0.22);
}

body.theme-light .question-table th,
body.theme-light .question-table tr:first-child td,
body.theme-light .question-table tr:nth-child(2) td {
  background: rgba(77, 139, 194, 0.1);
}

.options-list {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.option-btn {
  border-radius: 18px;
  text-align: left;
  line-height: 1.45;
}

.option-btn.active {
  color: var(--ink);
  background: var(--white);
}

.notes-preview,
#scratchCanvas {
  width: 100%;
  max-width: 100%;
  border-radius: 22px;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  background: #f7f7f2;
  touch-action: none;
}

.notes-preview {
  margin-top: 12px;
}

.sticky-answer {
  position: sticky;
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 5;
}

.chips,
.formula-row {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.chip,
.formula-btn {
  white-space: nowrap;
  border-radius: 999px;
  padding: 9px 12px;
}

.assist-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: visible;
  gap: 10px;
}

.assist-chips .chip {
  min-width: 0;
  display: grid;
  gap: 3px;
  justify-items: start;
  align-content: center;
  min-height: 66px;
  border-radius: 18px;
  padding: 11px 13px;
  text-align: left;
  white-space: normal;
  overflow: hidden;
}

.assist-chips .chip b,
.assist-chips .chip small {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.assist-chips .chip small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.assist-chips .chip.loading {
  cursor: wait;
  opacity: 0.72;
}

.answer-row {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

input,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
  resize: vertical;
}

textarea.long-answer {
  min-height: 128px;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.feedback {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  padding: 12px;
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.result-summary,
.result-details,
.stats-summary,
.stats-subjects,
.stats-recent {
  margin-top: 12px;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.insight-grid,
.analytics-layout {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.insight-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.analytics-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.insight-card,
.analytics-row,
.task-row {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  padding: 12px;
}

.insight-card span,
.insight-card small,
.analytics-row small,
.task-row small {
  display: block;
  color: var(--dim);
  font-size: 11px;
  font-weight: 800;
}

.insight-card b {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.insight-card small {
  margin-top: 6px;
  line-height: 1.35;
}

.stats-subjects,
.stats-recent,
.result-details,
.task-performance {
  display: grid;
  gap: 8px;
}

.analytics-row,
.task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.task-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.analytics-row b,
.task-row b {
  display: block;
  min-width: 0;
}

.bar-line {
  height: 7px;
  margin-top: 10px;
}

.metric-tag {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 48px;
  border-radius: 16px;
  color: var(--ink);
  background: var(--white);
  font-weight: 900;
}

.footer-panel {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 45;
  width: min(1016px, calc(100% - 24px));
  margin: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 24px;
  border-color: rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(220px 90px at 10% 0%, var(--glow-a), transparent 74%),
    radial-gradient(240px 90px at 92% 100%, var(--glow-c), transparent 76%),
    rgba(18, 19, 24, 0.72);
  transform: translateX(-50%);
}

.footer-btn {
  position: relative;
  min-width: 0;
  border-radius: 18px;
  padding: 12px 8px;
  overflow: hidden;
}

.footer-btn::before {
  content: "";
  display: block;
  width: 5px;
  height: 5px;
  margin: 0 auto 5px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.32;
  box-shadow: 0 0 12px currentColor;
}

.footer-btn.active::before {
  width: 18px;
  opacity: 0.72;
}

.footer-btn span {
  position: relative;
  z-index: 1;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footer-btn.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.38;
  transform: translateX(-50%);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-card {
  width: min(900px, 100%);
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 16px;
  animation: viewIn 0.22s ease both;
}

.modal-body {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  line-height: 1.58;
  white-space: pre-wrap;
}

.tutor-card {
  width: min(760px, 100%);
  display: grid;
  grid-template-rows: auto minmax(240px, 54vh) auto;
  overflow: hidden;
}

.tutor-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 220px;
  max-height: 54vh;
  overflow: auto;
  padding: 12px 2px;
}

.tutor-message {
  width: min(84%, 620px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  white-space: pre-wrap;
  line-height: 1.45;
  font-weight: 800;
  background:
    radial-gradient(160px 80px at 18% 0%, rgba(94, 231, 255, 0.13), transparent 72%),
    rgba(255, 255, 255, 0.06);
}

.tutor-message.user {
  justify-self: end;
  color: #050506;
  background: #f7f7f2;
}

.tutor-message.assistant {
  justify-self: start;
}

.tutor-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.tutor-compose textarea {
  width: 100%;
  min-height: 58px;
  max-height: 140px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-weight: 800;
  outline: none;
}

.tutor-compose textarea:focus {
  border-color: rgba(94, 231, 255, 0.62);
  box-shadow: 0 0 0 4px rgba(94, 231, 255, 0.12);
}

.ai-result-note {
  display: block;
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid rgba(94, 231, 255, 0.24);
  border-radius: 16px;
  background: rgba(94, 231, 255, 0.08);
}

.solution-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    radial-gradient(180px 90px at 20% 10%, rgba(94, 231, 255, 0.18), transparent 70%),
    rgba(255, 255, 255, 0.05);
  white-space: normal;
}

.solution-loading b,
.solution-loading small {
  display: block;
}

.solution-loading small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
}

.loader-dot {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 25%, #ffffff, transparent 28%),
    conic-gradient(from 0deg, #5ee7ff, #b78cff, #ff6bc8, #5ee7ff);
  box-shadow: 0 0 28px rgba(94, 231, 255, 0.42);
  animation: orbSpin 0.9s linear infinite;
}

.ghost-btn.loading,
.cta-btn.loading,
.primary-action.loading {
  opacity: 0.72;
  cursor: wait;
}

.notes-modal {
  padding: 8px;
}

.notes-card {
  width: min(1200px, 100%);
  height: calc(100vh - 16px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
}

.draw-toolbar {
  position: relative;
  z-index: 1;
  align-items: center;
  flex-wrap: wrap;
}

.width-row {
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  width: min(680px, calc(100vw - 24px));
  border-radius: 18px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(18, 18, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: 13px;
}

.toast.bad {
  background: rgba(111, 42, 42, 0.94);
}

.hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .boot-splash {
    display: none;
  }

  .view,
  .daily-card,
  .mode-card,
  .battle-card,
  .arena-result-card,
  .action-loader-card {
    animation-duration: 0.12s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.12s !important;
  }
}

@media (max-width: 720px) {
  .home-gift-panel {
    grid-template-columns: auto 1fr;
  }

  .home-gift-panel .cta-btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .gift-comet .comet-orb {
    width: 52px;
    height: 52px;
  }

  .streak-modal-grid {
    grid-template-columns: 1fr;
  }

  .reward-notice-stack {
    left: 14px;
    right: 14px;
    width: auto;
  }
}

@media (max-width: 860px) {
  .hero-stage,
  .setup-flow,
  .profile-layout,
  .battle-scope-card,
  .onboarding-flow {
    grid-template-columns: 1fr;
  }

  .profile-identity-card {
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: start;
  }

  .profile-avatar-large {
    width: 92px;
    height: 92px;
    border-radius: 26px;
    font-size: 38px;
  }

  .hero-copy {
    min-height: auto;
  }

  .start-dock {
    grid-template-columns: 1fr;
  }

  .quick-grid,
  .battle-grid,
  .boss-grid,
  .wallet-grid,
  .shop-grid,
  .goal-strip,
  .subscription-grid,
  .stats-summary,
  .weak-summary,
  .insight-grid,
  .analytics-layout,
  .profile-metrics {
    grid-template-columns: 1fr;
  }

  .player-card {
    min-height: 360px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) calc(104px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    border-radius: 24px;
  }

  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto auto auto;
  }

  .exam-switch {
    min-width: 0;
  }

  .exam-switch .tab-btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .icon-tab {
    padding-left: 10px;
    padding-right: 10px;
  }

  h2 {
    font-size: 28px;
  }

  .prep-settings-card {
    padding: 14px;
  }

  .onboarding-overlay {
    place-items: stretch;
    align-items: stretch;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .onboarding-card {
    width: 100%;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 28px;
    padding: 16px;
  }

  .onboarding-card h2 {
    font-size: clamp(24px, 7.8vw, 32px);
  }

  .onboarding-card .muted {
    font-size: 12px;
  }

  .onboarding-flow {
    gap: 10px;
  }

  .onboarding-flow .selector-block {
    padding: 10px;
    border-radius: 20px;
  }

  .onboarding-flow .pill-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .onboarding-flow .pill-btn {
    min-width: 0;
    width: 100%;
  }

  .onboarding-flow .prep-subject-grid {
    grid-template-columns: 1fr;
    max-height: min(210px, 26vh);
    max-height: min(210px, 26dvh);
  }

  .onboarding-flow .prep-subject-chip {
    min-height: 44px;
    padding: 8px 10px;
  }

  .prep-variant-row {
    grid-template-columns: 1fr;
  }

  .onboarding-flow .prep-variant-row {
    grid-template-columns: 1fr;
  }

  .onboarding-flow .prep-variant-row .pill-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .prep-subject-grid {
    grid-template-columns: 1fr;
  }

  .page-profile .big-head h2 {
    font-size: clamp(28px, 7.8vw, 36px);
    line-height: 1.02;
    letter-spacing: -0.045em;
  }

  .profile-panel .section-head {
    gap: 12px;
  }

  .profile-panel .status-pill {
    padding: 10px 14px;
    font-size: 13px;
  }

  .hero-stage,
  .progress-panel,
  .sessions-panel,
  .config-panel,
  .arena-screen,
  .boss-panel,
  .league-panel,
  .shop-panel,
  .weak-panel,
  .profile-panel,
  .friends-panel,
  .stats-panel,
  .solver-head-panel,
  .nav-panel,
  .question-panel,
  .notes-panel,
  .answer-panel,
  .result-panel {
    padding: 14px;
    border-radius: 24px;
  }

  .hero-actions {
    display: grid;
  }

  .start-dock {
    position: static;
    grid-template-columns: 1fr;
  }

  .cta-btn.big {
    width: 100%;
  }

  .section-head,
  .big-head,
  .card-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .solver-progress-row {
    grid-template-columns: auto auto 1fr auto;
    grid-template-areas:
      "prev progress timer next"
      "title title title title"
      "finish finish finish finish";
  }

  .nav-prev { grid-area: prev; }
  .progress-label { grid-area: progress; }
  .task-label { grid-area: title; white-space: normal; }
  #solverTimer { grid-area: timer; }
  .nav-next { grid-area: next; }
  .finish-btn { grid-area: finish; }

  .answer-row {
    grid-template-columns: 1fr;
  }

  .shop-tabs {
    position: static;
    grid-template-columns: 1fr;
  }

  .shop-section {
    min-height: 0;
    padding: 12px;
    border-radius: 24px;
  }

  .shop-section-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .shop-section-icon {
    width: 62px;
    height: 62px;
    border-radius: 22px;
  }

  .shop-section-head .status-pill {
    justify-self: start;
  }

  .battle-start,
  .battle-status,
  .live-result-wait,
  .arena-result-hero,
  .arena-versus,
  .result-reward-grid,
  .arena-score-grid,
  .achievement-grid,
  .league-rules-grid,
  .economy-status-grid,
  .arena-history-row,
  .arena-history-main,
  .weak-row,
  .analytics-row,
  .friend-connect,
  .friend-requests-panel,
  .friend-request-column,
  .friend-search-card,
  .friend-search-row,
  .friend-list-head,
  .friend-row,
  .friend-profile-hero,
  .friend-profile-grid,
  .profile-privacy-grid,
  .wallet-grid,
  .shop-grid,
  .task-row {
    grid-template-columns: 1fr;
  }

  .friend-score {
    text-align: left;
  }

  .profile-identity-card {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    border-radius: 24px;
  }

  .profile-avatar-large {
    width: 74px;
    height: 74px;
    border-radius: 22px;
    font-size: 32px;
  }

  .profile-avatar-large::after {
    inset: 7px;
    border-radius: 17px;
  }

  .profile-identity-form {
    gap: 9px;
  }

  .profile-identity-form label {
    gap: 5px;
    font-size: 10px;
  }

  .profile-identity-form input {
    min-height: 44px;
    border-radius: 16px;
    padding: 0 12px;
    font-size: 14px;
  }

  .profile-thought-status {
    grid-template-columns: 1fr;
    gap: 3px;
    width: 100%;
    min-height: 0;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .profile-thought-status b {
    font-size: 14px;
  }

  .avatar-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: none;
    gap: 7px;
  }

  .avatar-option {
    min-height: 50px;
    border-radius: 16px;
    padding: 6px 4px;
  }

  .avatar-option span {
    font-size: 24px;
  }

  .avatar-option small {
    display: none;
  }

  .profile-save-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding-bottom: 22px;
  }

  .profile-save-row .muted {
    display: none;
  }

  .profile-save-row .cta-btn {
    width: 100%;
    min-height: 50px;
    justify-content: center;
  }

  .profile-save-row .profile-logout-btn {
    width: 100%;
    min-height: 50px;
    justify-content: center;
  }

  .reminder-settings {
    grid-template-columns: 1fr;
  }

  .reminder-actions .cta-btn {
    width: 100%;
  }

  .arena-history-score {
    text-align: left;
  }

  .result-progress-card {
    grid-template-columns: 1fr;
  }

  .result-orb {
    width: 82px;
  }

  .friend-actions,
  .friend-profile-actions,
  .live-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .friend-profile-recent-row {
    grid-template-columns: 1fr;
  }

  .live-match {
    grid-template-columns: 1fr;
  }

  .sticky-answer {
    position: static;
  }

  .footer-panel {
    gap: 6px;
    padding: 7px;
    width: min(1016px, calc(100% - 20px));
  }

  .footer-btn {
    font-size: 12px;
    padding: 11px 4px;
  }

  .level-orb,
  .profile-orb {
    width: min(180px, 68vw);
  }
}

@media (max-width: 380px) {
  .top-actions {
    grid-template-columns: 1fr auto auto auto;
  }

  .selector-block .pill-row {
    grid-template-columns: 1fr;
  }

  .selector-block .task-pills {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .question-nav {
    grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
    gap: 6px;
  }

  .nav-btn {
    min-height: 38px;
    border-radius: 12px;
  }
}

@media (max-width: 860px) {
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-metrics,
  .stats-summary,
  .insight-grid,
  .result-reward-grid,
  .arena-score-grid,
  .friend-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .player-card {
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  .topbar {
    top: max(6px, env(safe-area-inset-top));
    padding: 10px;
    gap: 10px;
  }

  .topbar.glass {
    background:
      radial-gradient(220px 90px at 12% 0%, var(--glow-a), transparent 74%),
      radial-gradient(240px 90px at 92% 100%, var(--glow-c), transparent 76%),
      rgba(12, 13, 18, 0.82);
  }

  body.theme-light .topbar.glass {
    background:
      radial-gradient(220px 90px at 12% 0%, rgba(31, 170, 255, 0.16), transparent 74%),
      radial-gradient(240px 90px at 92% 100%, rgba(139, 92, 246, 0.12), transparent 76%),
      rgba(255, 255, 255, 0.9);
  }

  .brand-block {
    gap: 9px;
  }

  .pixel-mark {
    grid-template-columns: repeat(3, 6px);
    grid-template-rows: repeat(3, 6px);
    gap: 2px;
    padding: 8px;
    border-radius: 15px;
  }

  .pixel-mark span {
    width: 6px;
    height: 6px;
  }

  h1 {
    font-size: 16px;
  }

  h2 {
    font-size: clamp(24px, 7vw, 32px);
  }

  .hero-stage {
    min-height: 0;
    gap: 12px;
  }

  .selector-block {
    padding: 12px;
    border-radius: 20px;
  }

  .selector-block .pill-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .selector-block .pill-btn {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
  }

  .selector-block .task-pills {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hero-copy {
    display: grid;
    gap: 14px;
  }

  .subtitle {
    margin-top: 9px;
    font-size: 14px;
  }

  .hero-actions {
    margin-top: 0;
  }

  .primary-action,
  .secondary-action {
    min-height: 54px;
    border-radius: 18px;
    padding: 12px 14px;
  }

  .player-card {
    grid-template-rows: auto auto;
    gap: 12px;
    padding: 12px;
  }

  .player-card .level-orb {
    width: min(132px, 42vw);
  }

  .level-orb b {
    font-size: clamp(34px, 11vw, 44px);
  }

  .mini-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mini-metrics div,
  .stat-tile,
  .stat-box,
  .list-row,
  .result-item,
  .ladder-row {
    padding: 10px;
    border-radius: 16px;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .mode-card {
    min-height: 112px;
    border-radius: 22px;
    padding: 14px;
  }

  .mode-icon {
    margin-bottom: 10px;
  }

  .mode-card strong,
  .battle-card strong {
    font-size: 15px;
  }

  .mode-card small,
  .battle-card small {
    margin-top: 6px;
    font-size: 12px;
  }

  .wallet-grid,
  .economy-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .wallet-card,
  .economy-status-card {
    min-height: 0;
    padding: 10px;
    border-radius: 18px;
  }

  .wallet-card small,
  .economy-status-card small {
    display: none;
  }

  .wallet-card b,
  .economy-status-card b {
    font-size: clamp(17px, 5vw, 22px);
  }

  .shop-wallet {
    justify-self: start;
  }

  .shop-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 5px;
  }

  .shop-tab {
    min-height: 42px;
    border-radius: 15px;
    padding: 8px 6px;
    font-size: 12px;
  }

  .shop-section-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .shop-section-head .status-pill {
    grid-column: 1 / -1;
  }

  .crystal-pack-grid,
  .boost-grid,
  .subscription-grid {
    grid-template-columns: 1fr;
  }

  .shop-card,
  .subscription-card {
    min-height: 0;
    border-radius: 22px;
  }

  .shop-history-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .shop-history-meta {
    grid-column: 1 / -1;
    text-align: left;
  }

  .friend-search-card,
  .friend-connect,
  .friend-request-column,
  .friend-row,
  .friend-list-head {
    border-radius: 20px;
  }

  .friend-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .friend-row .friend-score,
  .friend-row .compact-actions {
    grid-column: 1 / -1;
  }

  .compact-actions {
    justify-content: stretch;
  }

  .compact-actions .ghost-btn,
  .compact-actions .cta-btn {
    flex: 1 1 auto;
  }

  .question-nav {
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
  }

  .question-panel,
  .answer-panel,
  .notes-panel,
  .nav-panel {
    border-radius: 22px;
  }

  .answer-title {
    align-items: center;
    flex-direction: row;
  }

  .answer-tools {
    width: 100%;
    justify-content: stretch;
  }

  .answer-tools .ghost-btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .tutor-card {
    grid-template-rows: auto minmax(220px, 1fr) auto;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .tutor-compose {
    grid-template-columns: 1fr;
  }

  .tutor-message {
    width: 94%;
  }

  .chips,
  .formula-row {
    margin-left: -4px;
    margin-right: -4px;
    padding-left: 4px;
    padding-right: 4px;
  }

  .result-reward-grid,
  .arena-score-grid,
  .friend-profile-grid,
  .stats-summary,
  .insight-grid,
  .profile-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-panel {
    bottom: max(8px, env(safe-area-inset-bottom));
    border-radius: 22px;
  }

  .footer-btn {
    min-height: 48px;
  }
}

@media (max-width: 380px) {
  .quick-grid,
  .profile-metrics,
  .result-reward-grid,
  .arena-score-grid,
  .stats-summary,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .wallet-grid,
  .economy-status-grid {
    grid-template-columns: 1fr;
  }
}

.section-head,
.fold-summary,
.friend-list-head {
  width: 100%;
  min-width: 0;
}

.section-head > div,
.fold-summary > div,
.friend-list-head > div,
.friend-search-card > div {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.section-head h2,
.fold-summary h2,
.fold-summary h3,
.friend-list-head h3 {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

.fold-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  max-width: 100%;
}

.sessions-panel .fold-summary h2,
.stats-panel .fold-summary h2 {
  font-size: clamp(26px, 4.8vw, 38px);
  line-height: 1.06;
  letter-spacing: -0.045em;
}

.sessions-panel .fold-summary h2 {
  max-width: 14.8ch;
}

.stats-panel .fold-summary h2 {
  max-width: 15.8ch;
}

.list-row.empty-state {
  padding: 16px 16px 16px 44px;
}

.friend-search-card {
  padding: 18px;
  overflow: visible;
}

.friend-search-card .muted,
.friend-search-card p,
.friend-search-card input {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.friend-search-card .eyebrow {
  display: block;
  margin-bottom: 6px;
}

.friend-search-card h3 {
  margin: 0;
  line-height: 1.15;
}

.friend-search-row .cta-btn {
  min-width: 132px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.tutorial-open {
  overflow: hidden;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(520px 260px at 52% 42%, rgba(94, 231, 255, 0.2), transparent 72%),
    radial-gradient(500px 260px at 62% 54%, rgba(139, 92, 246, 0.18), transparent 72%),
    rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.tutorial-card {
  width: min(620px, 100%);
  padding: clamp(20px, 4vw, 32px);
  border-radius: 32px;
  animation: viewIn 0.24s ease both;
}

.tutorial-card h2 {
  margin: 8px 0 0;
  font-size: clamp(30px, 6vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.tutorial-card .muted {
  margin-top: 12px;
  font-size: 15px;
}

.tutorial-hints {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tutorial-hints span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.065);
  font-size: 12px;
  font-weight: 800;
}

.tutorial-dots {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 7px;
  margin-top: 18px;
}

.tutorial-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  transition: width 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.tutorial-dots span.active {
  width: 26px;
  background: var(--white);
  box-shadow: 0 0 18px var(--glow-a);
}

.tutorial-actions {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.tutorial-actions .ghost-btn,
.tutorial-actions .cta-btn {
  min-height: 48px;
  min-width: 132px;
}

body.theme-light .tutorial-hints span {
  border-color: rgba(44, 86, 132, 0.24);
  background: rgba(255, 255, 255, 0.78);
}

@media (max-width: 860px) {
  .fold-summary {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .fold-chevron {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .app-shell,
  .view,
  .glass,
  .fold-panel,
  .sessions-panel,
  .stats-panel,
  .friends-panel,
  .friend-search-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .fold-summary {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .fold-chevron {
    justify-self: start;
    min-width: 86px;
  }

  .sessions-panel .fold-summary h2 {
    font-size: clamp(26px, 7.8vw, 34px);
    max-width: min(100%, 13.6ch);
  }

  .stats-panel .fold-summary h2 {
    font-size: clamp(24px, 6.8vw, 31px);
    max-width: min(100%, 15.6ch);
  }

  .friend-search-card {
    padding: 18px;
  }

  .friend-search-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .friend-search-row .cta-btn {
    width: 100%;
    min-width: 0;
    min-height: 52px;
  }

  .list-row.empty-state {
    padding: 15px 15px 15px 42px;
  }

  .tutorial-overlay {
    align-items: end;
    padding: 12px;
  }

  .tutorial-card {
    border-radius: 28px;
  }

  .tutorial-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tutorial-actions .ghost-btn,
  .tutorial-actions .cta-btn {
    width: 100%;
  }

  .onboarding-overlay {
    align-items: stretch;
    place-items: stretch;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .onboarding-card {
    width: 100%;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
  }
}

/* Admin bank panel */
.admin-page {
  min-height: 100vh;
  background:
    radial-gradient(760px 360px at 16% 0%, rgba(94, 231, 255, 0.18), transparent 72%),
    radial-gradient(620px 360px at 88% 14%, rgba(255, 107, 200, 0.12), transparent 72%),
    var(--bg);
}

.admin-shell {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 52px;
}

.admin-hero {
  display: grid;
  grid-template-columns: 1.1fr minmax(320px, 0.72fr);
  gap: 24px;
  align-items: end;
  padding: clamp(22px, 4vw, 42px);
  border-radius: 34px;
}

.admin-hero h1 {
  margin: 8px 0 12px;
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: clamp(36px, 7vw, 76px);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.admin-token-card {
  padding: 18px;
  border: 1px solid var(--glass-line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.admin-token-card label,
.admin-filters label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-token-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-token-row input,
.admin-filters input,
.admin-filters select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.075);
  outline: none;
}

body.theme-light .admin-token-row input,
body.theme-light .admin-filters input,
body.theme-light .admin-filters select {
  background: rgba(255, 255, 255, 0.74);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.admin-metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.admin-metric,
.admin-subject-card,
.admin-panel {
  border-radius: 28px;
  padding: 20px;
}

.admin-metric {
  min-height: 132px;
  display: grid;
  align-content: space-between;
  overflow: hidden;
  position: relative;
}

.admin-metric::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -34px;
  width: 108px;
  height: 108px;
  border-radius: 999px;
  background: radial-gradient(circle, var(--glow-a), transparent 66%);
  filter: blur(2px);
}

.admin-metric span,
.admin-metric small {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-weight: 800;
}

.admin-metric strong {
  position: relative;
  z-index: 1;
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.05em;
}

.admin-metric.accent-red::after { background: radial-gradient(circle, rgba(255, 107, 107, 0.34), transparent 66%); }
.admin-metric.accent-green::after { background: radial-gradient(circle, rgba(66, 245, 154, 0.32), transparent 66%); }
.admin-metric.accent-purple::after { background: radial-gradient(circle, rgba(139, 92, 246, 0.34), transparent 66%); }
.admin-metric.accent-blue::after { background: radial-gradient(circle, rgba(94, 231, 255, 0.34), transparent 66%); }
.admin-metric.accent-cyan::after { background: radial-gradient(circle, rgba(94, 231, 255, 0.36), transparent 66%); }
.admin-metric.accent-orange::after { background: radial-gradient(circle, rgba(255, 180, 84, 0.34), transparent 66%); }

.admin-panel {
  margin-top: 16px;
}

.admin-diagnostics-panel {
  overflow: hidden;
}

.admin-diagnostics-metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.admin-diagnostics-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.admin-diagnostics-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--glass-line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.055);
}

.admin-diagnostics-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.admin-diagnostics-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
}

.admin-diagnostics-item.is-error {
  border-color: rgba(255, 143, 143, 0.28);
  background: rgba(122, 46, 60, 0.18);
}

.admin-diagnostics-item b,
.admin-diagnostics-item small,
.admin-diagnostics-item code {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-diagnostics-item b {
  color: var(--text);
  font-weight: 900;
}

.admin-diagnostics-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-diagnostics-item code {
  margin-top: 8px;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 1.45;
}

body.theme-light .admin-diagnostics-card,
body.theme-light .admin-diagnostics-item {
  background: rgba(255, 255, 255, 0.72);
}

.admin-section-head {
  gap: 16px;
}

.admin-filters {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1fr 1.4fr;
  gap: 14px;
  margin-top: 18px;
}

.admin-card-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.admin-card-head h3 {
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.admin-bars {
  height: 12px;
  overflow: hidden;
  margin: 18px 0;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.admin-bars div {
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b), var(--accent-c));
  box-shadow: 0 0 22px var(--glow-a);
}

.admin-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-weight: 800;
}

body.theme-light .admin-stat-row {
  border-bottom-color: rgba(44, 86, 132, 0.16);
}

.admin-stat-row b {
  color: var(--text);
}

.admin-task-note {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
}

.admin-task-note span,
.admin-task-note small {
  display: block;
}

.admin-task-note span {
  color: var(--text);
  font-weight: 900;
}

.admin-task-note small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.admin-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.admin-chip-row button,
.admin-chip-row span {
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
  font-weight: 900;
}

.admin-chip-row button {
  cursor: pointer;
}

.admin-question-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.admin-question-item {
  padding: 16px;
  border: 1px solid var(--glass-line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
}

body.theme-light .admin-question-item,
body.theme-light .admin-task-note,
body.theme-light .admin-chip-row button,
body.theme-light .admin-chip-row span {
  background: rgba(255, 255, 255, 0.72);
}

.admin-question-meta,
.admin-question-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.admin-question-meta b,
.admin-question-meta code {
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.admin-mode-chip {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.admin-mode-auto {
  background: linear-gradient(135deg, rgba(66, 245, 154, 0.32), rgba(94, 231, 255, 0.24));
  border-color: rgba(66, 245, 154, 0.46);
}

.admin-mode-oracle {
  background: linear-gradient(135deg, rgba(94, 231, 255, 0.34), rgba(139, 92, 246, 0.28));
  border-color: rgba(94, 231, 255, 0.5);
}

.admin-mode-manual {
  background: linear-gradient(135deg, rgba(255, 180, 84, 0.3), rgba(255, 107, 107, 0.22));
  border-color: rgba(255, 180, 84, 0.5);
}

.admin-mode-unknown {
  background: rgba(255, 255, 255, 0.1);
}

.admin-inline-edit {
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.admin-inline-edit:hover {
  border-color: rgba(94, 231, 255, 0.45);
  box-shadow: 0 0 18px rgba(94, 231, 255, 0.16);
}

body.theme-light .admin-mode-chip {
  color: #142036;
  border-color: rgba(44, 86, 132, 0.2);
  box-shadow: 0 10px 24px rgba(39, 73, 114, 0.12);
}

.admin-question-item p {
  margin-top: 12px;
  line-height: 1.55;
  color: var(--text);
  font-weight: 700;
}

.admin-question-details {
  margin-top: 12px;
}

.admin-question-details b {
  color: var(--text);
}

.admin-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.admin-empty {
  padding: 22px;
  border: 1px dashed var(--glass-line);
  border-radius: 24px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.admin-error,
.admin-ok {
  font-weight: 900;
}

.admin-error { color: #ff8f8f; }
.admin-ok { color: var(--accent-e); }

@media (max-width: 1040px) {
  .admin-hero,
  .admin-filters {
    grid-template-columns: 1fr;
  }

  .admin-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-diagnostics-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-diagnostics-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .admin-shell {
    width: min(100vw - 18px, 100%);
    padding-top: 10px;
  }

  .admin-hero,
  .admin-panel,
  .admin-metric,
  .admin-subject-card {
    border-radius: 24px;
    padding: 16px;
  }

  .admin-token-row,
  .admin-grid,
  .admin-metrics,
  .admin-diagnostics-metrics {
    grid-template-columns: 1fr;
  }

  .admin-section-head {
    align-items: flex-start;
  }
}

.admin-repair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.admin-import-box label,
.admin-check-row span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-import-box input,
.admin-import-box select,
.admin-import-textarea {
  width: 100%;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.075);
  outline: none;
}

.admin-import-box input,
.admin-import-box select {
  min-height: 48px;
  padding: 0 14px;
}

.admin-import-textarea {
  min-height: 160px;
  margin-top: 14px;
  padding: 14px;
  resize: vertical;
  line-height: 1.45;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.admin-check-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.admin-check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-a);
}

.admin-check-row span {
  margin: 0;
  letter-spacing: normal;
  text-transform: none;
  font-size: 13px;
}

.admin-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.admin-import-report {
  min-height: 120px;
  margin: 14px 0 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

body.theme-light .admin-import-box input,
body.theme-light .admin-import-box select,
body.theme-light .admin-import-textarea,
body.theme-light .admin-check-row {
  background: rgba(255, 255, 255, 0.72);
}

body.theme-light .admin-import-report {
  background: rgba(255, 255, 255, 0.7);
}

.auth-gate {
  position: relative;
  z-index: 20;
  width: min(680px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  margin: clamp(40px, 11vh, 110px) auto 24px;
  padding: clamp(24px, 4vw, 42px);
  border-radius: 34px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  overflow: hidden;
}

.auth-gate * {
  min-width: 0;
}

.auth-gate[hidden] {
  display: none;
}

.auth-gate h1 {
  max-width: 100%;
  margin: 0;
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: clamp(28px, 4.2vw, 46px);
  line-height: 1.04;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.auth-gate > .muted {
  width: 100%;
  max-width: 520px;
  margin: 0;
  overflow-wrap: anywhere;
}

.telegram-login-box {
  display: grid;
  place-items: center;
  min-height: 58px;
  margin: 4px 0 0;
}

.telegram-login-box:empty {
  display: none;
  min-height: 0;
  margin: 0;
}

.auth-bot-link {
  width: min(360px, 100%);
  justify-content: center;
  text-decoration: none;
  text-align: center;
}

.auth-actions {
  width: min(520px, 100%);
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.auth-openid-link,
.auth-register-link {
  width: 100%;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
}

.auth-openid-link {
  color: #050506;
}

#authGateStatus {
  width: 100%;
  max-width: 520px;
  min-height: 22px;
  margin-top: 0;
  font-size: 14px;
  line-height: 1.45;
}

#authGateStatus.admin-error {
  color: #ffb8b8;
  background: rgba(188, 80, 80, 0.18);
  border: 1px solid rgba(255, 130, 130, 0.28);
  border-radius: 18px;
  padding: 10px 12px;
}

@media (max-width: 640px) {
  .assist-chips {
    grid-template-columns: 1fr;
  }

  .quick-resume {
    grid-template-columns: 1fr;
  }

  .quick-resume .primary-action.compact {
    width: 100%;
    min-width: 0;
  }

  .auth-gate {
    width: min(340px, calc(100vw - 24px));
    max-width: min(340px, calc(100vw - 24px));
    margin-top: 28px;
    margin-left: 12px;
    margin-right: 12px;
    padding: 22px 20px;
    border-radius: 28px;
  }

  .auth-gate h1 {
    max-width: 300px;
    font-size: clamp(23px, 7.4vw, 28px);
    letter-spacing: -0.055em;
    line-height: 1.12;
  }

  .auth-gate > .muted,
  #authGateStatus {
    max-width: 300px;
    font-size: 13px;
  }

  .auth-actions,
  .auth-bot-link {
    width: min(280px, 100%);
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }

  .auth-openid-link,
  .auth-register-link {
    min-height: 58px;
  }
}

body.auth-required .app-shell {
  display: none;
}

.admin-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 5, 12, 0.72);
  backdrop-filter: blur(18px);
}

.admin-editor-backdrop[hidden] {
  display: none;
}

.admin-editor-modal {
  width: min(980px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 30px;
}

.admin-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.admin-editor-grid label {
  display: grid;
  gap: 8px;
}

.admin-editor-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-editor-grid input,
.admin-editor-grid select,
.admin-editor-grid textarea {
  width: 100%;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.075);
  outline: none;
  font: inherit;
}

.admin-editor-grid textarea {
  resize: vertical;
  line-height: 1.45;
}

.admin-editor-wide {
  grid-column: 1 / -1;
}

.admin-history-box {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
}

.admin-history-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 800;
}

.admin-history-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
}

.admin-history-item b {
  color: var(--text);
}

.admin-history-item small,
.admin-history-item code {
  color: var(--muted);
  overflow-wrap: anywhere;
}

body.theme-light .admin-editor-backdrop {
  background: rgba(235, 242, 252, 0.72);
}

body.theme-light .admin-editor-grid input,
body.theme-light .admin-editor-grid select,
body.theme-light .admin-editor-grid textarea,
body.theme-light .admin-inline-edit,
body.theme-light .admin-history-box,
body.theme-light .admin-history-item {
  background: rgba(255, 255, 255, 0.76);
}

@media (max-width: 680px) {
  .admin-repair-grid {
    grid-template-columns: 1fr;
  }

  .admin-import-actions > * {
    width: 100%;
  }

  .admin-editor-backdrop {
    padding: 8px;
    place-items: stretch;
  }

  .admin-editor-modal {
    max-height: calc(100vh - 16px);
    border-radius: 24px;
  }

  .admin-editor-grid {
    grid-template-columns: 1fr;
  }
}
