/* ==========================================================================
   PROJECT: SANCTUM — Classic ARPG Dark-Fantasy CSS Stylesheet
   Aesthetic: Diablo II & Dungeon Siege 1 Wrought-Iron, Hammered Copper & Antiqued Bronze
   Motto: Small. Fast. Efficient. Moddable. Zero Modern Web Rounding.
   ========================================================================== */

/* --- CANONICAL PALETTE TOKENS & DESIGN SYSTEM --- */
:root {
  /* PICO-8 16-Color Canonical Palette */
  --p8-0: #000000;   /* Black */
  --p8-1: #1D2B53;   /* Dark Blue */
  --p8-2: #7E2553;   /* Dark Purple */
  --p8-3: #008751;   /* Dark Green */
  --p8-4: #AB5236;   /* Brown */
  --p8-5: #5F574F;   /* Dark Gray */
  --p8-6: #C2C3C7;   /* Light Gray */
  --p8-7: #FFF1E8;   /* White */
  --p8-8: #FF004D;   /* Red */
  --p8-9: #FFA300;   /* Orange */
  --p8-10: #FFEC27;  /* Yellow */
  --p8-11: #00E436;  /* Green */
  --p8-12: #29ADFF;  /* Blue */
  --p8-13: #83769C;  /* Indigo */
  --p8-14: #FF77A8;  /* Pink */
  --p8-15: #FFCCAA;  /* Peach */

  /* Forged Iron Metal Tones */
  --iron-abyss: #040508;
  --iron-950: #0a0c12;
  --iron-900: #10131c;
  --iron-800: #181d29;
  --iron-700: #242a3a;
  --iron-600: #353d52;
  --iron-highlight: #616e8e;

  /* Hammered Copper Tones */
  --copper-darkest: #240d02;
  --copper-dark: #4d1c06;
  --copper-mid: #943b0d;
  --copper-bright: #c45518;
  --copper-highlight: #f07b35;

  /* Antiqued Bronze & Brass Tones */
  --bronze-darkest: #170f03;
  --bronze-dark: #362309;
  --bronze-mid: #6e4917;
  --bronze-bright: #ab7529;
  --bronze-highlight: #dfa448;
  --brass-gold: #f7c667;

  /* Weathered Bone & Parchment (Legible Retro Typography) */
  --bone-white: #f5eedf;
  --parchment-light: #dfd3bd;
  --parchment-mid: #b8a990;
  --parchment-dark: #7d715d;

  /* Semantic UI Colors */
  --bg-abyss: var(--iron-abyss);
  --bg-slate-950: var(--iron-950);
  --bg-slate-900: var(--iron-900);
  --bg-slate-800: var(--iron-800);
  --bg-slate-700: var(--iron-700);

  --border-slate-800: #1c2230;
  --border-slate-700: #2d364a;
  --border-gold: var(--bronze-highlight);
  --border-amber-500: var(--copper-bright);
  --border-amber-700: var(--copper-mid);
  --border-amber-800: var(--copper-dark);
  --border-amber-900: var(--copper-darkest);
  --border-indigo-700: #3b4b70;
  --border-indigo-800: #293450;
  --border-indigo-900: #1a2337;
  --border-rose-800: #881337;
  --border-rose-900: #50071f;

  --text-slate-100: var(--bone-white);
  --text-slate-200: var(--parchment-light);
  --text-slate-300: #e2e8f0;
  --text-slate-400: #cbd5e1;
  --text-slate-500: #94a3b8;

  --amber-200: #fef08a;
  --amber-300: var(--brass-gold);
  --amber-400: var(--bronze-highlight);
  --amber-500: var(--copper-highlight);
  --amber-600: var(--copper-bright);

  --cyan-300: #67e8f9;
  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;

  --rose-300: #fca5a5;
  --rose-400: #f87171;
  --rose-500: #ef4444;

  --emerald-300: #86efac;
  --emerald-400: #4ade80;
  --emerald-500: #22c55e;

  --indigo-200: #cbd5e1;
  --indigo-300: #94a3b8;
  --indigo-400: #64748b;
  --indigo-500: #475569;
  --indigo-600: #334155;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* --- HARDCORE RETRO OVERRIDES: ZERO ROUNDED CORNERS --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important; /* Strictly blocky geometry */
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--iron-abyss);
  color: var(--bone-white);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
}

/* --- CHISELED IRON SCROLLBARS --- */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--iron-abyss);
  border-left: 1px solid var(--bronze-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--iron-700);
  border-top: 1px solid var(--bronze-highlight);
  border-left: 1px solid var(--bronze-mid);
  border-right: 1px solid var(--iron-950);
  border-bottom: 1px solid var(--iron-abyss);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--iron-600);
  border-top-color: var(--brass-gold);
}

/* Pixel-art rendering */
.pixelated,
img.pixelated,
canvas.pixelated {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Dev Studio Checkerboard */
.checker-bg {
  background-image:
    linear-gradient(45deg, var(--iron-900) 25%, transparent 25%),
    linear-gradient(-45deg, var(--iron-900) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--iron-900) 75%),
    linear-gradient(-45deg, transparent 75%, var(--iron-900) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: var(--iron-abyss);
}

/* --- FORGED CAST-IRON & BRONZE STEPPED PANELS (DIABLO 2 & DUNGEON SIEGE) --- */
#panel-char,
#panel-inv,
#panel-pause > div,
#panel-death > div,
#screen-main-menu > div,
#screen-auth > div,
#screen-char-menu > div,
#screen-lobby > div {
  background-color: var(--iron-950) !important;
  background-image:
    linear-gradient(180deg, rgba(24, 29, 41, 0.98) 0%, rgba(10, 12, 18, 0.99) 100%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.35) 0px, rgba(0, 0, 0, 0.35) 2px, transparent 2px, transparent 4px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0px, rgba(0, 0, 0, 0.18) 2px, transparent 2px, transparent 4px) !important;
  border: 4px solid var(--bronze-mid) !important; /* Thick antique bronze rim */
  box-shadow:
    0 0 0 2px #000000,
    inset 2px 2px 0 var(--bronze-highlight),
    inset -2px -2px 0 var(--copper-darkest),
    inset 5px 5px 0 var(--iron-800),
    inset -5px -5px 0 var(--iron-abyss),
    0 16px 40px rgba(0, 0, 0, 0.95) !important;
  padding: 14px !important;
}

#screen-lobby > div {
  width: clamp(680px, 68vw, 1020px) !important;
  height: clamp(520px, 76vh, 720px) !important;
  max-width: 95vw !important;
  max-height: 92vh !important;
}

#screen-char-menu > div {
  width: clamp(660px, 64vw, 940px) !important;
  max-width: 95vw !important;
  max-height: 92vh !important;
}

#panel-char {
  width: 310px !important;
  height: auto !important;
  max-height: calc(100% - 92px) !important;
  bottom: auto !important;
  border-color: var(--bronze-bright) !important;
  box-shadow:
    0 0 0 2px #000000,
    inset 2px 2px 0 var(--brass-gold),
    inset -2px -2px 0 var(--bronze-dark),
    inset 5px 5px 0 #281d10,
    inset -5px -5px 0 var(--iron-abyss),
    0 16px 40px rgba(0, 0, 0, 0.95) !important;
}

#panel-inv {
  width: 350px !important;
  height: auto !important;
  max-height: calc(100% - 92px) !important;
  bottom: auto !important;
  border-color: var(--copper-bright) !important;
  box-shadow:
    0 0 0 2px #000000,
    inset 2px 2px 0 var(--copper-highlight),
    inset -2px -2px 0 var(--copper-darkest),
    inset 5px 5px 0 #2b170c,
    inset -5px -5px 0 var(--iron-abyss),
    0 16px 40px rgba(0, 0, 0, 0.95) !important;
}

#game-stage {
  border: 5px solid var(--bronze-dark) !important;
  box-shadow:
    0 0 0 2px #000000,
    inset 2px 2px 0 var(--bronze-bright),
    inset -2px -2px 0 var(--bronze-darkest),
    0 20px 50px rgba(0, 0, 0, 0.95) !important;
}

/* Panel Header Dividers */
#panel-char .border-b,
#panel-inv .border-b,
#panel-pause .border-b,
#screen-auth .border-b,
#screen-char-menu .border-b,
#screen-lobby .border-b {
  border-bottom: 3px solid var(--bronze-mid) !important;
  box-shadow: 0 2px 0 #000000 !important;
  padding-bottom: 8px !important;
  margin-bottom: 10px !important;
}

/* --- TACTILE HEAVY FANTASY BUTTONS (RAISED IRON SLABS) --- */
button {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #373e52 0%, #1d222f 50%, #12151e 100%) !important;
  border-top: 3px solid var(--iron-highlight) !important;
  border-left: 3px solid var(--iron-600) !important;
  border-right: 3px solid #06080d !important;
  border-bottom: 3px solid #020306 !important;
  box-shadow: 0 3px 0 #000, inset 1px 1px 0 rgba(255,255,255,0.2) !important;
  color: var(--bone-white) !important;
  text-shadow: 1px 1px 0 #000000;
  cursor: pointer;
  transition: filter 80ms;
  padding: 6px 12px !important;
}

button:hover {
  filter: brightness(1.25);
  color: #ffffff !important;
}

/* --- DEV STUDIO & SWATCH EXEMPTIONS --- */
.sp-swatch,
button.sp-swatch {
  background-image: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-width: 2px !important;
  text-shadow: none !important;
}

#sp-bank-list button {
  background: #141b29 !important;
  border: 1px solid #2b3952 !important;
  color: #f8fafc !important;
  padding: 6px 10px !important;
  text-shadow: none !important;
  box-shadow: none !important;
}

#sp-bank-list button:hover {
  background: #202b40 !important;
  border-color: #64748b !important;
}

#sp-bank-list button.border-amber-500 {
  background: #422108 !important;
  border-color: #f59e0b !important;
  color: #fef08a !important;
}

#sp-bank-list span {
  color: inherit;
}

#sp-bank-list span.text-slate-500 {
  color: #cbd5e1 !important;
}

.sp-tool-btn,
button.sp-tool-btn {
  padding: 4px 8px !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

select {
  color: #f8fafc !important;
  background-color: #0a0c12 !important;
  border: 1px solid #334155 !important;
  color-scheme: dark !important;
}

select option {
  background: #0f131c !important;
  color: #f8fafc !important;
}

select optgroup {
  background: #0a0c12 !important;
  color: var(--brass-gold) !important;
  font-weight: bold !important;
}

/* Compact dev studio & modal form controls */
#view-sprites input,
#view-sprites select,
#view-audio input,
#view-audio select,
.dev-modal select,
.dev-modal input {
  padding: 4px 8px !important;
  font-size: 11px !important;
  color: #f8fafc !important;
  color-scheme: dark !important;
}

input::placeholder {
  color: #94a3b8 !important;
  opacity: 1 !important;
}

button:active {
  background: linear-gradient(180deg, #090b10 0%, #141720 100%) !important;
  border-top: 3px solid #020306 !important;
  border-left: 3px solid #06080d !important;
  border-right: 3px solid var(--iron-600) !important;
  border-bottom: 3px solid var(--iron-highlight) !important;
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.95);
  transform: translate(2px, 2px);
}

button:disabled {
  filter: grayscale(0.8) brightness(0.6) !important;
  cursor: not-allowed !important;
  transform: none !important;
}

/* Primary Hammered Copper & Gold Buttons (PLAY, Create Hero, Respawn, Login) */
#btn-menu-play,
#btn-create-char,
#btn-respawn,
#btn-enter-solo,
#btn-open-lobbies,
#btn-auth-register,
#btn-auth-login,
#btn-accept-invite {
  background: linear-gradient(180deg, #c45518 0%, #87360a 50%, #471a03 100%) !important;
  border-top: 3px solid var(--brass-gold) !important;
  border-left: 3px solid var(--copper-highlight) !important;
  border-right: 3px solid #1a0801 !important;
  border-bottom: 3px solid #0d0400 !important;
  box-shadow: 0 4px 0 #000, inset 1px 1px 0 rgba(255, 236, 39, 0.45) !important;
  color: #ffffff !important;
  text-shadow: 1px 1px 0 #000, 0 0 6px rgba(0,0,0,0.9) !important;
  padding: 10px 16px !important;
  font-size: 15px !important;
}

#btn-menu-play:active,
#btn-create-char:active,
#btn-respawn:active,
#btn-enter-solo:active,
#btn-open-lobbies:active,
#btn-auth-register:active,
#btn-auth-login:active,
#btn-accept-invite:active {
  background: linear-gradient(180deg, #2b1002 0%, #5e2406 100%) !important;
  border-top: 3px solid #0d0400 !important;
  border-left: 3px solid #1a0801 !important;
  border-right: 3px solid var(--copper-highlight) !important;
  border-bottom: 3px solid var(--brass-gold) !important;
}

/* --- UNMISTAKABLE LOCKED-PRESSED / ACTIVE BUTTON STATE --- */
.btn-locked-pressed,
button.btn-locked-pressed,
.class-card.btn-locked-pressed,
#tab-btn-join.text-amber-300,
#tab-btn-create.text-amber-300 {
  background: linear-gradient(180deg, #05060a 0%, #10141e 50%, #1a1e2b 100%) !important;
  border-top: 3px solid #000000 !important;
  border-left: 3px solid #000000 !important;
  border-right: 2px solid var(--bronze-bright) !important;
  border-bottom: 2px solid var(--brass-gold) !important;
  box-shadow:
    inset 3px 3px 6px #000000,
    inset 0 0 14px rgba(196, 85, 24, 0.4),
    0 0 0 1px #000000 !important;
  color: var(--brass-gold) !important;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.8), 1px 1px 0 #000 !important;
  transform: translate(2px, 2px) !important;
  position: relative !important;
}

/* Illuminated Amber/Copper Pip Indicator on Locked-Pressed Buttons */
.btn-locked-pressed::after,
button.btn-locked-pressed::after,
.class-card.btn-locked-pressed::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  background: #ffec27;
  box-shadow: 0 0 6px #f59e0b, 0 0 2px #fff;
  border: 1px solid #78350f;
  pointer-events: none;
}

/* Hardcore Mode Locked-Pressed (Blood-Iron Red Accent) */
#btn-mode-hardcore.btn-locked-pressed {
  border-right-color: #9f1239 !important;
  border-bottom-color: #f43f5e !important;
  box-shadow:
    inset 3px 3px 6px #000000,
    inset 0 0 14px rgba(225, 29, 72, 0.45),
    0 0 0 1px #000000 !important;
  color: #fda4af !important;
  text-shadow: 0 0 8px rgba(225, 29, 72, 0.8), 1px 1px 0 #000 !important;
}
#btn-mode-hardcore.btn-locked-pressed::after {
  background: #f43f5e;
  box-shadow: 0 0 6px #e11d48, 0 0 2px #fff;
  border-color: #4c0519;
}

/* Audio Quality Buttons Selected State */
.btn-audio-quality.bg-indigo-950\/80 {
  background: linear-gradient(180deg, #05060a 0%, #151a26 100%) !important;
  border-top: 2px solid #000000 !important;
  border-left: 2px solid #000000 !important;
  border-right: 2px solid var(--copper-bright) !important;
  border-bottom: 2px solid var(--brass-gold) !important;
  box-shadow: inset 2px 2px 4px #000, inset 0 0 8px rgba(196, 85, 24, 0.35) !important;
  color: var(--brass-gold) !important;
  transform: translate(1px, 1px) !important;
}

/* --- SUNKEN CAST-IRON WELLS: SLOTS, ATTRIBUTES & INPUTS --- */
.paperdoll-socket {
  background: #06070b !important;
  border-top: 3px solid #000000 !important;
  border-left: 3px solid #000000 !important;
  border-right: 2px solid var(--bronze-dark) !important;
  border-bottom: 2px solid var(--bronze-mid) !important;
  box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.95) !important;
  min-height: 52px !important;
  padding: 6px 8px !important;
}

.inv-status-slab {
  background: #06070b !important;
  border-top: 2px solid #000000 !important;
  border-left: 2px solid #000000 !important;
  border-right: 2px solid var(--bronze-dark) !important;
  border-bottom: 2px solid var(--bronze-mid) !important;
  box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.95) !important;
}

#inv-list button {
  background: #080a10 !important;
  border-top: 2px solid #000000 !important;
  border-right: 2px solid var(--bronze-dark) !important;
  border-bottom: 2px solid var(--bronze-mid) !important;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.85) !important;
  padding: 6px 8px !important;
  margin-bottom: 4px !important;
}
#inv-list button:hover {
  background: #141722 !important;
  filter: brightness(1.15);
}

/* Character Attribute Rows */
#char-attrs > div {
  background: #07090f !important;
  border-top: 2px solid #000000 !important;
  border-left: 2px solid #000000 !important;
  border-right: 2px solid var(--bronze-dark) !important;
  border-bottom: 2px solid var(--bronze-mid) !important;
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.95);
  padding: 6px 10px !important;
  margin-bottom: 4px !important;
}

/* Stat Allocate + Buttons */
.btn-alloc-stat {
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #c45518 0%, #632506 100%) !important;
  border-top: 2px solid var(--brass-gold) !important;
  border-left: 2px solid var(--copper-highlight) !important;
  border-right: 2px solid #1a0801 !important;
  border-bottom: 2px solid #0d0400 !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  font-size: 13px !important;
}

/* Stone Inset Text Inputs */
input[type=text],
input[type=password] {
  background: #040508 !important;
  border-top: 3px solid #000000 !important;
  border-left: 3px solid #000000 !important;
  border-right: 2px solid var(--bronze-dark) !important;
  border-bottom: 2px solid var(--bronze-mid) !important;
  box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.95);
  color: var(--bone-white) !important;
  font-family: var(--font-mono) !important;
  padding: 8px 10px !important;
  font-size: 14px !important;
}
input[type=text]:focus,
input[type=password]:focus {
  border-top: 3px solid var(--copper-darkest) !important;
  border-left: 3px solid var(--copper-darkest) !important;
  border-right: 2px solid var(--copper-highlight) !important;
  border-bottom: 2px solid var(--copper-highlight) !important;
}

/* Stone Trough Progress Bars */
#char-xp-bar,
#inv-weight-bar,
#hud-xp-bar {
  border-radius: 0 !important;
}
.w-full.h-1\.5.bg-slate-900,
.w-full.h-1.bg-slate-900 {
  background: #030406 !important;
  border-top: 2px solid #000000 !important;
  border-left: 2px solid #000000 !important;
  border-right: 2px solid var(--bronze-dark) !important;
  border-bottom: 2px solid var(--bronze-mid) !important;
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.95);
  height: 10px !important;
}

/* --- BOTTOM ACTION HUD (DIABLO-INSPIRED CHUNKY BAR) --- */
.absolute.bottom-2 > div {
  background: var(--iron-950) !important;
  border: 3px solid var(--bronze-mid) !important;
  box-shadow:
    0 0 0 2px #000000,
    inset 2px 2px 0 var(--bronze-highlight),
    inset -2px -2px 0 var(--bronze-darkest),
    inset 4px 4px 0 var(--iron-800),
    inset -4px -4px 0 var(--iron-abyss),
    0 10px 28px rgba(0,0,0,0.95) !important;
  padding: 6px 12px !important;
}

/* Bottom Action HUD Buttons (Belt slots, skill buttons) */
#btn-pot,
.absolute.bottom-2 .w-8.h-8 {
  width: 40px !important;
  height: 40px !important;
  background: #07090f !important;
  border-top: 3px solid #000000 !important;
  border-left: 3px solid #000000 !important;
  border-right: 2px solid var(--bronze-dark) !important;
  border-bottom: 2px solid var(--bronze-mid) !important;
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.95) !important;
}

/* Health & Mana Orbs: Studded Bronze Bezels */
.w-7.h-7.rounded-full {
  width: 38px !important;
  height: 38px !important;
  border-radius: 2px !important;
  border: 3px solid var(--bronze-dark) !important;
  box-shadow:
    0 0 0 2px #000000,
    inset 2px 2px 0 rgba(255,255,255,0.3),
    inset -2px -2px 0 rgba(0,0,0,0.9) !important;
}

/* Class Selection Cards (Hammered Metal Slabs) */
.class-card {
  background: var(--iron-900) !important;
  border-top: 3px solid var(--iron-highlight) !important;
  border-left: 3px solid var(--iron-600) !important;
  border-right: 3px solid #06080d !important;
  border-bottom: 3px solid #020306 !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.85);
  cursor: pointer;
  padding: 10px !important;
  transition: transform 60ms, filter 60ms;
}
.class-card:hover {
  filter: brightness(1.22);
}

/* --- TAB NAVIGATION (JOIN / CREATE GAME) --- */
#tab-btn-join,
#tab-btn-create {
  border-bottom: 3px solid transparent !important;
  padding: 10px !important;
  font-size: 14px !important;
}
#tab-btn-join.text-amber-300,
#tab-btn-create.text-amber-300 {
  background: var(--iron-800) !important;
  border-bottom: 3px solid var(--copper-bright) !important;
  box-shadow: inset 0 2px 0 var(--bronze-highlight);
}

/* --- DISPLAY & VISIBILITY --- */
.hidden { display: none !important; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.block { display: block; }
.inline-block { display: inline-block; }

/* --- FLEXBOX HELPERS --- */
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

/* --- GRID TEMPLATES & SPANS --- */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-cols-9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }
.col-span-4 { grid-column: span 4 / span 4; }
.col-span-5 { grid-column: span 5 / span 5; }
.col-span-6 { grid-column: span 6 / span 6; }
.col-span-7 { grid-column: span 7 / span 7; }
.col-span-8 { grid-column: span 8 / span 8; }
.col-span-12 { grid-column: span 12 / span 12; }

@media (min-width: 640px) {
  .sm\:flex-row { flex-direction: row; }
  .sm\:w-auto { width: auto; }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .md\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .md\:col-span-5 { grid-column: span 5 / span 5; }
  .md\:col-span-7 { grid-column: span 7 / span 7; }
  .md\:col-span-6 { grid-column: span 6 / span 6; }
  .md\:p-6 { padding: 1.5rem; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .lg\:col-span-3 { grid-column: span 3 / span 3; }
  .lg\:col-span-4 { grid-column: span 4 / span 4; }
  .lg\:col-span-5 { grid-column: span 5 / span 5; }
  .lg\:col-span-9 { grid-column: span 9 / span 9; }
}

/* --- GAPS --- */
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-3\.5 { gap: 0.875rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }

/* --- POSITIONING & Z-INDEX --- */
.fixed { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.top-2 { top: 0.5rem; }
.top-3 { top: 0.75rem; }
.left-0 { left: 0; }
.left-2 { left: 0.5rem; }
.left-3 { left: 0.75rem; }
.left-1\/2 { left: 50%; }
.right-0 { right: 0; }
.right-3 { right: 0.75rem; }
.bottom-2 { bottom: 0.5rem; }
.bottom-20 { bottom: 5rem; }
.-translate-x-1\/2 { transform: translateX(-50%); }
.-top-1 { top: -0.25rem; }
.-right-1 { right: -0.25rem; }
.origin-top-left { transform-origin: top left; }

.z-\[8\] { z-index: 8; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.z-\[60\] { z-index: 60; }

/* --- SIZING --- */
.w-full { width: 100%; }
.h-full { height: 100%; }
.w-screen { width: 100vw; }
.h-screen { height: 100vh; }
.min-h-screen { min-height: 100vh; }
.min-w-0 { min-width: 0; }
.box-border { box-sizing: border-box; }

.max-w-xs { max-width: 20rem; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-\[1600px\] { max-width: 1600px; }

.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.w-3\.5 { width: 0.875rem; }
.h-3\.5 { height: 0.875rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-7 { width: 1.75rem; }
.h-7 { height: 1.75rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-20 { width: 5rem; }
.w-24 { width: 6rem; }
.w-44 { width: 11rem; }
.w-64 { width: 16rem; }
.w-72 { width: 18rem; }
.w-80 { width: 20rem; }
.w-84 { width: 21rem; }
.w-96 { width: 24rem; }
.w-px { width: 1px; }
.h-1 { height: 0.25rem; }
.h-1\.5 { height: 0.375rem; }
.h-24 { height: 6rem; }
.min-h-0 { min-height: 0; }

.min-h-\[42px\] { min-height: 42px; }
.max-h-44 { max-height: 11rem; }
.max-h-56 { max-height: 14rem; }
.max-h-\[380px\] { max-height: 380px; }
.max-h-\[480px\] { max-height: 480px; }
.max-h-\[92vh\] { max-height: 92vh; }

/* --- OVERFLOW --- */
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }

/* --- PADDING & MARGIN --- */
.p-1 { padding: 0.25rem; }
.p-1\.5 { padding: 0.375rem; }
.p-2 { padding: 0.5rem; }
.p-2\.5 { padding: 0.625rem; }
.p-3 { padding: 0.75rem; }
.p-3\.5 { padding: 0.875rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }

.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }

.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pb-1\.5 { padding-bottom: 0.375rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-2\.5 { padding-bottom: 0.625rem; }
.pb-3 { padding-bottom: 0.75rem; }
.pr-1 { padding-right: 0.25rem; }
.pr-2 { padding-right: 0.5rem; }

.mx-auto { margin-left: auto; margin-right: auto; }
.mx-0\.5 { margin-left: 0.125rem; margin-right: 0.125rem; }
.mx-5 { margin-left: 1.25rem; margin-right: 1.25rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-10 { margin-top: 2.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.5rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.mr-2 { margin-right: 0.5rem; }

/* Space-y Stacking Helpers */
.space-y-0\.5 > * + * { margin-top: 0.125rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-1\.5 > * + * { margin-top: 0.375rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-2\.5 > * + * { margin-top: 0.625rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* --- TYPOGRAPHY (SCALED FOR RETRO CLARITY) --- */
.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: var(--font-mono); }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }

.text-\[8px\] { font-size: 10px; line-height: 12px; }
.text-\[9px\] { font-size: 11px; line-height: 14px; }
.text-\[10px\] { font-size: 12px; line-height: 16px; font-weight: 600; }
.text-\[11px\] { font-size: 13px; line-height: 17px; }
.text-xs { font-size: 14px; line-height: 18px; }
.text-sm { font-size: 16px; line-height: 22px; font-weight: 700; }
.text-base { font-size: 17px; line-height: 24px; font-weight: 700; }
.text-lg { font-size: 20px; line-height: 26px; font-weight: 800; }
.text-xl { font-size: 24px; line-height: 30px; font-weight: 900; }
.text-3xl { font-size: 34px; line-height: 40px; font-weight: 900; letter-spacing: 0.12em; }

h1, h2, h3, .font-bold, .font-black {
  text-shadow: 2px 2px 0 #000000;
}

.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.uppercase { text-transform: uppercase; }
.normal-case { text-transform: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Text Colors */
.text-white { color: #ffffff; }
.text-slate-100 { color: var(--bone-white); }
.text-slate-200 { color: var(--parchment-light); }
.text-slate-300 { color: #e2e8f0; }
.text-slate-400 { color: #cbd5e1; }
.text-slate-500 { color: #94a3b8; }

.text-amber-100 { color: #fef3c7; }
.text-amber-200 { color: #fef08a; }
.text-amber-300 { color: var(--brass-gold); }
.text-amber-400 { color: var(--bronze-highlight); }
.text-amber-500 { color: var(--copper-highlight); }

.text-cyan-200 { color: #a5f3fc; }
.text-cyan-300 { color: var(--cyan-300); }
.text-cyan-400 { color: var(--cyan-400); }

.text-rose-200 { color: #fecdd3; }
.text-rose-300 { color: var(--rose-300); }
.text-rose-400 { color: var(--rose-400); }

.text-emerald-200 { color: #bbf7d0; }
.text-emerald-300 { color: var(--emerald-300); }
.text-emerald-400 { color: var(--emerald-400); }

.text-indigo-100 { color: #e2e8f0; }
.text-indigo-200 { color: #cbd5e1; }
.text-indigo-300 { color: #94a3b8; }
.text-indigo-400 { color: #64748b; }

/* --- BACKGROUND COLORS --- */
.bg-black { background-color: #000000; }
.bg-transparent { background-color: transparent; }
.bg-slate-950 { background-color: var(--iron-950); }
.bg-slate-900 { background-color: var(--iron-900); }
.bg-slate-800 { background-color: var(--iron-800); }
.bg-slate-700 { background-color: var(--iron-700); }

.bg-slate-950\/95 { background-color: rgba(10, 12, 18, 0.95); }
.bg-slate-950\/92 { background-color: rgba(10, 12, 18, 0.92); }
.bg-slate-950\/90 { background-color: rgba(10, 12, 18, 0.90); }
.bg-slate-950\/85 { background-color: rgba(10, 12, 18, 0.85); }
.bg-slate-950\/80 { background-color: rgba(10, 12, 18, 0.80); }
.bg-slate-950\/70 { background-color: rgba(10, 12, 18, 0.70); }
.bg-slate-950\/60 { background-color: rgba(10, 12, 18, 0.60); }
.bg-slate-950\/40 { background-color: rgba(10, 12, 18, 0.40); }

.bg-slate-900\/95 { background-color: rgba(16, 19, 28, 0.95); }
.bg-slate-900\/90 { background-color: rgba(16, 19, 28, 0.90); }
.bg-slate-900\/80 { background-color: rgba(16, 19, 28, 0.80); }
.bg-slate-900\/70 { background-color: rgba(16, 19, 28, 0.70); }
.bg-slate-900\/40 { background-color: rgba(16, 19, 28, 0.40); }

.bg-slate-800\/80 { background-color: rgba(24, 29, 41, 0.80); }

.bg-amber-950 { background-color: var(--copper-darkest); }
.bg-amber-950\/95 { background-color: rgba(36, 13, 2, 0.95); }
.bg-amber-950\/70 { background-color: rgba(36, 13, 2, 0.70); }
.bg-amber-950\/60 { background-color: rgba(36, 13, 2, 0.60); }
.bg-amber-950\/40 { background-color: rgba(36, 13, 2, 0.40); }
.bg-amber-950\/25 { background-color: rgba(36, 13, 2, 0.25); }
.bg-amber-950\/20 { background-color: rgba(36, 13, 2, 0.20); }
.bg-amber-900\/60 { background-color: rgba(77, 28, 6, 0.60); }
.bg-amber-600 { background-color: var(--copper-bright); }
.bg-amber-500 { background-color: var(--copper-highlight); }
.bg-amber-400 { background-color: var(--bronze-highlight); }

.bg-rose-950 { background-color: #3b0512; }
.bg-rose-950\/75 { background-color: rgba(59, 5, 18, 0.75); }
.bg-rose-950\/70 { background-color: rgba(59, 5, 18, 0.70); }
.bg-rose-950\/60 { background-color: rgba(59, 5, 18, 0.60); }
.bg-rose-950\/50 { background-color: rgba(59, 5, 18, 0.50); }
.bg-rose-950\/40 { background-color: rgba(59, 5, 18, 0.40); }
.bg-rose-950\/20 { background-color: rgba(59, 5, 18, 0.20); }
.bg-rose-500 { background-color: var(--rose-500); }

.bg-indigo-950 { background-color: #121824; }
.bg-indigo-950\/80 { background-color: rgba(18, 24, 36, 0.80); }
.bg-indigo-950\/60 { background-color: rgba(18, 24, 36, 0.60); }
.bg-indigo-950\/40 { background-color: rgba(18, 24, 36, 0.40); }
.bg-indigo-900\/70 { background-color: rgba(26, 35, 53, 0.70); }
.bg-indigo-600 { background-color: #3b4b70; }
.bg-indigo-400 { background-color: #616e8e; }

.bg-cyan-600 { background-color: #0891b2; }
.bg-cyan-950\/80 { background-color: rgba(8, 51, 68, 0.80); }

.bg-emerald-600 { background-color: #059669; }
.bg-emerald-950\/70 { background-color: rgba(6, 78, 59, 0.70); }
.bg-emerald-400 { background-color: var(--emerald-400); }

/* --- BORDERS & RADII --- */
.border { border-width: 1px; border-style: solid; border-color: var(--border-slate-800); }
.border-2 { border-width: 2px; border-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; border-color: var(--border-slate-800); }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; border-color: var(--border-slate-800); }
.border-b-2 { border-bottom-width: 2px; border-bottom-style: solid; }
.border-l { border-left-width: 1px; border-left-style: solid; border-color: var(--border-slate-800); }

.border-transparent { border-color: transparent; }
.border-slate-900 { border-color: var(--iron-900); }
.border-slate-800 { border-color: var(--border-slate-800); }
.border-slate-800\/60 { border-color: rgba(28, 34, 48, 0.6); }
.border-slate-700 { border-color: var(--border-slate-700); }
.border-slate-700\/60 { border-color: rgba(45, 54, 74, 0.6); }
.border-slate-600 { border-color: #404b66; }

.border-amber-500 { border-color: var(--copper-bright); }
.border-amber-500\/80 { border-color: rgba(196, 85, 24, 0.8); }
.border-amber-600\/60 { border-color: rgba(148, 59, 13, 0.6); }
.border-amber-700 { border-color: var(--copper-mid); }
.border-amber-700\/70 { border-color: rgba(148, 59, 13, 0.7); }
.border-amber-700\/60 { border-color: rgba(148, 59, 13, 0.6); }
.border-amber-800\/60 { border-color: rgba(77, 28, 6, 0.6); }
.border-amber-900\/60 { border-color: rgba(36, 13, 2, 0.6); }

.border-indigo-500 { border-color: #4f5f87; }
.border-indigo-700 { border-color: var(--border-indigo-700); }
.border-indigo-700\/60 { border-color: rgba(59, 75, 112, 0.6); }
.border-indigo-700\/50 { border-color: rgba(59, 75, 112, 0.5); }
.border-indigo-800 { border-color: var(--border-indigo-800); }
.border-indigo-800\/60 { border-color: rgba(41, 52, 80, 0.6); }
.border-indigo-900 { border-color: var(--border-indigo-900); }
.border-indigo-900\/60 { border-color: rgba(26, 35, 55, 0.6); }

.border-rose-700 { border-color: #be123c; }
.border-rose-700\/60 { border-color: rgba(190, 18, 60, 0.6); }
.border-rose-800 { border-color: var(--border-rose-800); }
.border-rose-800\/60 { border-color: rgba(136, 19, 55, 0.6); }
.border-rose-900 { border-color: var(--border-rose-900); }
.border-rose-900\/60 { border-color: rgba(80, 7, 31, 0.6); }

.border-red-400\/50 { border-color: rgba(248, 113, 113, 0.5); }
.border-red-900\/60 { border-color: rgba(127, 29, 29, 0.6); }

.border-cyan-400\/50 { border-color: rgba(34, 211, 238, 0.5); }
.border-cyan-600\/60 { border-color: rgba(8, 145, 178, 0.6); }
.border-cyan-800 { border-color: #155e75; }

.border-emerald-700\/60 { border-color: rgba(5, 150, 105, 0.6); }
.border-emerald-800 { border-color: #065f46; }

.border-blue-900\/60 { border-color: rgba(30, 58, 138, 0.6); }
.border-dashed { border-style: dashed; }

.divide-y > * + * { border-top-width: 1px; border-top-style: solid; border-color: var(--border-slate-800); }
.divide-slate-800\/70 > * + * { border-color: rgba(28, 34, 48, 0.7); }

/* --- SHADOWS & BLURS --- */
.shadow { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.shadow-lg { box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.8), 0 8px 10px -6px rgba(0, 0, 0, 0.7); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.95); }
.shadow-inner { box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.8); }
.drop-shadow { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.9)); }

.backdrop-blur-sm { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.backdrop-blur-md { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* --- INTERACTIVITY & STATES --- */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }
.cursor-crosshair { cursor: crosshair; }
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

.transition { transition: all 100ms ease; }
.transition-all { transition: all 100ms ease; }

.opacity-40 { opacity: 0.4; }
.opacity-50 { opacity: 0.5; }
.opacity-60 { opacity: 0.6; }

/* Pulse Animation */
@keyframes sanctum-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.animate-pulse {
  animation: sanctum-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Range Sliders: Hammered Bronze & Iron Tracks */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: var(--iron-abyss);
  border-top: 1px solid #000;
  border-left: 1px solid #000;
  border-right: 1px solid var(--bronze-dark);
  border-bottom: 1px solid var(--bronze-mid);
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.9);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 18px;
  border-radius: 0 !important;
  background: linear-gradient(180deg, #c45518 0%, #632506 100%);
  border-top: 1px solid var(--brass-gold);
  border-left: 1px solid var(--copper-highlight);
  border-right: 1px solid #140601;
  border-bottom: 1px solid #080200;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.9);
}
#slider-vol-sfx::-webkit-slider-thumb {
  background: linear-gradient(180deg, #ab7529 0%, #472b07 100%);
  border-top-color: var(--brass-gold);
  border-left-color: var(--bronze-highlight);
}
#slider-vol-music::-webkit-slider-thumb {
  background: linear-gradient(180deg, #22c55e 0%, #064e3b 100%);
  border-top-color: #86efac;
  border-left-color: #4ade80;
}

/* ==========================================================================
   PAPERDOLL & COMPARATIVE TOOLTIPS (DIABLO II / DUNGEON SIEGE STYLE)
   ========================================================================== */
.paperdoll-socket {
  background: linear-gradient(180deg, #0b0e14 0%, #111622 100%) !important;
  border: 2px solid var(--bronze-dark) !important;
  box-shadow: inset 2px 2px 5px #000, 0 1px 0 rgba(247, 198, 103, 0.1) !important;
  min-height: 58px;
  position: relative;
  transition: border-color 100ms ease, background-color 100ms ease, transform 60ms ease !important;
  user-select: none;
}

.paperdoll-socket:hover {
  border-color: var(--bronze-bright) !important;
  background: linear-gradient(180deg, #131926 0%, #1a2233 100%) !important;
}

.paperdoll-socket:active {
  transform: translateY(1px) !important;
  box-shadow: inset 3px 3px 6px #000 !important;
}

.paperdoll-socket.socket-occupied {
  border-color: var(--bronze-mid) !important;
}

.paperdoll-socket.socket-occupied:hover {
  border-color: var(--brass-gold) !important;
}

.paperdoll-socket .slot-icon {
  filter: drop-shadow(1px 1px 0px #000);
}

.item-card {
  background: linear-gradient(180deg, #121622 0%, #080b12 100%) !important;
  border: 3px solid var(--bronze-mid) !important;
  box-shadow:
    0 0 0 1px #000000,
    inset 1px 1px 0 var(--bronze-highlight),
    inset -1px -1px 0 var(--bronze-darkest),
    0 12px 32px rgba(0, 0, 0, 0.95) !important;
}

.item-card-equipped {
  border-color: var(--iron-600) !important;
  opacity: 0.9;
}

.stat-delta-pos {
  color: #4ade80 !important;
  font-weight: 700;
}

.stat-delta-neg {
  color: #f43f5e !important;
  font-weight: 700;
}

.stat-delta-neu {
  color: #94a3b8 !important;
}

