/* ── Codex overlay (F1) ────────────────────────────────────────────── */
#codex-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #0a0a0a;
  overflow-y: auto;
  font-family: var(--ui-font);
}
#codex-overlay.open { display: block; }

/* Sticky nav bar */
#codex-nav {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0a0a0a;
  border-bottom: 1px solid #1e1e1e;
  padding: 10px 32px 0;
}
#codex-nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
#codex-close-btn {
  background: transparent;
  border: 1px solid #282828;
  color: #484848;
  font-size: 16px;
  line-height: 1;
  padding: 2px 8px;
  cursor: pointer;
  font-family: monospace;
  transition: color 0.1s, border-color 0.1s;
}
#codex-close-btn:hover { color: #c8c8c8; border-color: #505050; }
#codex-nav-title {
  font-family: 'Manufacturing Consent', serif;
  color: #e0c040;
  font-size: 17px;
  letter-spacing: 1px;
  font-weight: 400;
}
#codex-nav-title::before,
#codex-nav-title::after {
  content: ' ✦ ';
  color: #907020;
  font-size: 0.55em;
  vertical-align: middle;
}
.codex-hint {
  color: #3a3a3a;
  font-size: 11px;
}
.codex-hint kbd {
  background: #181818;
  border: 1px solid #2a2a2a;
  padding: 2px 6px;
  border-radius: 2px;
  color: #555;
  font-family: monospace;
  font-size: 13px;
}
#codex-tabs { display: flex; gap: 2px; }
.codex-tab {
  padding: 7px 18px;
  background: transparent;
  color: #606060;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: color 0.1s;
  text-transform: uppercase;
  outline: none;
}
.codex-tab:hover  { color: #a0a0a0; }
.codex-tab.active { color: #e0c040; border-bottom-color: #e0c040; }
.codex-tab-sep {
  color: #333333;
  font-family: var(--ui-font);
  font-size: 11px;
  font-style: italic;
  letter-spacing: 1px;
  align-self: center;
  padding: 0 4px 2px 12px;
  pointer-events: none;
  user-select: none;
}

/* Content area */
#codex-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 28px 32px 80px;
  color: #c8c8c8;
  font-size: 14px;
  line-height: 1.75;
}

.codex-section { margin-bottom: 28px; }

.codex-section h2 {
  color: #d4b860;
  font-size: 17px;
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.codex-section p         { margin-bottom: 8px; color: #c8c8c8; }
.codex-section p strong  { color: #eeeeee; }
.codex-section ul        { padding-left: 20px; margin-bottom: 8px; }
.codex-section li        { margin-bottom: 4px; color: #c0c0c0; }
.codex-section li strong { color: #eeeeee; }

/* Key/value reference tables */
.codex-table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 12px;
}
.codex-table th {
  color: #707070;
  font-weight: 400;
  font-size: 12px;
  text-align: left;
  padding: 5px 16px 5px 0;
  width: 180px;
  vertical-align: top;
  border-bottom: 1px solid #1c1c1c;
}
.codex-table td {
  color: #c8c8c8;
  padding: 5px 0;
  vertical-align: top;
  border-bottom: 1px solid #161616;
}
.codex-table kbd {
  background: #181818;
  border: 1px solid #2a2a2a;
  padding: 2px 7px;
  border-radius: 2px;
  color: #989898;
  font-family: monospace;
  font-size: 13px;
}

/* Core mechanic highlight block */
.codex-lede {
  background: #111111;
  border-left: 3px solid #505050;
  padding: 10px 14px;
  margin-bottom: 14px;
  color: #c8c8c8;
  font-size: 13px;
  line-height: 1.75;
}
.codex-lede strong { color: #eeeeee; }

/* Ability tables */
.codex-abtable {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 14px;
}
.codex-abtable td {
  padding: 8px 12px 8px 0;
  vertical-align: middle;
  color: #c8c8c8;
}
.codex-abtable tr:nth-child(even) td { background: #111111; }
.codex-abtable td:first-child  { width: 54px; padding-left: 6px; vertical-align: middle; }
.codex-abtable td:nth-child(2) { color: #eeeeee; font-weight: 700; width: 148px; }
.codex-abtable td:nth-child(3) { width: 64px; color: #707070; font-size: 13px; }
.codex-abtable td:last-child   { font-size: 13px; }
.codex-abtable td strong { color: #eeeeee; }

/* CD cell variants */
.cd-offgcd {
  color: #50c878;
  cursor: help;
  text-decoration: underline dotted #50c878;
  text-underline-offset: 3px;
}
.cd-passive {
  color: #4a4a4a;
  font-style: italic;
  font-size: 12px;
}

/* Playstyle summary line */
.codex-playstyle {
  font-size: 14px;
  color: #d8d8d8;
  margin-bottom: 10px;
  line-height: 2.4;
}
.codex-playstyle strong { color: #ffffff; }

/* Inline sprite icons — 3× (16px → 48px) */
.cicon {
  display: inline-block;
  width: 48px;
  height: 48px;
  background-image: url('/assets/actions.png');
  background-size: 768px auto;
  image-rendering: pixelated;
  vertical-align: middle;
}

/* Small inline icons (2×) */
.cicon-sm {
  display: inline-block;
  width: 32px;
  height: 32px;
  background-image: url('/assets/actions.png');
  background-size: 512px auto;
  image-rendering: pixelated;
  vertical-align: middle;
  margin: 0 2px;
}

/* Stacked dual icons for alternating-pair abilities */
.cicon-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}

/* Player sprite icons — 2× (24px → 48px) */
.picon {
  display: inline-block;
  width: 48px;
  height: 48px;
  background-image: url('/assets/players.png');
  background-size: 480px auto;
  image-rendering: pixelated;
  vertical-align: middle;
}

/* Tag colors */
.tag-yellow { color: #ffe060; }
.tag-red    { color: #e06060; }
.tag-green  { color: #60e060; }
.tag-phys   { color: #e0c080; }
.tag-magic  { color: #80a0e0; }
.tag-true   { color: #e080c0; }

/* Settings tab */
.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.settings-label { color: #c8c8c8; min-width: 140px; }
.settings-note  { color: #505050; font-size: 12px; }
.settings-btn {
  background: #1c1c1c;
  border: 1px solid #404040;
  color: #c0c0c0;
  padding: 3px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  border-radius: 2px;
}
.settings-btn:hover { border-color: #686868; color: #e8e8e8; }
.settings-keys-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  margin-bottom: 6px;
}
.settings-keys-table th {
  text-align: left;
  color: #606060;
  padding: 2px 10px 6px 0;
  font-weight: normal;
  border-bottom: 1px solid #2a2a2a;
}
.settings-keys-table td {
  padding: 4px 10px 4px 0;
  color: #c0c0c0;
  border-bottom: 1px solid #1a1a1a;
}
.settings-rebind-btn {
  background: transparent;
  border: 1px solid #363636;
  color: #808080;
  padding: 2px 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  border-radius: 2px;
}
.settings-rebind-btn:hover    { border-color: #606060; color: #c0c0c0; }
.settings-rebind-btn.listening { border-color: #e0c040; color: #e0c040; }
.settings-ability-col { color: #505050; font-style: italic; }
.settings-preset-btn {
  background: transparent;
  border: 1px solid #363636;
  color: #808080;
  padding: 2px 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  border-radius: 2px;
}
.settings-preset-btn:hover  { border-color: #606060; color: #c0c0c0; }
.settings-preset-btn.active { border-color: #ffe040; color: #ffe040; }
