:root {
  --bg-dark: #090b12;
  --panel-bg: rgba(16, 20, 32, 0.9);
  --panel-border: rgba(148, 163, 184, 0.22);
  --gold: #fbbf24;
  --crimson: #e0483e;
  --emerald: #2dd48f;
  --cyan: #38bdf8;
  --text: #f1f5f9;
  --muted: #94a3b8;
}

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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg-dark);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.hidden {
  display: none !important;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* ========== TITLE & CLASS SELECT (LIVE HAND-DRAWN SPIRE STAGE) ========== */
#screen-title {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #090b12;
}

#title-stage-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.title-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 68% 52%, rgba(9, 11, 18, 0.04) 0%, rgba(9, 11, 18, 0.72) 68%, rgba(6, 8, 14, 0.94) 100%),
    linear-gradient(90deg, rgba(7, 9, 16, 0.88) 0%, rgba(7, 9, 16, 0.52) 42%, rgba(7, 9, 16, 0.08) 72%);
  z-index: 1;
}

.sts-title-shell {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 38px 74px;
  pointer-events: none;
}

.sts-top-nav,
.sts-hero-panel,
.sts-roster-bar {
  pointer-events: auto;
}

.sts-top-nav {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.sts-logo-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fef3c7;
  text-shadow: 0 3px 0 #090b12, 0 0 24px rgba(245, 158, 11, 0.4);
  line-height: 1;
}

.sts-logo-sub {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: #d97706;
  margin-top: 5px;
  text-shadow: 0 2px 0 #090b12;
}

.sts-nav-links {
  display: flex;
  gap: 10px;
}

.sts-nav-link {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  border-radius: 7px;
  background: rgba(15, 20, 32, 0.88);
  border: 2.5px solid #090b12;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25), 0 4px 0 #090b12;
  transition: transform 0.12s ease, color 0.12s ease;
}

.sts-nav-link:hover {
  transform: translateY(-2px);
  color: #fef08a;
}

.sts-hero-stage {
  display: grid;
  grid-template-columns: minmax(340px, 470px) 1fr;
  align-items: center;
  gap: 24px;
  max-width: 1260px;
  width: 100%;
  margin: auto 0;
}

@media (max-width: 820px) {
  .sts-title-shell { padding: 14px 18px 18px; }
  .sts-hero-stage { grid-template-columns: 1fr; }
  .sts-stage-spacer { display: none; }
}

.sts-hero-panel {
  background: rgba(15, 19, 31, 0.86);
  border: 3px solid #090b12;
  box-shadow:
    inset 0 0 0 1.5px rgba(251, 191, 36, 0.28),
    0 8px 0 #090b12,
    0 20px 44px rgba(0, 0, 0, 0.65);
  border-radius: 12px;
  padding: 20px 22px 18px;
  backdrop-filter: blur(4px);
}

.sts-eyebrow {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.24em;
  color: #94a3b8;
  margin-bottom: 4px;
}

.sts-hero-name {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(2rem, 3.4vw, 2.85rem);
  font-weight: 900;
  line-height: 1.05;
  color: #f8fafc;
  text-shadow: 0 3px 0 #090b12;
  margin-bottom: 10px;
}

.sts-hero-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.sts-stat-chip {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 5px;
  border: 2px solid #090b12;
  box-shadow: 0 2px 0 #090b12;
}

.stat-hp {
  background: #7f1d1d;
  color: #fecaca;
}

.stat-energy {
  background: #78350f;
  color: #fef08a;
}

.sts-hero-flavor {
  font-size: 13.5px;
  line-height: 1.5;
  color: #cbd5e1;
  margin-bottom: 14px;
}

.sts-relic-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(9, 12, 20, 0.85);
  border: 2px solid #090b12;
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.25);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.sts-relic-medallion {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: radial-gradient(circle at 35% 30%, #27324a, #0e1320);
  border: 2px solid #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.sts-relic-kicker {
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #94a3b8;
}

.sts-relic-name {
  font-weight: 800;
  font-size: 13.5px;
  color: #fde68a;
}

.sts-relic-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.3;
}

.sts-cards-preview-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: #94a3b8;
  margin-bottom: 8px;
}

.sts-card-fan {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sts-mini-card {
  width: 126px;
  height: 162px;
  border-radius: 9px;
  border: 2.5px solid #090b12;
  box-shadow: 0 5px 0 #090b12;
  overflow: hidden;
  position: relative;
  background: #141927;
  transition: transform 0.16s ease;
}

.sts-mini-card:nth-child(1) { transform: rotate(-3deg); }
.sts-mini-card:nth-child(2) { transform: translateY(-4px); }
.sts-mini-card:nth-child(3) { transform: rotate(3deg); }
.sts-mini-card:hover { transform: translateY(-10px) scale(1.06) rotate(0deg); z-index: 5; }

.sts-mini-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sts-roster-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1260px;
  width: 100%;
}

.sts-roster-list {
  display: flex;
  gap: 12px;
}

.sts-roster-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 19, 31, 0.92);
  border: 3px solid #090b12;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.22), 0 5px 0 #090b12;
  border-radius: 10px;
  padding: 6px 16px 6px 8px;
  cursor: pointer;
  color: #94a3b8;
  transition: transform 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.sts-roster-btn canvas {
  width: 52px;
  height: 52px;
  border-radius: 7px;
  background: #0c101b;
  border: 2px solid #090b12;
}

.sts-roster-meta {
  text-align: left;
}

.sts-roster-name {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 900;
  font-size: 14.5px;
  display: block;
}

.sts-roster-role {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.78;
}

.sts-roster-btn:hover {
  transform: translateY(-3px);
  color: #f8fafc;
}

.sts-roster-btn.selected {
  color: #fef08a;
  box-shadow:
    inset 0 0 0 2px var(--gold),
    0 5px 0 #090b12,
    0 0 24px rgba(251, 191, 36, 0.32);
}

.sts-embark-btn {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  color: #090b12;
  border: 3px solid #090b12;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    0 6px 0 #090b12,
    0 10px 28px rgba(217, 119, 6, 0.45);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.18em;
  padding: 15px 46px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.sts-embark-btn:hover {
  transform: translateY(-3px);
  filter: brightness(1.07);
}

.sts-embark-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #090b12;
}

/* ========== ARTIFACTS BAR & REWARD CHOICES ========== */
.relics-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 340px;
}

.artifact-chip {
  font-size: 12px;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fde68a;
  padding: 4px 8px;
  border-radius: 7px;
  cursor: help;
}

.artifact-choices-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 14px 0 6px;
}

@media (max-width: 680px) {
  .artifact-choices-grid { grid-template-columns: 1fr; }
}

.artifact-choice-card {
  background: rgba(15, 20, 34, 0.9);
  border: 2px solid rgba(251, 191, 36, 0.35);
  border-radius: 12px;
  padding: 16px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.artifact-choice-card:hover {
  transform: translateY(-5px);
  border-color: #fef08a;
  box-shadow: 0 12px 26px rgba(251, 191, 36, 0.28);
}

.artifact-choice-icon { font-size: 34px; }
.artifact-choice-name { font-weight: 800; font-size: 15px; color: #fde68a; }
.artifact-choice-rarity {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em;
  color: #94a3b8;
}
.artifact-choice-desc { font-size: 12.5px; color: #cbd5e1; line-height: 1.4; }

/* ========== PHASE 1: DECK SCREEN ========== */
#screen-deck {
  background:
    radial-gradient(circle at 50% 18%, rgba(56, 189, 248, 0.08), transparent 45%),
    radial-gradient(circle at 18% 85%, rgba(224, 72, 62, 0.1), transparent 45%),
    linear-gradient(180deg, #0b0e17 0%, #090b12 100%);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(12, 16, 26, 0.94);
  border-bottom: 1px solid var(--panel-border);
  gap: 14px;
}

.top-left, .top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-center {
  text-align: center;
}

.mini-portrait {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--gold);
}

.class-label {
  font-weight: 800;
  font-size: 15px;
}

.hp-pill {
  font-size: 13px;
  font-weight: 700;
  color: #fca5a5;
}

.relic-pill {
  font-size: 12.5px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fde68a;
  padding: 5px 10px;
  border-radius: 999px;
}

.floor-title {
  font-weight: 800;
  font-size: 16px;
  color: var(--gold);
}

.enemy-preview {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.deck-stage {
  flex: 1;
  display: grid;
  grid-template-columns: 225px minmax(0, 1fr) 260px;
  gap: 14px;
  padding: 10px 18px 6px;
  min-height: 0;
  overflow: hidden;
  align-items: center;
}

@media (max-width: 960px) {
  .deck-stage {
    grid-template-columns: 185px 1fr 215px;
  }
}

.energy-panel, .loadout-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 100%;
  overflow-y: auto;
}

.energy-panel {
  align-items: center;
  text-align: center;
}

.energy-orb {
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef08a 0%, #f59e0b 45%, #b45309 100%);
  border: 4px solid #fde68a;
  box-shadow: 0 0 28px rgba(245, 158, 11, 0.55), inset 0 0 14px rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 900;
  color: #1c1917;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.energy-sep {
  font-size: 20px;
  opacity: 0.7;
  margin: 0 2px;
}

.energy-caption {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--gold);
}

.pile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
  font-size: 12px;
  color: var(--muted);
}

.phase-tip {
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  border-radius: 8px;
}

.forge-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 6px 8px;
  max-height: 100%;
  overflow-y: auto;
  min-height: 0;
}

.forge-banner h2 {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 4px;
}

.forge-banner p {
  color: #cbd5e1;
  font-size: 13px;
  max-width: 480px;
  line-height: 1.35;
}

.horde-preview-box {
  background: rgba(11, 14, 24, 0.88);
  border: 2.5px solid #090b12;
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.22), 0 5px 0 #090b12;
  border-radius: 12px;
  padding: 8px 12px 10px;
  width: 100%;
  max-width: 580px;
}

.horde-preview-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: #fbbf24;
  margin-bottom: 6px;
}

.horde-preview-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.horde-enemy-card {
  background: radial-gradient(circle at 50% 45%, #1b2236 0%, #0d111c 100%);
  border: 2px solid rgba(148, 163, 184, 0.22);
  border-radius: 9px;
  padding: 5px 6px 6px;
  width: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.horde-enemy-card.has-aoe {
  border-color: rgba(239, 68, 68, 0.65);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.22);
}

.horde-enemy-card.has-aoe .horde-enemy-role {
  color: #fca5a5;
}

.horde-enemy-power {
  font-size: 9.5px;
  line-height: 1.25;
  color: #cbd5e1;
  text-align: center;
  margin-top: 2px;
}

.horde-enemy-card.is-boss {
  border-color: #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.25);
}

.horde-enemy-card canvas {
  width: 82px;
  height: 62px;
  display: block;
}

.horde-enemy-name {
  font-size: 11px;
  font-weight: 800;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.horde-enemy-role {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.horde-enemy-card.is-boss .horde-enemy-role {
  color: #fbbf24;
}

.btn-enter-arena {
  position: relative;
  z-index: 30;
  flex-shrink: 0;
  background: linear-gradient(135deg, #ef4444 0%, #f59e0b 100%);
  color: #0b0d14;
  border: 2px solid #fef08a;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 12px 28px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(239, 68, 68, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-enter-arena:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 34px rgba(245, 158, 11, 0.6);
}

.btn-warn-confirm {
  background: linear-gradient(135deg, #f59e0b 0%, #fde047 100%) !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 26px rgba(250, 204, 21, 0.8) !important;
  animation: warnPulse 0.9s ease-in-out infinite alternate;
}
@keyframes warnPulse {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

.btn-primary {
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #ffffff;
  border: none;
  font-weight: 800;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--panel-border);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 16px;
}

.loadout-panel h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--gold);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.loadout-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}

.loadout-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.loadout-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12.5px;
  font-weight: 600;
}

.loadout-chip .lvl {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  background: rgba(251, 191, 36, 0.16);
  padding: 2px 6px;
  border-radius: 6px;
}

.loadout-empty {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* ========== SLAY THE SPIRE CARD HAND ========== */
.hand-tray {
  padding: 4px 18px 14px;
  min-height: 235px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.hand-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 22px 12px 6px;
  max-width: 100%;
}

.sts-card {
  position: relative;
  width: 162px;
  min-width: 162px;
  min-height: 230px;
  height: auto;
  border-radius: 13px;
  background: linear-gradient(180deg, #1e2436 0%, #111521 100%);
  border: 2.5px solid #64748b;
  padding: 8px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
}

.sts-card.class-ironclad {
  background: linear-gradient(180deg, #3c1518 0%, #170b0d 100%);
  border-color: #b91c1c;
}

.sts-card.class-silent {
  background: linear-gradient(180deg, #0d3326 0%, #071913 100%);
  border-color: #059669;
}

.sts-card.class-defect {
  background: linear-gradient(180deg, #0f2942 0%, #091322 100%);
  border-color: #0284c7;
}

.sts-card.class-watcher {
  background: linear-gradient(180deg, #32124d 0%, #140821 100%);
  border-color: #a855f7;
}

.sts-card.rarity-uncommon {
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4), 0 10px 24px rgba(0, 0, 0, 0.55);
}

.sts-card.rarity-rare {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.35), 0 10px 24px rgba(0, 0, 0, 0.55);
}

.sts-card:hover:not(.disabled) {
  transform: translateY(-20px) scale(1.07);
  z-index: 20;
  border-color: #fef08a;
  box-shadow: 0 18px 36px rgba(251, 191, 36, 0.35);
}

.sts-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.card-cost {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef08a, #f59e0b 60%, #92400e);
  border: 2.5px solid #fef9c3;
  color: #1c1917;
  font-weight: 900;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
  z-index: 3;
}

.card-cost.cost-reduced {
  background: radial-gradient(circle at 35% 30%, #bbf7d0, #22c55e 60%, #166534);
  border-color: #dcfce7;
  color: #052e16;
}

.card-header {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  padding: 2px 6px 5px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-header.upgraded {
  color: #4ade80;
}

.card-art-frame {
  position: relative;
  height: 92px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: #0b0d14;
  margin-bottom: 6px;
}

/* Zoom cleanly into the authentic Slay the Spire card illustration window */
.card-art-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 28%;
  transform: scale(1.62);
  display: block;
}

.card-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.card-type-pill {
  align-self: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #cbd5e1;
  margin-top: -13px;
  margin-bottom: 5px;
  position: relative;
  z-index: 2;
}

.card-type-pill.type-power {
  background: rgba(180, 83, 9, 0.85);
  border-color: #fde047;
  color: #fef9c3;
}

.card-exhaust-tag {
  position: absolute;
  top: 33px;
  right: 12px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(127, 29, 29, 0.92);
  border: 1px solid #f87171;
  color: #fecaca;
  padding: 1px 5px;
  border-radius: 4px;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
}

.card-desc {
  flex: 1;
  font-size: 11.4px;
  line-height: 1.38;
  color: #cbd5e1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
}

.card-desc .kw { color: #fcd34d; font-weight: 700; }
.card-desc .kw-tag { color: #fde68a; font-weight: 800; letter-spacing: 0.02em; }
.card-desc .kw-num { color: #ffffff; font-weight: 800; }
.card-desc .kw-block { color: #7dd3fc; font-weight: 700; }
.card-desc .kw-poison { color: #4ade80; font-weight: 700; }
.card-desc .kw-dmg { color: #fca5a5; font-weight: 700; }
.card-desc .kw-wrath { color: #fb923c; font-weight: 800; }
.card-desc .kw-calm { color: #38bdf8; font-weight: 800; }
.card-desc .kw-divinity { color: #e879f9; font-weight: 800; }

/* Pre-rolled qualitative upgrade bonus badge shown on weapon cards in hand before play */
.card-upg-preview {
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #bae6fd;
  letter-spacing: 0.02em;
}

/* Floating Slay-the-Spire Keyword Tooltip on Card Hover */
.card-kw-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  width: 235px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kw-tip-item {
  background: rgba(12, 17, 29, 0.96);
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 9px;
  padding: 7px 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
}

.kw-tip-title {
  font-size: 11.5px;
  font-weight: 800;
  color: #fde68a;
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}

.kw-tip-body {
  font-size: 11px;
  line-height: 1.35;
  color: #cbd5e1;
}

/* Compact live combat stats strip under Survival HP/Block bars */
.surv-stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.surv-stat-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
  letter-spacing: 0.02em;
}

.surv-stat-pill.stat-str { border-color: rgba(248, 113, 113, 0.55); color: #fecaca; }
.surv-stat-pill.stat-spd { border-color: rgba(250, 204, 21, 0.55); color: #fef08a; }
.surv-stat-pill.stat-dodge { border-color: rgba(74, 222, 128, 0.55); color: #bbf7d0; }
.surv-stat-pill.stat-crit { border-color: rgba(251, 146, 60, 0.55); color: #fed7aa; }
.surv-stat-pill.stat-focus { border-color: rgba(56, 189, 248, 0.55); color: #bae6fd; }

/* Post-Run Feedback Box inside #modal-end */
.end-feedback-box {
  margin: 14px 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(10, 14, 24, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.28);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.fb-heading {
  font-size: 12px;
  font-weight: 800;
  color: #fde68a;
  letter-spacing: 0.03em;
}

.fb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fb-stars {
  display: flex;
  gap: 3px;
}

.fb-star {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #475569;
  cursor: pointer;
  padding: 2px;
  transition: transform 0.1s ease, color 0.1s ease;
}

.fb-star:hover,
.fb-star.active {
  color: #fbbf24;
  transform: scale(1.12);
}

.fb-diff-row {
  display: flex;
  gap: 5px;
}

.fb-diff-btn {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}

.fb-diff-btn.active {
  background: rgba(251, 191, 36, 0.2);
  border-color: #fbbf24;
  color: #fef08a;
}

.fb-comment {
  width: 100%;
  resize: vertical;
  min-height: 46px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #f1f5f9;
  font-family: inherit;
  font-size: 12.5px;
  padding: 7px 10px;
}

.fb-comment:focus {
  outline: none;
  border-color: #38bdf8;
}

.fb-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fb-status {
  font-size: 11.5px;
  color: #4ade80;
  font-weight: 700;
}

.fb-send-btn {
  padding: 6px 14px;
  font-size: 12px;
}

/* ========== PHASE 2: SURVIVAL SCREEN ========== */
#screen-survival {
  position: fixed;
  inset: 0;
  background: #090b12;
}

#survival-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.xp-bar-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(56, 189, 248, 0.45);
  z-index: 15;
}

.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0284c7, #38bdf8, #a5f3fc);
  transition: width 0.12s ease-out;
}

.xp-level-badge {
  position: absolute;
  right: 12px;
  top: -1px;
  font-size: 11px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 4px #000;
}

.surv-hud {
  position: fixed;
  top: 22px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
  z-index: 12;
}

.surv-hud-left, .surv-hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.surv-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bar-track {
  position: relative;
  width: 210px;
  height: 26px;
  background: rgba(15, 23, 42, 0.92);
  border: 2.5px solid #090b12;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 3px 0 #090b12;
  border-radius: 7px;
  overflow: hidden;
}

.deck-hp-track {
  width: 148px;
  height: 20px;
  margin-top: 3px;
}

.shield-track {
  height: 19px;
  background: rgba(15, 23, 42, 0.88);
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
  transition: width 0.15s ease, background 0.2s ease;
}

.hp-fill.hp-mid {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
}

.hp-fill.hp-low {
  background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
}

.shield-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
  transition: width 0.15s ease;
}

.bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 3px #000, 0 0 6px rgba(0, 0, 0, 0.9);
}

.shield-badge {
  font-size: 12px;
  color: #93c5fd;
  background: rgba(30, 58, 138, 0.65);
  border: 1px solid rgba(96, 165, 250, 0.5);
  padding: 2px 9px;
  border-radius: 6px;
  width: fit-content;
}

.surv-hud-center {
  text-align: center;
  background: rgba(9, 11, 18, 0.72);
  border: 1px solid rgba(251, 191, 36, 0.35);
  padding: 6px 18px;
  border-radius: 12px;
  backdrop-filter: blur(4px);
}

.surv-timer {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #fef08a;
  line-height: 1.05;
}

.surv-floor-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.kills-badge {
  background: rgba(9, 11, 18, 0.78);
  border: 1px solid var(--panel-border);
  padding: 7px 12px;
  border-radius: 9px;
  font-weight: 800;
  font-size: 14px;
}

.boss-bar-wrap {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, 85vw);
  z-index: 12;
  text-align: center;
}

.boss-name {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: #fbbf24;
  text-shadow: 0 2px 6px #000;
  margin-bottom: 4px;
}

.boss-track {
  height: 14px;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid #fbbf24;
  border-radius: 999px;
  overflow: hidden;
}

.boss-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #dc2626, #f59e0b);
}

.surv-weapons-bar {
  position: fixed;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  z-index: 12;
}

.weapon-slot {
  background: rgba(12, 16, 26, 0.86);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
}

.weapon-slot .w-lvl {
  font-size: 11px;
  color: var(--gold);
}

.controls-hint {
  position: fixed;
  bottom: 18px;
  right: 18px;
  font-size: 12px;
  color: rgba(203, 213, 225, 0.72);
  background: rgba(9, 11, 18, 0.65);
  padding: 5px 10px;
  border-radius: 8px;
  z-index: 12;
}

/* ========== REWARD & MODALS ========== */
#screen-reward {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(251, 191, 36, 0.12), rgba(7, 9, 16, 0.98));
  padding: 20px;
  overflow-y: auto;
}

.reward-panel {
  max-width: 820px;
  width: 100%;
  background: rgba(16, 20, 32, 0.95);
  border: 1.5px solid rgba(251, 191, 36, 0.35);
  border-radius: 18px;
  padding: 24px 26px;
  text-align: center;
}

.reward-summary {
  color: #cbd5e1;
  font-size: 14px;
  margin: 8px 0 18px;
}

.reward-sub {
  font-size: 15px;
  color: var(--gold);
  margin-bottom: 14px;
}

.reward-cards-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  padding-top: 26px;
  margin-bottom: 18px;
}

.reward-actions, .campfire-choices, .end-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.smith-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  max-height: 360px;
  overflow-y: auto;
  padding: 12px 6px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 13, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal-box {
  background: rgba(16, 20, 32, 0.97);
  border: 2px solid rgba(251, 191, 36, 0.45);
  border-radius: 16px;
  padding: 22px 26px;
  max-width: 720px;
  width: 100%;
  text-align: center;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.levelup-deck-box {
  max-width: 1020px;
  width: 96vw;
  background: rgba(14, 18, 30, 0.96);
  border: 3px solid #fbbf24;
  box-shadow: 0 10px 0 #090b12, 0 24px 60px rgba(0, 0, 0, 0.85);
  padding: 20px 24px 18px;
}

.levelup-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  text-align: left;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 14px;
}

.levelup-energy-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.energy-orb-sm {
  width: 68px;
  height: 68px;
  font-size: 22px;
  border-width: 3px;
  flex-shrink: 0;
}

.lv-piles {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: #cbd5e1;
}

.levelup-heading {
  flex: 1;
  min-width: 240px;
  text-align: center;
}

.levelup-heading h2 {
  font-size: 22px;
  font-weight: 900;
  margin: 2px 0 4px;
}

.lv-sub {
  font-size: 13px;
  color: #cbd5e1;
}

.btn-resume-sm {
  padding: 12px 22px;
  font-size: 14px;
  white-space: nowrap;
  border: 3px solid #090b12;
  box-shadow: 0 5px 0 #090b12;
}

.lv-delta-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 4px;
  min-height: 28px;
}

.lv-delta-chip {
  font-size: 12px;
  font-weight: 800;
  color: #fef08a;
  background: rgba(251, 191, 36, 0.15);
  border: 2px solid rgba(251, 191, 36, 0.5);
  padding: 3px 10px;
  border-radius: 999px;
}

.lv-hand-container {
  padding: 36px 14px 10px;
  min-height: 274px;
  overflow-y: visible;
}

/* Chunky Brotato / hand-drawn HUD accents */
.weapon-slot, .kills-badge, .surv-hud-center, .bar-track, .shield-badge {
  border-width: 2.5px;
  box-shadow: 0 3px 0 #090b12;
}

/* ========== MOBILE & TABLET RESPONSIVE LAYOUT ========== */
@media (max-width: 960px) {
  .sts-title-shell {
    padding: max(12px, env(safe-area-inset-top)) 14px max(78px, env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
  }

  .sts-logo-title { font-size: 20px; letter-spacing: 0.1em; }
  .sts-logo-sub { font-size: 9px; letter-spacing: 0.18em; }
  .sts-nav-link { font-size: 11px; padding: 6px 9px; }

  .sts-hero-panel {
    padding: 14px 14px 12px;
  }

  .sts-hero-name { font-size: 1.75rem; margin-bottom: 6px; }
  .sts-hero-flavor { font-size: 12px; margin-bottom: 10px; }
  .sts-relic-box { padding: 8px 10px; margin-bottom: 10px; }
  .sts-mini-card { width: 88px; height: 116px; }

  .sts-roster-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .sts-roster-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .sts-roster-btn {
    flex-direction: column;
    padding: 6px 4px;
    gap: 4px;
    text-align: center;
  }

  .sts-roster-btn canvas { width: 42px; height: 42px; }
  .sts-roster-meta { text-align: center; }
  .sts-roster-name { font-size: 11.5px; }
  .sts-roster-role { display: none; }

  .sts-embark-btn {
    width: 100%;
    padding: 13px 20px;
    font-size: 17px;
  }

  /* Phase 1: Spire Forge on phone & tablet (clean scroll, ZERO overlap!) */
  #screen-deck {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }

  .top-bar {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
    flex-shrink: 0;
  }

  .mini-portrait { width: 34px; height: 34px; }
  .class-label { font-size: 13px; }
  .floor-title { font-size: 13.5px; }
  .enemy-preview { font-size: 10.5px; }
  .relics-bar { display: none; }

  .deck-stage {
    flex: 0 0 auto;
    min-height: auto;
    align-items: stretch;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 8px;
    padding: 8px 10px 6px;
  }

  .forge-center {
    grid-column: 1 / -1;
    order: -1;
    padding: 4px 4px;
    gap: 8px;
  }

  .forge-banner h2 { font-size: 17px; margin-bottom: 2px; }
  .forge-banner p { font-size: 11.5px; }
  .phase-tip { display: none; }

  .horde-preview-box { padding: 8px 8px 9px; }
  .horde-preview-grid { gap: 6px; }
  .horde-enemy-card { width: 102px; padding: 4px 5px 5px; }
  .horde-enemy-card canvas { width: 64px; height: 46px; }
  .horde-enemy-power { font-size: 8.5px; }

  .energy-panel, .loadout-panel {
    padding: 10px;
    gap: 6px;
    max-height: 160px;
  }

  .energy-orb { width: 58px; height: 58px; font-size: 20px; border-width: 3px; }
  .btn-enter-arena { padding: 12px 20px; font-size: 14px; width: 100%; }

  .hand-tray {
    flex: 0 0 auto;
    padding: 4px 8px max(78px, env(safe-area-inset-bottom));
    min-height: 224px;
  }

  .hand-container {
    justify-content: flex-start;
    padding: 18px 8px 4px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
  }

  .sts-card {
    width: 136px;
    min-width: 136px;
    height: 196px;
    padding: 6px;
  }

  .sts-card:hover:not(.disabled) {
    transform: translateY(-8px) scale(1.03);
  }

  .card-art-frame { height: 74px; }
  .card-cost.cost-reduced {
  background: radial-gradient(circle at 35% 30%, #bbf7d0, #22c55e 60%, #166534);
  border-color: #dcfce7;
  color: #052e16;
}

.card-header { font-size: 11.5px; }
  .card-desc { font-size: 10px; line-height: 1.25; }

  /* Phase 2: Survival HUD on phone */
  .surv-hud {
    top: 18px;
    left: 8px;
    right: 8px;
  }

  .bar-track { width: 146px; height: 22px; }
  .shield-track { height: 18px; }
  .deck-hp-track { width: 120px; height: 18px; }
  .surv-timer { font-size: 20px; }
  .surv-hud-center { padding: 4px 12px; }
  .kills-badge { padding: 5px 8px; font-size: 12px; }

  .surv-weapons-bar {
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 8px;
    right: 8px;
    gap: 5px;
  }

  .weapon-slot { padding: 4px 7px; font-size: 11px; }
  .controls-hint { display: none; }

  /* Mid-Wave Level-Up Modal on phone */
  .modal { padding: 10px; }
  .levelup-deck-box {
    padding: 12px 12px 10px;
    max-height: 94dvh;
    overflow-y: auto;
  }
  .levelup-top { gap: 10px; padding-bottom: 10px; }
  .levelup-heading h2 { font-size: 16px; }
  .lv-sub { font-size: 11px; }
  .btn-resume-sm { width: 100%; padding: 10px 14px; font-size: 13px; }
  .lv-hand-container {
    min-height: 215px;
    padding: 20px 6px 6px;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Reward & Path Choices on phone */
  .reward-panel { padding: 16px 14px; }
  .reward-cards-row { gap: 10px; padding-top: 12px; }
}

/* ========== TEST MODE / SANDBOX MODAL & BUTTONS ========== */
.sts-action-btns {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sts-testmode-btn {
  padding: 13px 20px;
  border-radius: 12px;
  border: 2px solid rgba(56, 189, 248, 0.65);
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.88), rgba(15, 23, 42, 0.94));
  color: #e0f2fe;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 5px 0 #090b12, 0 0 18px rgba(56, 189, 248, 0.25);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.sts-testmode-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

.btn-test-chip {
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 800;
  border-color: rgba(56, 189, 248, 0.6);
  color: #bae6fd;
}

.testmode-box {
  width: min(880px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tm-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tm-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fbbf24;
  text-transform: uppercase;
}

.tm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 8px;
}

.tm-card {
  text-align: left;
  background: rgba(15, 23, 42, 0.88);
  border: 2px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 10px 11px;
  color: #f1f5f9;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.12s ease, transform 0.12s ease, background 0.12s ease;
}

.tm-card:hover {
  border-color: rgba(251, 191, 36, 0.7);
  transform: translateY(-1px);
}

.tm-card.active {
  border-color: #fbbf24;
  background: linear-gradient(180deg, rgba(180, 83, 9, 0.34), rgba(15, 23, 42, 0.95));
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.25);
}

.tm-card-title {
  font-size: 13px;
  font-weight: 900;
  color: #fff;
}

.tm-card-sub {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.3;
}

.tm-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.tm-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.tm-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tm-pill {
  padding: 7px 13px;
  border-radius: 8px;
  border: 2px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.85);
  color: #cbd5e1;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}

.tm-pill.active {
  border-color: #38bdf8;
  background: rgba(14, 116, 144, 0.5);
  color: #f0f9ff;
}

.tm-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.tm-summary {
  font-size: 12.5px;
  color: #cbd5e1;
  font-weight: 600;
}

@media (max-width: 640px) {
  .sts-action-btns {
    width: 100%;
    justify-content: stretch;
  }
  .sts-action-btns > button {
    flex: 1;
    padding: 12px 10px;
    font-size: 13px;
  }
  .tm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .testmode-box {
    padding: 14px 14px;
  }
}

/* ========== NEW PLAYER GUIDE, GOLD PILL, SPIRE MAP, SHOP & EVENTS ========== */
.sts-nav-btn {
  background: rgba(251, 191, 36, 0.14);
  border: 1.5px solid rgba(251, 191, 36, 0.55);
  color: #fde68a;
  cursor: pointer;
  font-family: inherit;
}

.sts-nav-btn:hover {
  background: rgba(251, 191, 36, 0.28);
}

.gold-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 9px;
  background: rgba(120, 53, 15, 0.42);
  border: 1.5px solid rgba(251, 191, 36, 0.55);
  color: #fde68a;
  font-size: 13px;
  font-weight: 800;
}

.guide-box {
  width: min(820px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 22px;
}

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

.guide-step {
  background: rgba(15, 23, 42, 0.88);
  border: 2px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-step-num {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fbbf24;
}

.guide-step h3 {
  font-size: 15px;
  font-weight: 900;
  color: #f8fafc;
}

.guide-step p {
  font-size: 12.5px;
  line-height: 1.5;
  color: #cbd5e1;
}

/* Iconic Dark-Ink & Gold-Parchment Slay the Spire Branching Map */
.map-modal-box {
  width: min(720px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px 20px;
}

.spire-map-wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background:
    radial-gradient(circle at 50% 15%, rgba(251, 191, 36, 0.14), transparent 55%),
    linear-gradient(180deg, #1b1713 0%, #121520 55%, #0d1018 100%);
  border: 3px solid #090b12;
  box-shadow: inset 0 0 0 2px rgba(217, 119, 6, 0.45), 0 8px 28px rgba(0, 0, 0, 0.65);
  border-radius: 16px;
  padding: 12px 14px;
}

.spire-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px dashed rgba(251, 191, 36, 0.35);
  font-size: 12px;
}

.spire-map-act {
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fbbf24;
}

.spire-map-boss-hint {
  color: #cbd5e1;
}

.spire-map-canvas {
  position: relative;
  width: 100%;
  height: 360px;
  overflow: hidden;
  border-radius: 10px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 28px),
    radial-gradient(circle at 50% 50%, rgba(30, 41, 59, 0.35), rgba(9, 11, 18, 0.65));
}

.spire-map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-edge {
  stroke: rgba(148, 163, 184, 0.32);
  stroke-width: 2.5;
  stroke-dasharray: 6 6;
}

.map-edge.visited {
  stroke: rgba(251, 191, 36, 0.85);
  stroke-width: 3.5;
  stroke-dasharray: none;
}

.map-edge.active {
  stroke: #fbbf24;
  stroke-width: 3.5;
  stroke-dasharray: 8 5;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.75));
}

.map-floor-tag {
  position: absolute;
  left: 6px;
  transform: translateY(-50%);
  font-size: 10.5px;
  font-weight: 900;
  color: rgba(251, 191, 36, 0.6);
  letter-spacing: 0.06em;
  pointer-events: none;
}

.spire-map-nodes {
  position: absolute;
  inset: 0;
}

.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #151926;
  border: 3px solid #090b12;
  box-shadow: inset 0 0 0 2px rgba(148, 163, 184, 0.35), 0 4px 10px rgba(0, 0, 0, 0.6);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  opacity: 0.58;
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.map-node.type-boss {
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, #450a0a 0%, #18080c 100%);
  box-shadow: inset 0 0 0 2.5px #f43f5e, 0 0 18px rgba(244, 63, 94, 0.45);
  opacity: 0.92;
}

.map-node-icon {
  font-size: 20px;
  line-height: 1;
}

.map-node.type-boss .map-node-icon {
  font-size: 28px;
}

.map-node-caption {
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10px;
  font-weight: 900;
  color: #fef08a;
  background: rgba(9, 11, 18, 0.88);
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  pointer-events: none;
}

.map-node.is-visited {
  opacity: 0.85;
  background: #1e293b;
  box-shadow: inset 0 0 0 2px #fbbf24;
}

.map-node.is-current {
  opacity: 1;
  box-shadow: inset 0 0 0 2.5px #38bdf8, 0 0 14px rgba(56, 189, 248, 0.65);
}

.map-node.is-reachable {
  opacity: 1;
  cursor: pointer;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.28), #151926 75%);
  box-shadow: inset 0 0 0 2.5px var(--node-col, #fbbf24), 0 0 18px rgba(251, 191, 36, 0.6);
  animation: mapNodePulse 1.4s ease-in-out infinite;
}

.map-node.is-reachable:hover {
  transform: translate(-50%, -50%) scale(1.16);
  z-index: 5;
}

@keyframes mapNodePulse {
  0%, 100% { box-shadow: inset 0 0 0 2.5px var(--node-col, #fbbf24), 0 0 12px rgba(251, 191, 36, 0.45); }
  50%      { box-shadow: inset 0 0 0 3px #fef08a, 0 0 22px rgba(251, 191, 36, 0.85); }
}

.spire-map-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  padding-top: 9px;
  margin-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 700;
}

/* Merchant Shop & Mystery Event Rooms */
.shop-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}

.shop-status-msg {
  font-size: 12.5px;
  color: #cbd5e1;
  margin-bottom: 12px;
}

.shop-cards-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 14px;
}

.shop-card-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.shop-buy-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 2px solid #090b12;
  background: linear-gradient(180deg, #fbbf24, #d97706);
  color: #090b12;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.shop-buy-btn:disabled {
  background: #334155;
  color: #94a3b8;
  cursor: not-allowed;
}

.shop-services-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.shop-service-card {
  background: rgba(15, 23, 42, 0.88);
  border: 2px solid rgba(251, 191, 36, 0.32);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.event-card-box {
  max-width: 560px;
  margin: 0 auto;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid rgba(192, 132, 252, 0.45);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.event-icon {
  font-size: 42px;
  line-height: 1;
}

.event-desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: #e2e8f0;
}

.event-choices-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.event-choice-btn {
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.85);
  color: #f8fafc;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.event-choice-btn:hover:not(:disabled) {
  border-color: #c084fc;
  background: rgba(88, 28, 135, 0.4);
}

.event-choice-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.event-result-msg {
  font-size: 13.5px;
  font-weight: 800;
  color: #fde68a;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(120, 53, 15, 0.35);
  border: 1px solid rgba(251, 191, 36, 0.4);
}

@media (max-width: 640px) {
  .guide-grid,
  .shop-services-row {
    grid-template-columns: 1fr;
  }
  .spire-map-canvas {
    height: 320px;
  }
  .map-node {
    width: 38px;
    height: 38px;
  }
  .map-node.type-boss {
    width: 52px;
    height: 52px;
  }
}

/* Bouncing "YOU" pointer pin on the Spire Map */
.map-you-pointer {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #090b12;
  background: linear-gradient(180deg, #7dd3fc, #38bdf8);
  border: 2px solid #090b12;
  padding: 2px 7px;
  border-radius: 7px;
  box-shadow: 0 3px 10px rgba(56, 189, 248, 0.75);
  pointer-events: none;
  z-index: 6;
  animation: mapYouBounce 1.1s ease-in-out infinite;
}

@keyframes mapYouBounce {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, -4px); }
}

/* ========== SPIRE POTIONS BELT & GRAZE PILL ========== */
.surv-potions-bar {
  position: fixed;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.potion-slot-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 9px;
  border: 2px solid var(--pot-col, #fbbf24);
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
  transition: transform 0.1s ease, filter 0.1s ease;
}

.potion-slot-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

.potion-slot-key {
  font-size: 10px;
  font-weight: 900;
  color: #090b12;
  background: #fde047;
  padding: 1px 4px;
  border-radius: 4px;
}

.graze-energy-pill {
  padding: 5px 10px;
  border-radius: 9px;
  border: 2px solid rgba(56, 189, 248, 0.7);
  background: rgba(12, 74, 110, 0.85);
  color: #e0f2fe;
  font-size: 11.5px;
  font-weight: 900;
}

/* Status & Curse Card Visual Styling */
.type-status {
  background: rgba(71, 85, 105, 0.85) !important;
  color: #cbd5e1 !important;
}
.type-curse {
  background: rgba(88, 28, 135, 0.9) !important;
  color: #e9d5ff !important;
}
.sts-card.rarity-status {
  border-color: #64748b;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}
.sts-card.rarity-curse {
  border-color: #7e22ce;
  background: linear-gradient(180deg, #2e1065 0%, #0f071a 100%);
}

/* The Watcher Live Stance HUD Pills */
.stance-hud-pill {
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 900;
  border: 2px solid rgba(192, 132, 252, 0.75);
  background: rgba(59, 7, 100, 0.9);
  color: #f3e8ff;
}
.stance-hud-pill.stance-calm {
  border-color: #60a5fa;
  background: rgba(12, 74, 110, 0.92);
  color: #e0f2fe;
}
.stance-hud-pill.stance-wrath {
  border-color: #fb7185;
  background: rgba(136, 19, 55, 0.92);
  color: #ffe4e6;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.55);
}
.stance-hud-pill.stance-divinity {
  border-color: #fde047;
  background: rgba(113, 63, 18, 0.95);
  color: #fef9c3;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.65);
}

/* Explicit Weapon Evolution Badges & Ascended Slots */
.card-evo-tag {
  margin-top: 4px;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(250, 204, 21, 0.14);
  border: 1px solid rgba(250, 204, 21, 0.55);
  color: #fde047;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}
.loadout-chip-evolved {
  border-color: #fde047 !important;
  background: linear-gradient(135deg, rgba(113, 63, 18, 0.85), rgba(66, 32, 6, 0.92)) !important;
  color: #fef08a !important;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.4);
}
.weapon-slot.weapon-evolved {
  border-color: #fde047 !important;
  background: linear-gradient(135deg, rgba(113, 63, 18, 0.92), rgba(55, 25, 8, 0.95)) !important;
  color: #fef08a !important;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.55);
}
.weapon-slot.weapon-evolved .w-lvl {
  background: #fde047;
  color: #090b12;
  padding: 1px 5px;
  border-radius: 5px;
}

/* Ascension Ladder Selector on Title Screen */
.sts-ascension-box {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(15, 20, 34, 0.86);
  border: 1.5px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.asc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.asc-label {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fbbf24;
}
.asc-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.asc-step-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1.5px solid rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.14);
  color: #fef08a;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}
.asc-step-btn:hover { background: rgba(251, 191, 36, 0.32); }
.asc-step-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.asc-level-badge {
  min-width: 34px;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  color: #fde047;
}
.asc-level-badge.asc-active {
  color: #fb7185;
  text-shadow: 0 0 8px rgba(244, 63, 94, 0.55);
}
.asc-cleared-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}
.asc-cleared-tag.has-clear {
  background: rgba(250, 204, 21, 0.2);
  color: #fde047;
  border: 1px solid rgba(250, 204, 21, 0.45);
}
.asc-desc {
  margin-top: 5px;
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.35;
}
.btn-ai-on {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #04130d !important;
  border-color: #6ee7b7 !important;
  font-weight: 900 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.55);
}
.sts-continue-btn {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  color: #f8fafc;
  border: 2px solid #bae6fd;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(14, 165, 233, 0.45);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.sts-continue-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(56, 189, 248, 0.6);
}

/* Non-commercial fan tribute disclaimer footer on title screen */
.sts-fan-disclaimer {
  text-align: center;
  font-size: 11px;
  color: rgba(148, 163, 184, 0.72);
  padding: 4px 12px 6px;
  line-height: 1.3;
  pointer-events: auto;
}
.sts-fan-disclaimer a {
  color: #fbbf24;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sts-fan-disclaimer a:hover {
  color: #fef08a;
}
