/* Vampire Castle Siege — 16-Bit Gothic Horror-Action Styling */
:root {
  --bg: #0a0812;
  --panel: rgba(16, 13, 28, 0.94);
  --panel-solid: #120f20;
  --panel-hi: rgba(31, 24, 52, 0.92);
  --border: rgba(148, 132, 184, 0.28);
  --crimson: #dc2626;
  --crimson-hi: #ef4444;
  --gold: #f59e0b;
  --gold-hi: #fbbf24;
  --cyan: #38bdf8;
  --text: #f3f0fa;
  --muted: #a69ec0;
  --footer-h: 42px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.hidden {
  display: none !important;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

.stage-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  background: #0d0a16;
}

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

/* --- HUD --- */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.xp-bar-shell {
  position: relative;
  width: 100%;
  height: 18px;
  background: rgba(8, 6, 16, 0.92);
  border-bottom: 1px solid rgba(96, 165, 250, 0.35);
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1d4ed8, #38bdf8, #a5f3fc);
  transition: width 0.14s ease-out;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.65);
}

.xp-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #f8fafc;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.hud-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 12px 0;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 150px;
  max-width: 38%;
}

.hp-shell {
  position: relative;
  width: 185px;
  max-width: 100%;
  height: 20px;
  background: rgba(15, 8, 18, 0.9);
  border: 1px solid rgba(239, 68, 68, 0.55);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #991b1b, #dc2626, #f87171);
  transition: width 0.12s ease-out;
}

.hp-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

.loadout-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.slot-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(15, 12, 26, 0.85);
  border: 1px solid rgba(148, 132, 184, 0.35);
  font-size: 10.5px;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1.1;
}

.slot-pill.evolved {
  border-color: #fbbf24;
  background: linear-gradient(135deg, rgba(185, 28, 28, 0.88), rgba(146, 64, 14, 0.88));
  color: #fef3c7;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.45);
}

.slot-pill.passive {
  border-color: rgba(56, 189, 248, 0.42);
  color: #bae6fd;
}

.slot-pill img {
  width: 14px;
  height: 14px;
  image-rendering: pixelated;
  object-fit: contain;
}

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.timer-display {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fef3c7;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9), 0 0 12px rgba(220, 38, 38, 0.45);
  line-height: 1;
}

.wave-pill {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(15, 11, 28, 0.82);
  border: 1px solid rgba(245, 158, 11, 0.38);
  color: #fde68a;
  white-space: nowrap;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.stat-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(15, 11, 26, 0.86);
  border: 1px solid rgba(148, 132, 184, 0.3);
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
  white-space: nowrap;
}

.chip-gold {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.chip-kills {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.hud-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(148, 132, 184, 0.38);
  background: rgba(16, 13, 28, 0.9);
  color: #f8fafc;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.icon-btn:hover {
  border-color: var(--gold-hi);
  transform: translateY(-1px);
}

/* Boss Bar */
.boss-hud {
  align-self: center;
  width: min(460px, 86vw);
  background: rgba(18, 8, 18, 0.92);
  border: 1px solid rgba(239, 68, 68, 0.65);
  border-radius: 10px;
  padding: 6px 10px;
  box-shadow: 0 6px 24px rgba(220, 38, 38, 0.35);
}

.boss-hud-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fecaca;
  margin-bottom: 4px;
}

.boss-bar-track {
  width: 100%;
  height: 10px;
  background: #1f0a12;
  border-radius: 999px;
  overflow: hidden;
}

.boss-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #b91c1c, #ef4444, #f59e0b);
  transition: width 0.1s linear;
}

.hud-challenge {
  align-self: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(146, 64, 14, 0.88);
  border: 1px solid #fbbf24;
  color: #fef3c7;
  font-size: 11px;
  font-weight: 800;
}

.event-banner {
  align-self: center;
  margin-top: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(153, 27, 27, 0.95), rgba(127, 29, 29, 0.95));
  border: 1px solid #fca5a5;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 6px 24px rgba(220, 38, 38, 0.55);
  animation: bannerPulse 0.35s ease;
}

@keyframes bannerPulse {
  from { transform: scale(0.86); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- Modals (always position: fixed so mobile & studio-bar never clip) --- */
.modal-backdrop {
  position: fixed;
  inset: 0 0 var(--footer-h) 0;
  z-index: 40;
  background: radial-gradient(circle at 50% 30%, rgba(28, 12, 34, 0.72), rgba(7, 5, 14, 0.88));
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
}

.card {
  width: 100%;
  max-width: 600px;
  max-height: 100%;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(24, 18, 42, 0.97), rgba(13, 10, 24, 0.98));
  border: 1px solid rgba(220, 38, 38, 0.42);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.78), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.title-crest {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.crest-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.badge-gold {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.5);
}

.badge-crimson {
  background: rgba(220, 38, 38, 0.28);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.6);
}

.game-title {
  margin: 0;
  font-size: clamp(22px, 4.5vw, 31px);
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff7ed 0%, #fbbf24 55%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.game-subtitle {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 480px;
  line-height: 1.35;
}

.challenge-banner {
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(146, 64, 14, 0.35), rgba(185, 28, 28, 0.35));
  border: 1px solid rgba(251, 191, 36, 0.55);
  color: #fef3c7;
  font-size: 12.5px;
  font-weight: 800;
  text-align: center;
}

/* Mode Selector */
.mode-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 11px;
  border-radius: 11px;
  background: rgba(28, 22, 48, 0.72);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.12s ease;
}

.mode-btn:hover {
  border-color: rgba(251, 191, 36, 0.6);
}

.mode-btn.active {
  background: linear-gradient(135deg, rgba(153, 27, 27, 0.42), rgba(30, 22, 52, 0.92));
  border-color: #ef4444;
  box-shadow: 0 0 14px rgba(220, 38, 38, 0.25);
}

.mode-title {
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.streak-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.45);
}

/* Hunter Grid */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.section-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.gold-bank {
  font-size: 12.5px;
  font-weight: 800;
  color: #fde68a;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
}

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

.hunter-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 9px 7px;
  border-radius: 12px;
  background: rgba(24, 19, 42, 0.85);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
  transition: transform 0.13s ease, border-color 0.13s ease, background 0.13s ease;
}

.hunter-card:hover {
  border-color: var(--gold-hi);
  transform: translateY(-1px);
}

.hunter-card.selected {
  border-color: var(--gold-hi);
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.45), rgba(24, 19, 42, 0.95));
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.25);
}

.hunter-card.locked {
  opacity: 0.86;
}

.hunter-sprite-box {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  background: radial-gradient(circle, rgba(56, 40, 88, 0.65), rgba(14, 10, 26, 0.92));
  border: 1px solid rgba(148, 132, 184, 0.24);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hunter-sprite-box img {
  max-width: 48px;
  max-height: 48px;
  image-rendering: pixelated;
}

.hunter-name {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.hunter-role {
  font-size: 10.5px;
  color: #fde68a;
  font-weight: 700;
}

.hunter-perk {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.25;
}

.hunter-unlock-tag {
  margin-top: 2px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(245, 158, 11, 0.22);
  border: 1px solid rgba(251, 191, 36, 0.55);
  color: #fef3c7;
}

/* Buttons */
.cta-row {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.secondary-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
}

.btn {
  font-family: inherit;
  border: none;
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  border: 1px solid rgba(252, 165, 165, 0.45);
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.4);
  font-size: 15px;
  padding: 13px 18px;
}

.btn-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #140b02;
  border: 1px solid #fde68a;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
}

.btn-crimson {
  background: linear-gradient(135deg, #7c2d12, #991b1b);
  color: #fef3c7;
  border: 1px solid #f59e0b;
}

.btn-secondary {
  background: rgba(36, 28, 64, 0.9);
  color: #f3f0fa;
  border: 1px solid rgba(148, 132, 184, 0.35);
}

.btn-ghost {
  background: rgba(20, 16, 36, 0.75);
  color: #cbd5e1;
  border: 1px solid rgba(148, 132, 184, 0.25);
}

.btn-sm {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
}

/* Level-Up Cards */
.modal-card {
  max-width: 640px;
}

.modal-head {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
}

.modal-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

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

.upgrade-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 7px;
  padding: 13px 10px;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(32, 24, 58, 0.95), rgba(17, 13, 32, 0.98));
  border: 1px solid rgba(148, 132, 184, 0.35);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.13s ease, border-color 0.13s ease, box-shadow 0.13s ease;
}

.upgrade-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-hi);
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.25);
}

.upgrade-icon-box {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: rgba(10, 8, 20, 0.9);
  border: 1px solid rgba(251, 191, 36, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
}

.upgrade-icon-box img {
  width: 44px;
  height: 44px;
  image-rendering: pixelated;
  object-fit: contain;
}

.upgrade-lv {
  font-size: 10px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.45);
}

.upgrade-lv.is-new {
  background: rgba(52, 211, 153, 0.2);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.5);
}

.upgrade-name {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.upgrade-desc {
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.3;
  flex: 1;
}

.upgrade-synergy {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 7px;
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.32);
}

/* Chest Modal */
.chest-card {
  max-width: 440px;
  text-align: center;
  border-color: rgba(251, 191, 36, 0.72);
  box-shadow: 0 0 48px rgba(245, 158, 11, 0.28);
}

.chest-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
}

.chest-reward-icon {
  width: 74px;
  height: 74px;
  border-radius: 16px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.32), rgba(16, 12, 28, 0.95));
  border: 2px solid #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chest-reward-icon img {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
  object-fit: contain;
}

.chest-desc {
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.4;
}

.chest-gold-tag {
  font-size: 13px;
  font-weight: 800;
  color: #fde68a;
}

/* Armory Modal */
.armory-card {
  max-width: 620px;
}

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

.armory-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(30, 24, 52, 0.9);
  color: #e2e8f0;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

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

.armory-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 11px;
  border-radius: 12px;
  background: rgba(24, 19, 44, 0.88);
  border: 1px solid var(--border);
}

.armory-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.armory-item-name {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.armory-pips {
  display: flex;
  gap: 3px;
}

.pip {
  width: 10px;
  height: 6px;
  border-radius: 2px;
  background: rgba(148, 132, 184, 0.26);
}

.pip.filled {
  background: #fbbf24;
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.65);
}

.armory-item-desc {
  font-size: 11px;
  color: var(--muted);
}

.armory-buy-btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
  cursor: pointer;
}

.armory-buy-btn:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.34);
}

.armory-buy-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.armory-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
}

.armory-hint {
  font-size: 11.5px;
  color: var(--muted);
}

/* Post-Run Panel */
.postrun-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.stat-box {
  padding: 8px 6px;
  border-radius: 10px;
  background: rgba(24, 18, 44, 0.9);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-val {
  font-size: 16px;
  font-weight: 900;
  color: #fef3c7;
}

.stat-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.cliffhanger-box {
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(30, 22, 52, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.38);
  font-size: 12px;
  color: #fde68a;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cliff-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 12, 26, 0.9);
  overflow: hidden;
}

.cliff-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.lb-submit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.lb-input {
  flex: 1;
  min-width: 130px;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(10, 8, 20, 0.92);
  border: 1px solid rgba(148, 132, 184, 0.38);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.lb-submit-msg {
  font-size: 11.5px;
  color: #6ee7b7;
  font-weight: 700;
}

.postrun-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.postrun-actions .btn {
  flex: 1 1 130px;
  padding: 10px 12px;
  font-size: 13px;
}

.share-preview {
  margin: 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(8, 6, 16, 0.9);
  border: 1px solid rgba(148, 132, 184, 0.25);
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Leaderboard Modal */
.lb-card {
  max-width: 520px;
}

.lb-mutator-bar {
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(153, 27, 27, 0.25);
  border: 1px solid rgba(248, 113, 113, 0.4);
  font-size: 12px;
  color: #fecaca;
  font-weight: 700;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 280px;
  overflow-y: auto;
}

.lb-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(24, 19, 44, 0.85);
  border: 1px solid rgba(148, 132, 184, 0.2);
  font-size: 12.5px;
}

.lb-rank {
  font-weight: 900;
  color: #fbbf24;
  width: 28px;
}

.lb-name {
  flex: 1;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  font-weight: 900;
  color: #fde68a;
}

/* Pause Evolution Guide */
.pause-card {
  max-width: 480px;
  text-align: center;
}

.evo-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  text-align: left;
}

.evo-row {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(24, 19, 44, 0.85);
  border: 1px solid var(--border);
  font-size: 11px;
  color: #cbd5e1;
}

.evo-row strong {
  color: #fde68a;
  display: block;
}

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

/* Studio Footer Dock */
.footer-bar {
  height: var(--footer-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  background: #090711;
  border-top: 1px solid rgba(148, 132, 184, 0.2);
  font-size: 11.5px;
  color: var(--muted);
  z-index: 50;
  overflow: hidden;
}

.footer-controls {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footer-brand {
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
}

/* --- Mobile Responsive (390x844 & narrow screens: 0px horizontal overflow) --- */
@media (max-width: 640px) {
  :root {
    --footer-h: 44px;
  }

  .hud-row {
    padding: 3px 6px 0;
    gap: 4px;
    align-items: flex-start;
  }

  .hud-left {
    min-width: 0;
    flex: 0 1 112px;
    max-width: 112px;
  }

  .hp-shell {
    width: 108px;
    height: 17px;
  }

  .hp-label {
    font-size: 9.5px;
  }

  .hud-center {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
  }

  .timer-display {
    font-size: 17px;
  }

  .wave-pill {
    font-size: 8.5px;
    padding: 2px 6px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hud-right {
    flex: 0 0 auto;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 3px;
  }

  .stat-chips {
    gap: 3px;
    flex-wrap: nowrap;
  }

  .chip {
    font-size: 9.5px;
    padding: 2px 5px;
  }

  .hud-actions {
    gap: 4px;
  }

  .icon-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .card {
    padding: 13px 12px;
    gap: 9px;
    border-radius: 14px;
  }

  .mode-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .hunter-grid {
    gap: 6px;
  }

  .hunter-card {
    padding: 7px 4px;
  }

  .hunter-sprite-box {
    width: 44px;
    height: 44px;
  }

  .hunter-sprite-box img {
    max-width: 38px;
    max-height: 38px;
  }

  .hunter-name {
    font-size: 11.5px;
  }

  .hunter-perk {
    font-size: 9.5px;
  }

  .upgrade-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .upgrade-card {
    flex-direction: row;
    text-align: left;
    padding: 9px 10px;
    gap: 10px;
  }

  .upgrade-icon-box {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
  }

  .upgrade-icon-box img {
    width: 36px;
    height: 36px;
  }

  .upgrade-meta-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
  }

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

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

  .evo-guide {
    grid-template-columns: 1fr;
  }

  .footer-controls {
    display: none;
  }

  .footer-brand {
    font-size: 11px;
  }
}
