* { box-sizing: border-box; margin: 0; padding: 0; }

@font-face {
  font-family: 'Press Start 2P';
  src: url('/fonts/PressStart2P-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Silkscreen';
  src: url('/fonts/Silkscreen-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Silkscreen';
  src: url('/fonts/Silkscreen-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg0: #0a0a10;
  --bg1: #12121a;
  --panel: #14141e;
  --panel-edge: #2a2a38;
  --ink: #e8e6e3;
  --muted: #8a8490;
  --dim: #5c5666;
  --mana-W: #e8d9a8;
  --mana-U: #3d9be9;
  --mana-B: #6b7c8a;
  --mana-R: #e03a3a;
  --mana-G: #2f9e5a;
  --mana-C: #c4b8a8;
  --accent: #d3202a;
  --gold: #f0c14b;
  --font-pixel: 'Press Start 2P', monospace;
  --font-ui: 'Silkscreen', monospace;
  --font-body: 'Silkscreen', ui-monospace, monospace;
}

html {
  overscroll-behavior: contain;
}
html, body {
  font-family: var(--font-body);
  background: var(--bg0);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  text-rendering: optimizeSpeed;
}

.hidden { display: none !important; }

#game-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #0d0d12;
  /* Centra il canvas quando resta più piccolo della finestra (tetto massimo
     dell'arena su schermi grandi, vedi MAX_W/MAX_H in game.js) — gli overlay
     figli (touch/level-up/pausa/scintilla) sono tutti position:fixed+inset:0,
     quindi restano a piena finestra indipendentemente da questo flex. */
  display: flex;
  align-items: center;
  justify-content: center;
}

.pause-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 0 12px max(14px, env(safe-area-inset-bottom));
  pointer-events: none;
}

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

.pause-menu-sheet {
  pointer-events: auto;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px 12px;
  background: #12121a;
  border: 3px solid #d3202a;
  box-shadow: 4px 4px 0 #000;
}

.pause-btn {
  appearance: none;
  width: 100%;
  min-height: 52px;
  border-radius: 0;
  padding: 12px 16px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  touch-action: manipulation;
  box-shadow: 3px 3px 0 #000;
}

.pause-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

.pause-btn-resume {
  background: #b81c24;
  color: #fff;
  border: 3px solid #ff6b5a;
  font-family: var(--font-pixel);
  font-size: 12px;
}

.pause-btn-quit {
  background: #1a1010;
  color: #ffcdd2;
  border: 3px solid #c62828;
  font-family: var(--font-ui);
  font-size: 11px;
}

.pause-menu-note {
  margin: 0;
  text-align: center;
  font-size: 10px;
  color: #78716c;
  font-family: var(--font-ui);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Hub/UI sprites: keep sharp on high-DPI phones */
.vestment-chip img,
.pick-card img,
.codex-art img,
.card-list img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.version {
  position: fixed;
  bottom: max(4px, env(safe-area-inset-bottom));
  right: max(8px, env(safe-area-inset-right));
  font-size: 10px;
  color: #44403c;
  pointer-events: none;
  z-index: 200;
}

#game-shell:not(.hidden) ~ .version {
  display: none;
}

/* Touch controls — dynamic stick + pause */
.touch-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  touch-action: none;
}

.touch-zone {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
}

.touch-zone-move {
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  padding-top: max(56px, calc(env(safe-area-inset-top) + 48px));
}

.joystick-base {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff18, #00000055);
  border: 2px solid #ffffff33;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px #00000066;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.12s ease;
}

.joystick-base.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.joystick-knob {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffffff44, #ffffff15);
  border: 2px solid #ffffff55;
  transform: translate(0, 0);
  will-change: transform;
}

.touch-btn-pause {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 2px solid #ffffff33;
  background: #00000088;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  pointer-events: auto;
  touch-action: none;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}

.touch-btn-pause.is-paused {
  display: none;
}

.touch-controls.is-paused .touch-zone-move {
  pointer-events: none;
}

.touch-btn-pause:active {
  transform: scale(0.96);
}

/* Level-up overlay (touch + desktop) */
.levelup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: auto;
}

.levelup-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.levelup-backdrop {
  position: absolute;
  inset: 0;
  background: #000000cc;
}

.levelup-sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 85dvh;
  overflow-y: auto;
  background: #16161d;
  border-radius: 16px 16px 0 0;
  padding: 20px 16px max(24px, env(safe-area-inset-bottom));
  border-top: 2px solid #444;
}

.levelup-sheet h2 {
  font-size: 1.4rem;
  text-align: center;
}

.levelup-sub {
  text-align: center;
  color: #78716c;
  font-size: 13px;
  margin: 4px 0 16px;
}

.levelup-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.levelup-card {
  text-align: left;
  background: #1c1c26;
  border: 2px solid #444;
  border-radius: 12px;
  padding: 14px;
  color: inherit;
  cursor: pointer;
  width: 100%;
}

.levelup-card:active { transform: scale(0.98); }

.color-border-R { border-color: #d3202a; }
.color-border-U { border-color: #0e68ab; }
.color-border-gold { border-color: #7b2cbf; }
.color-border-W { border-color: #d4c5a0; }
.color-border-B { border-color: #37474f; }
.color-border-G { border-color: #00733e; }

.levelup-card-name { display: block; font-weight: 700; font-size: 16px; }
.levelup-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.levelup-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.levelup-badge.new { background: #166534; color: #bbf7d0; }
.levelup-badge.up { background: #7c2d12; color: #fed7aa; }
.levelup-card-type {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #78716c;
  margin-top: 4px;
}
.levelup-pips {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}
.mana-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}
.levelup-card-desc {
  display: block;
  font-size: 13px;
  color: #d6d3d1;
  margin-top: 6px;
  line-height: 1.35;
}
.levelup-card-effect {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #fbbf24;
}

@media (min-width: 640px) {
  .levelup-modal { align-items: center; padding: 16px; }
  .levelup-sheet { border-radius: 16px; max-height: 90vh; }
}

/* Spark reveal overlay (elite pickup) */
.spark-overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  pointer-events: auto;
}

.spark-overlay.hidden { display: none; }

.spark-reveal-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

.spark-reveal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 38%, #f0c14b22 0%, #000000e6 55%, #000000f2 100%);
  opacity: 0;
  transition: opacity 0.45s ease;
}

.spark-reveal-bloom {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.15);
  background: radial-gradient(circle,
    #ffffff 0%,
    #fff8dc 18%,
    #fde68a 36%,
    #f59e0b66 58%,
    transparent 72%
  );
  will-change: transform, opacity;
}

.spark-reveal-bloom.is-charging {
  opacity: 0.55;
  transition: transform 0.7s ease-out, opacity 0.7s ease-out;
  transform: scale(2.2);
}

.spark-reveal-bloom.is-surging {
  opacity: 0.85;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.55s ease-out;
  transform: scale(8);
}

.spark-reveal-bloom.is-full {
  opacity: 1;
  transition: transform 0.55s cubic-bezier(0.15, 0.85, 0.35, 1), opacity 0.35s ease-out;
  transform: scale(42);
  background: radial-gradient(circle,
    #ffffff 0%,
    #fffef5 22%,
    #fff8dc 48%,
    #fde68acc 70%,
    #f59e0b88 100%
  );
}

.spark-reveal-bloom.is-fade {
  opacity: 0;
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
  transform: scale(48);
}

.spark-reveal-stage {
  position: relative;
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s ease;
  z-index: 3;
}

.spark-reveal-stage.phase-enter {
  transform: scale(1);
  opacity: 1;
}

.spark-reveal-stage.phase-enter ~ .spark-reveal-backdrop,
.spark-reveal-modal:has(.phase-enter) .spark-reveal-backdrop {
  opacity: 1;
}

.spark-reveal-gem-stage {
  position: relative;
  width: 120px;
  height: 120px;
  margin-top: 8px;
}

.spark-reveal-gem-wrap {
  position: absolute;
  inset: 0;
  transition: opacity 0.4s ease, transform 0.45s ease, filter 0.4s ease;
}

.spark-reveal-gem-wrap.is-hidden {
  opacity: 0;
  transform: scale(0.35);
  filter: brightness(3);
  pointer-events: none;
}

.spark-reveal-gem {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.spark-gem-glow {
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff8dc99 0%, #fde68a55 28%, #f59e0b22 50%, transparent 72%);
  animation: spark-gem-pulse 1.1s ease-in-out infinite;
  transition: inset 0.6s ease, opacity 0.5s ease;
}

.spark-reveal-stage.phase-charge .spark-gem-glow {
  animation-duration: 0.4s;
  inset: -36px;
}

.spark-reveal-stage.phase-surge .spark-gem-glow {
  animation: spark-gem-flash 0.28s ease-out infinite;
  inset: -56px;
  opacity: 1;
}

@keyframes spark-gem-pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.65; }
  50% { transform: scale(1.08); opacity: 1; }
}

@keyframes spark-gem-flash {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

.spark-gem-ring {
  position: absolute;
  width: 88px;
  height: 88px;
  border-radius: 12px;
  transform: rotate(45deg);
  border: 1px solid #fde68a44;
  box-shadow: 0 0 20px #fbbf2466, inset 0 0 8px #fff8dc33;
  opacity: 0.85;
  transition: opacity 0.3s ease, box-shadow 0.4s ease;
}

.spark-reveal-stage.phase-charge .spark-gem-ring {
  animation: spark-gem-shake 0.11s linear infinite;
  box-shadow: 0 0 28px #fbbf2488, inset 0 0 12px #fff8dc55;
}

.spark-reveal-stage.phase-surge .spark-gem-ring {
  animation: spark-gem-shake 0.055s linear infinite;
  opacity: 1;
  box-shadow: 0 0 40px #fff8dccc, 0 0 18px #fde68a, inset 0 0 16px #fff;
}

.spark-gem-body {
  position: relative;
  width: 72px;
  height: 72px;
  transform: rotate(45deg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 0 28px #fbbf2499,
    0 0 8px #fff8dc66,
    inset 0 0 14px #fff8dc55,
    inset 0 -8px 16px #b4530944;
  transition: filter 0.35s ease, box-shadow 0.35s ease;
}

.spark-reveal-stage.phase-charge .spark-gem-body {
  animation: spark-gem-shake 0.11s linear infinite;
  filter: brightness(1.12);
}

.spark-reveal-stage.phase-surge .spark-gem-body {
  animation: spark-gem-shake 0.055s linear infinite;
  filter: brightness(1.55) saturate(1.2);
  box-shadow:
    0 0 40px #fff8dc,
    0 0 16px #fde68a,
    inset 0 0 22px #fff;
}

@keyframes spark-gem-shake {
  0%, 100% { transform: rotate(45deg) translate(0, 0); }
  25% { transform: rotate(45deg) translate(-1.5px, 1px); }
  50% { transform: rotate(45deg) translate(1px, -1.5px); }
  75% { transform: rotate(45deg) translate(1.5px, 1px); }
}

.spark-gem-facet {
  position: absolute;
  inset: 0;
}

.spark-gem-facet-a {
  background: linear-gradient(135deg, #fff8dc 0%, #fef3c7 18%, #f59e0b 52%, #b45309 100%);
}

.spark-gem-facet-b {
  background: linear-gradient(315deg, transparent 38%, #ffffffaa 72%, #fde68a44 100%);
  mix-blend-mode: screen;
}

.spark-gem-facet-c {
  background: linear-gradient(225deg, transparent 55%, #92400e55 100%);
  mix-blend-mode: multiply;
  opacity: 0.55;
}

.spark-gem-core {
  position: absolute;
  inset: 20%;
  border-radius: 5px;
  background: radial-gradient(circle at 38% 32%, #fff 0%, #fff8dc 22%, #fde68a 45%, #f59e0b 88%);
  box-shadow: 0 0 18px #fff8dc, 0 0 6px #fff;
  transition: inset 0.5s ease, box-shadow 0.4s ease;
}

.spark-reveal-stage.phase-surge .spark-gem-core {
  inset: 12%;
  box-shadow: 0 0 28px #fff, 0 0 12px #fff8dc;
}

.spark-gem-shine {
  position: absolute;
  top: 8%;
  left: 12%;
  width: 28%;
  height: 22%;
  border-radius: 40%;
  background: linear-gradient(135deg, #ffffffcc 0%, transparent 100%);
  transform: rotate(-12deg);
  pointer-events: none;
}

.spark-gem-sparkles span {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px #fde68a;
  opacity: 0;
}

.spark-gem-sparkles span:nth-child(1) { top: 18%; left: 62%; }
.spark-gem-sparkles span:nth-child(2) { top: 72%; left: 28%; }
.spark-gem-sparkles span:nth-child(3) { top: 42%; left: 82%; }
.spark-gem-sparkles span:nth-child(4) { top: 58%; left: 12%; }

.spark-reveal-stage.phase-charge .spark-gem-sparkles span,
.spark-reveal-stage.phase-surge .spark-gem-sparkles span {
  animation: spark-twinkle 0.55s ease-in-out infinite;
}

.spark-gem-sparkles span:nth-child(2) { animation-delay: 0.12s; }
.spark-gem-sparkles span:nth-child(3) { animation-delay: 0.24s; }
.spark-gem-sparkles span:nth-child(4) { animation-delay: 0.36s; }

@keyframes spark-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.4); }
  50% { opacity: 1; transform: scale(1.35); }
}

.spark-reveal-copy {
  text-align: center;
  min-height: 56px;
  transition: opacity 0.35s ease;
}

.spark-reveal-stage.phase-bloom .spark-reveal-copy {
  opacity: 0;
}

.spark-reveal-stage.phase-reveal .spark-reveal-copy {
  opacity: 1;
}

.spark-reveal-title {
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fde68a;
  text-shadow: 0 0 18px #f59e0b88;
  margin: 0;
}

.spark-reveal-sub {
  margin: 6px 0 0;
  color: #a8a29e;
  font-size: 13px;
}

.spark-reveal-cards {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spark-reveal-card {
  opacity: 0;
  transform: translateY(18px) scale(0.94);
  transition: opacity 0.38s ease, transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: default;
}

.spark-reveal-card.is-revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.spark-reveal-continue {
  margin-top: 4px;
  min-width: 160px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.spark-reveal-stage.phase-ready .spark-reveal-continue {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 640px) {
  .spark-reveal-gem-stage { width: 140px; height: 140px; }
  .spark-gem-body { width: 84px; height: 84px; }
  .spark-gem-ring { width: 102px; height: 102px; }
}

/* Hub */
.hub {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(56px, env(safe-area-inset-bottom));
  z-index: 1;
}

.hub-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, #d3202a22, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 30%, #0e68ab18, transparent 50%),
    radial-gradient(ellipse 50% 35% at 0% 70%, #00733e18, transparent 50%),
    linear-gradient(180deg, #0c0c14 0%, #0a0a10 100%);
}
.hub-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(#ffffff06 1px, transparent 1px),
    linear-gradient(90deg, #ffffff06 1px, transparent 1px);
  background-size: 16px 16px;
  image-rendering: pixelated;
  animation: hub-grid-drift 28s linear infinite;
}
.eldrazi-eye {
  position: fixed;
  right: 14px;
  bottom: max(72px, calc(env(safe-area-inset-bottom) + 62px));
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 40;
  background: radial-gradient(circle at 50% 45%, #2a2430 0%, #0d0a12 72%, transparent 100%);
  opacity: calc(0.35 + 0.35 * var(--eye-intensity, 0));
  filter: drop-shadow(0 0 calc(4px + 8px * var(--eye-intensity, 0)) #7e57c2aa);
  animation: eldrazi-eye-pulse 3.4s ease-in-out infinite;
  transition: opacity 0.6s ease;
}
.eldrazi-eye.hidden { display: none; }
.eldrazi-eye:active { transform: scale(0.92); }

/* Wrapper della card di Zendikar (Scegli piano): l'occhio vive QUI come fratello del
   bottone, non al suo interno — così non eredita l'opacità ridotta di ".locked"
   (altrimenti diventa un'ombra quasi nera, illeggibile). */
.portal-card-wrap {
  position: relative;
}
.portal-card-wrap .portal-card {
  width: 100%;
  height: 100%;
}

/* Seconda copia dell'occhio dentro la card di Zendikar, subito sotto al numerino
   missione (stesso angolo, non più vicino al portale). */
.eldrazi-eye--inline {
  position: absolute;
  right: 6px;
  top: 30px;
  z-index: 2;
}

.eldrazi-eye-img {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
}
.eldrazi-eye-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.eldrazi-eye.has-art .eldrazi-eye-iris { display: none; }

.eldrazi-eye-iris {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #b39ddb 0%, #7e57c2 45%, #150b00 100%);
}
.eldrazi-eye-iris::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 16%;
  bottom: 16%;
  width: 2px;
  margin-left: -1px;
  background: #150b00;
  border-radius: 2px;
}

@keyframes eldrazi-eye-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}

.eldrazi-eye-whisper {
  position: fixed;
  right: 14px;
  bottom: max(110px, calc(env(safe-area-inset-bottom) + 100px));
  max-width: 210px;
  margin: 0;
  background: #14101ae6;
  border: 1px solid #7e57c266;
  color: #d8c9f0;
  font-size: 11px;
  font-style: italic;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 4px;
  box-shadow: 0 0 16px #7e57c244;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 41;
  pointer-events: none;
}
.eldrazi-eye-whisper.hidden { display: none; }
.eldrazi-eye-whisper.is-visible { opacity: 1; transform: translateY(0); }

.hub-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    #00000018 2px,
    #00000018 4px
  );
  opacity: 0.4;
  pointer-events: none;
}

@keyframes hub-grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 64px, 64px 0; }
}

.hub-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 18px;
  position: relative;
}

.hub-brand {
  text-align: center;
  padding: 8px 4px 0;
}

.mana-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.mana {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #0a0a10;
  border: 2px solid #1a1a22;
  box-shadow: 2px 2px 0 #000;
  image-rendering: pixelated;
  animation: mana-pulse 3.2s ease-in-out infinite;
}
.mana:nth-child(2) { animation-delay: 0.2s; }
.mana:nth-child(3) { animation-delay: 0.4s; }
.mana:nth-child(4) { animation-delay: 0.6s; }
.mana:nth-child(5) { animation-delay: 0.8s; }
.mana-W { background: var(--mana-W); }
.mana-U { background: var(--mana-U); color: #fff; }
.mana-B { background: var(--mana-B); color: #fff; }
.mana-R { background: var(--mana-R); color: #fff; }
.mana-G { background: var(--mana-G); color: #fff; }
.mana-C { background: var(--mana-C); color: #2a2418; }

@keyframes mana-pulse {
  0%, 100% { transform: translateY(0); filter: brightness(1); }
  50% { transform: translateY(-2px); filter: brightness(1.15); }
}

.hub-kicker {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.hub-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  line-height: 1.25;
}

.hub-title-line {
  font-family: var(--font-pixel);
  font-size: clamp(14px, 3.8vw, 22px);
  letter-spacing: 0.04em;
  color: #f5f0e8;
  text-shadow:
    3px 0 0 #1a0a0a,
    -3px 0 0 #1a0a0a,
    0 3px 0 #1a0a0a,
    0 -3px 0 #1a0a0a,
    3px 3px 0 #000,
    0 0 18px #d3202a55;
  image-rendering: pixelated;
}

.hub-title-accent {
  color: #ff6b5a;
  text-shadow:
    3px 0 0 #2a0808,
    -3px 0 0 #2a0808,
    0 3px 0 #2a0808,
    0 -3px 0 #2a0808,
    3px 3px 0 #000,
    0 0 22px #0e68ab66;
  animation: title-flicker 4.5s steps(2, end) infinite;
}

@keyframes title-flicker {
  0%, 92%, 100% { opacity: 1; filter: brightness(1); }
  93% { opacity: 0.85; filter: brightness(1.3); }
  95% { opacity: 1; }
}

.hub-sub {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.hub-user {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
  width: min(100%, 320px);
  padding: 10px 12px;
  background: var(--panel);
  border: 3px solid var(--panel-edge);
  box-shadow: 4px 4px 0 #000;
  image-rendering: pixelated;
}

.hub-user-cloud {
  border-color: #3d9be9aa;
  background: linear-gradient(135deg, #141428 0%, #121820 100%);
}

.hub-user-local {
  border-color: #555;
}

a.hub-user {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

a.hub-user-local:hover {
  border-color: #3d9be9aa;
}

.hub-user-pip {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border: 2px solid #0a0a10;
  box-shadow: 2px 2px 0 #000;
}
.hub-user-cloud .hub-user-pip {
  background: var(--mana-U);
  box-shadow: 2px 2px 0 #000, 0 0 8px #3d9be988;
  animation: mana-pulse 2s ease-in-out infinite;
}
.hub-user-local .hub-user-pip {
  background: #666;
}

.hub-user-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hub-user-label {
  font-size: 10px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hub-user-name {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: #fff;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-user-meta {
  font-size: 10px;
  color: var(--muted);
}

.hub-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: center;
  margin-top: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hub-tabs::-webkit-scrollbar { display: none; }

.hub-tab {
  position: relative;
  font-family: var(--font-ui);
  background: var(--panel);
  border: 3px solid var(--panel-edge);
  color: var(--muted);
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 0;
  cursor: pointer;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0 #000;
}

.hub-tab-icon {
  width: 22px;
  height: 22px;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.hub-tab.active {
  background: #2a1214;
  color: #fff;
  border-color: var(--accent);
  box-shadow: 3px 3px 0 #5a1010, 0 0 12px #d3202a44;
}

.hub-tab:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 #000; }

.hub-tab-flag {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  background: #e63946;
  box-shadow: 0 0 6px #e63946aa;
  pointer-events: none;
}

.hub-tab-flag.hidden { display: none; }

.hub-ver-mismatch {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
  background: #2a1214;
  border: 2px solid var(--accent);
  box-shadow: 3px 3px 0 #5a1010;
}

.hub-ver-mismatch.hidden { display: none; }

.hub-ver-mismatch p {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 11px;
  color: #f5f0e8;
  line-height: 1.45;
  text-align: center;
}

.settings-live-version {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: #fde68a;
}

.settings-live-version:empty {
  display: none;
}

.hub-tab-panel.hidden { display: none !important; }

/* —— Mission brief (compact play) —— */
.mission-brief {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  max-width: 520px;
  margin: 0 auto;
}

.slot-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 3px solid var(--panel-edge);
  border-radius: 0;
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: 4px 4px 0 #000;
  color: inherit;
  font: inherit;
  min-height: 88px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.slot-card:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

.slot-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Focus da navigazione a controller (gamepad-nav.js) — colore diverso dal
   focus-visible da tastiera/screen-reader per non confonderli. */
.gp-focus {
  outline: 3px solid #f4d35e !important;
  outline-offset: 3px !important;
}

.slot-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  margin-bottom: 8px;
}

.slot-body {
  display: flex;
  gap: 14px;
  align-items: center;
}

.slot-sprite,
.slot-portal {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0d0d12;
  border: 2px solid #2a2a38;
}

.slot-portal {
  width: 72px;
  height: 72px;
}

.slot-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.slot-name {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.slot-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.slot-tap {
  font-size: 10px;
  color: var(--gold);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-ui);
}

.slot-char { border-color: #5a3038; }
.slot-plane { border-color: #2a4060; }

.mission-meta {
  background: var(--panel);
  border: 3px solid var(--panel-edge);
  box-shadow: 3px 3px 0 #000;
  padding: 10px 12px;
}

/* —— Maestrie board (sopra gli slot) —— */
.mastery-board {
  background:
    linear-gradient(135deg, #1a1520 0%, #12121a 45%, #14181f 100%);
  border: 3px solid var(--panel-edge);
  box-shadow: 4px 4px 0 #000, inset 0 0 0 1px #ffffff08;
  padding: 12px 12px 14px;
  position: relative;
  overflow: hidden;
}

.mastery-board::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 80% at 10% 0%, #f8f5e914, transparent 55%),
    radial-gradient(ellipse 60% 70% at 90% 100%, #d3202a12, transparent 50%);
}

.mastery-board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.mastery-board-title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-shadow: 0 0 12px #f0c14b44;
}

.mastery-board-stats {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.02em;
}

.mastery-board--link {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.mastery-board--link:hover,
.mastery-board--link:focus-visible {
  border-color: var(--gold);
  box-shadow: 4px 4px 0 #000, 0 0 14px #f0c14b33;
  outline: none;
}

.mastery-board-hint {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: auto;
  margin-right: 8px;
}

.mastery-picker-head {
  margin-bottom: 8px;
}

.mastery-board-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  position: relative;
  z-index: 1;
}

.mastery-board-row.has-colorless {
  grid-template-columns: repeat(3, 1fr);
}

.hub-records {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 2px;
}
.hub-records:empty { display: none; }
.hub-record-item,
.hub-record-chip {
  font-size: 10px;
  color: var(--dim);
  background: #14141ccc;
  border: 1px solid #2a2a38;
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}
.hub-record-chip { color: #fde68a; }
.hub-wins-trophy { cursor: pointer; }

.hub-wins-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 2px 0 4px;
  padding: 8px 10px;
  background: #14141ccc;
  border: 1px solid #2a2a38;
  border-radius: 10px;
  max-height: 200px;
  overflow-y: auto;
}
.hub-wins-detail.hidden { display: none; }
.hub-wins-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--dim);
}
.hub-wins-detail-row span:last-child { color: #fde68a; white-space: nowrap; }

.m-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px 7px;
  background: #0c0c12ee;
  border: 2px solid #2a2a38;
  box-shadow: 2px 2px 0 #000;
  min-width: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.m-tile:hover,
.m-tile:focus-visible {
  border-color: var(--gold);
  box-shadow: 2px 2px 0 #000, 0 0 10px #f0c14b33;
  outline: none;
}

.m-tile.is-hot {
  animation: m-tile-pulse 2.8s ease-in-out infinite;
}

@keyframes m-tile-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.m-gem {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  color: #0a0a10;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  box-shadow: 0 0 10px currentColor;
  text-shadow: none;
}

.m-W .m-gem { background: var(--mana-W); color: #3a3420; box-shadow: 0 0 12px #e8d9a866; }
.m-U .m-gem { background: var(--mana-U); color: #fff; box-shadow: 0 0 12px #3d9be966; }
.m-B .m-gem { background: var(--mana-B); color: #fff; box-shadow: 0 0 12px #6b7c8a66; }
.m-R .m-gem { background: var(--mana-R); color: #fff; box-shadow: 0 0 12px #e03a3a66; }
.m-G .m-gem { background: var(--mana-G); color: #fff; box-shadow: 0 0 12px #2f9e5a66; }
.m-C .m-gem { background: var(--mana-C); color: #2a2418; box-shadow: 0 0 12px #c4b8a866; }

.m-W { border-color: #e8d9a844; }
.m-U { border-color: #3d9be944; }
.m-B { border-color: #6b7c8a44; }
.m-R { border-color: #e03a3a44; }
.m-G { border-color: #2f9e5a44; }
.m-C { border-color: #c4b8a844; }

.m-W.is-hot { border-color: #e8d9a8; box-shadow: 2px 2px 0 #000, 0 0 10px #e8d9a833; }
.m-U.is-hot { border-color: #3d9be9; box-shadow: 2px 2px 0 #000, 0 0 10px #3d9be933; }
.m-B.is-hot { border-color: #9aa8b4; box-shadow: 2px 2px 0 #000, 0 0 10px #6b7c8a33; }
.m-R.is-hot { border-color: #e03a3a; box-shadow: 2px 2px 0 #000, 0 0 10px #e03a3a33; }
.m-G.is-hot { border-color: #2f9e5a; box-shadow: 2px 2px 0 #000, 0 0 10px #2f9e5a33; }
.m-C.is-hot { border-color: #c4b8a8; box-shadow: 2px 2px 0 #000, 0 0 10px #c4b8a833; }

.m-lv {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #c4bfb8;
}

.m-track {
  display: block;
  width: 100%;
  height: 5px;
  background: #1a1a24;
  border: 1px solid #2a2a38;
  overflow: hidden;
}

.m-tile .m-fill {
  display: block;
  height: 100%;
  width: 0;
  transition: width 0.35s ease-out;
}

.m-W .m-fill { background: linear-gradient(90deg, #c4b280, var(--mana-W)); }
.m-U .m-fill { background: linear-gradient(90deg, #0a4a7a, var(--mana-U)); }
.m-B .m-fill { background: linear-gradient(90deg, #3a4450, #9aa8b4); }
.m-R .m-fill { background: linear-gradient(90deg, #8a151c, var(--mana-R)); }
.m-G .m-fill { background: linear-gradient(90deg, #045030, var(--mana-G)); }
.m-C .m-fill { background: linear-gradient(90deg, #6a6258, var(--mana-C)); }

@media (max-width: 380px) {
  .mastery-board-row { gap: 5px; }
  .m-gem { width: 24px; height: 24px; font-size: 10px; }
  .m-lv { font-size: 8px; }
}

.mastery-compact {
  gap: 0;
  margin-bottom: 8px;
}

.mastery-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.m-pill {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border: 2px solid #2a2a38;
  background: #12121a;
  letter-spacing: 0.04em;
}

.m-stats {
  font-size: 11px;
  color: var(--dim);
  margin-left: auto;
}

.quest-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.quest-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  border: 2px solid #3a3038;
  background: #16141c;
  font-size: 11px;
  overflow-wrap: break-word;
}
.quest-chip .quest-match-tag { flex-basis: 100%; }

.quest-chip strong {
  font-family: var(--font-ui);
  font-size: 10px;
  text-transform: uppercase;
  color: #ff7043;
}

.quest-chip.district-izzet { border-color: #0e68ab66; }
.quest-chip.district-izzet strong { color: #4fc3f7; }
.quest-chip.district-orzhov { border-color: #9e9e9e66; }
.quest-chip.district-orzhov strong { color: #e0e0e0; }
.quest-chip.district-selesnya { border-color: #00733e66; }
.quest-chip.district-selesnya strong { color: #66bb6a; }
.quest-chip.district-boros { border-color: #d3202a66; }

.quest-chip--match {
  border-color: #fbbf24 !important;
  background: #78350f28;
  box-shadow: inset 0 0 0 1px #fbbf2466;
}

.quest-match-tag {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.35;
  color: #fde68a;
  font-weight: 600;
}

.mission-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 3px;
  background: #fbbf24;
  color: #1a1408;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #1c1c26;
  z-index: 2;
  pointer-events: none;
}

.mission-badge--tap {
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.12s;
}
.mission-badge--tap:hover,
.mission-badge--tap:active {
  transform: scale(1.15);
}

.codex-quest--jump-flash {
  animation: codex-quest-flash 1.6s ease-out;
}
@keyframes codex-quest-flash {
  0% { box-shadow: inset 0 0 0 2px #fbbf24, 0 0 16px #fbbf2466; }
  100% { box-shadow: inset 0 0 0 0 #fbbf2400, 0 0 0 #fbbf2400; }
}

.pick-card,
.portal-card,
.vestment-chip,
.slot-card {
  position: relative;
}

.codex-quest--match {
  border-color: #fbbf24 !important;
  box-shadow: inset 0 0 0 1px #fbbf2466, 0 0 12px #fbbf2422;
}

.codex-objective {
  font-size: 11px;
  color: #fde68a;
  margin: 6px 0 4px;
  line-height: 1.35;
}

.quest-hint {
  width: 100%;
  font-size: 11px;
  color: #fbbf24;
  margin: 2px 0 0;
}

/* —— Character / plane pickers —— */
.picker-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  max-width: 640px;
}

.picker-head h2 {
  font-family: var(--font-ui);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c4bfb8;
  margin: 0;
}

.btn-back {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--panel);
  color: #e8e6e3;
  border: 3px solid var(--panel-edge);
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
}

.btn-back:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 #000;
}

#tab-pick-char .panel-loadout {
  max-width: 640px;
}

.portal-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  max-width: 640px;
}

@media (min-width: 560px) {
  .portal-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.portal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  background: var(--panel);
  border: 3px solid var(--panel-edge);
  padding: 14px 10px;
  cursor: pointer;
  box-shadow: 4px 4px 0 #000;
  color: inherit;
  font: inherit;
  min-height: 160px;
}

.portal-card:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

.portal-card.selected {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 #5a1010, 0 0 14px #d3202a44;
}

.portal-card.locked {
  opacity: 0.72;
  cursor: not-allowed;
  border-color: #333;
  box-shadow: 3px 3px 0 #000;
}

.portal-card.locked .portal-sil {
  filter: brightness(0.25) contrast(1.1);
}

.portal-card.locked .portal-name {
  color: #78716c;
}

.portal-card img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0d0d12;
  border: 2px solid #2a2a38;
}

.portal-name {
  display: block;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
}

.districts-panel {
  background-size: cover;
  background-position: center;
  border-radius: 2px;
}

.districts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 640px;
  position: relative;
}

.district-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  background: var(--panel);
  border: 3px solid var(--panel-edge);
  padding: 16px 10px;
  cursor: pointer;
  box-shadow: 4px 4px 0 #000;
  color: inherit;
  font: inherit;
  position: relative;
}

.district-crest {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 2px #000a);
}
.district-card:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #000; }
.district-card.locked { opacity: 0.55; cursor: pointer; }
.district-card:not(.locked) { border-color: var(--gold); box-shadow: 4px 4px 0 #000, 0 0 14px #f0c14b33; }

.district-pips { display: flex; gap: 4px; }
.mana.district-pip { width: 18px; height: 18px; font-size: 7px; animation: none; }

.district-name {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
}

.portal-sigil {
  display: block;
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 0.04em;
}
.hub-sigil-chip { color: var(--gold); }

.sigil-vetrina-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px 18px;
  background:
    radial-gradient(ellipse at 50% 0%, #f0c14b22, transparent 46%),
    #05040ccc;
}

.sigil-vetrina-cabinet {
  width: min(520px, 100%);
  max-height: min(88vh, 720px);
  overflow: auto;
  padding: 14px 14px 16px;
  background:
    linear-gradient(180deg, #2a1e0ecc 0%, #100e14f2 28%, #0a090ef8 100%);
  border: 3px solid #c9a227;
  box-shadow:
    inset 0 0 0 1px #f4d35e66,
    0 12px 0 #000,
    0 0 40px #f0c14b22;
}

.sigil-vetrina-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #c9a22755;
}

.sigil-vetrina-kicker {
  margin: 0 0 2px;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #c9a227;
}

.sigil-vetrina-head h2 {
  margin: 0;
  font-family: var(--font-display, 'Press Start 2P', monospace);
  font-size: 13px;
  color: #f4d35e;
}

.sigil-vetrina-sub {
  margin: 6px 0 0;
  font-size: 11px;
  color: #c4b8a8;
}

.sigil-vetrina-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sigil-exhibit {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  min-height: 148px;
  background: #0a080c;
  border: 2px solid #5c4a1e;
  box-shadow: inset 0 0 18px #000000aa;
}

.sigil-exhibit.is-found {
  border-color: #c9a227;
  box-shadow: inset 0 0 18px #f0c14b22;
}

.sigil-exhibit-glass {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 40%, #f0c14b18, transparent 62%),
    repeating-linear-gradient(135deg, #16120a 0 6px, #100e0a 6px 12px);
  border: 1px solid #3a3018;
}

.sigil-exhibit-art {
  width: 56px;
  height: 56px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 8px #f0c14b88);
}

.sigil-exhibit-void {
  width: 28px;
  height: 28px;
  border: 2px dashed #3a3428;
  border-radius: 50%;
  opacity: 0.7;
}

.sigil-exhibit strong {
  font-size: 10px;
  color: #f4d35e;
}

.sigil-exhibit.is-empty strong { color: #78716c; }

.sigil-exhibit span {
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a8a29e;
}

.sigil-exhibit em {
  font-style: normal;
  font-size: 9px;
  line-height: 1.35;
  color: #d6d3d1;
}

.sigil-exhibit.is-empty em { color: #57534e; }
.district-status { font-size: 10px; color: #78716c; }
.district-status--open { color: var(--gold); font-weight: 700; }

.districts-toast {
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translate(-50%, 6px);
  background: #14101ae6;
  border: 1px solid #57534eaa;
  color: #d6d3d1;
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.districts-toast.hidden { display: none; }
.districts-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

#district-detail-content {
  background-size: cover;
  background-position: center;
}

.district-npc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #14141ccc;
  border: 2px solid #2a2a38;
  padding: 12px;
  margin-bottom: 14px;
}
.district-npc-portrait {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font-pixel);
  font-size: 14px;
  color: #0a0a10;
  background: linear-gradient(135deg, var(--mana-U), var(--mana-R));
  border: 2px solid #1a1a22;
  box-shadow: 2px 2px 0 #000;
}
.district-npc-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  image-rendering: pixelated;
}
.district-npc-text { display: flex; flex-direction: column; gap: 4px; }
.district-npc-text strong { font-family: var(--font-ui); font-size: 14px; color: #fff; }
.district-npc-flavor { font-size: 11px; color: #a8a29e; line-height: 1.4; }

.niv-overlord-card { border-color: var(--gold); box-shadow: 0 0 14px #f0c14b22; }
.niv-overlord-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.niv-overlord-actions .district-talk-btn { margin-top: 0; }

.eldrazi-void-card {
  margin-top: 14px;
  background: #0a0612cc;
  border-color: #4a1a5c;
  box-shadow: 0 0 18px #4a1a5c55;
}
button.eldrazi-void-card {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button.eldrazi-void-card:hover { box-shadow: 0 0 22px #4a1a5c88; }
button.eldrazi-void-card:active { transform: translate(1px, 1px); }
.eldrazi-void-portrait {
  background: radial-gradient(circle, #2a1240, #0a0612) !important;
  filter: saturate(1.2);
}
.eldrazi-void-card .district-npc-flavor { color: #b39ddb; }
.story-vn-reward {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1a1424cc;
  border: 1px solid var(--gold);
  padding: 8px 10px;
  margin-bottom: 8px;
  animation: guild-pact-pop 0.4s ease;
}
.story-vn-reward-text { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.story-vn-reward-text strong { font-family: var(--font-ui); font-size: 13px; color: #fff; }
@keyframes guild-pact-pop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.void-crest-icon {
  width: 78% !important;
  height: 78% !important;
  object-fit: contain !important;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 3px #000a);
}

.niv-tour-ring-layer { position: fixed; inset: 0; z-index: 9998; pointer-events: none; }
.niv-tour-ring {
  position: fixed;
  border-radius: 4px;
  box-shadow: 0 0 0 4px var(--gold), 0 0 24px 7px #f0c14bcc;
  transition: left .3s ease, top .3s ease, width .3s ease, height .3s ease;
  pointer-events: none;
}
#niv-tour-slot:empty { display: none; }
.niv-tour-card {
  width: min(100%, 480px);
  margin: 10px auto 0;
  display: flex;
  gap: 12px;
  background: #14141e;
  border: 2px solid var(--gold);
  box-shadow: 4px 4px 0 #000, 0 4px 24px #000c;
  padding: 14px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .2s, transform .2s;
}
.niv-tour-card.is-open { opacity: 1; transform: translateY(0); }
.niv-tour-portrait {
  width: 56px;
  height: 56px;
  object-fit: cover;
  object-position: top center;
  image-rendering: pixelated;
  flex-shrink: 0;
  border: 2px solid #1a1a22;
}
.niv-tour-body { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.niv-tour-body strong { font-family: var(--font-ui); color: var(--gold); font-size: 13px; }
.niv-tour-text { font-size: 12px; color: #e8e6e3; line-height: 1.4; margin: 0; }
.niv-tour-actions { display: flex; gap: 8px; justify-content: flex-end; }
.niv-tour-actions button {
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 6px 12px;
  cursor: pointer;
  border: 2px solid var(--panel-edge);
  background: #1a1a22;
  color: #fff;
}
.niv-tour-actions .niv-tour-next { border-color: var(--gold); color: var(--gold); }

.district-section-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #78716c;
  margin: 18px 0 6px;
  border-bottom: 1px solid #ffffff1a;
  padding-bottom: 4px;
}
.district-section-label:first-child { margin-top: 0; }

.district-portal-heading {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin-bottom: 8px;
}

.btn-primary.district-portal-btn {
  width: 100%;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--portal-c1, var(--gold)) 70%, #000 0%), color-mix(in srgb, var(--portal-c2, var(--accent)) 65%, #000 20%) 75%);
  border-color: #fff9;
  box-shadow: 4px 4px 0 #000, 0 0 18px color-mix(in srgb, var(--portal-c1, var(--gold)) 45%, transparent);
}

.district-shop-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.district-shop-badge {
  font-size: 9px;
  padding: 2px 6px;
  background: #00000055;
  border: 1px solid #ffffff22;
  border-radius: 3px;
  color: #d6d3d1;
  white-space: nowrap;
}
.district-shop-badge--max {
  color: #fde68a;
  border-color: #f0c14baa;
  background: #3a2a0acc;
  font-weight: 600;
}

.district-portal-banner {
  font-size: 11px;
  color: #fde68a;
  background: #2a1f0acc;
  border: 1px solid #f0c14b44;
  padding: 8px 10px;
  margin: -6px 0 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-wrap: break-word;
  word-break: break-word;
}
.district-portal-banner.hidden { display: none; }
.district-portal-banner strong { font-size: 12px; color: #fff; }
.district-portal-banner span { font-size: 10px; color: #d6c896; }
.district-portal-banner span.hidden { display: none; }

.corruption-banner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
  background: linear-gradient(135deg, #2a0a0acc, #1a0a14cc);
  border: 2px solid #8b1f1f;
  box-shadow: 0 0 14px #8b1f1f55;
  padding: 12px;
  margin: 10px 0 12px;
}
.infinite-banner {
  margin: 10px 0 12px;
  padding: 10px 12px;
  background: #0c1520ee;
  border: 2px solid #3b82f6;
  box-shadow: 0 0 10px #3b82f644;
  text-align: center;
}
.infinite-banner.hidden { display: none; }
.infinite-banner-text {
  margin: 0;
  font-size: 12px;
  color: #bfdbfe;
  text-align: center;
}
.difficulty-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px;
  background: #14141ccc;
  border: 2px solid #2a2a38;
  max-width: 640px;
}
.difficulty-toggle.hidden { display: none; }
.infinite-submode-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 10px;
  background: #14141ccc;
  border: 2px solid #2a2a38;
  max-width: 640px;
}
.infinite-submode-toggle.hidden { display: none; }
.infinite-submode-btn {
  font: inherit;
  font-size: 12px;
  padding: 8px 10px;
  background: var(--panel);
  border: 2px solid var(--panel-edge);
  color: #e8e0d4;
  cursor: pointer;
}
.infinite-submode-btn.is-on {
  border-color: #3b82f6;
  box-shadow: 0 0 8px #3b82f688;
  color: #fff;
}
.infinite-submode-btn[data-submode="cursed"].is-on {
  border-color: #8b1f6a;
  box-shadow: 0 0 8px #6a1b6a88;
}
.infinite-submode-hint {
  margin: -4px 0 12px;
  font-size: 12px;
  color: #a8a29e;
  max-width: 640px;
}
.infinite-submode-hint.hidden { display: none; }
.infinite-random-hint {
  margin: 0 0 14px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
  color: #bfdbfe;
  background: #0c1520cc;
  border: 2px solid #3b82f644;
  max-width: 640px;
}
.difficulty-label {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: #f0c14b;
  margin-right: 4px;
}
.difficulty-btn {
  font: inherit;
  font-size: 12px;
  padding: 8px 12px;
  background: var(--panel);
  border: 2px solid var(--panel-edge);
  color: #e8e0d4;
  cursor: pointer;
}
.difficulty-btn.is-on {
  border-color: #8b1f6a;
  box-shadow: 0 0 8px #6a1b6a88;
  color: #fff;
}
.difficulty-btn[data-diff="normal"].is-on {
  border-color: #3b82f6;
  box-shadow: 0 0 8px #3b82f688;
}
.portal-card.portal-hard {
  border-color: #8b1f6a;
}
.corruption-banner.hidden { display: none; }
.corruption-banner-text {
  font-size: 12px;
  color: #f4a3a3;
  line-height: 1.4;
  margin: 0;
}
.corruption-accept-btn {
  border-color: #8b1f1f !important;
  color: #f4a3a3 !important;
}

.corrupted-subh {
  color: #f4a3a3;
  border-top-color: #8b1f1f;
}
#corrupted-planes-section.hidden { display: none; }
#corrupted-planes-section { margin-top: 16px; }

.squad-edit-link {
  display: block;
  margin: -4px 0 10px;
  background: none;
  border: none;
  color: #f4a3a3;
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.squad-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}
.squad-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel);
  border: 2px solid var(--panel-edge);
  padding: 8px 10px;
}
.squad-row-plane {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #e8e0d4;
}
.squad-row-plane img { width: 40px; height: 40px; image-rendering: pixelated; }
.squad-pick-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #14141ccc;
  border: 2px solid #8b1f1f;
  color: #f4a3a3;
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
}
.squad-pick-btn img { width: 32px; height: 32px; image-rendering: pixelated; }
.squad-empty { color: #a8a29e; }

.squad-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.squad-char-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 2px solid var(--panel-edge);
  color: #e8e0d4;
  font-size: 12px;
  padding: 8px;
  cursor: pointer;
  flex-wrap: wrap;
}
.squad-char-chip img { width: 40px; height: 40px; image-rendering: pixelated; }
.squad-char-chip.is-current {
  box-shadow: 0 0 0 2px #f0c14b88;
}
.squad-char-chip.is-taken {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.7);
}
.squad-slot-num {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: #f0c14b;
  min-width: 1.6em;
}
.squad-row.is-fallen {
  opacity: 0.55;
  border-color: #5c1a1a;
}
.squad-rebuild-btn {
  width: 100%;
  margin-top: 10px;
}
.squad-clear-chip {
  grid-column: 1 / -1;
  justify-content: center;
  color: #fbbf24;
}
.pick-card.roster-fallen {
  opacity: 0.45;
  filter: grayscale(0.85);
  cursor: not-allowed;
}
.pick-card.roster-pick {
  width: 100%;
  margin-bottom: 8px;
}

.demo-map-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.demo-map-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
}
#demo-map-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid var(--panel-edge);
  box-shadow: 4px 4px 0 #000;
  touch-action: none;
  cursor: grab;
}
.demo-map-interact {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  min-width: 112px;
  min-height: 48px;
  padding: 10px 14px;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: #1a1208;
  background: #f0c14b;
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
  cursor: pointer;
}
.demo-map-interact.hidden { display: none; }
.demo-map-interact:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.demo-map-hint {
  font-size: 12px;
  color: #f0c14b;
  background: #14141ccc;
  border: 1px solid #f0c14b44;
  padding: 6px 12px;
  text-align: center;
}
.demo-map-hint.hidden { display: none; }
.demo-map-controls {
  font-size: 11px;
  color: var(--dim);
  text-align: center;
  max-width: 28em;
}

/* Overlay legacy tenuto nascosto: la scena reale è sui portali. */
.corruption-reveal-overlay { display: none !important; }

.corruption-scene-caption {
  font-family: var(--font-pixel);
  font-size: 13px;
  color: #fff0f0;
  text-align: center;
  margin: 8px 0 14px;
  text-shadow: 0 0 8px #8b1f1f, 0 0 18px #6a1b6a;
  animation: corruption-caption-pulse 1.2s ease-in-out infinite;
}
.corruption-scene-caption.hidden { display: none; }
@keyframes corruption-caption-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

.hub.hub-cinematic-lock {
  pointer-events: none;
  user-select: none;
}

.portal-card.portal-tremble {
  animation: portal-tremble-kf 0.38s ease-in-out;
  border-color: #8b1f6a;
  box-shadow: 0 0 14px #6a1b6acc, 4px 4px 0 #000;
}
@keyframes portal-tremble-kf {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-6px, 3px) rotate(-1.2deg); }
  40% { transform: translate(7px, -4px) rotate(1.4deg); }
  60% { transform: translate(-5px, -5px) rotate(-0.8deg); }
  80% { transform: translate(5px, 4px) rotate(0.9deg); }
}

.portal-card img.portal-morph-flash {
  filter: brightness(2.2) saturate(0.3) hue-rotate(280deg);
  transition: filter 0.08s linear;
}

.portal-card.portal-corrupted-glow {
  border-color: #8b1f6a;
  box-shadow: 0 0 12px #6a1b6a99, 4px 4px 0 #000;
}

.portal-card.portal-locking {
  animation: portal-lock-slam-kf 0.28s ease-out;
}
@keyframes portal-lock-slam-kf {
  0% { transform: scale(1.04); }
  60% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

.relic-shop {
  margin: 14px 0;
  background: #14141ccc;
  border: 2px solid #2a2a38;
  padding: 12px;
}
.relic-shop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.relic-shop-gold {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: #fde68a;
}
.relic-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.relic-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #0d0d12;
  border: 1px solid #2a2a38;
  padding: 8px 10px;
}
.relic-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.relic-card-text strong { font-size: 13px; color: #fff; }
.relic-card-desc { font-size: 10px; color: #a8a29e; }
.relic-card-level { font-size: 10px; color: #78716c; }
.relic-buy-btn {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 8px 12px;
  white-space: nowrap;
}
.relic-buy-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.charm-unlock-card {
  border-color: var(--gold);
  margin-bottom: 10px;
}
.charm-buy-btn {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 8px 12px;
  white-space: nowrap;
}
.charm-buy-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.portal-desc {
  display: block;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.hub-grid {
  display: grid;
  gap: 14px;
  position: relative;
}

@media (min-width: 760px) {
  .hub-header {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
  .hub-brand {
    text-align: left;
    grid-column: 1;
    grid-row: 1;
  }
  .mana-row { justify-content: flex-start; }
  .hub-title { align-items: flex-start; }
  .hub-user {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    margin-top: 28px;
  }
  .hub-tabs {
    grid-column: 1 / -1;
    justify-content: center;
  }
  .hub-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }
  .panel-wide,
  #quest-panel { grid-column: 1 / -1; }
  .panel-loadout { grid-row: span 1; }
}

.panel {
  background: var(--panel);
  border: 3px solid var(--panel-edge);
  border-radius: 0;
  padding: 14px;
  box-shadow: 4px 4px 0 #000;
  position: relative;
}

.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--mana-W), var(--mana-U), var(--mana-B), var(--mana-R), var(--mana-G));
  opacity: 0.55;
}

.panel h2 {
  font-family: var(--font-ui);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c4bfb8;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-ico {
  color: var(--gold);
  font-size: 12px;
}

.panel-ico-img,
.btn-inline-ico {
  display: inline-block;
  vertical-align: middle;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
}

.picker-title-with-ico {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-with-ico {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.panel-subh {
  font-family: var(--font-ui);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin: 16px 0 8px;
  padding-top: 12px;
  border-top: 2px dashed #2a2a38;
}

.panel-note {
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 10px;
}

.codex-spell-filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--dim);
  margin: -4px 0 12px;
  cursor: pointer;
  user-select: none;
}
.codex-spell-filter-toggle input { accent-color: var(--gold); }

.codex {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 0 48px;
}

.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.codex-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #1c1c26;
  border: 2px solid #444;
  border-radius: 12px;
  padding: 12px;
}

.codex-art {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d12;
  border-radius: 10px;
  overflow: hidden;
}

.codex-art img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.codex-art.silhouette img {
  filter: brightness(0);
  opacity: 0.85;
}

.codex-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.codex-info strong { font-size: 15px; }
.codex-sub { font-size: 11px; color: #78716c; }
.codex-hint {
  font-size: 12px;
  color: #fbbf24;
  line-height: 1.35;
  margin-top: 4px;
}

.codex-card.unlocked .codex-hint { color: #86efac; }

.codex-ability {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: #d6d3d1;
}
.codex-ability strong { color: #f0c14b; font-size: 12px; }

.codex-subnav {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
}

.codex-subnav-btn {
  appearance: none;
  border: 2px solid #444;
  background: #1a1a22;
  color: #e7e5e4;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
}

.codex-subnav-btn.is-active {
  border-color: var(--accent);
  color: #fff;
  background: #2a1214;
  box-shadow: 0 0 10px #d3202a33;
}

.arsenal-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 14px;
}

.arsenal-switch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 96px;
  padding: 14px 10px 12px;
  border: 3px solid var(--panel-edge);
  background:
    linear-gradient(155deg, #1a1520 0%, #12121a 55%, #14181f 100%);
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  font: inherit;
  color: var(--muted);
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s, transform 0.1s;
}

.arsenal-switch-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

.arsenal-switch-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.arsenal-switch-btn.is-active {
  color: #fff;
}

.arsenal-switch-btn--pw.is-active {
  border-color: #c084fc;
  background: linear-gradient(155deg, #2a1838 0%, #1a1028 55%, #12101a 100%);
  box-shadow: 4px 4px 0 #3b0764, 0 0 16px #a855f744;
}

.arsenal-switch-btn--spells.is-active {
  border-color: #38bdf8;
  background: linear-gradient(155deg, #102030 0%, #0c1828 55%, #10141c 100%);
  box-shadow: 4px 4px 0 #0c4a6e, 0 0 16px #38bdf844;
}

.arsenal-switch-img {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 4px #a855f766);
}

.arsenal-switch-btn:not(.is-active) .arsenal-switch-img {
  opacity: 0.78;
  filter: grayscale(0.25) drop-shadow(0 0 2px #0008);
}

.arsenal-switch-btn--spells.is-active .arsenal-switch-img {
  filter: drop-shadow(0 0 6px #38bdf888);
}

.arsenal-switch-btn--pw.is-active .arsenal-switch-img {
  filter: drop-shadow(0 0 6px #f59e0b88);
}

.panel-title-with-ico {
  display: flex;
  align-items: center;
  gap: 8px;
}

.arsenal-switch-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.arsenal-switch-text strong {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.2;
}

.arsenal-switch-text em {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--dim);
  line-height: 1.25;
}

.arsenal-switch-btn.is-active .arsenal-switch-text em {
  color: #c4b5a8;
}

.pw-codex-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}
.pw-filter-chip {
  appearance: none;
  border: 2px solid #444;
  background: #1a1a22;
  color: #e7e5e4;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  min-height: 36px;
  cursor: pointer;
  touch-action: manipulation;
}
.pw-filter-chip.is-active {
  border-color: #f0c14b;
  box-shadow: 0 0 0 1px #f0c14b55;
  background: #2a2418;
}
.pw-filter-chip .mana { margin: 0; }

.codex-quest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.codex-section-title {
  margin: 16px 0 4px;
  font-size: 0.95rem;
  color: #e7e5e4;
}

.codex-bonus-strip {
  margin-bottom: 8px;
}

.codex-mission-block-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.codex-mission-block--done {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #2a2a38;
}

.codex-mission-block--done.hidden {
  display: none;
}

.codex-mission-block--done .codex-quest.done {
  opacity: 0.88;
}

.codex-mission-empty {
  margin: 0 0 4px;
}

.mastery-tracks {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mastery-track {
  background: #16161f;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 12px;
}

.m-track-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.m-track-head strong {
  display: block;
  font-size: 1rem;
}

.m-track-meta {
  display: block;
  font-size: 11px;
  color: #a8a29e;
  margin-top: 2px;
}

.m-level-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid #2a2a35;
  opacity: 0.55;
}

.m-level-row.is-reached {
  opacity: 1;
}

.m-level-badge {
  font-size: 12px;
  font-weight: 700;
  color: #fbbf24;
  padding-top: 2px;
}

.m-unlock-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m-unlock {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
}

.m-unlock-mark {
  width: 1rem;
  color: #57534e;
  flex-shrink: 0;
}

.m-unlock.is-done .m-unlock-mark {
  color: #86efac;
}

.m-unlock.is-future {
  opacity: 0.42;
}

.m-unlock.is-future .m-unlock-mark {
  color: #3f3f46;
}

.m-unlock-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.m-unlock-body strong {
  font-size: 13px;
}

.m-unlock-body em {
  font-style: normal;
  font-size: 11px;
  color: #a8a29e;
  line-height: 1.35;
}

.m-unlock.pw strong { color: #e7e5e4; }
.m-unlock.bonus strong { color: #c4b5fd; }
.m-unlock.quest strong { color: #fde68a; }
.m-unlock.dual strong { color: #7dd3fc; }

.codex-quest {
  background: #1c1c26;
  border: 1px solid #444;
  border-radius: 12px;
  padding: 12px;
}

.codex-quest.active { border-color: #a78bfa88; }
.codex-quest.done { border-color: #16653488; }
.codex-quest.locked { border-color: #444; opacity: 0.9; }

.codex-quest-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.codex-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  background: #292524;
  color: #a8a29e;
}

.codex-quest.active .codex-badge { background: #4c1d95; color: #e9d5ff; }
.codex-quest.done .codex-badge { background: #166534; color: #bbf7d0; }
.codex-quest.locked .codex-hint { color: #a8a29e; }

.codex-spells {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.codex-spell-group {
  background: #14141c;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 12px 14px;
}

.codex-spell-group h3 {
  font-size: 14px;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.color-panel-W { border-color: #d4c5a066; }
.color-panel-U { border-color: #0e68ab66; }
.color-panel-B { border-color: #546e7a66; }
.color-panel-R { border-color: #d3202a66; }
.color-panel-G { border-color: #00733e66; }
.color-panel-C { border-color: #c4b8a866; }
.color-panel-gold { border-color: #7b2cbf66; }
.color-panel-shared { border-color: #78716c66; }

.codex-spell-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.codex-spell {
  padding: 8px 0;
  border-top: 1px solid #2a2a35;
}
.codex-spell:first-child { border-top: none; padding-top: 0; }

.codex-spell-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.codex-spell-body {
  min-width: 0;
  flex: 1;
}

.spell-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 3px solid #444;
  background: #0a0a10;
  box-shadow: 2px 2px 0 #000;
  image-rendering: pixelated;
}

.spell-ico img,
.spell-ico svg {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.levelup-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 6px;
}

.levelup-pw-art {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0d0d12;
  border: 2px solid #2a2a38;
}

.levelup-card-main {
  min-width: 0;
  flex: 1;
}


.codex-spell-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.codex-spell-meta {
  font-size: 10px;
  color: #78716c;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.codex-spell-desc {
  font-size: 12px;
  color: #a8a29e;
  margin-top: 2px;
  line-height: 1.35;
}

.codex-spell-req {
  font-size: 11px;
  color: #57534e;
  margin-top: 2px;
}

.affinity-notes { margin-top: 10px; font-size: 12px; color: #fbbf24; }
.affinity-notes p { margin: 4px 0; }

.quest-box {
  background: #1a1a24;
  border: 3px solid #d3202a66;
  border-radius: 0;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 3px 3px 0 #000;
}
.quest-box strong { color: #ff7043; display: block; margin-bottom: 4px; font-family: var(--font-ui); }
.quest-box.district-izzet { border-color: #0e68ab88; }
.quest-box.district-izzet strong { color: #4fc3f7; }
.quest-box.district-orzhov { border-color: #9e9e9e88; }
.quest-box.district-orzhov strong { color: #e0e0e0; }
.quest-obj { font-size: 12px; color: #a78bfa; margin-top: 6px; }
.quest-muted { font-size: 12px; color: #57534e; }
.quest-hint { font-size: 12px; color: #fbbf24; margin-top: 6px; }
.quest-done { font-size: 12px; color: #86efac; margin-bottom: 6px; }
.quest-results { background: #16653433; border: 3px solid #166534; border-radius: 0; padding: 12px; margin-bottom: 12px; box-shadow: 3px 3px 0 #000; }
.quest-results p { color: #bbf7d0; font-size: 13px; margin: 4px 0; }

.result-section {
  text-align: left;
  margin: 16px 0;
  padding: 14px;
  border-radius: 10px;
  border: 2px solid #292524;
  background: #16161d;
}
.result-section--run {
  border-color: #166534;
  background: #16653422;
}
.result-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #78716c;
  margin: 0 0 10px;
  text-align: center;
}
.result-section--run .result-section-title { color: #86efac; }

.result-section--damage {
  border-color: #92400e;
  background: #78350f18;
  text-align: left;
}

.result-section--damage .result-section-title { color: #fbbf24; }

.result-damage-total {
  margin: -4px 0 12px;
  font-size: 12px;
  color: #78716c;
  text-align: center;
}

.result-damage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-damage-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-damage-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.result-damage-name {
  font-weight: 600;
  color: #e7e5e4;
}

.result-damage-val {
  color: #fbbf24;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.result-damage-val small {
  color: #78716c;
  font-weight: 500;
}

.result-damage-bar-wrap {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: #1c1c26;
  overflow: hidden;
}

.result-damage-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b45309, #fbbf24);
  min-width: 4px;
}

.result-goals {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-goal {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 14px;
  position: relative;
}
.result-goal::before {
  content: '▸';
  position: absolute;
  left: 0;
  top: 0;
  color: #a78bfa;
  font-size: 12px;
}
.result-section--run .result-goal::before { color: #86efac; }
.result-goal-title {
  font-size: 13px;
  color: #e7e5e4;
  line-height: 1.35;
}
.result-goal-detail {
  font-size: 12px;
  color: #a8a29e;
  line-height: 1.35;
}
.result-unlock-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.result-unlock-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fbbf24;
  margin: 0 0 6px;
}
.result-all-done {
  color: #86efac;
  font-size: 13px;
  margin: 16px 0 24px;
}
.result-xp {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}
.result-xp-pill {
  display: inline-block;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #292524;
  color: #e7e5e4;
}

.outfit-row {
  margin-top: 8px;
  padding-left: 4px;
}

.outfit-grid {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

.pw-outfit-block {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pw-outfit-block + .pw-outfit-block {
  margin-top: 4px;
}

.pw-card-wrap {
  position: relative;
}

.pw-switch {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 6px 10px;
  border: 2px solid #888;
  background: #1a1a24;
  color: #f0ebe0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 2px 2px 0 #000;
  line-height: 1.1;
}

.pw-switch:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 #000;
}

.pick-sprite-lg {
  width: 72px;
  height: 72px;
}

.vestment-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #78716c;
  margin: 12px 0 8px;
  font-family: var(--font-ui);
}

.vest-pip-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 4px;
  padding-left: 2px;
}

.vest-pip {
  width: 28px;
  height: 28px;
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
}

.vest-pip.is-on {
  opacity: 1;
  outline: 2px solid #f4d35e;
  outline-offset: 1px;
}

.vest-pip:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 #000;
}

.vest-mana-inline {
  display: inline-flex;
  width: 18px;
  height: 18px;
  font-size: 10px;
  vertical-align: middle;
  margin-left: 6px;
  border: 1px solid #000;
}

.vest-chevron {
  margin-left: auto;
  align-self: center;
  font-size: 18px;
  color: #a8a29e;
  padding: 0 6px;
}

.vest-expand.hidden {
  display: none;
}

.vestment-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.vestment-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: #1c1c26;
  border: 3px solid #444;
  border-radius: 0;
  color: #e8e6e3;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  min-height: 44px;
  box-shadow: 2px 2px 0 #000;
  font-family: var(--font-ui);
}

.vestment-chip img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.vestment-chip.selected {
  background: #22222f;
  box-shadow: 2px 2px 0 #000, 0 0 0 2px #fff4;
}

.vestment-chip:active {
  transform: scale(0.97);
}

.look-row {
  display: flex;
  gap: 8px;
  margin: 0 0 10px;
}

.look-chip {
  flex: 1;
  padding: 8px 10px;
  border: 2px solid #3a3a4a;
  background: #16161f;
  color: #e8e4d8;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  image-rendering: pixelated;
}

.look-chip.selected {
  border-color: #f4d35e;
  background: #22222f;
  box-shadow: 2px 2px 0 #000;
}

.look-swatch .swatch {
  display: block;
  width: 28px;
  height: 28px;
  border: 2px solid #000;
  box-shadow: inset 0 0 0 1px #fff3;
}

.look-grid {
  margin-bottom: 8px;
}

.pick-passive.muted,
.look-hint {
  opacity: 0.65;
  font-size: 11px;
}

.look-setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #0a0a12ee;
}

.look-setup-card {
  width: min(420px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #16161f;
  border: 3px solid #f4d35e;
  box-shadow: 4px 4px 0 #000;
  padding: 16px;
}

.look-first-title {
  font-size: 1.1rem;
  margin: 0 0 6px;
  color: #f4d35e;
}

.look-preview-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 12px;
}

.look-preview {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  background: #0a0a12;
  border: 2px solid #333;
}

.look-save-btn {
  width: 100%;
  margin-top: 12px;
}

.legend-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 9px;
  letter-spacing: 0.06em;
  vertical-align: middle;
  color: #1a1208;
  background: linear-gradient(180deg, #f4d35e, #c9a227);
  border: 1px solid #000;
  box-shadow: 1px 1px 0 #000;
}

@media (max-width: 480px) {
  .vestment-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pick-card {
  text-align: left;
  background: #1c1c26;
  border: 3px solid #444;
  border-radius: 0;
  padding: 12px;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.08s;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 3px 3px 0 #000;
  font-family: var(--font-body);
}

.pick-card:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 #000;
}

.pick-card.selected {
  background: #22222f;
  box-shadow: 3px 3px 0 #000, 0 0 0 2px #fff3;
}

.pick-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.pick-card.locked.hidden-pw .pick-sprite {
  filter: brightness(0);
  opacity: 0.75;
}

.pick-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.pick-sprite {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0d0d12;
  border-radius: 0;
  border: 2px solid #2a2a38;
}
.pick-text { min-width: 0; }
.pick-name { display: block; font-weight: 700; font-size: 14px; font-family: var(--font-ui); }
.pick-title { display: block; font-size: 11px; color: #a8a29e; margin-top: 2px; }
.pick-passive, .pick-active { display: block; font-size: 11px; color: #78716c; margin-top: 4px; }
.lock-tag { display: block; font-size: 11px; color: #fbbf24; margin-top: 6px; }

.mastery-grid { display: flex; flex-direction: column; gap: 8px; }

.mastery-row {
  display: grid;
  grid-template-columns: 72px 1fr 40px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.m-bar {
  height: 8px;
  background: #292524;
  border-radius: 4px;
  overflow: hidden;
}

.m-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }

.color-R { color: #ff7043; }
.color-U { color: #4fc3f7; }
.color-W { color: #f5f5dc; }
.color-B { color: #78909c; }
.color-G { color: #66bb6a; }

.color-R-fill { background: #d3202a; }
.color-U-fill { background: #0e68ab; }
.color-W-fill { background: #d4c5a0; }
.color-B-fill { background: #37474f; }
.color-G-fill { background: #00733e; }

.stats-row {
  margin-top: 12px;
  font-size: 12px;
  color: #78716c;
}

.hub-footer {
  text-align: center;
  margin-top: 22px;
  position: sticky;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 5;
  padding: 8px 0 4px;
}

.btn-primary {
  position: relative;
  overflow: hidden;
  background: #b81c24;
  color: #fff;
  border: 3px solid #ff6b5a;
  padding: 16px 28px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 0;
  cursor: pointer;
  letter-spacing: 0.06em;
  min-height: 52px;
  width: min(100%, 360px);
  font-family: var(--font-pixel);
  text-transform: uppercase;
  box-shadow: 4px 4px 0 #000, 0 0 20px #d3202a44;
}

.btn-primary-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, #ffffff33 50%, transparent 70%);
  transform: translateX(-120%);
  animation: btn-shine 3.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btn-shine {
  0%, 60% { transform: translateX(-120%); }
  80% { transform: translateX(120%); }
  100% { transform: translateX(120%); }
}

.btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

.btn-secondary {
  background: #1c1c28;
  color: #e8e6e3;
  border: 3px solid #4fc3f7;
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 0;
  cursor: pointer;
  letter-spacing: 0.04em;
  min-height: 48px;
  font-family: var(--font-ui);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 #000;
}

.btn-secondary:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 #000;
}

.btn-secondary:disabled {
  opacity: 0.55;
  cursor: wait;
}

.settings-block {
  margin-top: 8px;
  margin-bottom: 18px;
}

.settings-danger {
  padding-top: 12px;
  border-top: 2px solid #5a2020;
}

.settings-danger .panel-subh {
  color: #ef9a9a;
}

.btn-danger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #1a1010;
  color: #ffcdd2;
  border: 3px solid #c62828;
  padding: 12px 20px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 0;
  cursor: pointer;
  letter-spacing: 0.04em;
  min-height: 48px;
  min-width: 220px;
  font-family: var(--font-ui);
  text-transform: uppercase;
  box-shadow: 3px 3px 0 #000;
  user-select: none;
  touch-action: none;
}

.btn-danger-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, #8b1515, #e53935);
  opacity: 0.85;
  pointer-events: none;
  transition: none;
}

.btn-danger-label {
  position: relative;
  z-index: 1;
}

.btn-danger.is-holding {
  border-color: #ff7043;
  color: #fff;
}

.btn-danger:disabled {
  opacity: 0.6;
  cursor: wait;
}

.settings-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 12px;
}

.changelog-fix-list {
  padding-left: 18px;
  margin: 0 0 18px;
}

.changelog-fix-list li {
  margin-bottom: 6px;
}

.changelog-spell-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.changelog-spell-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.changelog-spell-row:last-child {
  border-bottom: none;
}

.changelog-spell-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.changelog-spell-info .settings-desc {
  margin-bottom: 0;
}

.settings-status {
  margin-top: 10px;
}

.settings-slider-row {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.settings-slider-row label { font-size: 11px; color: var(--muted); }
.settings-slider-row input[type="range"] { width: 100%; accent-color: var(--gold); }

.settings-dev {
  border-color: #7b2cbf66;
  background: linear-gradient(135deg, #1a1228 0%, #1c1c26 100%);
}

.panel-sprite-showcase {
  max-width: 1100px;
}

.sprite-showcase-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #333;
}

.sprite-showcase-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.sprite-showcase-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sprite-showcase-section-head .panel-subh {
  margin: 0;
  border: none;
  padding: 0;
}

.sprite-showcase-count {
  font-size: 11px;
  color: #ffe082;
  background: #2a2410;
  border: 1px solid #665522;
  border-radius: 999px;
  padding: 2px 8px;
}

.sprite-showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.sprite-showcase-card {
  background: #14141c;
  border: 2px solid #3a3a48;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.sprite-showcase-card:hover {
  border-color: #7b2cbf;
}

.sprite-showcase-card.sprite-showcase-copied {
  border-color: #66bb6a;
}

.sprite-showcase-thumb {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a10;
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
}

.sprite-showcase-thumb.sprite-showcase-missing {
  background: repeating-linear-gradient(
    45deg,
    #2a1010,
    #2a1010 6px,
    #1a0808 6px,
    #1a0808 12px
  );
}

.sprite-showcase-thumb img {
  max-width: 100%;
  max-height: 76px;
  object-fit: contain;
}

/* Strip 4×32: mostra il 1° frame a dimensione leggibile (non tutta la striscia schiacciata) */
.sprite-showcase-thumb--strip {
  overflow: hidden;
}
.sprite-showcase-thumb--strip img {
  width: 128px;
  height: 32px;
  max-width: none;
  max-height: none;
  object-fit: none;
  object-position: 0 0;
  transform: scale(2);
  transform-origin: left center;
  margin-right: 96px; /* spazio per lo scale 2× sul primo cell */
}

.sprite-showcase-thumb--aura img {
  max-height: 64px;
}

.sprite-showcase-badge.is-catalog {
  color: #90a4ae;
  border-color: #546e7a;
}

  display: block;
  font-size: 10px;
  color: #ffe082;
  word-break: break-all;
  line-height: 1.35;
}

.sprite-showcase-label {
  display: block;
  font-size: 11px;
  color: #e0e0e0;
  margin-top: 2px;
}

.sprite-showcase-path {
  display: block;
  font-size: 9px;
  color: #777;
  word-break: break-all;
  margin-top: 4px;
  line-height: 1.3;
}

.sprite-showcase-meta {
  display: block;
  font-size: 9px;
  color: #9ccc65;
  margin-top: 3px;
  line-height: 1.3;
}

.sprite-showcase-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.sprite-showcase-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 999px;
  line-height: 1.2;
}

.sprite-showcase-badge.is-used {
  background: #14532d;
  color: #bbf7d0;
  border: 1px solid #166534;
}

.sprite-showcase-badge.is-missing-file {
  background: #7c2d12;
  color: #ffedd5;
  border: 1px solid #c2410c;
}

.sprite-showcase-card.sprite-showcase-unused {
  border-color: #57534e;
  opacity: 0.85;
}

.sprite-showcase-thumb.sprite-showcase-missing::after {
  content: 'PNG mancante';
  position: absolute;
  font-size: 9px;
  color: #fecaca;
  text-align: center;
  padding: 0 4px;
}

.sprite-showcase-thumb {
  position: relative;
}

.logout-link {
  color: #a8a29e;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.logout-link:hover { color: #e8e6e3; }

.hint {
  margin-top: 12px;
  font-size: 12px;
  color: #57534e;
}

/* Results */
.results {
  max-width: 520px;
  margin: 60px auto;
  text-align: center;
  padding: 24px;
}

.results h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.result-char {
  margin: 0 0 20px;
  color: #a8a29e;
  font-size: 14px;
}
.result-char strong {
  color: #f5f5f4;
  font-weight: 600;
}

.result-whisper {
  margin: -12px 0 20px;
  font-size: 13px;
  font-style: italic;
  color: #78716c;
  letter-spacing: 0.02em;
  line-height: 1.45;
  opacity: 0.92;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.result-grid div {
  background: #16161d;
  border-radius: 10px;
  padding: 16px 8px;
  font-size: 14px;
}

.result-grid strong { color: #78716c; font-size: 11px; text-transform: uppercase; }

.xp-gain { color: #a78bfa; margin-bottom: 8px; }
.unlock-hint { color: #78716c; font-size: 13px; margin-bottom: 24px; }
.result-section--next { margin-bottom: 24px; }

.results .btn-primary { margin-top: 8px; }

/* —— Story VN / slice-of-life dialogue —— */
.story-vn {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.22s ease;
  font-family: var(--font-ui);
  color: #f5f0e8;
}
.story-vn.is-open { opacity: 1; }
.story-vn.is-closing { opacity: 0; pointer-events: none; }

.story-vn-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #12101a;
  filter: saturate(0.85) brightness(0.9);
}

.story-vn-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.story-vn-actor {
  position: absolute;
  bottom: 18%;
  width: min(52vw, 420px);
  height: min(78vh, 640px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transition: opacity 0.28s ease, transform 0.28s ease, filter 0.28s ease;
  filter: brightness(0.72);
}
.story-vn-actor--left { left: 0; }
.story-vn-actor--right { right: 0; }
.story-vn-actor.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: brightness(1);
}
.story-vn-actor img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.55));
  pointer-events: none;
  user-select: none;
}

/* Modalità a 3 attori (es. scena Eldrazi): slot "back" piccolo/dietro, in alto al centro,
   gli attori si accumulano invece di sostituirsi — evidenziato solo chi parla ora. */
.story-vn-actor--back {
  bottom: auto;
  top: 3%;
  left: 50%;
  right: auto;
  width: min(44vw, 340px);
  height: min(56vh, 440px);
  z-index: 0;
  transform: translate(-50%, -14px) scale(0.85);
}
.story-vn-actor--back.is-active { transform: translate(-50%, 0) scale(0.85); }
.story-vn.is-actors3 .story-vn-actor--left,
.story-vn.is-actors3 .story-vn-actor--right { z-index: 1; }
.story-vn.is-actors3 .story-vn-actor.is-active:not(.is-speaking) { filter: brightness(0.55); }
.story-vn.is-actors3 .story-vn-actor.is-speaking { filter: brightness(1); }

/* Scena "classica" a 3 posizioni (accumulate:false): un solo Eldrazi in scena alla volta,
   a piena taglia — anche il centro (slot "back") usa le stesse dimensioni di sinistra/destra. */
.story-vn.is-swap3 .story-vn-actor--back {
  bottom: 18%;
  top: auto;
  width: min(52vw, 420px);
  height: min(78vh, 640px);
  z-index: 1;
  transform: translate(-50%, 18px) scale(0.96);
}
.story-vn.is-swap3 .story-vn-actor--back.is-active { transform: translate(-50%, 0) scale(1); }
/* Emrakul (centro): più in alto e deliberatamente più grande dello schermo — sborda
   leggermente dai bordi (tagliata dall'overflow:hidden dello stage) per incutere terrore. */
.story-vn.is-swap3 .story-vn-actor--back[data-eldrazi="emrakul"] {
  bottom: 30%;
  width: min(100vw, 780px);
  height: min(88vh, 760px);
  transform: translate(-50%, 18px) scale(1.15);
}
.story-vn.is-swap3 .story-vn-actor--back[data-eldrazi="emrakul"].is-active {
  transform: translate(-50%, 0) scale(1.15);
}

.story-vn-box {
  position: relative;
  z-index: 2;
  margin: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
  padding: 14px 16px 18px;
  min-height: 118px;
  background: linear-gradient(180deg, #1a1624ee, #0e0c14f2);
  border: 3px solid #c4a574;
  box-shadow: 4px 4px 0 #000, inset 0 0 0 1px #3a3428;
  cursor: pointer;
}
.story-vn-name {
  display: inline-block;
  margin: -28px 0 8px;
  padding: 5px 12px;
  background: #2a2218;
  border: 2px solid #c4a574;
  color: #f0d9a8;
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: 0.04em;
  box-shadow: 2px 2px 0 #000;
}
.story-vn-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: #f5f0e8;
  min-height: 3.2em;
}
.story-vn-next {
  position: absolute;
  right: 14px;
  bottom: 10px;
  color: #c4a574;
  font-size: 12px;
  opacity: 0;
  animation: story-vn-blink 0.9s steps(2, end) infinite;
}
.story-vn-next.is-visible { opacity: 1; }
@keyframes story-vn-blink {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

.story-vn-skip {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 3;
  background: #16161dcc;
  border: 2px solid #444;
  color: #a8a29e;
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  box-shadow: 2px 2px 0 #000;
}
.story-vn-skip:active { transform: translate(1px, 1px); }

.district-talk-btn {
  align-self: flex-start;
  margin-top: 8px;
  padding: 6px 12px;
  font-size: 12px;
}

@media (max-width: 700px) {
  .story-vn-actor {
    width: min(78vw, 360px);
    height: min(62vh, 480px);
    bottom: 22%;
  }
  .story-vn-actor--back {
    width: min(64vw, 300px);
    height: min(47vh, 360px);
    bottom: auto;
    top: 2%;
  }
  /* Modalità a 3: su schermi stretti sinistra+destra insieme sforerebbero il 78vw
     l'una nell'altra — restringere solo qui, il 2-attori normale non ne ha bisogno
     (mostra sempre un solo lato alla volta). Margine largo perché le creature Eldrazi
     hanno artigli/tentacoli che arrivano fino al bordo del riquadro (verificato con
     screenshot reale: un piccolo gap tra i box non basta, si toccano comunque). */
  .story-vn.is-actors3 .story-vn-actor--left,
  .story-vn.is-actors3 .story-vn-actor--right {
    width: min(41vw, 178px);
    height: min(53vh, 380px);
  }
  /* Scena "classica" (accumulate:false): un solo Eldrazi alla volta, nessun rischio di
     sovrapposizione — il centro usa la stessa taglia piena di sinistra/destra. */
  .story-vn.is-swap3 .story-vn-actor--left,
  .story-vn.is-swap3 .story-vn-actor--right {
    width: min(78vw, 360px);
    height: min(62vh, 480px);
  }
  .story-vn.is-swap3 .story-vn-actor--back {
    width: min(78vw, 360px);
    height: min(62vh, 480px);
    bottom: 22%;
    top: auto;
  }
  .story-vn.is-swap3 .story-vn-actor--back[data-eldrazi="emrakul"] {
    bottom: 32%;
    width: min(112vw, 460px);
    height: min(58vh, 440px);
    transform: translate(-50%, 18px) scale(1.1);
  }
  .story-vn.is-swap3 .story-vn-actor--back[data-eldrazi="emrakul"].is-active {
    transform: translate(-50%, 0) scale(1.1);
  }
  .story-vn-text { font-size: 14px; }
}

/* Dev sandbox combattimento */
.dev-sandbox-section {
  margin-bottom: 20px;
}
.dev-sandbox-section-title {
  margin: 0 0 10px;
  font-size: 12px;
  color: #ffe082;
  font-family: 'Silkscreen', monospace;
  letter-spacing: 0.04em;
}
.dev-sandbox-char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  max-height: min(36vh, 280px);
  overflow-y: auto;
  margin-top: 8px;
  padding-right: 4px;
}
.dev-sandbox-char-card {
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 8px 10px;
  border: 2px solid #3a3a48;
  border-radius: 10px;
  background: #14141c;
  color: inherit;
  cursor: pointer;
  width: 100%;
}
.dev-sandbox-char-card:hover { border-color: #7b2cbf; }
.dev-sandbox-char-card.is-selected {
  border-color: #f0c14b;
  background: #1f1a10;
}
.dev-sandbox-char-sprite {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: pixelated;
}
.dev-sandbox-char-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.dev-sandbox-char-name { font-size: 13px; color: #fff; font-weight: 600; }
.dev-sandbox-char-title { font-size: 10px; color: #a8a29e; }
.dev-sandbox-char-passive { font-size: 10px; color: #78716c; line-height: 1.3; }

.dev-sandbox-pause {
  position: absolute;
  left: 50%;
  top: max(8px, env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 80;
  width: min(460px, 96vw);
  max-height: min(58vh, 520px);
  overflow-y: auto;
  pointer-events: none;
}
.dev-sandbox-pause.hidden { display: none; }
.dev-sandbox-pause-panel {
  pointer-events: auto;
  background: #12121af0;
  border: 2px solid #d4af37;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 11px;
  color: #d6d3d1;
  line-height: 1.45;
}
.dev-sandbox-pause-meta {
  margin: 0 0 10px;
  text-align: center;
  color: #a8a29e;
  font-size: 10px;
}
.dev-sandbox-pause-block {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #2a2a38;
}
.dev-sandbox-pause-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.dev-sandbox-pause-block h4 {
  margin: 0 0 6px;
  font-size: 10px;
  color: #fbbf24;
  font-family: 'Silkscreen', monospace;
  letter-spacing: 0.05em;
}
.dev-sandbox-pause-name { margin: 0 0 4px; color: #fff; font-size: 13px; }
.dev-sandbox-pause-desc { margin: 0 0 8px; color: #a8a29e; font-size: 11px; }
.dev-sandbox-pause-now { margin: 0 0 6px; color: #fef08a; font-size: 11px; }
.dev-sandbox-pause-next { margin: 0 0 8px; color: #86efac; font-size: 11px; }
.dev-sandbox-pause-levels {
  margin: 0;
  padding: 0;
  list-style: none;
}
.dev-sandbox-pause-lv {
  margin: 0 0 6px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 10px;
  color: #78716c;
  line-height: 1.4;
}
.dev-sandbox-pause-lv.is-current {
  background: #292524;
  color: #fef08a;
}
.dev-sandbox-pause-lv.is-next {
  background: #14532d44;
  color: #86efac;
}
.dev-sandbox-pause-lv-num {
  display: inline-block;
  min-width: 2.2em;
  color: inherit;
  opacity: 0.85;
}

.dev-sandbox-picker-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 12px 0 16px;
  align-items: flex-end;
}
.dev-sandbox-search-label,
.dev-sandbox-level-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  min-width: 160px;
  flex: 1;
}
.dev-sandbox-search {
  padding: 8px 10px;
  border: 2px solid #3a3a48;
  border-radius: 8px;
  background: #0a0a10;
  color: #f5f0e8;
  font-family: inherit;
  font-size: 13px;
}
.dev-sandbox-hud-pw {
  margin: 0 0 8px;
  font-size: 10px;
  color: #a8a29e;
  line-height: 1.35;
}
.dev-sandbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  margin-bottom: 16px;
  padding-right: 4px;
}
.dev-sandbox-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  padding: 10px 12px;
  border: 2px solid #3a3a48;
  border-radius: 10px;
  background: #14141c;
  color: inherit;
  cursor: pointer;
  width: 100%;
}
.dev-sandbox-card:hover { border-color: #7b2cbf; }
.dev-sandbox-card.is-selected {
  border-color: #f0c14b;
  background: #1f1a10;
}
.dev-sandbox-card-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dev-sandbox-card-icon .spell-ico {
  width: 22px !important;
  height: 22px !important;
}
.dev-sandbox-card-icon .spell-ico img {
  width: 16px !important;
  height: 16px !important;
}
.dev-sandbox-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dev-sandbox-card-name { font-size: 14px; color: #fff; }
.dev-sandbox-card-meta { font-size: 10px; color: #ffe082; }
.dev-sandbox-card-desc { font-size: 11px; color: #78716c; line-height: 1.35; }
.dev-sandbox-launch { width: 100%; max-width: 280px; }

.dev-sandbox-hud {
  position: absolute;
  left: max(8px, env(safe-area-inset-left));
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 50;
  pointer-events: none;
  max-width: min(96vw, 420px);
}
.dev-sandbox-hud.is-paused,
.dev-sandbox-hud.hidden { display: none; }
.dev-sandbox-hud-panel {
  pointer-events: auto;
  touch-action: manipulation;
  background: rgba(10, 10, 16, 0.94);
  border: 2px solid #7b2cbf88;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 10px;
  color: #d6d3d1;
  box-shadow: 0 4px 16px #000000aa;
}
.dev-sandbox-hud-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.dev-sandbox-hud-title-row {
  margin-bottom: 4px;
  justify-content: space-between;
}
.dev-sandbox-hud-title {
  font-size: 11px;
  color: #f0c14b;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58vw;
}
.dev-sandbox-hud-lv { color: #a8a29e; }
.dev-sandbox-hud-lv strong { color: #fff; }
.dev-sandbox-hud-stats {
  margin-bottom: 6px;
  color: #78716c;
  gap: 6px 10px;
}
.dev-sandbox-hud-stats strong { color: #e7e5e4; }
.dev-sandbox-coins { color: #d4af37; }
.dev-sandbox-coins strong { color: #fde68a; }
.dev-sandbox-coins.hidden { display: none; }
.dev-sandbox-hud-hint {
  margin: 0 0 6px;
  font-size: 9px;
  color: #78716c;
  line-height: 1.3;
}
.dev-sandbox-hud-hint.has-lifesteal {
  color: #66bb6a;
}
.dev-sandbox-hud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dev-sandbox-btn {
  flex: 0 0 auto;
  padding: 5px 8px;
  font-size: 10px;
  font-family: inherit;
  border: 2px solid #3a3a48;
  border-radius: 6px;
  background: #1c1c26;
  color: #f5f0e8;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.dev-sandbox-btn:active { transform: translateY(1px); }
.dev-sandbox-btn:disabled { opacity: 0.45; cursor: default; }
.dev-sandbox-btn-exit {
  border-color: #7f1d1d;
  color: #fca5a5;
}
.dev-sandbox-btn-kill {
  border-color: #854d0e;
  color: #fde68a;
}
.dev-sandbox-btn.is-on {
  background: #14532d;
  border-color: #22c55e;
  color: #bbf7d0;
}

