/* ============================================================
   Urugal's Descent — Dark Gothic UI
   Stone, iron, blood, and candlelight.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=IM+Fell+English+SC&family=IM+Fell+English:ital@0;1&family=Cormorant+Garamond:wght@400;500;600&display=swap');

:root {
  /* Core surfaces — near-black with cold purple undertones */
  --bg:         #060409;
  --bg-2:       #0a0710;
  --panel:      #120c16;
  --panel-2:    #1a1220;
  --panel-3:    #221829;
  --stone:      #2a2030;
  --stone-edge: #3a2c44;

  /* Ink, parchment, candlelight */
  --text:       #e6d9bd;
  --text-soft:  #c9b88f;
  --muted:      #8a7a5e;
  --whisper:    #5b5142;

  /* Blood, brass, sigil */
  --blood:      #8a1414;
  --blood-lit:  #c0282a;
  --crimson:    #6a0d12;
  --brass:      #b88a3c;
  --brass-lit:  #d9a85a;
  --gold:       #c9a24a;
  --bone:       #d9c9a3;

  /* Magical accents */
  --necro:      #6f3fa8;
  --poison:     #6f8a32;
  --frost:      #6792a8;
  --ember:      #d36a1c;

  /* Aliases used by older selectors */
  --accent:      var(--brass-lit);
  --accent-2:    var(--gold);
  --danger:      var(--blood-lit);
  --purple:      var(--necro);
  --green:       var(--poison);

  /* Typography */
  --font-display: 'IM Fell English SC', 'Cinzel', 'Cinzel Decorative', Georgia, serif;
  --font-heading: 'Cinzel', 'IM Fell English SC', Georgia, serif;
  --font-body:    'Cormorant Garamond', 'IM Fell English', Georgia, 'Times New Roman', serif;
  --font-mono:    ui-monospace, 'Courier New', monospace;

  /* Procedural ornament data URLs (set by JS at runtime; gracefully degrade if unset) */
  --orn-frame: none;
  --orn-divider: none;
  --orn-corner-tl: none;
  --orn-corner-tr: none;
  --orn-corner-bl: none;
  --orn-corner-br: none;
  --orn-stone: none;
  --orn-parchment: none;
  --orn-rune: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  letter-spacing: 0.2px;
  user-select: none;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 20% 10%, rgba(185, 90, 30, 0.06) 0%, transparent 55%),
    radial-gradient(1100px 700px at 80% 110%, rgba(140, 20, 20, 0.07) 0%, transparent 60%),
    radial-gradient(1400px 900px at 50% 50%, #0a0510 0%, var(--bg) 70%);
}

/* Subtle vignette + film grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
  z-index: 1000;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: var(--orn-stone);
  background-size: 256px 256px;
  z-index: 999;
}

/* ============================================================
   Layout
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 14px;
  padding: 14px;
  height: 100vh;
}

/* Reusable iron/stone panel base */
.panel,
.board-wrap,
.sidebar,
.title-row,
.stats,
.inventory,
.log,
.tavern,
.modal {
  position: relative;
  background:
    linear-gradient(180deg, rgba(40,28,46,0.55), rgba(10,6,14,0.85)),
    var(--panel);
  border: 1px solid #2c1f33;
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px rgba(201,162,74,0.08),
    inset 0 0 30px rgba(0,0,0,0.65),
    0 2px 0 rgba(0,0,0,0.6),
    0 12px 40px rgba(0,0,0,0.55);
}

/* Procedural stone tile texture overlay on every panel */
.panel::before,
.board-wrap::before,
.sidebar::before,
.modal::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image: var(--orn-stone);
  background-size: 128px 128px;
  background-repeat: repeat;
  opacity: 0.18;
  mix-blend-mode: overlay;
}

/* Brass corner ornaments */
.sidebar::after,
.modal::after,
.board-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image:
    var(--orn-corner-tl),
    var(--orn-corner-tr),
    var(--orn-corner-bl),
    var(--orn-corner-br);
  background-position: top left, top right, bottom left, bottom right;
  background-repeat: no-repeat;
  background-size: 36px 36px;
}

.board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  position: relative;
}

/* ============================================================
   Board hover tooltip — themed to match panels & modals
   ============================================================ */
.board-tooltip {
  display: none;
  position: absolute;
  pointer-events: none;
  z-index: 50;
  max-width: 260px;
  padding: 10px 12px 9px;
  background:
    linear-gradient(180deg, rgba(40,28,46,0.55), rgba(10,6,14,0.92)),
    var(--panel);
  border: 1px solid #2c1f33;
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px rgba(201,162,74,0.18),
    inset 0 0 24px rgba(0,0,0,0.7),
    0 2px 0 rgba(0,0,0,0.6),
    0 10px 28px rgba(0,0,0,0.7);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.35;
}
/* Procedural stone overlay (same texture as panels) */
.board-tooltip::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image: var(--orn-stone);
  background-size: 128px 128px;
  background-repeat: repeat;
  opacity: 0.18;
  mix-blend-mode: overlay;
}
/* Brass hairline at the top edge for that gilded modal feel */
.board-tooltip::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(217,168,90,0.65), transparent);
  pointer-events: none;
}
.board-tooltip .tt-title {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--brass-lit);
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(184,138,60,0.25);
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(217,168,90,0.35);
  position: relative;
}
.board-tooltip .tt-line {
  color: var(--text-soft);
  font-size: 14px;
  letter-spacing: 0.2px;
  position: relative;
}
.board-tooltip .tt-line + .tt-line { margin-top: 2px; }

canvas {
  image-rendering: pixelated;
  background: #050309;
  border-radius: 2px;
  border: 1px solid #2c1f33;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.8),
    inset 0 0 80px rgba(0,0,0,0.85),
    0 0 0 2px #0a0610,
    0 0 0 3px rgba(201,162,74,0.18),
    0 14px 60px rgba(0,0,0,0.7);
}

.sidebar {
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto auto minmax(120px, 1fr) auto;
  gap: 14px;
  overflow: hidden;
}
.sidebar .log { display: flex; flex-direction: column; min-height: 0; }
.sidebar .log .log-box { flex: 1 1 auto; height: auto; min-height: 120px; }

/* ============================================================
   Title row — banner with sigil
   ============================================================ */
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background:
    linear-gradient(180deg, rgba(58,30,30,0.45), rgba(10,6,12,0.9));
  border: 1px solid #3a1f1f;
  box-shadow:
    inset 0 0 0 1px rgba(201,162,74,0.18),
    inset 0 -10px 24px rgba(138,20,20,0.18),
    0 2px 0 rgba(0,0,0,0.6);
}
.title-row > div:first-child { min-width: 0; flex: 1 1 auto; }
.title-row .pill { flex-shrink: 0; white-space: nowrap; }

.game-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  color: var(--bone);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow:
    0 0 1px rgba(201,162,74,0.6),
    0 0 12px rgba(138,20,20,0.45),
    0 2px 0 #000;
}

.subtle {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 15px;
  font-style: italic;
}

/* ============================================================
   Sub-panels (stats, inventory, log, tavern)
   ============================================================ */
.stats, .inventory, .log, .tavern {
  padding: 14px 14px 12px;
}

.stats h3, .inventory h3, .log h3, .tavern h3 {
  margin: 0 0 10px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--brass-lit);
  text-shadow: 0 0 8px rgba(201,162,74,0.25), 0 1px 0 #000;
  position: relative;
  padding-bottom: 8px;
}
.stats h3::after,
.inventory h3::after,
.log h3::after,
.tavern h3::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 8px;
  background-image: var(--orn-divider);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.85;
}

/* Always-visible HP/MP/EXP bar stack above the collapsible details */
.stats-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.stats-bars .statbar { margin-top: 0; }

/* Collapsible panel headings (Stats / Inventory) */
.collapser {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 120ms ease;
}
.collapser:hover { color: var(--bone) !important; }
.collapser .chev {
  display: inline-block;
  font-size: 0.85em;
  width: 1em;
  color: var(--brass);
  transition: transform 120ms ease;
}
.collapser .key-hint {
  margin-left: auto;
  font-size: 0.8em;
  color: var(--ash);
  font-weight: normal;
  letter-spacing: 0.5px;
}
.collapsed .collapsible { display: none; }
.collapsed h3 { margin-bottom: 0; padding-bottom: 0; }
.collapsed h3::after { display: none; }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--text-soft);
}

/* Stat bars */
.statbar { grid-column: 1 / -1; margin-top: 4px; }
.statbar .label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}
.statbar .track {
  height: 12px;
  background: #0a0610;
  border: 1px solid #2c1f33;
  border-radius: 2px;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(201,162,74,0.1),
    inset 0 2px 6px rgba(0,0,0,0.85);
}
.statbar .fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(180deg, #d62828 0%, #8a1414 50%, #4a0a0a 100%);
  box-shadow: inset 0 1px 0 rgba(255,180,140,0.3), inset 0 -2px 4px rgba(0,0,0,0.5);
  transition: width 160ms ease;
}
.statbar.mp .fill {
  background: linear-gradient(180deg, #6792a8 0%, #2f5b78 50%, #14283a 100%);
  box-shadow: inset 0 1px 0 rgba(180,220,255,0.25), inset 0 -2px 4px rgba(0,0,0,0.5);
}
.statbar.exp .fill {
  background: linear-gradient(180deg, #d9a85a 0%, #b88a3c 50%, #6a4a1c 100%);
  box-shadow: inset 0 1px 0 rgba(255,230,170,0.4), inset 0 -2px 4px rgba(0,0,0,0.5);
}
.statbar.sta .fill {
  background: linear-gradient(180deg, #a0d878 0%, #5a9a3a 50%, #1a4a0f 100%);
  box-shadow: inset 0 1px 0 rgba(200,255,180,0.35), inset 0 -2px 4px rgba(0,0,0,0.5);
}

.hp { color: var(--blood-lit); text-shadow: 0 0 6px rgba(192,40,42,0.4); }
.gold { color: var(--gold); text-shadow: 0 0 6px rgba(201,162,74,0.4); }

/* ============================================================
   Inventory items
   ============================================================ */
.inventory-list {
  display: grid;
  grid-auto-rows: minmax(36px, auto);
  gap: 6px;
  max-height: 200px;
  overflow: auto;
  padding-right: 6px;
}

.item {
  padding: 8px 12px;
  background:
    linear-gradient(180deg, rgba(34,24,41,0.9), rgba(12,8,16,0.95));
  border: 1px solid #2c1f33;
  border-left: 3px solid var(--brass);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-soft);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.6);
}

.item .name { color: var(--text); flex: 1 1 auto; min-width: 0; }
.item canvas { image-rendering: pixelated; border: 1px solid rgba(217,168,90,0.4); border-radius: 2px; }
.shop .card canvas { image-rendering: pixelated; border: 1px solid rgba(217,168,90,0.4); border-radius: 2px; }
.item .rarity-common { color: var(--text-soft); }
.item .rarity-magic { color: #b48cdc; text-shadow: 0 0 4px rgba(111,63,168,0.5); }
.item .rarity-rare { color: var(--brass-lit); text-shadow: 0 0 6px rgba(201,162,74,0.6); }

.penalty {
  color: #ff6b6b;
  font-weight: bold;
  text-shadow: 0 0 3px rgba(255,40,40,0.5);
}
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 0.72em;
  letter-spacing: 1px;
  vertical-align: middle;
  font-family: var(--font-display);
}
.equipped-badge {
  background: linear-gradient(180deg, #5a3a14, #2a1808);
  color: #f5d480;
  border: 1px solid #8a5e2a;
  text-shadow: 0 0 4px rgba(245,212,128,0.5);
}
.shop .card.equipped {
  border-color: #8a5e2a;
  box-shadow: 0 0 0 1px rgba(245,212,128,0.4), inset 0 0 12px rgba(120,80,30,0.18);
}

/* Fading +N stat-up indicator on the stats sheet (level-up feedback) */
.stat-delta {
  display: inline-block;
  margin-left: 6px;
  padding: 0 4px;
  font-family: var(--font-display);
  font-size: 0.85em;
  font-weight: bold;
  letter-spacing: 0.5px;
  border-radius: 2px;
  vertical-align: baseline;
  transition: opacity 120ms linear;
}
.stat-delta.pos {
  color: #f5d480;
  text-shadow: 0 0 6px rgba(245,212,128,0.7), 0 0 2px rgba(245,212,128,0.9);
}
.stat-delta.neg {
  color: #ff6b6b;
  text-shadow: 0 0 4px rgba(255,40,40,0.6);
}

/* ============================================================
   Buttons — aged brass plates
   ============================================================ */
.btn {
  padding: 9px 16px;
  background:
    linear-gradient(180deg, #3c2a18 0%, #261810 50%, #16100a 100%);
  border: 1px solid #5a3e1c;
  border-top-color: #8a5e2a;
  border-bottom-color: #1a0f06;
  border-radius: 2px;
  color: var(--bone);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000, 0 0 6px rgba(201,162,74,0.25);
  box-shadow:
    inset 0 1px 0 rgba(217,168,90,0.3),
    inset 0 -2px 4px rgba(0,0,0,0.5),
    0 2px 0 rgba(0,0,0,0.7),
    0 0 0 1px rgba(0,0,0,0.6);
  transition: filter 100ms ease, transform 80ms ease;
}
.btn:hover {
  filter: brightness(1.18) saturate(1.1);
  border-color: #b88a3c;
  color: #fff3d4;
}
.btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 4px rgba(0,0,0,0.7),
    0 0 0 1px rgba(0,0,0,0.6);
}
.btn:disabled,
.btn[disabled] {
  cursor: not-allowed;
  filter: grayscale(0.6) brightness(0.55);
  opacity: 0.75;
}
.btn.cooldown {
  background: linear-gradient(180deg, #1c1410 0%, #0f0a06 100%);
  border-color: #3a2814;
  color: #8a6a3a;
  text-shadow: 0 1px 0 #000;
  position: relative;
}
.btn.cooldown::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(120,60,20,0.18) 0 6px, transparent 6px 12px);
  pointer-events: none;
}
.btn.low-mp {
  border-color: #4a2030;
  color: #8a6a78;
}

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { height: 8px; }

/* ============================================================
   Log panel — flickering candle text
   ============================================================ */
.log { margin-top: 0; }
.log-box {
  height: 180px;
  overflow: auto;
  font-family: var(--font-body);
  font-size: 16px;
  padding: 10px 12px;
  background:
    linear-gradient(180deg, rgba(8,4,12,0.95), rgba(4,2,8,0.98));
  border: 1px solid #2c1f33;
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.7),
    inset 0 4px 12px rgba(0,0,0,0.85);
}
.log-line {
  color: var(--text-soft);
  padding: 1px 0;
  line-height: 1.35;
  font-style: italic;
}
.log-line::before {
  content: '› ';
  color: var(--brass);
  font-style: normal;
}

/* ============================================================
   HUD pills (top of board)
   ============================================================ */
.hud {
  /* Flows below the canvas inside the column-oriented board-wrap so
     pills never obscure the play area. `order: 2` keeps it after the
     canvas regardless of HTML order, and flex-wrap lets the row fold
     onto additional lines on narrow viewports. */
  order: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  z-index: 2;
}

.pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #5a3e1c;
  background: linear-gradient(180deg, rgba(34,18,8,0.85), rgba(8,4,4,0.92));
  color: var(--bone);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000;
  box-shadow:
    inset 0 1px 0 rgba(217,168,90,0.25),
    0 1px 4px rgba(0,0,0,0.7);
}

#levelPill {
  background: linear-gradient(180deg, rgba(74,12,12,0.85), rgba(20,4,4,0.95));
  border-color: #6a1414;
  color: var(--bone);
  text-shadow: 0 0 8px rgba(192,40,42,0.6), 0 1px 0 #000;
}

.kbd {
  font-family: var(--font-mono);
  background: #0a0610;
  border: 1px solid #3a2c44;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--bone);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.6);
}

.toast {
  /* Floats over the canvas near the top so the HUD row below the board
     never covers level-up / pickup messages. Opacity + translate give a
     subtle rise-and-fade feel driven by the .show class. */
  position: absolute;
  top: 28px; left: 50%;
  transform: translate(-50%, 8px);
  background: linear-gradient(180deg, rgba(20,12,24,0.95), rgba(8,4,12,0.98));
  border: 1px solid #5a3e1c;
  color: var(--bone);
  padding: 12px 22px;
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms ease, transform 280ms ease, visibility 0s linear 280ms;
  z-index: 30;
  box-shadow:
    inset 0 1px 0 rgba(217,168,90,0.25),
    0 8px 28px rgba(0,0,0,0.7);
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity 200ms ease, transform 200ms ease, visibility 0s;
}

/* ============================================================
   Modals — ancient tomes
   ============================================================ */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(20,8,8,0.6) 0%, rgba(0,0,0,0.92) 80%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal {
  width: min(760px, 92vw);
  padding: 28px 32px;
  background:
    linear-gradient(180deg, rgba(50,32,56,0.55), rgba(10,6,14,0.95)),
    var(--panel);
  border: 1px solid #3a1f1f;
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px rgba(201,162,74,0.18),
    inset 0 0 60px rgba(0,0,0,0.85),
    0 0 0 2px #0a0610,
    0 0 0 3px rgba(201,162,74,0.18),
    0 30px 80px rgba(0,0,0,0.85);
}

/* Controls help modal: three-column grid of keybindings. */
#controlsHelp { width: min(860px, 94vw); }
.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 24px;
}
.controls-col h3 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c9a24a;
  border-bottom: 1px solid rgba(201,162,74,0.22);
  padding-bottom: 4px;
}
.ctrl-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
}
.ctrl-keys {
  font-family: 'Cinzel', serif;
  color: #e9ecf1;
  background: rgba(201,162,74,0.08);
  border: 1px solid rgba(201,162,74,0.22);
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .controls-grid { grid-template-columns: 1fr; }
}

/* Class-select gets a splash banner that rises above the modal frame,
   with its bottom edge tucked under the frame's top border. */
#classSelect {
  position: relative;
  overflow: visible;
  margin-top: 180px; /* reserve vertical space above so flex-center keeps
                         the splash + modal visually balanced */
}
.splash-image {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 2px);
  transform: translateX(-50%);
  width: min(620px, 94vw);
  height: auto;
  pointer-events: none;
  user-select: none;
  z-index: 2;
  filter: drop-shadow(0 16px 32px rgba(0,0,0,0.85));
}
@media (max-height: 820px) {
  #classSelect { margin-top: 110px; }
  .splash-image { width: min(520px, 90vw); }
}
@media (max-height: 680px) {
  #classSelect { margin-top: 60px; }
  .splash-image { width: min(440px, 86vw); }
}

/* "Created by WAS" credit line beneath the class cards. */
.splash-credit {
  margin-top: 18px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.8;
}
.splash-credit a {
  color: var(--brass-lit);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-shadow: 0 0 8px rgba(201,162,74,0.4), 0 1px 0 #000;
  transition: color 150ms ease, text-shadow 150ms ease;
}
.splash-credit a:hover {
  color: var(--bone);
  text-shadow: 0 0 12px rgba(217,168,90,0.7), 0 0 18px rgba(138,20,20,0.35), 0 1px 0 #000;
}

/* Boss dialogue overlay — sits on top of the canvas during boss fights. */
.boss-dialogue {
  position: absolute;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  min-width: 320px;
  max-width: min(70%, 680px);
  padding: 10px 18px 12px;
  background: linear-gradient(180deg, rgba(18,8,10,0.92), rgba(26,12,14,0.92));
  border: 2px solid rgba(201,162,74,0.55);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 8px 28px rgba(0,0,0,0.7), inset 0 0 24px rgba(138,20,20,0.25);
  color: #f1e6c8;
  font-family: var(--font-body);
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  transition: opacity 180ms ease;
}
.boss-dialogue.visible { opacity: 1; }
.boss-dialogue-name {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #ff6b6b;
  text-shadow: 0 0 6px rgba(255,80,80,0.45), 0 1px 0 #000;
  margin-bottom: 4px;
}
.boss-dialogue-text {
  font-size: 16px;
  line-height: 1.35;
  color: #f6eacd;
  text-shadow: 0 1px 0 #000;
}
.boss-dialogue.roast .boss-dialogue-name { color: #ffd166; text-shadow: 0 0 6px rgba(255,200,80,0.45), 0 1px 0 #000; }

.modal h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--bone);
  text-align: center;
  text-shadow:
    0 0 10px rgba(138,20,20,0.5),
    0 0 22px rgba(138,20,20,0.25),
    0 2px 0 #000;
}
.modal h2::after {
  content: '';
  display: block;
  height: 14px;
  margin: 10px auto 4px;
  width: 80%;
  background-image: var(--orn-divider);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.9;
}

.modal h3 {
  font-family: var(--font-heading);
  font-size: 17px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--brass-lit);
  margin: 14px 0 8px;
  text-shadow: 0 1px 0 #000;
}

.muted {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 16px;
  font-style: italic;
  text-align: center;
}

.classes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.class-card {
  position: relative;
  border: 1px solid #3a2c44;
  background:
    linear-gradient(180deg, rgba(40,24,46,0.7), rgba(10,6,14,0.95));
  border-radius: 3px;
  padding: 14px 12px;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(201,162,74,0.1),
    inset 0 -16px 24px rgba(0,0,0,0.6),
    0 2px 0 rgba(0,0,0,0.6);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.class-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image: var(--orn-stone);
  background-size: 96px 96px;
  opacity: 0.12;
  mix-blend-mode: overlay;
}
.class-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--bone);
  text-shadow: 0 0 8px rgba(201,162,74,0.35), 0 1px 0 #000;
  text-align: center;
}
.class-card .muted {
  text-align: left;
  font-size: 15px;
}
.class-card:hover {
  border-color: var(--brass-lit);
  box-shadow:
    inset 0 0 0 1px rgba(217,168,90,0.35),
    inset 0 -16px 24px rgba(138,20,20,0.25),
    0 0 18px rgba(192,40,42,0.25),
    0 2px 0 rgba(0,0,0,0.6);
  transform: translateY(-2px);
}

/* ============================================================
   Shop / Tavern
   ============================================================ */
.shop {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: min-content;
  align-content: start;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 8px;
}

.shop .card {
  background:
    linear-gradient(180deg, rgba(40,24,46,0.75), rgba(10,6,14,0.95));
  border: 1px solid #3a2c44;
  border-left: 3px solid var(--brass);
  border-radius: 2px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: start;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-soft);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.6);
}
.shop .card:hover { border-color: var(--brass-lit); }

/* ============================================================
   Scrollbars
   ============================================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0a0610; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3c2a18, #1a0f06);
  border: 1px solid #5a3e1c;
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #5a3e1c, #261810); }

/* ============================================================
   Misc legacy compat
   ============================================================ */
.stats h3, .inventory h3, .log h3, .tavern h3 { color: var(--brass-lit); }
