/* =========================================================
   Heroes of Might and Magic III - HTML5 Medieval Gold Theme
   ========================================================= */
:root {
  --bg-dark: #120d09;
  --panel-bg: #231912;
  --panel-bg-2: #2d2016;
  --panel-inner: #18110c;
  --gold: #d4af37;
  --gold-bright: #f4d778;
  --gold-dim: #8c6e26;
  --border-oak: #4a3525;
  --text-main: #f3e6cc;
  --text-muted: #b7a386;
  --danger: #c0392b;
  --success: #2ecc71;
  --mana: #3498db;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.72);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: "Songti SC", "Noto Serif SC", "PingFang SC", Georgia, serif;
}

.hidden {
  display: none !important;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
}
.screen.active {
  display: flex;
}

/* ---------- Buttons ---------- */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: transform 0.1s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-gold {
  background: linear-gradient(180deg, #e5c158 0%, #b88b22 60%, #8a6414 100%);
  color: #1c1208;
  font-weight: 700;
  border: 2px solid #f7df8c;
  border-radius: 6px;
  padding: 10px 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 12px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 0 rgba(255, 240, 190, 0.5);
}
.btn-gold:hover:not(:disabled) {
  filter: brightness(1.1);
}
.btn-gold.primary-lg {
  font-size: 18px;
  padding: 12px 34px;
  letter-spacing: 2px;
}

.btn-stone {
  background: linear-gradient(180deg, #3c2c1f 0%, #261b13 100%);
  color: var(--text-main);
  border: 1.5px solid var(--gold-dim);
  border-radius: 5px;
  padding: 8px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 230, 170, 0.15), 0 2px 6px rgba(0, 0, 0, 0.4);
}
.btn-stone:hover:not(:disabled) {
  border-color: var(--gold);
  background: linear-gradient(180deg, #4b3727 0%, #312318 100%);
}

.btn-danger {
  background: linear-gradient(180deg, #a83228 0%, #701d16 100%);
  color: #fff3e6;
  border: 1.5px solid #e06a5c;
  border-radius: 5px;
  padding: 8px 14px;
}
.btn-danger:hover:not(:disabled) {
  filter: brightness(1.12);
}

.sm {
  padding: 6px 8px;
  font-size: 12.5px;
}

.btn-close {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  background: #3b231b;
  color: var(--gold-bright);
  border: 1px solid var(--gold-dim);
  font-size: 16px;
  line-height: 1;
}
.btn-close:hover {
  background: #612a22;
  border-color: var(--gold);
}

/* ---------- Title Screen ---------- */
#title-screen {
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 16px 0;
}
.title-backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 25%, rgba(212, 175, 55, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 20% 80%, rgba(120, 40, 30, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 75%, rgba(30, 70, 120, 0.22) 0%, transparent 50%),
    linear-gradient(180deg, #1b130d 0%, #0d0906 100%);
  z-index: 0;
}
.title-container {
  position: relative;
  z-index: 1;
  width: min(880px, 94vw);
  text-align: center;
  padding: 20px 10px;
  margin: auto;
}
.title-crest {
  font-size: 42px;
  color: var(--gold-bright);
  text-shadow: 0 0 22px rgba(212, 175, 55, 0.65);
  margin-bottom: 4px;
}
.game-title {
  font-size: clamp(28px, 4.5vw, 44px);
  color: var(--gold-bright);
  letter-spacing: 5px;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.9), 0 0 24px rgba(212, 175, 55, 0.35);
}
.game-subtitle {
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 20px;
}

.setup-panel {
  background: linear-gradient(180deg, rgba(40, 29, 20, 0.96), rgba(24, 17, 12, 0.98));
  border: 2px solid var(--gold-dim);
  box-shadow: inset 0 0 0 1px rgba(244, 215, 120, 0.16), var(--shadow);
  border-radius: 10px;
  padding: 18px 22px;
  text-align: left;
}
.setup-row {
  margin-bottom: 16px;
}
.setup-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.setup-group label {
  display: block;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  font-weight: 700;
}
.option-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.option-cards.compact {
  grid-template-columns: 1fr;
  gap: 8px;
}
.opt-card {
  text-align: left;
  padding: 10px 12px;
  background: rgba(18, 13, 9, 0.78);
  border: 1.5px solid var(--border-oak);
  border-radius: 6px;
  color: var(--text-main);
}
.opt-card:hover {
  border-color: var(--gold-dim);
  background: rgba(45, 32, 22, 0.85);
}
.opt-card.selected {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(84, 62, 28, 0.55), rgba(40, 29, 16, 0.9));
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.25);
}
.opt-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-bright);
  margin-bottom: 3px;
}
.opt-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.title-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}
.title-footer {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Main Adventure Layout ---------- */
.game-layout {
  display: flex;
  width: 100%;
  height: 100%;
}

.map-viewport-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #0a0806;
}

#adventure-canvas {
  flex: 1;
  width: 100%;
  height: calc(100% - 36px);
  display: block;
  cursor: pointer;
}

/* Bottom Resource Bar */
.resource-bar {
  height: 36px;
  background: linear-gradient(180deg, #322419 0%, #1d140e 100%);
  border-top: 2px solid var(--gold-dim);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 14px;
  font-size: 13px;
  z-index: 5;
}
.res-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.res-item small {
  color: #7ee081;
  font-size: 11px;
}
.res-icon {
  font-size: 14px;
}
.gold-item {
  color: var(--gold-bright);
  font-weight: 700;
}
.date-display {
  margin-left: auto;
  color: var(--gold-bright);
  font-weight: 700;
  padding: 2px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  font-size: 12.5px;
}

/* Floating Banners & Tooltips */
.turn-banner {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(25, 17, 10, 0.92), rgba(66, 46, 20, 0.95), rgba(25, 17, 10, 0.92));
  border: 2px solid var(--gold);
  border-radius: 6px;
  padding: 10px 28px;
  color: var(--gold-bright);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  box-shadow: var(--shadow);
  z-index: 20;
  pointer-events: none;
}
.toast-container {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
  pointer-events: none;
  max-width: 360px;
}
.toast-item {
  background: rgba(24, 17, 12, 0.92);
  border-left: 3px solid var(--gold);
  border-top: 1px solid rgba(212, 175, 55, 0.3);
  border-right: 1px solid rgba(212, 175, 55, 0.3);
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-main);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  animation: fadeInSlide 0.2s ease;
}
@keyframes fadeInSlide {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(20, 14, 10, 0.95);
  border: 1.5px solid var(--gold);
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-main);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
  z-index: 25;
  max-width: 240px;
}
.map-tooltip .tt-title {
  color: var(--gold-bright);
  font-weight: 700;
  margin-bottom: 2px;
}

/* ---------- Right Sidebar ---------- */
.sidebar {
  width: 244px;
  flex-shrink: 0;
  height: 100%;
  background: linear-gradient(180deg, #2b1f16 0%, #19110c 100%);
  border-left: 2.5px solid var(--gold-dim);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.sidebar-box {
  background: var(--panel-inner);
  border: 1.5px solid var(--border-oak);
  border-radius: 6px;
  padding: 7px;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.65);
}
.minimap-box {
  padding: 5px;
  display: flex;
  justify-content: center;
  background: #0d0906;
}
#minimap-canvas {
  display: block;
  border: 1px solid var(--gold-dim);
  cursor: crosshair;
  width: 216px;
  height: 156px;
}

/* Hero Panel */
.hero-header {
  display: flex;
  gap: 8px;
  align-items: center;
}
.hero-avatar {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: radial-gradient(circle at 35% 30%, #5a4326, #241910);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.hero-meta {
  flex: 1;
  min-width: 0;
}
.hero-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  margin-bottom: 2px;
}
.bar-label {
  width: 34px;
  color: var(--text-muted);
}
.mini-bar {
  flex: 1;
  height: 6px;
  background: #0e0a07;
  border: 1px solid #4a3525;
  border-radius: 3px;
  overflow: hidden;
}
.mini-bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.2s ease;
}
.mini-bar-fill.move { background: linear-gradient(90deg, #27ae60, #6be38f); }
.mini-bar-fill.mana { background: linear-gradient(90deg, #2980b9, #6ec4ff); }
.bar-val {
  width: 34px;
  text-align: right;
  font-size: 10px;
  color: var(--text-main);
}

.hero-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 6px;
}
.stat-pill {
  background: #231912;
  border: 1px solid #4a3525;
  border-radius: 4px;
  text-align: center;
  padding: 2px 0;
  font-size: 11.5px;
  color: var(--gold-bright);
}

.army-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-top: 6px;
}
.army-mini-slot {
  height: 36px;
  background: #120d09;
  border: 1px solid #3c2b1e;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  position: relative;
}
.army-mini-slot.filled {
  border-color: var(--gold-dim);
  background: #241a12;
}
.army-mini-slot .cnt {
  position: absolute;
  bottom: 0;
  right: 2px;
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

/* Entity Lists */
.lists-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  min-height: 92px;
}
.list-title {
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 4px;
  text-align: center;
  border-bottom: 1px solid #3a2a1d;
  padding-bottom: 2px;
}
.entity-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 82px;
  overflow-y: auto;
}
.entity-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 5px;
  background: #251b13;
  border: 1px solid #453222;
  border-radius: 4px;
  color: var(--text-main);
  font-size: 11.5px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entity-btn:hover {
  border-color: var(--gold-dim);
}
.entity-btn.active {
  border-color: var(--gold-bright);
  background: #3d2c19;
  color: var(--gold-bright);
}

.actions-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.end-turn-btn {
  width: 100%;
  padding: 11px 0;
  font-size: 15px;
  letter-spacing: 2px;
  margin-top: auto;
}

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 2, 0.78);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 14px;
}

.modal-window {
  background: linear-gradient(180deg, #2c2016 0%, #1b130d 100%);
  border: 2px solid var(--gold);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(180deg, #3c2b1c 0%, #271b12 100%);
  border-bottom: 1.5px solid var(--gold-dim);
}
.modal-header h2 {
  font-size: 17px;
  color: var(--gold-bright);
  letter-spacing: 1px;
}
.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.badge-gold {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid var(--gold-dim);
  color: var(--gold-bright);
}

/* ---------- Town Modal ---------- */
.town-window {
  width: min(820px, 96vw);
  max-height: 92vh;
}
.town-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.town-panorama-wrap {
  position: relative;
  background: #100b08;
  border-bottom: 1.5px solid var(--gold-dim);
}
#town-canvas {
  width: 100%;
  height: 175px;
  display: block;
}
.town-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 12px;
  background: #1c140e;
  border-top: 1px solid #3c2b1e;
}
.tab-btn {
  background: #2a1e15;
  color: var(--text-muted);
  border: 1px solid #4a3525;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 13px;
}
.tab-btn:hover {
  color: var(--text-main);
  border-color: var(--gold-dim);
}
.tab-btn.active {
  background: linear-gradient(180deg, #5e4421, #382712);
  color: var(--gold-bright);
  border-color: var(--gold);
  font-weight: 700;
}

.town-tab-content {
  padding: 12px 14px;
  overflow-y: auto;
  max-height: 290px;
  min-height: 220px;
}

.building-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 9px;
}
.building-card {
  background: #17100b;
  border: 1.5px solid #443121;
  border-radius: 6px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.building-card.built {
  border-color: #3d7a4a;
  background: rgba(25, 48, 30, 0.45);
}
.building-card.can-build {
  border-color: var(--gold-dim);
}
.b-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--gold-bright);
  font-size: 13.5px;
}
.b-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}
.b-cost {
  font-size: 11.5px;
  color: #e8d3a3;
  margin-top: 2px;
}
.b-action {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
}

.recruit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 9px;
}
.recruit-card {
  background: #17100b;
  border: 1.5px solid var(--border-oak);
  border-radius: 6px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.recruit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.recruit-title {
  font-weight: 700;
  color: var(--gold-bright);
  font-size: 14px;
}
.recruit-stats {
  font-size: 11.5px;
  color: var(--text-muted);
}
.recruit-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.recruit-controls input[type="range"] {
  flex: 1;
  accent-color: var(--gold);
}

.town-garrison-bar {
  background: #140e0a;
  border-top: 1.5px solid var(--gold-dim);
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.garrison-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.garrison-label {
  width: 96px;
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.army-slots-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  flex: 1;
}
.army-slot-card {
  height: 46px;
  background: #1d150f;
  border: 1.5px solid #443121;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 12px;
}
.army-slot-card:hover {
  border-color: var(--gold);
}
.army-slot-card.selected {
  border-color: #6be38f;
  box-shadow: 0 0 8px rgba(107, 227, 143, 0.5);
}
.army-slot-card .u-icon {
  font-size: 18px;
}
.army-slot-card .u-name {
  font-size: 9.5px;
  color: var(--text-muted);
}
.army-slot-card .u-cnt {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gold-bright);
}

/* ---------- Combat Modal ---------- */
.combat-window {
  width: min(1020px, 97vw);
  background: linear-gradient(180deg, #271c14 0%, #150f0a 100%);
  border: 2.5px solid var(--gold);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.combat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: linear-gradient(180deg, #38281b, #231810);
  border-bottom: 1.5px solid var(--gold-dim);
  font-size: 13px;
}
.combat-side {
  display: flex;
  align-items: center;
  gap: 10px;
}
.combat-side.left { color: #8be0ff; }
.combat-side.right { color: #ff9c8a; }
.combat-round-badge {
  padding: 3px 14px;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-weight: 700;
}

.combat-canvas-wrap {
  position: relative;
  background: #0e0a07;
  display: flex;
  justify-content: center;
}
#combat-canvas {
  width: 100%;
  max-width: 960px;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  cursor: pointer;
}
.combat-spell-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(25, 16, 40, 0.94);
  border: 1.5px solid #9b72ff;
  color: #e6d6ff;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

.combat-bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: #201710;
  border-top: 1.5px solid var(--gold-dim);
}
.combat-queue {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  flex: 1;
}
.queue-chip {
  padding: 4px 8px;
  border-radius: 4px;
  background: #140e0a;
  border: 1px solid #4a3525;
  font-size: 11.5px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.queue-chip.ally { border-color: #3a8cc7; }
.queue-chip.enemy { border-color: #c24b3d; }
.queue-chip.active {
  border-color: var(--gold-bright);
  background: #423018;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}
.combat-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.combat-log-strip {
  padding: 6px 14px;
  background: #120c08;
  border-top: 1px solid #36271b;
  font-size: 12.5px;
  color: #e6d5b8;
  min-height: 28px;
}

/* ---------- Generic Dialog ---------- */
.dialog-window {
  width: min(560px, 94vw);
  max-height: 86vh;
}
.dialog-body {
  padding: 16px 18px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.6;
}
.dialog-footer {
  padding: 10px 18px;
  background: #18110c;
  border-top: 1px solid #3a2a1d;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.choice-card {
  background: #160f0a;
  border: 1.5px solid var(--gold-dim);
  border-radius: 6px;
  padding: 14px;
  text-align: center;
  color: var(--text-main);
}
.choice-card:hover {
  border-color: var(--gold-bright);
  background: #2f2214;
}
.choice-card .c-icon { font-size: 28px; margin-bottom: 6px; }
.choice-card .c-title { font-size: 15px; font-weight: 700; color: var(--gold-bright); }
.choice-card .c-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.spell-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.spell-card {
  background: #16101a;
  border: 1.5px solid #59417a;
  border-radius: 6px;
  padding: 9px;
  text-align: left;
  color: var(--text-main);
}
.spell-card:hover:not(:disabled) {
  border-color: #b490ff;
  background: #261a33;
}
.spell-card .s-name { font-weight: 700; color: #d6c2ff; font-size: 13.5px; }
.spell-card .s-cost { font-size: 11px; color: #7cc5ff; margin: 2px 0; }
.spell-card .s-desc { font-size: 11px; color: var(--text-muted); }

.hero-sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.info-panel {
  background: #140e0a;
  border: 1px solid #3d2c1e;
  border-radius: 6px;
  padding: 10px;
}
.info-panel h3 {
  font-size: 13px;
  color: var(--gold);
  margin-bottom: 6px;
  border-bottom: 1px solid #352518;
  padding-bottom: 4px;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-chip {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #271c14;
  border: 1px solid var(--gold-dim);
  color: var(--text-main);
}

/* Scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #120c08; }
::-webkit-scrollbar-thumb { background: #5a422b; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* Responsive adjustments */
@media (max-width: 860px) {
  .setup-row.two-col { grid-template-columns: 1fr; }
  .option-cards { grid-template-columns: 1fr; }
  .sidebar { width: 205px; }
  #minimap-canvas { width: 180px; height: 130px; }
  .resource-bar { gap: 8px; font-size: 11.5px; overflow-x: auto; }
}
