:root {
  --ink: #1a1410;
  --parchment: #e8dcc8;
  --parchment-dim: #c9b99a;
  --ember: #c45c2a;
  --ember-glow: #e87840;
  --gold: #d4a84b;
  --gold-bright: #f0c96a;
  --forest: #2d4a3e;
  --forest-deep: #1a2e26;
  --blood: #8b2e2e;
  --hero-hp: #4a9e6e;
  --enemy-hp: #a63d3d;
  --panel: rgba(26, 20, 16, 0.72);
  --border: rgba(212, 168, 75, 0.25);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

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

body {
  font-family: "EB Garamond", Georgia, serif;
  background: var(--ink);
  color: var(--parchment);
  min-height: 100vh;
  line-height: 1.45;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(196, 92, 42, 0.12), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(45, 74, 62, 0.2), transparent 50%),
    linear-gradient(180deg, #0f0c0a 0%, var(--ink) 40%, #12100e 100%);
  z-index: -2;
}

.grain {
  position: fixed;
  inset: 0;
  opacity: 0.04;
  pointer-events: none;
  z-index: 9998;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Header */
.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 12, 10, 0.85);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-sigil {
  font-size: 1.75rem;
  color: var(--gold);
  filter: drop-shadow(0 0 8px rgba(212, 168, 75, 0.4));
}

.brand h1 {
  font-family: "Cinzel", serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
}

.tagline {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--parchment-dim);
  opacity: 0.85;
}

.resource-strip {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.resource {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.res-icon {
  color: var(--gold);
  font-size: 0.9rem;
}

.scroll-icon {
  color: #8eb4d4;
  filter: none;
}

.res-sub {
  font-size: 0.8rem;
  color: var(--parchment-dim);
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1rem;
  padding: 1rem 1.5rem 0.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Combat */
.combat-panel {
  padding: 1.25rem;
}

.zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.zone-header h2 {
  font-family: "Cinzel", serif;
  font-size: 1.1rem;
  color: var(--parchment);
  letter-spacing: 0.04em;
}

.zone-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.game-unlock-banner {
  margin: -0.5rem 0 1rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  color: var(--gold-bright);
  background: rgba(212, 168, 75, 0.12);
  border: 1px solid var(--border);
  text-align: center;
}

.arena {
  position: relative;
  height: 240px;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.arena-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(0, 0, 0, 0.55) 0%, transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 35%, rgba(0, 0, 0, 0.45) 100%),
    repeating-linear-gradient(90deg, transparent, transparent 48px, rgba(255, 255, 255, 0.015) 48px, rgba(255, 255, 255, 0.015) 49px);
  background-color: var(--forest-deep);
  transition: background-color 0.6s ease;
}

.arena-bg::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 22px;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(212, 168, 75, 0.15) 20%, rgba(212, 168, 75, 0.25) 50%, rgba(212, 168, 75, 0.15) 80%, transparent);
  border-radius: 50%;
  filter: blur(0.5px);
}

.fighter {
  position: absolute;
  bottom: 24px;
  transition: transform 0.15s ease;
  z-index: 2;
}

.fighter.hero {
  left: 16%;
}

.fighter.enemy {
  right: 14%;
}

.sprite-shadow {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 10px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.55) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

.fighter.enemy .sprite-shadow {
  width: 64px;
}

.sprite-art {
  position: relative;
  width: 80px;
  height: 80px;
  z-index: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
  animation: heroIdle 3s ease-in-out infinite;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.pixel-sprite {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

.sprite-art svg {
  display: block;
  width: 100%;
  height: 100%;
  shape-rendering: crispEdges;
}

.sprite-art[data-family="hero"] { width: 80px; height: 80px; }
.sprite-art[data-family="slime"] { width: 80px; height: 80px; animation: enemyBob 2.2s ease-in-out infinite; }
.sprite-art[data-family="bat"] { width: 80px; height: 80px; animation: enemyBob 1.5s ease-in-out infinite; }
.sprite-art[data-family="wolf"] { width: 80px; height: 80px; animation: enemyBob 1.8s ease-in-out infinite; }
.sprite-art[data-family="mammoth"] { width: 96px; height: 84px; animation: enemyBob 1.8s ease-in-out infinite; }
.sprite-art[data-family="skeleton"] { width: 80px; height: 80px; animation: enemyBob 2.5s ease-in-out infinite; }
.sprite-art[data-family="humanoid"] { width: 80px; height: 80px; animation: enemyBob 2.3s ease-in-out infinite; }
.sprite-art[data-family="wraith"] { width: 80px; height: 80px; animation: wraithFloat 3s ease-in-out infinite; filter: drop-shadow(0 0 10px rgba(140, 100, 200, 0.5)); }
.sprite-art[data-family="dragon"] { width: 96px; height: 84px; animation: enemyBob 2.8s ease-in-out infinite; }
.sprite-art[data-family="crystal"] { width: 80px; height: 80px; animation: crystalPulse 2.5s ease-in-out infinite; filter: drop-shadow(0 0 12px rgba(160, 100, 220, 0.55)); }
.sprite-art[data-family="elf"] { width: 80px; height: 80px; animation: enemyBob 2.4s ease-in-out infinite; }
.sprite-art[data-family="goblin"] { width: 80px; height: 80px; animation: enemyBob 1.6s ease-in-out infinite; }

.fighter.enemy:has([data-family="dragon"]) .sprite-shadow,
.fighter.enemy:has([data-family="mammoth"]) .sprite-shadow {
  width: 88px;
}

.enemy-name {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Cinzel", serif;
  font-size: 0.68rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--parchment);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  z-index: 3;
}

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

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

@keyframes wraithFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.92; }
  50% { transform: translateY(-10px) scale(1.03); opacity: 1; }
}

@keyframes crystalPulse {
  0%, 100% { transform: translateY(0) scale(1); filter: drop-shadow(0 0 10px rgba(160, 100, 220, 0.45)); }
  50% { transform: translateY(-5px) scale(1.02); filter: drop-shadow(0 0 16px rgba(180, 120, 240, 0.7)); }
}

.fighter.hero.attacking .sprite-art {
  animation: heroLunge 0.2s ease;
}

@keyframes heroLunge {
  0% { transform: translateX(0); }
  40% { transform: translateX(14px) scale(1.02); }
  100% { transform: translateX(0); }
}

@keyframes swordSlash {
  0% { transform: rotate(12deg); }
  50% { transform: rotate(-35deg); }
  100% { transform: rotate(12deg); }
}

.fighter.hit .sprite-art {
  animation: hitFlash 0.25s ease;
}

@keyframes hitFlash {
  0%, 100% { filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45)); }
  30% { filter: drop-shadow(0 0 12px rgba(255, 80, 80, 0.8)) brightness(1.4); transform: translateX(3px); }
  60% { filter: drop-shadow(0 0 8px rgba(255, 80, 80, 0.5)); transform: translateX(-3px); }
}

.damage-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.dmg-num {
  position: absolute;
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  animation: floatUp 0.9s ease forwards;
  pointer-events: none;
}

.dmg-num.crit {
  color: var(--gold-bright);
  font-size: 1.4rem;
}

.dmg-num.heal {
  color: #6ecf8a;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-50px) scale(0.8); }
}

/* Bars */
.bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.bar-group label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--parchment-dim);
  margin-bottom: 0.25rem;
}

.bar {
  height: 10px;
  background: rgba(0,0,0,0.4);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}

.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.2s ease;
  border-radius: 1px;
}

.bar-fill.hero-hp { background: linear-gradient(90deg, var(--hero-hp), #6ecf8a); }
.bar-fill.enemy-hp { background: linear-gradient(90deg, var(--enemy-hp), #d06060); }

.bar-text {
  font-size: 0.75rem;
  color: var(--parchment-dim);
  margin-top: 0.2rem;
  display: block;
}

.combat-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--parchment-dim);
  margin-right: 0.25rem;
}

.equipped-heroes {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.equipped-heroes-title {
  font-family: "Cinzel", serif;
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.equipped-heroes-title span {
  color: var(--parchment-dim);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 0.68rem;
  letter-spacing: 0;
}

.equipped-heroes-list {
  list-style: none;
  min-height: 72px;
}

.equipped-heroes-empty,
.equipped-slot-empty {
  font-size: 0.8rem;
  color: var(--parchment-dim);
  font-style: italic;
  padding: 0.35rem 0;
}

.equipped-heroes-list .roster-item {
  padding: 0.35rem 0;
}

.equipped-heroes-list .roster-item-stat {
  font-size: 0.68rem;
}

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

/* Side panel */
.side-panel {
  display: flex;
  flex-direction: column;
}

.hero-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}

.hero-portrait {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: rgba(212, 168, 75, 0.08);
  overflow: hidden;
}

.hero-portrait .portrait-art {
  width: 40px;
  height: 48px;
  margin-top: 6px;
}

.hero-portrait .portrait-art svg {
  width: 100%;
  height: 100%;
}

.hero-card h3 {
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
}

.hero-level {
  font-size: 0.85rem;
  color: var(--gold);
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 0.65rem;
  background: none;
  border: none;
  color: var(--parchment-dim);
  font-family: "Cinzel", serif;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.tab:hover { color: var(--parchment); }
.tab.active {
  color: var(--gold-bright);
  background: rgba(212, 168, 75, 0.08);
  box-shadow: inset 0 -2px 0 var(--gold);
}

.tab-panel {
  display: none;
  padding: 0.75rem;
  flex: 1;
  overflow-y: auto;
  max-height: 420px;
}

.tab-panel.active { display: block; }

.panel-hint {
  font-size: 0.8rem;
  color: var(--parchment-dim);
  margin-bottom: 0.75rem;
  font-style: italic;
}

.ascend-card {
  padding: 0.85rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  background: rgba(212, 168, 75, 0.06);
}

.ascend-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 0.45rem;
}

.ascend-stat-row strong {
  font-family: "Cinzel", serif;
  color: var(--gold-bright);
  font-size: 1rem;
}

.ascend-preview {
  font-size: 0.82rem;
  color: var(--parchment);
  margin: 0.75rem 0;
}

.ascend-btn {
  width: 100%;
  margin-top: 0.5rem;
  background: linear-gradient(180deg, rgba(196, 92, 42, 0.35), rgba(139, 46, 46, 0.35));
  border-color: var(--ember);
  color: var(--gold-bright);
}

.ascend-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(232, 120, 64, 0.45), rgba(166, 61, 61, 0.45));
}

.ascend-btn:disabled {
  opacity: 0.55;
}

.ascend-upgrades-title {
  font-family: "Cinzel", serif;
  font-size: 0.75rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.upgrade-list, .zone-list {
  list-style: none;
}

.upgrade-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.65rem;
  border: 1px solid transparent;
  border-bottom-color: rgba(255,255,255,0.04);
  transition: background 0.15s;
}

.upgrade-item:hover {
  background: rgba(255,255,255,0.03);
}

.upgrade-item--heal {
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.upgrade-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
}

.upgrade-info h4 {
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  margin-bottom: 0.1rem;
}

.upgrade-info p {
  font-size: 0.75rem;
  color: var(--parchment-dim);
}

.upgrade-level {
  font-size: 0.7rem;
  color: var(--gold);
}

.btn {
  font-family: "Cinzel", serif;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--gold);
  background: rgba(212, 168, 75, 0.12);
  color: var(--gold-bright);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: rgba(212, 168, 75, 0.25);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

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

.zone-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.zone-item.locked { opacity: 0.45; }
.zone-item.current { background: rgba(212, 168, 75, 0.06); }

.zone-item h4 {
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
}

.zone-item p {
  font-size: 0.72rem;
  color: var(--parchment-dim);
}


/* Main menu */
.hidden { display: none !important; }

.main-menu {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.5rem;
}

.menu-card {
  width: min(420px, 100%);
  text-align: center;
  padding: 2.5rem 2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 4px;
}

.menu-sigil {
  display: block;
  font-size: 2.5rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 12px rgba(212, 168, 75, 0.45));
}

.menu-title {
  font-family: "Cinzel", serif;
  font-size: 2rem;
  letter-spacing: 0.1em;
  color: var(--gold-bright);
  margin-bottom: 0.35rem;
}

.menu-tagline {
  font-style: italic;
  color: var(--parchment-dim);
  margin-bottom: 1.5rem;
}

.menu-resources {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.menu-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
}

.play-btn {
  border-color: var(--gold);
  background: rgba(212, 168, 75, 0.2);
}

.summon-btn {
  border-color: #6a9ec4;
  color: #a8cce8;
  background: rgba(106, 158, 196, 0.15);
}

.summon-btn:hover:not(:disabled) {
  background: rgba(106, 158, 196, 0.28);
}

.workshop-btn {
  border-color: var(--ember);
  color: var(--ember-glow);
  background: rgba(196, 92, 42, 0.15);
}

.workshop-btn:hover:not(:disabled) {
  background: rgba(196, 92, 42, 0.28);
}

.shop-btn {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(212, 168, 75, 0.12);
}

.shop-btn:hover:not(:disabled) {
  background: rgba(212, 168, 75, 0.25);
}

.btn-cost {
  font-size: 0.75rem;
  opacity: 0.85;
}

.menu-hint {
  font-size: 0.78rem;
  color: var(--parchment-dim);
  font-style: italic;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.roster-section {
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.roster-title {
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  color: var(--gold);
  margin-bottom: 0.6rem;
  letter-spacing: 0.06em;
}

.roster-list {
  list-style: none;
  max-height: 140px;
  overflow-y: auto;
}

.roster-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
}

.roster-item-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.9rem;
}

.roster-item-stat {
  flex: 1;
  text-align: right;
  font-size: 0.72rem;
  color: var(--parchment-dim);
  margin-right: 0.5rem;
  min-width: 0;
}

.roster-item-name {
  white-space: nowrap;
}

.unequip-btn {
  font-size: 0.58rem;
  padding: 0.28rem 0.5rem;
  flex-shrink: 0;
  border-color: var(--enemy-hp);
  color: #d07070;
  background: rgba(166, 61, 61, 0.12);
}

.unequip-btn:hover:not(:disabled) {
  background: rgba(166, 61, 61, 0.25);
}

.slot-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  font-size: 0.85rem;
}

.slot-hero-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.slot-hero-icon {
  font-size: 1.2rem;
}

.roster-empty {
  font-size: 0.8rem;
  color: var(--parchment-dim);
  font-style: italic;
}

.menu-back-btn {
  font-size: 0.65rem;
  padding: 0.35rem 0.6rem;
  flex-shrink: 0;
}

/* Workshop */
.workshop-screen {
  min-height: 100vh;
  padding: 1.5rem;
}

.workshop-layout {
  max-width: 720px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-radius: 4px;
}

.workshop-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.workshop-header > div {
  flex: 1;
  min-width: 140px;
}

.workshop-heading {
  font-family: "Cinzel", serif;
  font-size: 1.25rem;
  color: var(--ember-glow);
  letter-spacing: 0.06em;
}

.workshop-sub {
  font-size: 0.85rem;
  color: var(--parchment-dim);
  font-style: italic;
}

.last-fusion-result {
  min-height: 1.25rem;
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--gold-bright);
}

.fusion-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fusion-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
  transition: border-color 0.15s, background 0.15s;
}

.fusion-item--ready {
  border-color: rgba(196, 92, 42, 0.35);
  background: rgba(196, 92, 42, 0.08);
}

.fusion-formula {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fusion-side {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.fusion-count {
  font-family: "Cinzel", serif;
  font-size: 0.72rem;
  color: var(--parchment-dim);
}

.fusion-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
}

.fusion-name {
  font-family: "Cinzel", serif;
  font-size: 0.78rem;
}

.fusion-rarity {
  font-size: 0.65rem;
  color: var(--parchment-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fusion-arrow {
  font-size: 1.1rem;
  color: var(--ember);
}

.fusion-details {
  grid-column: 1 / -1;
}

.fusion-stats {
  font-size: 0.72rem;
  color: var(--parchment-dim);
  margin-bottom: 0.2rem;
}

.fusion-owned {
  font-size: 0.72rem;
  color: var(--gold);
}

.fusion-btn {
  grid-row: 1;
  grid-column: 2;
  align-self: center;
  border-color: var(--ember);
  color: var(--ember-glow);
  background: rgba(196, 92, 42, 0.15);
  white-space: nowrap;
}

.fusion-btn:hover:not(:disabled) {
  background: rgba(196, 92, 42, 0.3);
}

.fusion-empty {
  font-size: 0.85rem;
  color: var(--parchment-dim);
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

@media (max-width: 540px) {
  .fusion-item {
    grid-template-columns: 1fr;
  }

  .fusion-btn {
    grid-row: auto;
    grid-column: 1;
    width: 100%;
  }
}

/* Shop */
.shop-screen {
  min-height: 100vh;
  padding: 1.5rem;
}

.shop-layout {
  max-width: 640px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-radius: 4px;
}

.shop-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.shop-header > div {
  flex: 1;
  min-width: 140px;
}

.shop-heading {
  font-family: "Cinzel", serif;
  font-size: 1.25rem;
  color: var(--gold-bright);
  letter-spacing: 0.06em;
}

.shop-sub {
  font-size: 0.85rem;
  color: var(--parchment-dim);
  font-style: italic;
}

.shop-gold {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 1.15rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}

.shop-section {
  margin-bottom: 1.5rem;
}

.shop-section-title {
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.shop-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.shop-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
  transition: background 0.15s;
}

.shop-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.shop-item-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  border: 1px solid var(--border);
  background: rgba(212, 168, 75, 0.08);
}

.shop-item-info h4 {
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  margin-bottom: 0.15rem;
}

.shop-item-info p {
  font-size: 0.75rem;
  color: var(--parchment-dim);
}

.shop-item-level {
  font-size: 0.68rem;
  color: var(--gold);
}

.shop-buy-btn {
  white-space: nowrap;
}

/* Summon hall */
.summon-screen,
.roster-screen {
  min-height: 100vh;
  padding: 1.5rem;
}

.summon-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
  align-items: center;
}

@media (max-width: 700px) {
  .summon-layout {
    grid-template-columns: 1fr;
  }
  .ancient-scroll {
    max-width: 180px;
    margin: 0 auto;
  }
}

.ancient-scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.5));
}

.scroll-roll {
  width: 100%;
  height: 28px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.15) 0%, transparent 15%, transparent 85%, rgba(0, 0, 0, 0.15) 100%),
    linear-gradient(180deg, #7a6048 0%, #5a4430 35%, #3d2e22 100%);
  border-radius: 14px;
  border: 1px solid rgba(80, 60, 40, 0.5);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.06),
    inset 0 -3px 6px rgba(0, 0, 0, 0.35);
}

.scroll-roll--top { margin-bottom: -4px; z-index: 2; }
.scroll-roll--bottom { margin-top: -4px; z-index: 2; }

.scroll-paper {
  width: 100%;
  min-height: 320px;
  padding: 2rem 1.25rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 40% at 50% 0%, rgba(180, 140, 60, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 20% 80%, rgba(160, 120, 40, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse 60% 45% at 88% 55%, rgba(200, 160, 70, 0.15) 0%, transparent 45%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0%, transparent 6%, transparent 94%, rgba(0, 0, 0, 0.12) 100%),
    linear-gradient(180deg, #c4a860 0%, #e8d898 8%, #f0e4b8 22%, #e6d4a0 55%, #d4bc78 82%, #b89850 100%);
  color: #3a2e22;
  border-left: 1px solid rgba(60, 45, 25, 0.2);
  border-right: 1px solid rgba(60, 45, 25, 0.2);
  position: relative;
  box-shadow: inset 0 0 40px rgba(120, 90, 30, 0.12);
}

.scroll-paper::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

.scroll-paper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(100, 75, 30, 0.03) 3px,
      rgba(100, 75, 30, 0.03) 4px
    );
  opacity: 0.6;
}

.scroll-age {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.scroll-hole {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #2a2018 0%, #0f0c0a 55%, #1a1410 100%);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(80, 60, 35, 0.5),
    0 0 0 2px rgba(180, 150, 90, 0.25);
}

.scroll-hole--1 {
  width: 11px;
  height: 10px;
  top: 14%;
  left: 8%;
  transform: rotate(-12deg);
  border-radius: 45% 55% 50% 50%;
}

.scroll-hole--2 {
  width: 7px;
  height: 8px;
  top: 38%;
  right: 10%;
  transform: rotate(8deg);
  border-radius: 50% 45% 55% 50%;
}

.scroll-hole--3 {
  width: 14px;
  height: 12px;
  bottom: 22%;
  left: 14%;
  transform: rotate(20deg);
  border-radius: 55% 45% 48% 52%;
  opacity: 0.92;
}

.scroll-hole--4 {
  width: 5px;
  height: 6px;
  bottom: 12%;
  right: 18%;
  border-radius: 48% 52% 50% 50%;
}

.scroll-stain {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.scroll-stain--1 {
  width: 72px;
  height: 48px;
  top: 8%;
  right: 6%;
  background: radial-gradient(ellipse, rgba(200, 160, 50, 0.35) 0%, rgba(180, 130, 40, 0.12) 45%, transparent 70%);
  transform: rotate(-18deg);
}

.scroll-stain--2 {
  width: 56px;
  height: 64px;
  bottom: 18%;
  left: 4%;
  background: radial-gradient(ellipse, rgba(220, 180, 70, 0.28) 0%, rgba(160, 110, 30, 0.1) 50%, transparent 72%);
  transform: rotate(12deg);
}

.scroll-stain--3 {
  width: 28px;
  height: 28px;
  top: 52%;
  left: 42%;
  background: radial-gradient(circle, rgba(210, 170, 60, 0.4) 0%, rgba(190, 140, 45, 0.15) 40%, transparent 65%);
}

.scroll-stain--4 {
  width: 18px;
  height: 16px;
  top: 28%;
  left: 22%;
  background: radial-gradient(circle, rgba(185, 145, 50, 0.45) 0%, transparent 70%);
  border-radius: 40% 60% 55% 45%;
}

.scroll-stain--5 {
  width: 40px;
  height: 24px;
  bottom: 8%;
  right: 8%;
  background: radial-gradient(ellipse, rgba(170, 130, 40, 0.3) 0%, transparent 68%);
  transform: rotate(-8deg);
}

.scroll-verse {
  font-family: "EB Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.7;
  text-align: center;
  position: relative;
  z-index: 3;
  text-shadow: 0 1px 0 rgba(255, 248, 220, 0.35);
}

.summon-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-radius: 4px;
}

.summon-heading,
.roster-heading {
  font-family: "Cinzel", serif;
  font-size: 1.25rem;
  color: var(--gold-bright);
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.summon-sub,
.roster-sub {
  font-size: 0.85rem;
  color: var(--parchment-dim);
  font-style: italic;
  margin-bottom: 1rem;
}

.main-summon-btn {
  width: 100%;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  border-color: #6a9ec4;
  color: #d8ecff;
  background: linear-gradient(180deg, rgba(106, 158, 196, 0.28) 0%, rgba(70, 110, 150, 0.18) 100%);
  box-shadow: 0 4px 16px rgba(60, 100, 140, 0.25);
}

.main-summon-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(106, 158, 196, 0.42) 0%, rgba(70, 110, 150, 0.28) 100%);
  transform: translateY(-1px);
}

.last-summon-result {
  min-height: 1.4rem;
  margin-bottom: 0.75rem;
  font-family: "Cinzel", serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
  text-align: center;
}

.summon-browse-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--parchment-dim);
  margin-bottom: 0.6rem;
}

.rarity-flash--common { color: #c8c8c8; }
.rarity-flash--uncommon { color: #6ecf8a; }
.rarity-flash--rare { color: #6aa8e8; }
.rarity-flash--epic { color: #b878e8; }
.rarity-flash--super { color: var(--gold-bright); }
.rarity-flash--legendary { color: var(--ember-glow); }
.rarity-flash--mythical { color: #40e0d0; }
.rarity-flash--infinite {
  background: linear-gradient(90deg, #ff4080, #ffb040, #ffe040, #40e080, #4080ff, #a040ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.screen-back-btn {
  margin-bottom: 1rem;
  font-size: 0.7rem;
}

.rarity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

@media (min-width: 500px) {
  .rarity-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.rarity-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--parchment);
  font-family: "Cinzel", serif;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  text-align: left;
}

.rarity-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.rarity-btn .rarity-count {
  font-size: 0.65rem;
  color: var(--parchment-dim);
  font-family: "EB Garamond", serif;
}

.rarity-btn[data-rarity="common"] { border-left: 3px solid #9a9a9a; }
.rarity-btn[data-rarity="uncommon"] { border-left: 3px solid #4a9e6e; }
.rarity-btn[data-rarity="rare"] { border-left: 3px solid #4a7ec4; }
.rarity-btn[data-rarity="epic"] { border-left: 3px solid #9a5ac4; }
.rarity-btn[data-rarity="super"] { border-left: 3px solid #d4a84b; }
.rarity-btn[data-rarity="legendary"] { border-left: 3px solid #e87840; }
.rarity-btn[data-rarity="mythical"] { border-left: 3px solid #40e0d0; }

.rarity-btn[data-rarity="infinite"] {
  position: relative;
  border-left: none;
  overflow: hidden;
  background:
    linear-gradient(
      135deg,
      rgba(255, 64, 128, 0.1) 0%,
      rgba(255, 176, 64, 0.08) 18%,
      rgba(255, 224, 64, 0.08) 36%,
      rgba(64, 224, 128, 0.08) 54%,
      rgba(64, 128, 255, 0.08) 72%,
      rgba(160, 64, 255, 0.1) 100%
    ),
    rgba(0, 0, 0, 0.25);
}

.rarity-btn[data-rarity="infinite"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(
    180deg,
    #ff4080 0%,
    #ffb040 18%,
    #ffe040 36%,
    #40e080 54%,
    #4080ff 72%,
    #a040ff 86%,
    #ff4080 100%
  );
  background-size: 100% 200%;
  animation: infiniteRainbow 4s linear infinite;
}

.rarity-btn[data-rarity="infinite"]:hover {
  background:
    linear-gradient(
      135deg,
      rgba(255, 64, 128, 0.16) 0%,
      rgba(255, 176, 64, 0.12) 18%,
      rgba(255, 224, 64, 0.12) 36%,
      rgba(64, 224, 128, 0.12) 54%,
      rgba(64, 128, 255, 0.12) 72%,
      rgba(160, 64, 255, 0.16) 100%
    ),
    rgba(255, 255, 255, 0.06);
}

.rarity-btn[data-rarity="infinite"] .rarity-count {
  background: linear-gradient(90deg, #ff8090, #ffc860, #80ffb0, #80b0ff, #c080ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes infiniteRainbow {
  0% { background-position: 0% 0%; }
  100% { background-position: 0% 200%; }
}

.rarity-infinite {
  background: linear-gradient(90deg, #ff4080, #ffb040, #ffe040, #40e080, #4080ff, #a040ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Roster / equip screen */
.roster-layout {
  max-width: 720px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-radius: 4px;
}

.roster-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.roster-header .screen-back-btn {
  margin-bottom: 0;
}

.roster-header > div {
  flex: 1;
  min-width: 140px;
}

.pull-btn {
  border-color: #6a9ec4;
  color: #a8cce8;
  background: rgba(106, 158, 196, 0.15);
  white-space: nowrap;
}

.pull-btn:hover:not(:disabled) {
  background: rgba(106, 158, 196, 0.28);
}

.equip-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.equip-slot {
  padding: 0.75rem;
  border: 1px dashed var(--border);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.equip-slot.filled {
  border-style: solid;
  border-color: var(--gold);
  background: rgba(212, 168, 75, 0.08);
}

.slot-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--parchment-dim);
}

.slot-empty {
  font-size: 0.8rem;
  color: var(--parchment-dim);
  font-style: italic;
}

.hero-collection {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
  max-height: 360px;
  overflow-y: auto;
}

.hero-card-select {
  padding: 0.75rem;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.hero-card-select:hover {
  background: rgba(255, 255, 255, 0.04);
}

.hero-card-select.selected {
  border-color: var(--gold);
  background: rgba(212, 168, 75, 0.12);
  box-shadow: 0 0 0 1px var(--gold);
}

.hero-card-select.equipped-other,
.hero-card-select.equip-blocked {
  opacity: 0.45;
  cursor: not-allowed;
}

.hero-card-icon {
  font-size: 1.75rem;
  margin-bottom: 0.35rem;
}

.hero-card-name {
  font-family: "Cinzel", serif;
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
}

.hero-card-stat {
  font-size: 0.65rem;
  color: var(--parchment-dim);
  margin-bottom: 0.45rem;
}

.sell-hero-btn {
  width: 100%;
  font-size: 0.58rem;
  padding: 0.3rem 0.45rem;
  border-color: #6a9ec4;
  color: #a8cce8;
  background: rgba(106, 158, 196, 0.12);
}

.sell-hero-btn:hover:not(:disabled) {
  background: rgba(106, 158, 196, 0.25);
}

.collection-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--parchment-dim);
  font-style: italic;
}

.confirm-equip-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.85rem;
}

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

.rarity-btn:disabled:hover {
  background: rgba(0, 0, 0, 0.25);
  transform: none;
}

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