/* ===== Theme Variables ===== */
:root {
  /* Backgrounds */
  --bg: #0a0a0f;
  --bg1: #0a0a0f;
  --bg2: #12121a;
  --bg3: #1a1a28;
  --bg4: #222235;
  --card: #1a1a28;
  --border: rgba(200,154,74,.25);

  /* Gold accent */
  --gold: #c89a4a;
  --gold-l: #e8b86a;
  --gold-d: #8b6f37;
  --gold-dim: rgba(200,154,74,.15);
  --card-border: rgba(200,154,74,.25);

  /* Semantic */
  --red: #8b3a3a;
  --red-l: #c45050;
  --blue: #3a5a8b;
  --blue-l: #5a8ac0;
  --green: #3a6b3a;
  --green-l: #5a9b5a;
  --cyan: #2a7a7a;
  --cyan-l: #4ababa;
  --purple: #5a3a7a;
  --purple-l: #8a6aaa;
  --orange: #8b5a2a;
  --orange-l: #c08040;
  --yellow: #7a7a2a;
  --yellow-l: #baba4a;

  /* Text */
  --text: #ede9e0;
  --text1: #ede9e0;
  --text2: #b8b0a4;
  --text3: #7a7468;

  /* Reader */
  --reader-fs: 18px;

  /* Fonts */
  --font-head: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Literata', Georgia, serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Layout */
  --sidebar-w: 260px;
  --content-w: 680px;

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-l); }

button {
  font-family: var(--font-ui);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select {
  font-family: var(--font-ui);
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
input:focus, select:focus {
  border-color: var(--gold-d);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-d); }

/* Selection */
::selection { background: var(--gold-dim); color: var(--gold-l); }

/* Magic type colors */
.type-amplification { --tc: #e8b86a; --tbg: rgba(232,184,106,.12); }
.type-fire          { --tc: #e07040; --tbg: rgba(224,112,64,.12); }
.type-water         { --tc: #5090d0; --tbg: rgba(80,144,208,.12); }
.type-wind          { --tc: #70b8a0; --tbg: rgba(112,184,160,.12); }
.type-earth         { --tc: #a08050; --tbg: rgba(160,128,80,.12); }
.type-electricity   { --tc: #c0c040; --tbg: rgba(192,192,64,.12); }
.type-healing       { --tc: #60c060; --tbg: rgba(96,192,96,.12); }
.type-mental        { --tc: #a070d0; --tbg: rgba(160,112,208,.12); }
.type-illusion      { --tc: #d070b0; --tbg: rgba(208,112,176,.12); }

/* Focus indicators (keyboard only) */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--gold);
}

/* ===== Light Theme ===== */
[data-theme="light"] {
  /* Backgrounds */
  --bg: #f5f2ed;
  --bg1: #f5f2ed;
  --bg2: #eae6df;
  --bg3: #ddd9d2;
  --bg4: #d0cbc3;
  --card: #ddd9d2;
  --border: rgba(154,117,53,.25);

  /* Gold accent (darkened for contrast on light bg) */
  --gold: #9a7535;
  --gold-l: #7a5a20;
  --gold-d: #b8913e;
  --gold-dim: rgba(154,117,53,.12);
  --card-border: rgba(154,117,53,.25);

  /* Text (dark on light) */
  --text: #1a1815;
  --text1: #1a1815;
  --text2: #4a4640;
  --text3: #8a8478;

  /* Scrollbar */
  --scrollbar-thumb: #b8b0a4;
}

[data-theme="light"] ::selection {
  background: rgba(154,117,53,.2);
  color: #7a5a20;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
}

[data-theme="light"] .card {
  background: rgba(234,230,223,.85);
}

/* Utility */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
