:root {
  --theme-bg: #150930;
  --theme-panel: #2a1658;
  --theme-panel-alt: #1c1040;
  --theme-ink: #fff5d6;
  --theme-cyan: #5de4ff;
  --theme-mint: #8effd3;
  --theme-yellow: #ffe35c;
  --theme-orange: #ff9a5a;
  --theme-red: #ff5f87;
  --theme-shadow: rgba(9, 6, 22, 0.55);
  --line: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at top, rgba(93, 228, 255, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(255, 154, 90, 0.14), transparent 30%),
    linear-gradient(180deg, #100320 0%, #150930 44%, #080311 100%);
  color: var(--theme-ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

#app {
  min-height: 100vh;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  isolation: isolate;
}

.scanlines,
.noise-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.scanlines {
  background: linear-gradient(transparent 0, rgba(255, 255, 255, 0.035) 50%, transparent 100%);
  background-size: 100% 6px;
  opacity: 0.22;
}

.noise-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black, transparent 85%);
  opacity: 0.22;
}

.topbar,
.screen-wrap {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 22px;
  max-width: 1240px;
}

.topbar__brand,
.topbar__actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topbar__actions {
  align-items: flex-end;
}

.topbar__eyebrow,
.panel__eyebrow,
.hero-card__kicker,
.hud-card__eyebrow {
  color: var(--theme-cyan);
  font-family: "Courier New", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar__title {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.topbar__toggle,
.button,
.character-card,
.ad {
  border: 3px solid #0f061e;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08), 0 12px 0 rgba(8, 4, 18, 0.45);
}

.topbar__toggle,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
  color: var(--theme-ink);
  padding: 12px 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar__toggle:hover,
.button:hover,
.character-card:hover {
  transform: translateY(-2px);
}

.screen-wrap {
  display: grid;
  place-items: center;
}

.screen {
  width: min(1240px, 100%);
}

.screen--title {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
}

.title-sidecar {
  display: grid;
  gap: 18px;
  align-content: start;
}

.screen--split {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
}

.screen--stacked {
  display: grid;
  gap: 22px;
}

.panel,
.hero-card,
.score-panel,
.gameover-card,
.hud-card,
.panel--table {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 4px solid #05020d;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 25%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--theme-panel);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.08),
    0 28px 45px rgba(5, 2, 13, 0.42);
}

.panel::before,
.hero-card::before,
.score-panel::before,
.gameover-card::before,
.hud-card::before {
  content: "";
  position: absolute;
  inset: auto -12% 100% auto;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 70%);
  opacity: 0.28;
}

.panel--accent,
.score-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    var(--theme-panel-alt);
}

.hero-card {
  display: grid;
  gap: 18px;
  min-height: 480px;
}

.hero-card__headline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.hero-card__sticker {
  display: grid;
  gap: 6px;
  align-self: start;
  max-width: 220px;
  padding: 12px 14px;
  border: 3px solid #44110d;
  background: linear-gradient(180deg, #ff9a5a 0%, #ff5f87 100%);
  color: #2b0a16;
  box-shadow: 0 8px 0 rgba(68, 17, 13, 0.45);
  transform: rotate(3deg);
}

.hero-card__sticker span,
.hero-showcase__overlay span,
.hero-stat-card span {
  font-family: "Courier New", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-card__sticker strong,
.hero-showcase__overlay strong,
.hero-stat-card strong {
  line-height: 1.25;
}

.hero-card h1,
.panel h2,
.screen-heading h2,
.gameover-card h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.3rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.hero-card__subtitle,
.panel__copy {
  max-width: 48ch;
  margin: 0;
  color: rgba(255, 245, 214, 0.88);
  font-size: 1.06rem;
  line-height: 1.55;
}

.hero-marquee {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-marquee span,
.arena-banner {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.12);
  color: var(--theme-yellow);
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-showcase {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  align-items: stretch;
}

.hero-showcase__frame {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  padding: 14px;
  border: 4px solid #0a0415;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 38%),
    linear-gradient(180deg, #5f6577 0%, #31354a 40%, #181325 100%);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.08),
    0 20px 36px rgba(5, 2, 13, 0.34);
}

.hero-showcase__frame::after {
  content: "";
  position: absolute;
  inset: 22px 26px 26px;
  border-radius: 18px;
  border: 4px solid rgba(7, 3, 14, 0.7);
  pointer-events: none;
}

.hero-showcase__image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 290px;
  object-fit: cover;
  border-radius: 22px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: saturate(1.05) contrast(1.04);
}

.hero-showcase__overlay {
  position: absolute;
  z-index: 1;
  display: grid;
  gap: 4px;
  max-width: 190px;
  padding: 10px 12px;
  border: 3px solid #0a0415;
  background: rgba(10, 4, 21, 0.84);
  color: var(--theme-ink);
  box-shadow: 0 8px 0 rgba(8, 4, 18, 0.35);
}

.hero-showcase__overlay--left {
  left: 24px;
  bottom: 24px;
}

.hero-showcase__overlay--right {
  right: 24px;
  top: 24px;
}

.hero-stats {
  display: grid;
  gap: 14px;
}

.hero-stat-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
}

.score-panel--arcade,
.score-panel--briefing {
  min-height: auto;
}

.button {
  min-height: 52px;
}

.button--primary {
  background: linear-gradient(180deg, var(--theme-yellow), #ffbb29);
  color: #281007;
  font-weight: 800;
}

.helper-text,
.empty-state {
  margin: 0;
  color: rgba(255, 245, 214, 0.74);
  line-height: 1.5;
}

.mission-note {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 3px solid rgba(93, 228, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(93, 228, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(7, 3, 14, 0.28);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.mission-note__label {
  color: var(--theme-cyan);
  font-family: "Courier New", monospace;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mission-note p {
  margin: 0;
  color: rgba(255, 245, 214, 0.92);
  line-height: 1.6;
}

.mission-note--hero {
  max-width: 52rem;
}

.mission-note--leaderboard {
  max-width: 62rem;
  justify-self: start;
}

.score-panel h2,
.panel h3 {
  margin: 0 0 16px;
  font-size: 1.5rem;
  text-transform: uppercase;
}

.score-list,
.bullet-list,
.leaderboard {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.score-list li,
.leaderboard__row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.16);
}

.score-list li {
  grid-template-columns: minmax(0, 1fr) auto;
}

.field {
  display: grid;
  gap: 10px;
}

.field span,
.stat-chip span {
  color: rgba(255, 245, 214, 0.75);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.text-input {
  border: 3px solid #0e061d;
  padding: 16px 18px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--theme-ink);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.text-input:focus-visible,
.button:focus-visible,
.topbar__toggle:focus-visible,
.character-card:focus-visible,
.ad:focus-visible {
  outline: 3px solid var(--theme-cyan);
  outline-offset: 2px;
}

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

.bullet-list li {
  position: relative;
  padding-left: 18px;
  line-height: 1.5;
}

.bullet-list li::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  width: 8px;
  height: 8px;
  background: var(--theme-yellow);
}

.screen-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

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

.character-card {
  position: relative;
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.06));
  color: var(--theme-ink);
  text-align: left;
}

.character-card--selected {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 32%),
    color-mix(in srgb, var(--character-accent) 26%, var(--theme-panel));
  box-shadow:
    0 0 0 3px var(--character-accent),
    0 12px 0 rgba(8, 4, 18, 0.45);
}

.character-card__hotkey {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.28);
  font-family: "Courier New", monospace;
  font-weight: 700;
}

.portrait-frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 3px solid #07030d;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 30%),
    linear-gradient(180deg, #f4ead9 0%, #fffdfa 100%);
}

.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity: 0;
  transition: opacity 160ms ease-out;
}

.portrait-frame--loaded img {
  opacity: 1;
}

.portrait-frame__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #2f215e;
  font-family: "Courier New", monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.portrait-frame--loaded .portrait-frame__fallback {
  display: none;
}

.portrait-frame--hud {
  width: 96px;
  min-width: 96px;
}

.character-card__name {
  font-size: 1.35rem;
  font-weight: 800;
}

.character-card__role {
  color: var(--theme-cyan);
  font-family: "Courier New", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.character-card__tagline {
  color: rgba(255, 245, 214, 0.84);
  line-height: 1.45;
}

.screen--gameplay {
  display: block;
}

.game-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  align-items: start;
}

.hud-card {
  display: grid;
  align-content: start;
  gap: 18px;
}

.hud-card__header {
  display: flex;
  gap: 16px;
  align-items: center;
}

.hud-card__header h2 {
  margin: 0;
  font-size: 1.8rem;
  text-transform: uppercase;
}

.hud-card__role {
  margin: 6px 0 0;
  color: rgba(255, 245, 214, 0.76);
}

.stat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-chip {
  display: grid;
  gap: 6px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.12);
}

.stat-chip strong {
  font-size: 1.3rem;
}

.stat-chip--frenzy strong {
  color: var(--theme-yellow);
}

.announcement,
.arena-streak {
  margin: 0;
  padding: 12px 14px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--theme-mint);
  line-height: 1.45;
}

.button-row--stack {
  flex-direction: column;
}

.bullet-list--compact li {
  font-size: 0.92rem;
}

.arena-shell {
  position: relative;
  overflow: hidden;
  min-height: 720px;
  min-height: min(720px, calc(100dvh - 140px));
  border: 4px solid #05020d;
  background:
    radial-gradient(circle at top left, rgba(93, 228, 255, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(255, 154, 90, 0.16), transparent 22%),
    linear-gradient(180deg, #36207a 0%, #1d0d4b 40%, #0c031b 100%);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.08),
    0 28px 45px rgba(5, 2, 13, 0.42);
}

.arena-overlay {
  position: absolute;
  inset: 16px 16px auto 16px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.arena-streak {
  max-width: 280px;
  color: var(--theme-yellow);
}

.arena {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  touch-action: manipulation;
}

.arena--paused {
  filter: saturate(0.65);
}

.pause-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  background: rgba(7, 3, 14, 0.65);
  backdrop-filter: blur(6px);
}

.pause-layer.hidden {
  display: none;
}

.pause-layer h3 {
  margin: 0;
  font-size: 2rem;
  text-transform: uppercase;
}

.pause-layer p {
  margin: 0;
}

.ad {
  position: absolute;
  z-index: 3;
  display: grid;
  gap: 6px;
  justify-items: start;
  align-content: start;
  padding: 12px;
  text-align: left;
  animation: ad-pop 180ms steps(4) forwards;
  -webkit-tap-highlight-color: transparent;
}

.ad--image {
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: #0f0a21;
  color: var(--theme-ink);
}

.ad--image .ad__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  border: 2px solid rgba(0, 0, 0, 0.65);
  background: rgba(255, 245, 214, 0.94);
  color: #221234;
}

.ad--image .ad__title {
  font-size: 0.94rem;
}

.ad--image .ad__flavor {
  font-size: 0.76rem;
  opacity: 0.84;
}

.ad__badge,
.ad__cta {
  font-family: "Courier New", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ad__badge {
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.22);
}

.ad__title {
  font-size: 1.1rem;
  line-height: 1.05;
}

.ad__art {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.ad__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.ad__footer {
  display: grid;
  gap: 2px;
  padding: 10px 12px 12px;
  background: linear-gradient(180deg, rgba(9, 6, 22, 0.05), rgba(9, 6, 22, 0.4));
}

.ad__flavor {
  font-size: 0.9rem;
  line-height: 1.3;
}

.ad__points {
  position: absolute;
  right: 8px;
  bottom: 56px;
  padding: 5px 8px;
  border: 2px solid rgba(0, 0, 0, 0.65);
  background: rgba(255, 245, 214, 0.92);
  color: #221234;
  font-family: "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.ad--regular {
  background: linear-gradient(180deg, #6ff0ff 0%, #2b8dff 100%);
  color: #0a1033;
}

.ad--golden {
  background: linear-gradient(180deg, #fff2a6 0%, #ffba30 100%);
  color: #341807;
  box-shadow: 0 0 0 3px rgba(255, 230, 109, 0.58), 0 12px 0 rgba(8, 4, 18, 0.45);
}

.ad--fake {
  background: linear-gradient(180deg, #ffc1cf 0%, #ff5f87 100%);
  color: #3d0718;
}

.a2a-bonus {
  position: absolute;
  z-index: 4;
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 3px solid #04162b;
  border-radius: 18px;
  background:
    radial-gradient(circle at center, rgba(93, 228, 255, 0.2), transparent 62%),
    linear-gradient(180deg, #c7fbff 0%, #5de4ff 55%, #2388ff 100%);
  color: #08233f;
  box-shadow:
    0 0 0 4px rgba(93, 228, 255, 0.28),
    0 12px 0 rgba(8, 4, 18, 0.45);
  animation: a2a-float 900ms ease-in-out infinite alternate;
  -webkit-tap-highlight-color: transparent;
}

.a2a-bonus__badge,
.a2a-bonus__label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Courier New", monospace;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.a2a-bonus__badge {
  top: -14px;
  padding: 4px 8px;
  border: 2px solid #04162b;
  background: var(--theme-yellow);
  color: #2a1808;
  font-size: 0.68rem;
}

.a2a-bonus__label {
  bottom: 8px;
  font-size: 0.86rem;
}

.a2a-bonus__head {
  position: relative;
  width: 62px;
  height: 54px;
  border: 3px solid #04162b;
  border-radius: 14px;
  background: linear-gradient(180deg, #eefcff 0%, #b8f2ff 100%);
}

.a2a-bonus__antenna {
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 6px;
  height: 16px;
  background: #04162b;
  transform: translateX(-50%);
}

.a2a-bonus__antenna::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 14px;
  height: 14px;
  border: 3px solid #04162b;
  border-radius: 50%;
  background: var(--theme-red);
  transform: translateX(-50%);
}

.a2a-bonus__eyes {
  position: absolute;
  top: 16px;
  left: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #04162b;
  box-shadow: 26px 0 0 #04162b;
}

.a2a-bonus__mouth {
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 28px;
  height: 8px;
  border: 3px solid #04162b;
  border-radius: 999px;
  background: rgba(93, 228, 255, 0.3);
  transform: translateX(-50%);
}

.score-popup {
  position: absolute;
  z-index: 5;
  font-size: 1.1rem;
  font-weight: 900;
  text-transform: uppercase;
  pointer-events: none;
  animation: popup-rise 850ms ease-out forwards;
}

.popup--good {
  color: var(--theme-mint);
}

.popup--gold {
  color: var(--theme-yellow);
}

.popup--agent {
  color: var(--theme-cyan);
  text-shadow: 0 0 12px rgba(93, 228, 255, 0.55);
}

.popup--bad {
  color: #ffd2de;
}

.arena-shell--pulse {
  animation: arena-pulse 250ms ease-out;
}

.arena-shell--warning {
  animation: arena-warning 250ms ease-out;
}

.arena-shell--frenzy {
  animation: arena-frenzy 320ms ease-out;
}

.arena-shell--a2a {
  animation: arena-a2a 420ms ease-out;
}

.gameover-card--winner {
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.08),
    0 0 0 4px rgba(255, 227, 92, 0.5),
    0 28px 45px rgba(5, 2, 13, 0.42);
}

.result-score {
  margin: 8px 0 14px;
  color: var(--theme-yellow);
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 900;
  line-height: 0.95;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  color: rgba(255, 245, 214, 0.78);
  font-size: 0.92rem;
}

.leaderboard {
  display: grid;
  gap: 10px;
}

.leaderboard__row {
  grid-template-columns: 64px minmax(0, 1.25fr) minmax(0, 1fr) auto minmax(130px, 0.9fr);
}

.leaderboard__rank {
  color: var(--theme-cyan);
  font-family: "Courier New", monospace;
  font-weight: 700;
}

.leaderboard__score {
  color: var(--theme-yellow);
}

.leaderboard--compact .leaderboard__row {
  grid-template-columns: 58px minmax(0, 1fr) auto;
}

.leaderboard--compact .leaderboard__character,
.leaderboard--compact .leaderboard__date {
  display: none;
}

.button-row--wide {
  justify-content: space-between;
}

@keyframes ad-pop {
  from {
    opacity: 0;
    transform: scale(0.7);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes a2a-float {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-8px);
  }
}

@keyframes popup-rise {
  from {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.8);
  }

  18% {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translate(-50%, -62px) scale(1.05);
  }
}

@keyframes arena-pulse {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.008);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes arena-warning {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  70% {
    transform: translateX(5px);
  }
}

@keyframes arena-frenzy {
  0% {
    filter: brightness(1);
  }

  30% {
    filter: brightness(1.18) saturate(1.22);
  }

  100% {
    filter: brightness(1);
  }
}

@keyframes arena-a2a {
  0% {
    filter: brightness(1) hue-rotate(0deg);
    box-shadow:
      inset 0 0 0 3px rgba(255, 255, 255, 0.08),
      0 28px 45px rgba(5, 2, 13, 0.42);
  }

  35% {
    filter: brightness(1.18) saturate(1.3) hue-rotate(-12deg);
    box-shadow:
      inset 0 0 0 3px rgba(255, 255, 255, 0.08),
      0 0 0 4px rgba(93, 228, 255, 0.45),
      0 28px 45px rgba(5, 2, 13, 0.42);
  }

  100% {
    filter: brightness(1) hue-rotate(0deg);
    box-shadow:
      inset 0 0 0 3px rgba(255, 255, 255, 0.08),
      0 28px 45px rgba(5, 2, 13, 0.42);
  }
}

@media (max-width: 1080px) {
  .screen--title,
  .screen--split,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .game-layout {
    gap: 16px;
  }

  .hud-card {
    order: 2;
  }

  .arena-shell {
    order: 1;
    min-height: min(70vh, 620px);
  }

  .hud-card {
    gap: 14px;
  }

  .button-row--stack {
    flex-direction: row;
    flex-wrap: wrap;
  }

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

  .arena-overlay {
    inset: 12px 12px auto 12px;
  }

  .hero-showcase {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .page-shell {
    padding: 18px;
  }

  .topbar__actions {
    align-items: flex-start;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .hud-card__header {
    align-items: flex-start;
  }

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

  .arena-shell {
    min-height: min(68vh, 560px);
  }

  .hero-card__headline {
    grid-template-columns: 1fr;
  }

  .hero-card__sticker {
    max-width: 100%;
    justify-self: start;
    transform: rotate(0deg);
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 16px;
  }

  .screen-wrap {
    align-items: start;
  }

  .topbar,
  .screen-heading {
    align-items: start;
    flex-direction: column;
  }

  .topbar__actions {
    align-items: start;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
  }

  .character-grid,
  .stat-grid,
  .leaderboard__row {
    grid-template-columns: 1fr;
  }

  .topbar__toggle,
  .button {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    padding: 10px 14px;
    font-size: 0.88rem;
  }

  .hero-card,
  .panel,
  .score-panel,
  .gameover-card,
  .hud-card,
  .panel--table {
    padding: 18px;
  }

  .hud-card__header {
    align-items: flex-start;
  }

  .portrait-frame--hud {
    width: 78px;
    min-width: 78px;
  }

  .hud-card__header h2 {
    font-size: clamp(1.6rem, 7vw, 2.4rem);
  }

  .announcement,
  .arena-streak {
    padding: 10px 12px;
    font-size: 0.92rem;
  }

  .button-row--stack {
    flex-direction: column;
  }

  .arena-shell {
    min-height: min(62vh, 500px);
  }

  .arena-overlay {
    flex-direction: column;
    gap: 8px;
  }

  .arena-banner,
  .arena-streak {
    max-width: 100%;
  }

  .arena-banner {
    font-size: 0.72rem;
    padding: 8px 10px;
  }

  .arena-streak {
    font-size: 0.78rem;
    padding: 8px 10px;
  }

  .hero-showcase__frame {
    min-height: 260px;
    padding: 10px;
  }

  .hero-showcase__image {
    min-height: 230px;
  }

  .hero-showcase__overlay {
    max-width: 150px;
    padding: 8px 10px;
  }

  .mission-note {
    padding: 12px 14px;
  }

  .ad {
    border-width: 2px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08), 0 8px 0 rgba(8, 4, 18, 0.38);
  }

  .ad--image .ad__title {
    font-size: 0.86rem;
  }

  .ad--image .ad__flavor {
    font-size: 0.68rem;
  }

  .ad__points {
    right: 6px;
    bottom: 48px;
    padding: 4px 7px;
    font-size: 0.7rem;
  }

  .a2a-bonus {
    width: 86px;
    height: 86px;
    border-width: 2px;
    border-radius: 14px;
  }

  .a2a-bonus__head {
    width: 48px;
    height: 42px;
  }

  .a2a-bonus__eyes {
    top: 12px;
    left: 8px;
    width: 8px;
    height: 8px;
    box-shadow: 22px 0 0 #04162b;
  }

  .a2a-bonus__mouth {
    width: 22px;
    height: 6px;
    bottom: 7px;
  }

  .leaderboard--compact .leaderboard__row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .page-shell {
    padding: 12px;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 16px;
  }

  .topbar__title {
    font-size: 1rem;
  }

  .hero-card h1,
  .panel h2,
  .screen-heading h2,
  .gameover-card h2 {
    font-size: clamp(1.7rem, 9vw, 2.5rem);
  }

  .hero-card__subtitle,
  .panel__copy,
  .helper-text,
  .empty-state {
    font-size: 0.95rem;
  }

  .character-grid {
    grid-template-columns: 1fr;
  }

  .hero-marquee span,
  .arena-banner {
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .screen-heading {
    align-items: start;
    flex-direction: column;
  }

  .hero-showcase__overlay {
    position: static;
    max-width: none;
    margin-top: 10px;
  }

  .hero-showcase__frame::after {
    inset: 14px 16px 16px;
  }

  .mission-note p {
    font-size: 0.95rem;
  }

  .hud-card__header {
    gap: 12px;
  }

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

  .arena-shell {
    min-height: min(58vh, 440px);
    border-width: 3px;
  }

  .arena {
    background-size: 32px 32px;
  }

  .score-popup {
    font-size: 0.92rem;
  }

  .stat-chip strong {
    font-size: 1.08rem;
  }

  .ad__footer {
    padding: 8px 10px 10px;
  }

  .ad--image .ad__title {
    font-size: 0.82rem;
  }

  .ad--image .ad__flavor {
    font-size: 0.68rem;
  }

  .ad__points {
    bottom: 48px;
    font-size: 0.68rem;
  }

  .pause-layer h3 {
    font-size: 1.5rem;
  }
}

@media (max-height: 740px) and (min-width: 721px) {
  .arena-shell {
    min-height: min(560px, calc(100dvh - 150px));
  }
}

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