/* ═══════════════════════════════════════════════════════
   The Savage Lands
   D&D dark theme
═══════════════════════════════════════════════════════ */

:root {
  --bg-deep:       #08080f;
  --bg-panel:      #10101c;
  --bg-panel-alt:  #14141f;
  --bg-msg-dm:     #13131e;
  --bg-msg-player: #0e0e18;
  --bg-input:      #12121d;

  --gold:          #c9a84c;
  --gold-dim:      rgba(201, 168, 76, 0.15);
  --gold-border:   rgba(201, 168, 76, 0.3);

  --text-dm:       #e2d0a8;
  --text-player:   #9db8d8;
  --text-label:    #7070a0;
  --text-ui:       #a0a0c8;
  --text-muted:    #505070;

  --hp-red:        #c04040;
  --hp-red-glow:   rgba(192, 64, 64, 0.4);
  --sp-purple:     #8855cc;
  --sp-purple-dim: rgba(136, 85, 204, 0.3);
  --ac-blue:       #3a7ab5;
  --teal:          #2a8a7a;
  --roll-amber:    #c8820a;
  --roll-amber-bg: rgba(200, 130, 10, 0.12);

  --border:        rgba(255, 255, 255, 0.06);
  --radius:        8px;

  --sidebar-w:     338px;
  --header-h:      52px;

  --font-display:  'Cinzel', 'Palatino Linotype', Georgia, serif;
  --font-body:     'Crimson Pro', Georgia, 'Times New Roman', serif;
  --font-ui:       'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-ui);
  font-family: var(--font-ui);
  font-size: 14px;
}

/* ═══ HEADER ════════════════════════════════════════════ */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

#title-block { display: flex; align-items: baseline; gap: 12px; }

#realm-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.08em;
}

#realm-sub {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#header-status { display: flex; align-items: center; gap: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--gold);
}

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.dot-checking { background: #666; }
.dot-ok       { background: #4caf50; box-shadow: 0 0 6px #4caf5099; }
.dot-error    { background: #f44336; box-shadow: 0 0 6px #f4433699; }

/* ═══ LAYOUT ════════════════════════════════════════════ */
#layout {
  display: flex;
  height: 100vh;
  padding-top: var(--header-h);
}

/* ═══ SIDEBAR ═══════════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-panel);
  border-right: 1px solid var(--gold-border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Tab buttons */
#sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--gold-border);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-panel);
  flex-shrink: 0;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 10px 2px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover  { color: var(--text-ui); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

/* Tab content panes */
.tab-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.tab-content.hidden { display: none; }

/* Currency row */
.currency-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.coin {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.coin-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
  font-weight: 600;
}
.coin-val {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text-dm);
}
.coin-pp { background: rgba(180,160,220,0.08); }
.coin-pp .coin-label { color: #b4a0dc; }
.coin-gp { background: rgba(201,168,76,0.08); }
.coin-gp .coin-label { color: var(--gold); }
.coin-ep { background: rgba(140,200,140,0.08); }
.coin-ep .coin-label { color: #88c888; }
.coin-sp { background: rgba(180,180,200,0.08); }
.coin-sp .coin-label { color: #b4b4c8; }
.coin-cp { background: rgba(180,120,80,0.08); }
.coin-cp .coin-label { color: #c89060; }

/* Spell slot rows */
.spell-slot-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.spell-slot-row:last-child { border-bottom: none; }

.spell-slot-label {
  font-size: 10px;
  color: var(--text-muted);
  width: 26px;
  text-align: right;
  flex-shrink: 0;
}
.spell-slot-pips {
  display: flex;
  gap: 4px;
  flex: 1;
}
.slot-pip {
  width: 13px; height: 13px;
  border-radius: 3px;
  border: 1.5px solid var(--sp-purple);
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.slot-pip.available {
  background: var(--sp-purple);
  box-shadow: 0 0 5px var(--sp-purple-dim);
}
.slot-pip.used {
  background: none;
  border-color: var(--text-muted);
  opacity: 0.3;
}
.spell-slot-count {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 24px;
  text-align: right;
}

/* Quest item title + description */
.quest-item-title {
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--text-ui);
  line-height: 1.4;
}

.quest-item-desc {
  font-size: 11px;
  font-family: var(--font-body);
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
  margin-top: 2px;
}

/* Quest completed style */
.quest-item.completed .quest-item-title {
  color: var(--text-muted);
  text-decoration: line-through;
}
.quest-item.completed .quest-item-desc { color: var(--text-muted); opacity: 0.6; }
.quest-item.completed::before { color: var(--text-muted); }

/* ─── Quest Complete Popup ─── */
.qc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 16px;
}

.qc-overlay.hidden { display: none; }

.qc-box {
  background: var(--bg-panel);
  border: 1px solid var(--gold-border);
  border-radius: 14px;
  padding: 32px 36px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 0 60px rgba(201, 168, 76, 0.15), 0 0 0 1px rgba(201,168,76,0.08);
  text-align: center;
}

.qc-header {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.qc-icon {
  font-size: 20px;
  color: var(--gold);
}

.qc-quests {
  margin-bottom: 20px;
}

.qc-quest-entry {
  padding: 10px 0;
  border-top: 1px solid var(--gold-border);
  border-bottom: 1px solid var(--gold-border);
  margin-bottom: 4px;
}
.qc-quest-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dm);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.qc-quest-desc {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  font-style: italic;
}

.qc-rewards {
  margin-bottom: 24px;
  min-height: 24px;
}

.qc-reward-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-dm);
}

.qc-reward-icon {
  color: var(--gold);
  font-size: 14px;
}

.qc-btn {
  padding: 10px 36px;
  background: linear-gradient(135deg, #8a6820 0%, #c9a84c 50%, #8a6820 100%);
  border: none;
  border-radius: 6px;
  color: #0a0a10;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: opacity 0.15s;
}

.qc-btn:hover { opacity: 0.9; }

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: var(--gold-border); border-radius: 4px; }

.panel {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-header {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}
.panel-toggle:hover { color: var(--gold); }

#char-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dm);
  margin-bottom: 3px;
}

#char-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1.4;
}

#char-exp {
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-label);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-ui);
}

/* HP bar */
.bar-track {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.bar-hp {
  background: linear-gradient(90deg, #8b1a1a, var(--hp-red));
  box-shadow: 0 0 8px var(--hp-red-glow);
}

/* Sorcery pips */
.pips-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.pip {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--sp-purple);
  transition: background 0.3s;
}
.pip.filled {
  background: var(--sp-purple);
  box-shadow: 0 0 6px var(--sp-purple-dim);
}

/* Badges row */
.badges-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.stat-badge {
  flex: 1;
  border-radius: var(--radius);
  padding: 7px 6px;
  text-align: center;
  border: 1px solid;
}

.badge-blue   { background: rgba(58,122,181,0.12); border-color: rgba(58,122,181,0.35); }
.badge-teal   { background: rgba(42,138,122,0.12); border-color: rgba(42,138,122,0.35); }
.badge-gold   { background: rgba(201,168,76,0.15); border-color: rgba(201,168,76,0.45); }
.badge-purple { background: rgba(140,80,200,0.12); border-color: rgba(140,80,200,0.35); }

.badge-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.badge-val {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dm);
}

/* Ability scores table */
.ability-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ability-table thead th {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 4px 5px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.ability-col-name  { text-align: left; width: 50%; }
.ability-col-score { text-align: center; width: 25%; }
.ability-col-mod   { text-align: center; width: 25%; }

.ability-table tbody tr {
  border-bottom: 1px solid var(--border);
}
.ability-table tbody tr:last-child {
  border-bottom: none;
}

.ability-name {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-label);
  padding: 5px 4px;
  text-align: left;
}

.ability-score {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-dm);
  text-align: center;
  padding: 5px 4px;
}

.ability-mod {
  font-family: var(--font-display);
  font-size: 13px;
  text-align: center;
  padding: 5px 4px;
  font-weight: 600;
}
.ability-mod.positive { color: #6fc08a; }
.ability-mod.negative { color: var(--hp-red); }
.ability-mod.neutral  { color: var(--text-muted); }

/* Skills table */
.skills-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.skills-table tbody tr {
  border-bottom: 1px solid var(--border);
}
.skills-table tbody tr:last-child {
  border-bottom: none;
}

.skill-name {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-ui);
  padding: 4px 4px 4px 0;
  text-align: left;
  white-space: nowrap;
}

.skill-ability {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-left: 4px;
}

.skill-value {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-dm);
  text-align: right;
  padding: 4px 0;
  width: 32px;
  font-weight: 600;
}

/* Quest list */
.quest-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quest-item {
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--text-ui);
  line-height: 1.4;
  padding-left: 12px;
  position: relative;
}

.quest-item::before {
  content: '◈';
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 10px;
  top: 1px;
}

/* Spell list */
.spell-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.spell-tag {
  font-size: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px;
  color: var(--text-muted);
  white-space: nowrap;
}
.spell-tag.prepared {
  background: rgba(140,80,200,0.12);
  border-color: rgba(140,80,200,0.35);
  color: var(--text-secondary);
}

/* Character Details panel */
.detail-field {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.detail-field:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.detail-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Weapon attack info in inventory list */
.item-atk-info {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Inventory list */
.inv-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inv-item {
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--text-ui);
  padding: 4px 6px 4px 18px;
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}

.inv-item:hover {
  background: rgba(201, 168, 76, 0.08);
  color: var(--gold);
}

.inv-item:hover::before {
  color: var(--gold);
}

.inv-item::before {
  content: '·';
  position: absolute;
  left: 6px;
  color: var(--text-muted);
  transition: color 0.12s;
}

.inv-item-name {
  flex: 1;
}

.magic-glyph {
  font-size: 9px;
  color: var(--sp-purple);
}

/* ─── Inventory item context menu ──────────────────────────── */
#item-menu {
  position: fixed;
  z-index: 2000;
  background: #18182a;
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}

#item-menu.hidden {
  display: none;
}

.item-menu-title {
  font-size: 11px;
  font-family: var(--font-display);
  color: var(--gold);
  padding: 3px 8px 5px;
  border-bottom: 1px solid var(--gold-border);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.item-menu-btn {
  background: none;
  border: none;
  color: var(--text-ui);
  font-size: 12px;
  font-family: var(--font-body);
  padding: 6px 10px;
  border-radius: 5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  display: flex;
  align-items: center;
  gap: 7px;
}

.item-menu-btn:hover {
  background: rgba(201, 168, 76, 0.1);
  color: var(--gold);
}

.item-menu-btn.btn-equip { color: #6cba6c; }
.item-menu-btn.btn-equip:hover { background: rgba(108, 186, 108, 0.12); color: #8fd98f; }

.item-menu-btn.btn-unequip { color: #c97070; }
.item-menu-btn.btn-unequip:hover { background: rgba(201, 112, 112, 0.12); color: #e08888; }

.item-menu-btn .btn-icon {
  font-size: 10px;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

/* ═══ CHAT SECTION ══════════════════════════════════════ */
#chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

#messages::-webkit-scrollbar { width: 5px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Messages */
.msg-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.msg-bubble {
  padding: 14px 18px;
  border-radius: var(--radius);
  line-height: 1.7;
  max-width: 820px;
  position: relative;
}

/* DM message */
.msg-dm .msg-label { color: var(--gold); }

.msg-dm .msg-bubble {
  background: var(--bg-msg-dm);
  border: 1px solid var(--gold-border);
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--text-dm);
  border-left: 3px solid var(--gold);
}

/* Player message */
.msg-player { align-self: flex-end; align-items: flex-end; }
.msg-player .msg-label { color: var(--text-player); }

.msg-player .msg-bubble {
  background: var(--bg-msg-player);
  border: 1px solid rgba(155, 185, 220, 0.2);
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text-player);
  border-right: 3px solid rgba(155, 185, 220, 0.5);
  text-align: right;
}

/* Error message */
.msg-error .msg-bubble {
  background: rgba(192,64,64,0.1);
  border: 1px solid rgba(192,64,64,0.35);
  color: #e08080;
  font-size: 13px;
}
.msg-error .msg-label { color: #cc5555; }

/* Typing indicator */
.typing-bubble {
  background: var(--bg-msg-dm);
  border: 1px solid var(--gold-border);
  border-left: 3px solid var(--gold);
  padding: 14px 18px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 5px;
}

.typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.4;
  animation: pulse 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.4; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.3); }
}

/* ═══ ROLL CARD ══════════════════════════════════════════ */
.roll-card {
  margin: 0 24px 12px;
  background: var(--roll-amber-bg);
  border: 1px solid rgba(200, 130, 10, 0.45);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.roll-card.hidden { display: none; }

#roll-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--roll-amber);
}

#roll-details {
  display: flex;
  align-items: center;
  gap: 10px;
}

#roll-type-label {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-dm);
}

.roll-dc-badge {
  background: rgba(200,130,10,0.2);
  border: 1px solid rgba(200,130,10,0.5);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--roll-amber);
  font-weight: 600;
}

#roll-btn {
  align-self: flex-start;
  background: var(--roll-amber);
  border: none;
  border-radius: var(--radius);
  color: #0a0a0f;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 8px 18px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

#roll-btn:hover  { opacity: 0.9; }
#roll-btn:active { transform: scale(0.97); }
#roll-btn:disabled { opacity: 0.4; cursor: default; }

#roll-result {
  font-family: var(--font-body);
  font-size: 22px;
  color: var(--text-dm);
  letter-spacing: 0.04em;
}
#roll-result.hidden { display: none; }

/* ═══ INPUT BAR ══════════════════════════════════════════ */
#input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 24px 18px;
  background: var(--bg-panel);
  border-top: 1px solid var(--gold-border);
}

#action-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-ui);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  padding: 10px 14px;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  max-height: 140px;
  overflow-y: auto;
}

#action-input::placeholder { color: var(--text-muted); }

#action-input:focus {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 2px var(--gold-dim);
}

#send-btn {
  width: 44px; height: 44px;
  background: var(--gold);
  border: none;
  border-radius: var(--radius);
  color: #0a0a0f;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.1s;
}

#send-btn:hover  { opacity: 0.9; }
#send-btn:active { transform: scale(0.95); }
#send-btn:disabled { opacity: 0.4; cursor: default; }

/* ═══ COMBAT PANEL ═══════════════════════════════════════ */

#combat-panel {
  margin: 0 12px 8px;
  border: 1px solid rgba(180, 60, 60, 0.45);
  border-radius: var(--radius);
  background: rgba(14, 6, 6, 0.94);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 0 28px rgba(160, 40, 40, 0.06);
}

#combat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(140, 30, 30, 0.28);
  border-bottom: 1px solid rgba(180, 60, 60, 0.35);
  font-family: var(--font-display);
  font-size: 12px;
  color: #e07070;
  letter-spacing: 0.08em;
}

#combat-icon { font-size: 13px; }

#combat-round-label {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  background: rgba(255,255,255,0.05);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.08);
  letter-spacing: 0.04em;
}

#combat-turn-label {
  font-size: 10px;
  color: #e0b070;
  font-family: var(--font-ui);
}

/* Initiative order */
#initiative-order {
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.combatant-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.02);
  border: 1px solid transparent;
  border-left: 2px solid rgba(255,255,255,0.07);
  font-size: 11px;
  font-family: var(--font-ui);
  transition: background 0.15s;
}

.combatant-row.active-turn {
  border-color: rgba(224, 176, 112, 0.4);
  border-left-color: rgba(224, 176, 112, 0.85);
  background: rgba(224, 176, 112, 0.07);
}

.combatant-row.player {
  border-left-color: rgba(100, 160, 220, 0.8);
  background: rgba(100, 160, 220, 0.05);
}

.combatant-row.ally {
  border-left-color: rgba(80, 200, 120, 0.7);
  background: rgba(80, 200, 120, 0.04);
}

.combatant-row.enemy {
  border-left-color: rgba(200, 70, 70, 0.5);
}

.combatant-row.dead {
  opacity: 0.32;
  text-decoration: line-through;
}

.combatant-name {
  flex: 1;
  color: var(--text-ui);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combatant-row.player .combatant-name { color: #8ab8d8; }
.combatant-row.ally   .combatant-name { color: #6ecf8a; }

/* Faction badges */
.faction-badge {
  font-size: 9px;
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-you  { background: rgba(100,160,220,0.18); color: #8ab8d8; border: 1px solid rgba(100,160,220,0.3); }
.badge-ally { background: rgba(80,200,120,0.15);  color: #6ecf8a; border: 1px solid rgba(80,200,120,0.3); }
.badge-foe  { background: rgba(200,70,70,0.15);   color: #e08080; border: 1px solid rgba(200,70,70,0.3); }

.combatant-init {
  font-size: 10px;
  color: var(--text-muted);
  min-width: 22px;
  text-align: right;
}

.combatant-hp-bar-wrap {
  width: 50px;
  height: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.combatant-hp-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.combatant-hp-bar.player-bar { background: var(--hp-red); }
.combatant-hp-bar.ally-bar   { background: #4caf6e; }
.combatant-hp-bar.enemy-bar  { background: #cc5522; }

.combatant-status {
  font-size: 10px;
  color: var(--text-muted);
  min-width: 60px;
  text-align: right;
}

.combatant-row.player .combatant-status { color: var(--text-ui); }
.combatant-row.ally   .combatant-status { color: var(--text-ui); }

/* Combat action area */
#combat-actions {
  padding: 6px 10px 8px;
  border-top: 1px solid rgba(180, 60, 60, 0.2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#combat-target-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.combat-label {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

#combat-target-select {
  background: var(--bg-input);
  border: 1px solid rgba(180, 60, 60, 0.35);
  color: var(--text-ui);
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  font-family: var(--font-ui);
  flex: 1;
}

/* Action groups */
#action-buttons {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.action-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.action-group-label {
  font-size: 9px;
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 2px;
}

.action-group-attack .action-group-label  { color: rgba(220, 90, 90, 0.75); }
.action-group-cantrip .action-group-label,
.action-group-spell .action-group-label   { color: rgba(150, 100, 220, 0.75); }
.action-group-sorcery .action-group-label { color: rgba(220, 140, 60, 0.75); }
.action-group-tactic .action-group-label  { color: rgba(160, 200, 220, 0.65); }
.action-group-flee .action-group-label    { color: rgba(100, 200, 100, 0.65); }

.action-group-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.action-btn {
  padding: 4px 9px;
  font-size: 11px;
  font-family: var(--font-ui);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-ui);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.action-btn:hover {
  background: rgba(201,168,76,0.14);
  border-color: var(--gold-border);
  color: var(--gold);
}

.action-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.action-btn.type-attack       { border-color: rgba(200, 80, 80, 0.3); }
.action-btn.type-attack:hover { background: rgba(200,80,80,0.14); border-color: rgba(200,80,80,0.55); color: #e08080; }

.action-btn.type-cantrip,
.action-btn.type-spell        { border-color: rgba(136, 85, 204, 0.3); }
.action-btn.type-cantrip:hover,
.action-btn.type-spell:hover  { background: rgba(136,85,204,0.14); border-color: rgba(136,85,204,0.55); color: #bb88ee; }

.action-btn.type-flee         { border-color: rgba(100, 180, 100, 0.3); }
.action-btn.type-flee:hover   { background: rgba(100,180,100,0.12); border-color: rgba(100,180,100,0.5); color: #80c880; }

.combat-end-banner {
  padding: 8px 12px;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-align: center;
  font-weight: 600;
}

.combat-end-banner.victory { color: #80c880; background: rgba(80,200,80,0.1); }
.combat-end-banner.defeat  { color: #e08080; background: rgba(200,80,80,0.1); }
.combat-end-banner.fled    { color: #e0c080; background: rgba(200,180,80,0.1); }

/* ─── Level-Up Banner ─────────────────────────────────── */
#levelup-banner {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #1a140a, #241c0e);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 12px 20px;
  z-index: 600;
  box-shadow: 0 0 30px rgba(201,168,76,0.25);
  max-width: 420px;
  width: calc(100% - 32px);
}

#levelup-banner.hidden { display: none; }

.levelup-banner-text {
  flex: 1;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.levelup-banner-btn {
  padding: 7px 16px;
  background: linear-gradient(135deg, #8a6820, #c9a84c, #8a6820);
  border: none;
  border-radius: 5px;
  color: #0a0a10;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.levelup-banner-btn:hover { opacity: 0.88; }


/* ─── Level-Up Modal ──────────────────────────────────── */
.levelup-modal-box {
  border-color: rgba(201,168,76,0.4) !important;
}

.levelup-hp-choices {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.levelup-hp-btn {
  flex: 1;
  padding: 12px;
  background: var(--bg-panel-alt, #14141f);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 8px;
  color: var(--gold, #c9a84c);
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-width: 120px;
}

.levelup-hp-btn:hover {
  border-color: var(--gold, #c9a84c);
  background: rgba(201,168,76,0.08);
}

.levelup-hp-roll {
  background: linear-gradient(135deg, rgba(138,104,32,0.2), rgba(201,168,76,0.15));
}

/* ─── Location Discovery Notification ─────────────────── */
#discovery-notification {
  position: fixed;
  bottom: 28px;
  right: 24px;
  z-index: 400;
  max-width: 320px;
  width: 100%;
  pointer-events: auto;
}
#discovery-inner {
  background: linear-gradient(135deg, rgba(20,18,32,0.97) 0%, rgba(30,24,48,0.97) 100%);
  border: 1px solid rgba(180, 140, 60, 0.5);
  border-radius: 10px;
  padding: 16px 18px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(180,140,60,0.1);
}
#discovery-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
#discovery-icon {
  font-size: 15px;
}
#discovery-title {
  flex: 1;
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold, #c9a84c);
}
#discovery-dismiss {
  background: none;
  border: none;
  color: var(--text-muted, #888);
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
}
#discovery-dismiss:hover { color: #ccc; }
#discovery-name {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 15px;
  font-weight: 600;
  color: #e8d9a8;
  margin-bottom: 2px;
}
#discovery-region {
  font-size: 11px;
  color: var(--text-muted, #888);
  margin-bottom: 8px;
  font-style: italic;
}
#discovery-region:empty { display: none; }
#discovery-description {
  font-size: 12px;
  color: var(--text-dim, #aaa);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@keyframes discoverySlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes discoverySlideOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(16px); }
}
.discovery-fade-in  { animation: discoverySlideIn  0.35s ease forwards; }
.discovery-fade-out { animation: discoverySlideOut 0.35s ease forwards; }


/* ─── PARTY TAB ─────────────────────────────────────────── */
.party-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.party-card:last-child { margin-bottom: 0; }
.party-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.party-name {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--gold, #c9a84c);
  font-weight: 600;
}
.party-trust {
  font-size: 10px;
  font-family: var(--font-ui);
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.04em;
}
.trust-friendly  { background: rgba(80,160,80,0.15);  color: #80c080; border: 1px solid rgba(80,160,80,0.3); }
.trust-trusted   { background: rgba(80,120,200,0.15); color: #80a8e8; border: 1px solid rgba(80,120,200,0.3); }
.trust-devoted   { background: rgba(160,80,200,0.15); color: #c090e8; border: 1px solid rgba(160,80,200,0.3); }
.party-desc {
  font-size: 11px;
  font-family: var(--font-body);
  color: var(--text-muted, #888);
  font-style: italic;
  margin-bottom: 6px;
  line-height: 1.45;
}
.party-location {
  font-size: 11px;
  font-family: var(--font-ui);
  color: var(--text-muted, #888);
  margin-bottom: 6px;
}
.party-trust-bar-track {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.party-trust-bar {
  height: 100%;
  background: linear-gradient(90deg, #6a9f6a, #a0c8a0);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.party-card[role="button"] {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.party-card[role="button"]:hover {
  border-color: var(--gold-border, #c9a84c55);
  background: rgba(255,255,255,0.06);
}
.party-card[role="button"]:focus-visible {
  outline: 2px solid var(--gold, #c9a84c);
  outline-offset: 2px;
}

/* ─── PARTY MEMBER MODAL ─────────────────────────────────── */
.pm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 16px;
}
.pm-box {
  background: var(--bg-panel, #1a1a2a);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border, #333);
  flex-shrink: 0;
}
.pm-title-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pm-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--gold, #c9a84c);
}
.pm-race {
  font-size: 12px;
  color: var(--text-muted, #888);
  font-family: var(--font-ui);
  font-style: italic;
}
.pm-close-btn {
  background: none;
  border: none;
  color: var(--text-muted, #888);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  margin-top: 2px;
  transition: color 0.15s;
}
.pm-close-btn:hover { color: var(--text, #ddd); }
.pm-tabs {
  display: flex;
  gap: 2px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--border, #333);
  flex-shrink: 0;
}
.pm-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted, #888);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 6px 12px 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.pm-tab-btn:hover { color: var(--text, #ddd); }
.pm-tab-btn.active {
  color: var(--gold, #c9a84c);
  border-bottom-color: var(--gold, #c9a84c);
}
.pm-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}
.pm-body-text {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text, #ccc);
  line-height: 1.65;
  white-space: pre-wrap;
}
.pm-muted {
  color: var(--text-muted, #888);
}
.pm-section-label {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted, #777);
  margin-bottom: 6px;
}
/* Events tab */
.pm-event-entry {
  border-left: 2px solid var(--border, #444);
  padding: 6px 0 6px 12px;
  margin-bottom: 12px;
}
.pm-event-entry.pm-event-important {
  border-left-color: var(--gold, #c9a84c);
}
.pm-event-date {
  font-size: 10px;
  font-family: var(--font-ui);
  color: var(--text-muted, #777);
  margin-bottom: 3px;
}
.pm-event-summary {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text, #ccc);
  line-height: 1.5;
}
/* Stats tab */
.pm-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
}
.pm-stat-row:last-of-type { border-bottom: none; }
.pm-stat-label {
  font-family: var(--font-ui);
  color: var(--text-muted, #888);
  font-size: 12px;
}
.pm-stat-val {
  font-family: var(--font-body);
  color: var(--text, #ccc);
}
.pm-alive  { color: #80c080; }
.pm-dead   { color: #c08080; }
.pm-trust-bar-track {
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.pm-trust-bar {
  height: 100%;
  background: linear-gradient(90deg, #6a9f6a, #a0c8a0);
  border-radius: 3px;
}

/* Ability score grid */
.pm-ability-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.pm-ability-cell {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
}
.pm-ability-name {
  font-size: 9px;
  font-family: var(--font-ui);
  letter-spacing: 0.06em;
  color: var(--text-muted, #777);
  text-transform: uppercase;
  margin-bottom: 3px;
}
.pm-ability-score {
  font-size: 15px;
  font-family: var(--font-display);
  color: var(--text, #ddd);
  font-weight: 600;
  line-height: 1;
}
.pm-ability-mod {
  font-size: 11px;
  font-family: var(--font-ui);
  color: var(--gold, #c9a84c);
  margin-top: 2px;
}
/* Combat badges */
.pm-combat-badges {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.pm-combat-badge {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  padding: 8px 16px;
  text-align: center;
  min-width: 60px;
}
.pm-combat-badge-label {
  font-size: 10px;
  font-family: var(--font-ui);
  color: var(--text-muted, #777);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pm-combat-badge-val {
  font-size: 16px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text, #ddd);
  margin-top: 2px;
}
/* HP bar (red) */
.pm-hp-bar {
  height: 100%;
  background: linear-gradient(90deg, #8b2020, #c04040);
  border-radius: 3px;
  transition: width 0.4s ease;
}
/* Tag lists (equipment, proficiencies, spells) */
.pm-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}
.pm-tag {
  font-size: 11px;
  font-family: var(--font-ui);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border, #3a3a4a);
  border-radius: 4px;
  padding: 3px 8px;
  color: var(--text, #ccc);
}
.pm-tag-cantrip {
  border-color: rgba(100,150,220,0.4);
  background: rgba(100,150,220,0.08);
  color: #8ab4e8;
}
.pm-tag-spell {
  border-color: rgba(160,100,220,0.4);
  background: rgba(160,100,220,0.08);
  color: #c090e8;
}

/* ═══ QUEST INTRO MODAL ══════════════════════════════════ */
#quest-intro-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(4, 4, 10, 0.97);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 20px 60px;
}
#quest-intro-scroll {
  max-width: 680px;
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--gold-border);
  border-radius: 12px;
  padding: 48px 52px 40px;
  position: relative;
  margin: auto 0;
}
.qi-title-block {
  text-align: center;
  margin-bottom: 36px;
}
.qi-glyph {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 5px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.qi-subtitle {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text-dm);
  margin-bottom: 6px;
}
.qi-location-line {
  font-family: var(--font-display);
  font-size: 13px;
  color: #a07828;
  letter-spacing: 2px;
  margin-top: 4px;
}
.qi-body {
  margin-bottom: 28px;
}
.qi-body p {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: var(--text-dm);
  margin-bottom: 14px;
}
.qi-callout {
  background: var(--gold-dim);
  border-left: 3px solid var(--gold);
  padding: 10px 16px;
  border-radius: 0 6px 6px 0;
  margin-top: 6px;
}
.qi-section {
  margin-bottom: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.qi-section p {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: var(--text-dm);
  margin-bottom: 12px;
}
.qi-section-header {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.qi-emphasis {
  font-style: italic;
  color: var(--text-ui) !important;
}
.qi-list {
  margin: 8px 0 12px 22px;
}
.qi-list li {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-dm);
  margin-bottom: 6px;
}
.qi-list li strong {
  color: var(--text-ui);
}
#quest-intro-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--gold-border);
}
.qi-action-btn {
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid var(--gold-border);
  color: var(--text-dm);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 14px 20px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  line-height: 1.5;
  transition: background 0.2s, border-color 0.2s;
  width: 100%;
}
.qi-action-btn:hover {
  background: rgba(201, 168, 76, 0.18);
  border-color: var(--gold);
}
#quest-intro-skip {
  text-align: center;
  margin-top: 20px;
}
#quest-intro-skip button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  letter-spacing: 0.5px;
}
#quest-intro-skip button:hover { color: var(--text-ui); }

/* ═══ TTS CONTROLS ═══════════════════════════════════════ */

#tts-toggle-btn,
#tts-settings-btn {
  width: 38px; height: 38px;
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius);
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
#tts-toggle-btn:hover,
#tts-settings-btn:hover {
  color: var(--text-ui);
  border-color: var(--gold-border);
  background: rgba(255,255,255,0.08);
}
#tts-toggle-btn.tts-active {
  color: var(--gold);
  border-color: var(--gold-border);
  background: var(--gold-dim);
}

/* ─── TTS Settings Modal ───────────────────────────────── */

.tts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 16px;
}

.tts-modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--gold-border);
  border-radius: 12px;
  padding: 24px 28px 20px;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tts-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tts-modal-title {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--gold);
  letter-spacing: 0.06em;
}
.tts-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
}
.tts-modal-close:hover { color: var(--text-ui); }

.tts-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tts-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 110px;
}
.tts-select {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-ui);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
  outline: none;
}
.tts-select:focus { border-color: var(--gold-border); }

.tts-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: var(--font-ui);
  margin-bottom: 8px;
}

#tts-npc-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.tts-npc-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tts-npc-name {
  font-size: 12px;
  color: var(--text-dm);
  font-family: var(--font-ui);
  min-width: 110px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tts-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.tts-cancel-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
}
.tts-cancel-btn:hover { color: var(--text-ui); border-color: var(--gold-border); }
.tts-save-btn {
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.tts-save-btn:hover { background: rgba(180,140,60,0.25); }

/* ═══ UTILITY ════════════════════════════════════════════ */
.hidden { display: none !important; }

/* Scrollbar resets */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
