/* ════════════════════════════════════════
   CHARACTER-CREATOR.CSS
   Supplemental styles for character-creator.html
   ════════════════════════════════════════ */

/* ── Sheet wrapper ── */
.sheet-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Print title (hidden on screen) ── */
.sheet-print-title { display: none; text-align: center; margin-bottom: 1.5rem; }
.sheet-studio-mark { font-family: var(--font-heading); font-size: 1.2rem; letter-spacing: 0.2em; color: var(--gold); }
.sheet-subtitle { font-size: 0.8rem; color: var(--text-muted); }

/* ── Character header ── */
.sheet-header {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 700px) {
  .sheet-header { grid-template-columns: 1fr; }
}

/* ── Portrait ── */
.portrait-area { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.portrait-placeholder {
  width: 140px; height: 180px;
  background: var(--bg-darker);
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.8rem;
  background-size: cover; background-position: center;
}
.portrait-upload {
  font-size: 0.75rem; color: var(--gold); cursor: pointer;
  padding: 0.3rem 0.6rem; border: 1px solid rgba(201,168,76,0.4);
  border-radius: 4px; text-align: center;
}
.portrait-upload:hover { background: rgba(201,168,76,0.1); }
.portrait-upload input { display: none; }

/* ── Header fields ── */
.header-fields { display: flex; flex-direction: column; gap: 0.75rem; }
.field-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.field-group { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; min-width: 120px; }
.field-group label { font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); }

/* ── Form elements ── */
.sheet-input, .sheet-select, .sheet-textarea {
  background: var(--bg-darker);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 5px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  font-family: var(--font-body);
  width: 100%;
  transition: border-color 0.2s;
}
.sheet-input:focus, .sheet-select:focus, .sheet-textarea:focus {
  outline: none;
  border-color: rgba(201,168,76,0.5);
  background: rgba(201,168,76,0.04);
}
.sheet-input.large { font-size: 1.1rem; padding: 0.5rem 0.75rem; }
.sheet-input.small, .sheet-input.mini { max-width: 80px; }
.sheet-textarea { resize: vertical; }
.sheet-textarea.compact { min-height: 50px; }
.sheet-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6' fill='none' stroke='%23c9a84c' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.6rem center; background-size: 10px; padding-right: 2rem; }

/* ── Tabs ── */
.sheet-tabs {
  display: flex; gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  background: none; border: none; border-bottom: 3px solid transparent;
  padding: 0.7rem 1.2rem; font-family: var(--font-heading); font-size: 0.85rem;
  letter-spacing: 0.05em; color: var(--text-muted); cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -2px; white-space: nowrap;
}
.tab-btn:hover { color: var(--gold-light); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Sheet cards ── */
.sheet-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}
.card-title {
  font-family: var(--font-heading); font-size: 0.95rem;
  color: var(--gold-light); letter-spacing: 0.05em;
  margin-bottom: 1rem; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.card-header-row .card-title { margin-bottom: 0; border-bottom: none; }

/* ── Sheet layouts ── */
.sheet-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.sheet-row-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (max-width: 900px) { .sheet-row-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .sheet-row-3, .sheet-row-2 { grid-template-columns: 1fr; } }

.mt-2 { margin-top: 1.25rem !important; }
.mt-3 { margin-top: 1.5rem !important; }

/* ── Attributes ── */
.attr-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
@media (max-width: 500px) { .attr-grid { grid-template-columns: repeat(3, 1fr); } }

.attr-box {
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg-darker); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.5rem 0.25rem;
  gap: 0.2rem; text-align: center;
}
.attr-label { font-family: var(--font-heading); font-size: 0.65rem; letter-spacing: 0.1em; color: var(--gold); }
.attr-score {
  width: 52px; height: 42px; text-align: center;
  background: var(--bg-dark); border: 1px solid rgba(201,168,76,0.25);
  color: var(--text-primary); font-size: 1.3rem; font-weight: 700; border-radius: 5px;
}
.attr-score:focus { outline: none; border-color: var(--gold); }
.attr-mod { font-family: var(--font-heading); font-size: 0.8rem; color: var(--gold-light); min-height: 1em; }

/* ── Defenses ── */
.defense-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.defense-box { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; background: var(--bg-darker); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; text-align: center; }
.defense-label { font-size: 0.65rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); }
.defense-score { width: 60px; text-align: center; background: var(--bg-dark); border: 1px solid rgba(201,168,76,0.25); color: var(--text-primary); font-size: 1.1rem; font-weight: 700; border-radius: 5px; padding: 0.3rem; }
.defense-score:focus { outline: none; border-color: var(--gold); }

/* ── HP ── */
.hp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.hp-box { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; background: var(--bg-darker); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; text-align: center; }
.hp-box.primary { border-color: rgba(139,26,42,0.5); background: rgba(139,26,42,0.08); }
.hp-label { font-size: 0.65rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); }
.hp-score { width: 70px; text-align: center; background: var(--bg-dark); border: 1px solid rgba(201,168,76,0.25); color: var(--text-primary); font-size: 1.3rem; font-weight: 700; border-radius: 5px; padding: 0.3rem; }
.hp-score:focus { outline: none; border-color: var(--gold); }

.death-save-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.death-boxes { display: flex; gap: 4px; }
.death-boxes input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--gold); }
.death-boxes.fails input[type="checkbox"] { accent-color: var(--crimson); }
.exhaustion-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-muted); }

/* ── Skills ── */
.skills-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 800px) { .skills-grid { grid-template-columns: 1fr; } }

.skill-header {
  display: grid; grid-template-columns: 2fr 60px 55px 55px 55px;
  gap: 0.25rem; padding: 0.3rem 0.4rem;
  background: rgba(201,168,76,0.08);
  border-radius: 5px; margin-bottom: 0.25rem;
}
.skill-header span { font-size: 0.65rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--gold); text-align: center; }
.skill-header span:first-child { text-align: left; }

.skill-row {
  display: grid; grid-template-columns: 2fr 60px 55px 55px 55px;
  gap: 0.25rem; align-items: center;
  padding: 0.2rem 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.skill-row:last-child { border-bottom: none; }
.skill-name { font-size: 0.83rem; color: var(--text-secondary); }
.skill-ability { font-size: 0.72rem; color: var(--text-muted); text-align: center; }
.skill-train, .skill-magic {
  width: 100%; text-align: center; background: var(--bg-darker);
  border: 1px solid var(--border); color: var(--text-primary);
  border-radius: 4px; padding: 0.2rem 0; font-size: 0.82rem;
}
.skill-train:focus, .skill-magic:focus { outline: none; border-color: var(--gold); }
.skill-total {
  text-align: center; font-weight: 700; font-size: 0.88rem;
  color: var(--gold-light); background: rgba(201,168,76,0.06);
  border-radius: 4px; padding: 0.2rem;
}

/* ── Features display ── */
.features-display { display: flex; flex-direction: column; gap: 0.5rem; }
.feature-item { font-size: 0.87rem; color: var(--text-secondary); padding: 0.4rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); line-height: 1.4; }
.feature-item:last-child { border-bottom: none; }
.feature-item strong { color: var(--gold-light); }

/* ── Equipment ── */
.equip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; }
@media (max-width: 500px) { .equip-grid { grid-template-columns: repeat(2, 1fr); } }
.equip-slot { display: flex; flex-direction: column; gap: 0.3rem; }
.equip-slot.full-width { grid-column: 1 / -1; }
.slot-icon { font-size: 1.2rem; text-align: center; }
.slot-label { font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); text-align: center; }

.currency-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.currency-box { display: flex; flex-direction: column; gap: 0.25rem; background: var(--bg-darker); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.8rem; }
.currency-label { font-size: 0.78rem; color: var(--text-muted); }
.currency-input { background: none; border: none; color: var(--text-primary); font-size: 1.1rem; font-weight: 700; width: 100%; padding: 0; }
.currency-input:focus { outline: none; }

.carry-row { display: flex; gap: 0.75rem; }

/* ── Weapons / Inventory table ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.83rem; white-space: nowrap; }
thead tr { background: rgba(201,168,76,0.08); }
th { font-family: var(--font-heading); font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gold); padding: 0.5rem 0.5rem; text-align: left; border-bottom: 1px solid var(--border); }
td { padding: 0.35rem 0.4rem; border-bottom: 1px solid rgba(255,255,255,0.04); }
tr:last-child td { border-bottom: none; }
.sheet-input.mini { max-width: 70px; }
.sheet-select.mini { max-width: 110px; }

/* ── Spells ── */
.spell-slots-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.slot-level-row { display: flex; align-items: center; gap: 0.5rem; }
.slot-level-label { font-size: 0.78rem; color: var(--text-muted); min-width: 55px; }
.slot-boxes { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.slot-boxes input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--gold); }
.slot-max { width: 44px; text-align: center; background: var(--bg-darker); border: 1px solid var(--border); color: var(--text-primary); font-size: 0.82rem; border-radius: 4px; padding: 0.2rem; }
.slot-max:focus { outline: none; border-color: var(--gold); }

.spell-list { display: flex; flex-direction: column; gap: 0.4rem; }
.spell-entry { display: flex; gap: 0.3rem; align-items: center; flex-wrap: wrap; }
.spell-entry.cantrip { gap: 0.4rem; }
.sheet-input.wide { flex: 1; min-width: 100px; }

.spell-school-entry { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.4rem; }

/* ── Feats ── */
.feat-entry { background: var(--bg-darker); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; margin-bottom: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }

/* ── Buttons ── */
.btn { border: none; border-radius: 5px; cursor: pointer; font-family: var(--font-heading); letter-spacing: 0.04em; transition: all 0.2s; }
.btn-primary { background: var(--gold); color: var(--bg-dark); padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-primary:hover { background: var(--gold-light); }
.btn-secondary { background: rgba(201,168,76,0.12); color: var(--gold); border: 1px solid rgba(201,168,76,0.3); padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-secondary:hover { background: rgba(201,168,76,0.2); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn-danger { background: rgba(139,26,42,0.2); color: var(--crimson); border: 1px solid rgba(139,26,42,0.3); padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.btn-danger:hover { background: rgba(139,26,42,0.4); }

/* ── Print FAB ── */
.print-fab {
  position: fixed; bottom: 2rem; right: 2rem;
  background: var(--gold); color: var(--bg-dark);
  border: none; border-radius: 50%;
  width: 56px; height: 56px; font-size: 1.4rem;
  cursor: pointer; box-shadow: 0 4px 20px rgba(201,168,76,0.4);
  transition: transform 0.2s, box-shadow 0.2s; z-index: 900;
}
.print-fab:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(201,168,76,0.6); }

/* ═══════════════════════════════
   DICE ROLLER
   ═══════════════════════════════ */
.dice-roller {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.dice-roller-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.dice-roller-header h3 {
  font-family: var(--font-heading);
  color: var(--gold);
  font-size: 1.1rem;
  margin: 0;
}
.dice-quick-btns {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.dice-btn {
  background: linear-gradient(135deg, rgba(139,26,42,0.3), rgba(201,168,76,0.15));
  border: 1px solid var(--border);
  color: var(--gold);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.dice-btn:hover {
  background: linear-gradient(135deg, rgba(139,26,42,0.5), rgba(201,168,76,0.3));
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(201,168,76,0.3);
}
.dice-custom-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.dice-custom-row .sheet-input { flex: 1; }
.dice-roll-attrs { margin-bottom: 0.75rem; }
.dice-log {
  max-height: 200px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}
.dice-log-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.25rem;
  background: rgba(255,255,255,0.03);
  font-size: 0.85rem;
}
.dice-log-entry.crit {
  background: rgba(201,168,76,0.15);
  border-left: 3px solid var(--gold);
}
.dice-log-entry.fumble {
  background: rgba(139,26,42,0.2);
  border-left: 3px solid var(--crimson);
}
.dice-log-entry.attr-roll {
  flex-direction: column;
  background: rgba(201,168,76,0.08);
}
.roll-label { color: var(--text-secondary); font-weight: 600; }
.roll-dice { color: var(--text-muted); font-size: 0.8rem; }
.roll-total { color: var(--gold); font-family: var(--font-heading); font-size: 1rem; font-weight: 700; margin-left: auto; }
.roll-attr-line { font-size: 0.82rem; color: var(--text-secondary); }

/* Roll button (inline on attribute boxes / skill rows) */
.roll-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  transition: all 0.2s;
  opacity: 0.6;
}
.roll-btn:hover {
  opacity: 1;
  transform: scale(1.2);
  background: rgba(201,168,76,0.15);
}
.attr-box .roll-btn { margin-top: 0.15rem; }

/* ── Lore Links ── */
.lore-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.lore-link {
  display: block;
  padding: 0.4rem 0.75rem;
  background: rgba(201,168,76,0.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--gold);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.lore-link:hover {
  background: rgba(201,168,76,0.15);
  border-color: var(--gold);
  transform: translateX(4px);
}

/* ═══════════════════════════════
   VAULT BAR
   ═══════════════════════════════ */
.vault-bar {
  background: var(--bg-darker);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.5rem;
}
.vault-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
}
.vault-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--gold);
  letter-spacing: 0.05em;
  margin-right: 0.5rem;
}

/* ═══════════════════════════════
   RACE BONUS DISPLAY
   ═══════════════════════════════ */
.race-bonus-display {
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}
.race-bonus-display strong {
  color: var(--gold);
}

/* ── Attribute race-bonus indicator ── */
.attr-race-bonus {
  font-size: 0.65rem;
  color: var(--gold);
  min-height: 0.8em;
  opacity: 0.85;
}

/* ── HP formula text ── */
.hp-formula-text {
  margin-top: 0.6rem;
  padding: 0.4rem 0.6rem;
  border-left: 3px solid rgba(201,168,76,0.3);
  background: rgba(201,168,76,0.04);
  border-radius: 0 6px 6px 0;
}

/* ── Skill header roll column in print-hide ── */
.skill-header span.print-hide,
.skill-row .roll-btn { min-width: 30px; text-align: center; }

/* ═══════════════════════════════
   PRINT STYLES
   ═══════════════════════════════ */
@media print {
  @page { size: A4; margin: 1cm; }

  body { background: #fff !important; color: #000 !important; }

  .nav, .page-header, .print-hide, .vault-bar, footer { display: none !important; }

  .sheet-print-title { display: block !important; }
  .sheet-studio-mark { color: #000 !important; }
  .sheet-subtitle { color: #444 !important; }

  .sheet-wrapper { padding: 0; max-width: 100%; }

  .sheet-header { background: #f8f8f8 !important; border: 1px solid #ccc !important; }

  .sheet-tabs { display: none !important; }
  .tab-panel { display: block !important; page-break-before: always; }
  .tab-panel.active { page-break-before: avoid; }

  .sheet-card { background: #fff !important; border: 1px solid #ccc !important; break-inside: avoid; margin-bottom: 0.5cm; }

  .attr-box, .defense-box, .hp-box, .currency-box, .equip-slot { background: #f4f4f4 !important; border: 1px solid #ccc !important; }

  .attr-score, .defense-score, .hp-score, .sheet-input, .sheet-select, .sheet-textarea {
    background: #fff !important; border: 1px solid #999 !important; color: #000 !important;
  }

  .attr-label, .defense-label, .hp-label, .slot-level-label,
  .skill-name, .skill-ability, .field-group label,
  .card-title, .sheet-studio-mark { color: #000 !important; }

  .skill-total { color: #000 !important; background: #f0f0f0 !important; }
  .attr-mod { color: #333 !important; }

  th { color: #000 !important; background: #e8e8e8 !important; }
  td { color: #000 !important; }

  .tab-btn, .print-fab { display: none !important; }

  .portrait-placeholder { border: 1px solid #ccc !important; }
  .portrait-upload { display: none !important; }

  .sheet-row-3, .sheet-row-2 { break-inside: avoid; }

  details { background: #fff !important; border: 1px solid #ccc !important; }
  details summary { color: #000 !important; }
  details[open] .details-content { display: block !important; }
}

/* ═══════════════════════════════════════
   SPELL COMPENDIUM & ROLLER STYLES
   ═══════════════════════════════════════ */

/* Compendium Browser */
.compendium-browser { margin-top: .75rem; }
.compendium-filters {
  display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem;
}
.compendium-filters .sheet-input { flex: 1 1 200px; }
.compendium-filters .sheet-select { flex: 0 0 150px; }

.compendium-results {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: .75rem; max-height: 60vh; overflow-y: auto; padding-right: .25rem;
}

.comp-spell-card {
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px; padding: .75rem; transition: border-color .2s;
}
.comp-spell-card:hover { border-color: var(--accent); }

.comp-spell-top {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .35rem;
}
.comp-spell-name { font-weight: 700; font-size: 1rem; color: var(--text); }
.comp-spell-lvl { font-size: .8rem; color: var(--text-muted); margin-left: auto; }

.comp-spell-badge {
  display: inline-block; font-size: .7rem; font-weight: 600; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px; letter-spacing: .03em;
  background: rgba(255,255,255,.08); color: var(--text-muted);
}

/* School colour badges */
.school-life { background: #2d5a27; color: #8fef88; }
.school-necromancy { background: #3a1a3a; color: #d89fed; }
.school-soul { background: #1a2a3a; color: #9fbfdf; }
.school-order { background: #3a3a1a; color: #efef8f; }
.school-arcane { background: #1a1a4a; color: #9f9fef; }
.school-nature { background: #1a3a1a; color: #7fd77f; }
.school-artifice { background: #3a2a1a; color: #dfbf8f; }
.school-terran { background: #3a2a0a; color: #cfa94f; }
.school-destruction { background: #4a1a1a; color: #ef8f8f; }
.school-aquamancy { background: #0a2a3a; color: #6fcfef; }
.school-illusion { background: #2a1a3a; color: #bf8fdf; }
.school-astral { background: #0a0a3a; color: #8f8fef; }
.school-battle { background: #2a2a2a; color: #cfcfcf; }
.school-chaos { background: #3a0a1a; color: #ef6f8f; }
.school-abyssal { background: #1a0a2a; color: #9f6fdf; }
.school-lunar { background: #1a2a2a; color: #8fdfdf; }
.school-crusade { background: #3a1a0a; color: #ef9f4f; }

.comp-spell-meta { font-size: .78rem; color: var(--text-muted); margin-bottom: .35rem; }
.comp-spell-desc { font-size: .82rem; color: var(--text-secondary, #bbb); line-height: 1.4; margin-bottom: .35rem; }
.comp-spell-esc { font-size: .78rem; color: #efbc4f; margin-bottom: .25rem; }
.comp-spell-conds { font-size: .78rem; color: #ef8f4f; margin-bottom: .5rem; }
.comp-spell-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* Known Spells */
.known-spell-list { display: flex; flex-direction: column; gap: .35rem; }
.known-spell-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem .75rem; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px; gap: .5rem; flex-wrap: wrap;
}
.known-spell-row:hover { border-color: var(--accent); }
.known-spell-info { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; flex: 1; }
.known-spell-name { font-weight: 600; color: var(--text); }
.known-spell-quick { font-size: .78rem; color: var(--text-muted); }
.known-spell-btns { display: flex; gap: .3rem; }

/* Spell Roller Panel */
.spell-roller {
  position: fixed; right: 1rem; bottom: 1rem; width: 380px; max-height: 85vh;
  overflow-y: auto; background: var(--card-bg, #1e1e2a); border: 1px solid var(--accent);
  border-radius: 12px; padding: 1rem; z-index: 1100; box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.spell-roller-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem;
}
.spell-roller-header h3 { margin: 0; font-size: 1.05rem; color: var(--accent); }
.spell-roller-info { margin-bottom: .5rem; }
.spell-roller-meta { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }

/* ══════════════════════════════════════════
   WEAPON ROLLER PANEL (left-side)
   ══════════════════════════════════════════ */
.weapon-roller {
  position: fixed; bottom: 1rem; left: .75rem;
  width: 360px; max-height: 80vh; overflow-y: auto;
  background: var(--card-bg, #1e1e2a); border: 1px solid var(--accent);
  border-radius: 12px; padding: 1rem; z-index: 1100;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
}
.weapon-roller-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.weapon-roller-header h3 { margin: 0; font-size: 1.05rem; color: var(--accent); }
.weapon-roller-meta { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }
.weapon-roller-btns { display: flex; gap: .5rem; margin-top: .5rem; }

/* ══════════════════════════════════════════
   LEVEL-UP MODAL
   ══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
}
.modal-box {
  background: var(--card-bg, #1e1e2a); border: 1px solid var(--accent);
  border-radius: 12px; padding: 1.5rem;
  max-width: 540px; width: 90%; max-height: 85vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-header h3 { margin: 0; color: var(--accent); }
.modal-actions { display: flex; gap: .5rem; margin-top: 1rem; justify-content: flex-end; }
.levelup-info { display: flex; flex-direction: column; gap: .7rem; }
.levelup-level { font-size: 1.2rem; font-weight: 700; color: var(--accent); }
.levelup-level span { color: #8fef88; font-size: 1.4rem; }
.levelup-row { display: flex; align-items: center; gap: .5rem; }
.levelup-row label { font-weight: 600; min-width: 110px; }
.levelup-features { font-size: .85rem; margin-top: .25rem; }
.levelup-features ul { margin: .25rem 0 0 1rem; padding: 0; }

/* ══════════════════════════════════════════
   CONDITIONS TRACKER
   ══════════════════════════════════════════ */
.condition-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.cond-chip {
  padding: .3rem .65rem; border-radius: 20px; font-size: .8rem; font-weight: 600;
  cursor: pointer; border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06); color: var(--text-secondary, #aaa);
  transition: background .15s, border-color .15s, color .15s; user-select: none;
}
.cond-chip:hover { border-color: var(--accent); color: var(--accent); }
.cond-chip.active { background: rgba(239,143,79,.18); border-color: #ef8f4f; color: #ef8f4f; }
.condition-custom-row { display: flex; gap: .4rem; margin-top: .5rem; }
.active-cond-row { display: flex; align-items: center; gap: .4rem; margin-top: .35rem; }
.cond-tag {
  padding: .2rem .55rem; border-radius: 14px; font-size: .78rem; font-weight: 600;
  background: rgba(239,143,79,.18); border: 1px solid #ef8f4f; color: #ef8f4f;
}

/* ══════════════════════════════════════════
   REST BUTTONS
   ══════════════════════════════════════════ */
.rest-btns { display: flex; gap: .5rem; margin-top: .65rem; }

/* ══════════════════════════════════════════
   UTILITY BUTTON VARIANTS
   ══════════════════════════════════════════ */
.btn-outline {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-secondary, #aaa); cursor: pointer; border-radius: 6px;
  padding: .3rem .65rem; font-size: .82rem; transition: border-color .15s, color .15s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-group-inline { display: flex; gap: .35rem; }

/* ══════════════════════════════════════════
   COMBAT TRACKER (Combat Tab)
   ══════════════════════════════════════════ */
.add-combatant-row { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .6rem; }
.combat-footer-btns { display: flex; gap: .35rem; margin-top: .5rem; }
.combatant-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .6rem; border-radius: 6px; margin-bottom: .3rem;
  border: 1px solid rgba(255,255,255,.08); font-size: .88rem;
  background: rgba(255,255,255,.03);
}
.combatant-row.active-turn { border-color: var(--accent); background: rgba(239,188,79,.08); }
.type-ally   { border-left: 3px solid #8fef88; }
.type-enemy  { border-left: 3px solid #ef5f5f; }
.type-neutral { border-left: 3px solid #8fbfef; }
.cbt-init { min-width: 30px; font-weight: 700; color: var(--accent); }
.cbt-name { flex: 1; font-weight: 600; }
.cbt-hp   { display: flex; align-items: center; gap: .25rem; color: #ef8f8f; }
.cbt-ac   { min-width: 40px; color: #8fbfef; }

/* ══════════════════════════════════════════
   ACTIVE EFFECTS (Combat Tab)
   ══════════════════════════════════════════ */
.add-effect-row { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .6rem; }
.effect-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .6rem; border-radius: 6px; margin-bottom: .3rem;
  border: 1px solid rgba(255,255,255,.08); font-size: .85rem;
}
.effect-buff         { border-left: 3px solid #8fef88; background: rgba(143,239,136,.05); }
.effect-debuff       { border-left: 3px solid #ef5f5f; background: rgba(239,95,95,.05);  }
.effect-condition    { border-left: 3px solid #ef8f4f; background: rgba(239,143,79,.05); }
.effect-concentration { border-left: 3px solid #bf8fef; background: rgba(191,143,239,.05); }
.effect-name  { flex: 1; font-weight: 600; }
.effect-type-badge {
  font-size: .72rem; padding: 1px 6px; border-radius: 4px;
  background: rgba(255,255,255,.1); color: var(--text-muted, #888);
}
.effect-dur { color: var(--accent); font-weight: 700; min-width: 32px; text-align: right; }

/* ══════════════════════════════════════════
   SESSION JOURNAL (Journal Tab)
   ══════════════════════════════════════════ */
.journal-add-row { display: flex; gap: .4rem; margin-bottom: 1rem; }
.journal-entry {
  border: 1px solid var(--border); border-radius: 8px;
  padding: .75rem; margin-bottom: .75rem;
  background: rgba(255,255,255,.02);
}
.journal-date {
  font-size: .8rem; color: var(--accent); font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .5rem;
}
.journal-entry textarea { width: 100%; resize: vertical; min-height: 80px; }

/* ══════════════════════════════════════════
   PREPARED SPELLS ROW
   ══════════════════════════════════════════ */
.prepare-row { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; font-size: .85rem; }
.prepare-row label { font-weight: 600; }

/* Know-spell row prepare button */
.btn-prepare {
  font-size: .75rem; padding: .15rem .45rem; border-radius: 4px;
  background: rgba(191,143,239,.12); border: 1px solid rgba(191,143,239,.35); color: #bf8fef;
  cursor: pointer; transition: background .15s;
}
.btn-prepare.prepared { background: rgba(191,143,239,.35); color: #e8d5ff; border-color: #bf8fef; }

/* Spell Skill row in Spell Stats card */
.spell-skill-row {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem;
  padding: .5rem .6rem; background: rgba(255,255,255,.04); border-radius: 6px;
}
.spell-skill-label { font-weight: 600; font-size: .85rem; white-space: nowrap; }
.spell-skill-row .sheet-select { flex: 1 1 140px; }
.spell-skill-total {
  font-weight: 700; font-size: 1.05rem; color: var(--accent);
  min-width: 36px; text-align: center;
}

/* Spell Roller to-hit area */
.spell-roller-tohit {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem;
  padding: .4rem .5rem; background: rgba(143,239,136,.08); border-radius: 6px;
}
.spell-tohit-skill { font-size: .82rem; color: var(--text-muted); }
.btn-accent {
  background: linear-gradient(135deg, #8fef88, #4fd97f); color: #111; font-weight: 700;
  border: none; cursor: pointer; border-radius: 6px; padding: .3rem .65rem;
}
.btn-accent:hover { filter: brightness(1.15); }

/* Crit / Fumble highlights */
.spell-log-entry .roll-total.crit { color: #8fef88; text-shadow: 0 0 6px rgba(143,239,136,.5); }
.spell-log-entry .roll-total.fumble { color: #ef5f5f; }
.spell-log-entry.spell-log-tohit { background: rgba(143,239,136,.05); border-radius: 4px; }

.spell-roller-desc {
  font-size: .82rem; color: var(--text-secondary, #bbb); line-height: 1.4;
  padding: .5rem; background: rgba(0,0,0,.2); border-radius: 6px; margin-bottom: .5rem;
}
.spell-roller-escalate {
  padding: .4rem .5rem; background: rgba(239,188,79,.1); border-radius: 6px;
  font-size: .82rem; margin-bottom: .5rem;
}
.spell-roller-escalate label { color: #efbc4f; font-weight: 600; }

.spell-roll-btns { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.spell-roll-btn { font-size: .82rem; }

.spell-cond-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
.cond-tag {
  display: inline-block; font-size: .72rem; font-weight: 600;
  padding: 2px 8px; border-radius: 4px;
  background: rgba(239,143,79,.15); color: #ef8f4f; border: 1px solid rgba(239,143,79,.3);
}

.spell-roller-log { max-height: 200px; overflow-y: auto; }
.spell-log-entry {
  padding: .35rem .5rem; border-bottom: 1px solid rgba(255,255,255,.06); font-size: .82rem;
}
.spell-log-entry .roll-label { color: var(--accent); font-weight: 600; }
.spell-log-entry .roll-dice { color: var(--text-muted); margin: 0 .5rem; }
.spell-log-entry .roll-total { font-weight: 700; color: #efef8f; }
.spell-log-entry.spell-log-all { background: rgba(255,255,255,.03); border-radius: 6px; margin-bottom: .25rem; }
.spell-roll-line { display: inline-block; margin-left: .5rem; }
.grand-total { font-size: 1rem; color: #8fef88; }

/* Responsive */
@media (max-width: 600px) {
  .spell-roller { width: calc(100vw - 2rem); right: 1rem; left: 1rem; }
  .compendium-results { grid-template-columns: 1fr; }
  .compendium-filters .sheet-select { flex: 1 1 auto; }
}

/* Print: hide spell roller & compendium browser */
@media print {
  .spell-roller, .compendium-browser { display: none !important; }
  .known-spell-btns { display: none !important; }
  .known-spell-row { border-color: #ccc !important; background: #fff !important; }
  .comp-spell-badge { background: #eee !important; color: #333 !important; }
}
