/* ── CUSTOM PROPERTIES ─────────────────────────────────────────────── */
:root {
  --bg:          #0a0908;
  --bg-card:     #141210;
  --bg-card2:    #1c1916;
  --bg-input:    #0d0c0a;
  --border:      #2a2520;
  --border-gold: #4a3c1e;
  --border-glow: #6b5525;

  --gold:        #c9a84c;
  --gold-bright: #e8c870;
  --gold-dim:    #6b5525;
  --ember:       #b84000;
  --ember-glow:  #e06000;

  --text:        #c8b89a;
  --text-dim:    #7a6a55;
  --text-muted:  #4a3e30;
  --text-label:  #a89070;

  --success:     #3a6a3a;
  --radius:      4px;
  --radius-lg:   8px;

  --font-head:   'Cinzel', 'Georgia', serif;
  --font-body:   'Crimson Pro', 'Georgia', serif;
}

/* ── RESET & BASE ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 17px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── EMBER OVERLAY (atmospheric gradient) ────────────────────────── */
.ember-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(120,40,0,0.18) 0%, transparent 65%),
              radial-gradient(ellipse at 50% 0%, rgba(50,30,10,0.25) 0%, transparent 60%);
}

/* ── HEADER ────────────────────────────────────────────────────────── */
.site-header {
  position: relative; z-index: 1;
  text-align: center;
  padding: 3rem 1rem 2rem;
  border-bottom: 1px solid var(--border-gold);
  background: linear-gradient(180deg, #0f0d0b 0%, transparent 100%);
}
.header-glyph {
  font-size: 2.5rem;
  color: var(--gold);
  opacity: 0.7;
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
}
.site-header h1 {
  font-family: var(--font-head);
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 0 40px rgba(201,168,76,0.3);
}
.header-sub {
  margin-top: 0.4rem;
  color: var(--text-dim);
  font-size: 1.05rem;
  font-style: italic;
}

/* ── HEADER: LOGO (login page) ─────────────────────────────────────── */
.site-header--logo {
  padding: 2rem 1rem;
  background: #0a0806;
}
.header-logo {
  max-width: min(480px, 90vw);
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ── HEADER: BANNER (all other pages) ──────────────────────────────── */
.site-header--banner {
  padding: 0;
  overflow: hidden;
}
.header-banner {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.site-header--banner .header-inner {
  padding: 0.75rem 1rem 1rem;
  background: linear-gradient(180deg, rgba(10,8,6,0.7) 0%, #0a0806 100%);
}

/* ── MAIN LAYOUT ───────────────────────────────────────────────────── */
main {
  position: relative; z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── CARD ──────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.card-title {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem; height: 1.8rem;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  font-size: 0.75rem;
  color: var(--gold-dim);
  flex-shrink: 0;
}
.card-intro {
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

/* ── FORM FIELDS ───────────────────────────────────────────────────── */
.field-row { display: flex; gap: 1.25rem; margin-bottom: 1.25rem; }
.field-row.two-col .field { flex: 1; }
.field-row:last-child { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field.full { flex: 1; }

label {
  font-family: var(--font-head);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-label);
}

input[type="text"],
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.6rem 0.85rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
input[type="text"]:focus,
select:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 2px rgba(107,85,37,0.25);
}
input[type="text"]::placeholder { color: var(--text-muted); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b5525' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}
select option { background: #1a1714; }

.origin-hint {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.5;
  border-left: 2px solid var(--gold-dim);
  padding-left: 0.75rem;
}

/* ── DETAILS PANEL ─────────────────────────────────────────────────── */
.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 640px) { .details-grid { grid-template-columns: 1fr; } }

.detail-panel {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.detail-panel-title {
  font-family: var(--font-head);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Stat block (STR DEX CON etc.) */
.stat-block {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  text-align: center;
  margin-bottom: 1rem;
}
.stat-cell { display: flex; flex-direction: column; }
.stat-name {
  font-family: var(--font-head);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--gold-dim);
  text-transform: uppercase;
}
.stat-value {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--gold-bright);
  line-height: 1.2;
}
.stat-mod {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-key {
  font-family: var(--font-head);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  flex-shrink: 0;
  margin-right: 0.75rem;
}
.detail-val { color: var(--text); text-align: right; }

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.skill-tag {
  font-size: 0.8rem;
  background: rgba(201,168,76,0.08);
  border: 1px solid var(--border-gold);
  border-radius: 3px;
  padding: 0.15rem 0.5rem;
  color: var(--text);
}

.magic-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.magic-tag {
  background: rgba(100,60,180,0.15);
  border: 1px solid rgba(150,80,220,0.3);
  border-radius: 3px;
  padding: 0.15rem 0.6rem;
  font-size: 0.85rem;
  color: #c090f0;
}

.bloodied-text {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* ── CLASS FEATURES TABLE ──────────────────────────────────────────── */
.features-section { margin-bottom: 1.5rem; }
.features-section-title {
  font-family: var(--font-head);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.feature-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.features-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.features-table th {
  font-family: var(--font-head);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-dim);
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border-gold);
}
.features-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.features-table tr:last-child td { border-bottom: none; }
.features-table tr.level-highlight td {
  background: rgba(201,168,76,0.04);
}
.features-table tr:hover td { background: rgba(255,255,255,0.02); }

.level-cell {
  font-family: var(--font-head);
  font-size: 0.75rem;
  color: var(--gold-dim);
  white-space: nowrap;
  width: 4rem;
}
.feature-names { color: var(--text); }
.feature-name-pill {
  display: inline-block;
  margin: 0.1rem 0.3rem 0.1rem 0;
  cursor: pointer;
  border-bottom: 1px dotted var(--text-muted);
  transition: color 0.15s;
}
.feature-name-pill:hover { color: var(--gold); }

.feature-desc-row { display: none; }
.feature-desc-row.open { display: table-row; }
.feature-desc-cell {
  padding: 0.5rem 0.75rem 0.75rem 2rem !important;
  color: var(--text-dim);
  font-size: 0.88rem;
  font-style: italic;
  line-height: 1.6;
  background: rgba(0,0,0,0.15) !important;
  border-bottom: 1px solid var(--border-gold) !important;
}

.recharge-badge {
  font-size: 0.65rem;
  font-family: var(--font-head);
  letter-spacing: 0.08em;
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.25rem;
  vertical-align: middle;
}
.recharge-lr { background: rgba(180,60,0,0.2); color: #cc7744; border: 1px solid rgba(180,60,0,0.3); }
.recharge-sr { background: rgba(60,100,180,0.2); color: #7799cc; border: 1px solid rgba(60,100,180,0.3); }
.pos-cost-badge {
  font-size: 0.65rem;
  background: rgba(201,168,76,0.1);
  border: 1px solid var(--border-gold);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.25rem;
  color: var(--gold-dim);
  vertical-align: middle;
}

/* ── FIGHTING STYLES ────────────────────────────────────────────────── */
.fighting-styles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.style-card {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.style-card-name {
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.4rem;
}
.style-card-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.style-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.75rem;
}

/* ── ROLL BLOCKS ───────────────────────────────────────────────────── */
.roll-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: var(--bg-card2);
}
.roll-block:last-child { margin-bottom: 0; }

.roll-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.roll-label {
  font-family: var(--font-head);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-label);
  min-width: 7rem;
}
.roll-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-roll, .btn-reroll {
  font-family: var(--font-head);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 0.45rem 1rem;
  border: 1px solid;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.2s;
}
.btn-roll {
  background: rgba(201,168,76,0.1);
  color: var(--gold);
  border-color: var(--border-gold);
}
.btn-roll:hover { background: rgba(201,168,76,0.2); }
.btn-roll:disabled { opacity: 0.35; cursor: default; }
.btn-roll .dice-icon { margin-right: 0.3rem; }

.btn-reroll {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
  font-size: 0.65rem;
}
.btn-reroll:hover { color: var(--text); border-color: var(--text-muted); }

.roll-num {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-bright);
  min-width: 2.5rem;
  text-align: center;
  animation: popIn 0.25s ease;
}

.roll-result {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.6;
  animation: fadeIn 0.35s ease;
}

/* Rolling animation on dice icon */
@keyframes spin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.3); }
  100% { transform: rotate(360deg) scale(1); }
}
.btn-roll.rolling .dice-icon { display: inline-block; animation: spin 0.4s ease; }

@keyframes popIn {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SUBMIT & SUCCESS ──────────────────────────────────────────────── */
.card-submit { text-align: center; padding: 1.5rem; }

.btn-begin {
  font-family: var(--font-head);
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(180,80,0,0.4), rgba(140,50,0,0.6));
  color: var(--gold-bright);
  border: 1px solid var(--ember);
  border-radius: var(--radius);
  padding: 0.9rem 2.5rem;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 20px rgba(180,80,0,0.15);
}
.btn-begin:hover {
  background: linear-gradient(135deg, rgba(220,100,0,0.5), rgba(180,60,0,0.7));
  border-color: var(--ember-glow);
  box-shadow: 0 0 30px rgba(200,100,0,0.3);
}
.btn-begin span { margin-right: 0.5rem; }

.card-success { text-align: center; }
.success-inner { padding: 1rem; }
.success-glyph { font-size: 3rem; color: var(--gold); opacity: 0.6; margin-bottom: 1rem; }
.card-success h2 {
  font-family: var(--font-head);
  font-size: 1.6rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}
.success-char-name {
  font-size: 1.3rem;
  color: var(--gold-bright);
  font-style: italic;
  margin-bottom: 1rem;
}
.success-sub { color: var(--text-dim); margin-bottom: 1.25rem; }
.uuid-display {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--text-dim);
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  margin-bottom: 1.5rem;
  word-break: break-all;
  letter-spacing: 0.05em;
}
.success-actions { margin-top: 1rem; }

/* ── FOOTER ────────────────────────────────────────────────────────── */
.site-footer {
  position: relative; z-index: 1;
  text-align: center;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

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

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-gold), transparent);
  margin: 1.25rem 0;
}

/* Scrollable feature table wrapper */
.table-scroll {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ── CHARACTER SHEET ───────────────────────────────────────────────── */

/* Identity bar */
.cs-identity { padding: 1rem 2rem; }
.cs-identity-grid {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  align-items: center;
}
.cs-id-cell { display: flex; flex-direction: column; min-width: 90px; }
.cs-id-label {
  font-family: var(--font-head);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.2rem;
}
.cs-id-value {
  font-family: var(--font-head);
  font-size: 1rem;
  color: var(--text);
}
.souls-value { color: var(--gold); }

/* Position bar */
.pos-bar-wrapper { display: flex; flex-direction: column; gap: 0.5rem; }
.pos-bar-track {
  position: relative;
  height: 12px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.pos-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3a6a3a, #4aaa4a);
  border-radius: 6px;
  transition: width 0.3s ease;
}
.pos-bar-fill.bloodied { background: linear-gradient(90deg, #8a2000, #c84000); }
.pos-bar-bloodied-mark {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--ember);
  opacity: 0.7;
  transform: translateX(-50%);
}
.pos-bar-labels {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}
.pos-current {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  color: #4aaa4a;
}
.pos-current.bloodied-text { color: var(--ember); }
.pos-divider { color: var(--text-muted); }
.pos-max {
  font-family: var(--font-head);
  font-size: 1rem;
  color: var(--text-dim);
}
.pos-bloodied-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-left: auto;
}
.bloodied-active {
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--ember);
  margin-top: 0.4rem;
}

/* Stats layout */
.stats-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
@media (max-width: 720px) { .stats-two-col { grid-template-columns: 1fr; } }

/* Attribute grid */
.attr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.attr-box {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.4rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}
.attr-name {
  font-family: var(--font-head);
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  color: var(--gold-dim);
  text-transform: uppercase;
}
.attr-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-bright);
  line-height: 1.1;
}
.attr-mod { font-size: 0.85rem; color: var(--text-dim); }
.attr-base { font-size: 0.68rem; color: var(--text-muted); font-style: italic; }
.attr-upgrade-btn {
  margin-top: 0.35rem;
  font-family: var(--font-head);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  background: rgba(201,168,76,0.08);
  color: var(--gold-dim);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 0.2rem 0.45rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.attr-upgrade-btn:hover:not(:disabled) { background: rgba(201,168,76,0.2); color: var(--gold); }
.attr-upgrade-btn:disabled, .attr-upgrade-btn.disabled { opacity: 0.3; cursor: default; }
.attr-upgrade-note { font-size: 0.78rem; color: var(--text-muted); font-style: italic; }

/* Combat panel */
.combat-section-title {
  font-family: var(--font-head);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}
.combat-saves {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  margin-bottom: 0.6rem;
}
.combat-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
}
.combat-label { color: var(--text-dim); font-size: 0.82rem; flex: 1; }
.combat-val {
  font-family: var(--font-head);
  font-size: 0.9rem;
  color: var(--text);
  min-width: 2rem;
  text-align: right;
}
.save-proficient .combat-label { color: var(--text); }
.save-proficient .combat-val { color: var(--gold-bright); }
.save-prof-badge {
  font-family: var(--font-head);
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  color: var(--gold-dim);
  border: 1px solid var(--border-gold);
  border-radius: 2px;
  padding: 0.05rem 0.2rem;
}
.combat-divider { height: 1px; background: var(--border); margin: 0.5rem 0; }

/* Skill proficiency panel */
.skill-pool-bar {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.skill-pool {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}
.skill-pool-label {
  font-family: var(--font-head);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  min-width: 130px;
}
.skill-pool-pips { display: flex; gap: 0.3rem; }
.skill-pip {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1px solid var(--border-gold);
}
.skill-pip.used { background: var(--gold-dim); }
.skill-pip.avail { background: transparent; }
.skill-pool-count { font-family: var(--font-head); font-size: 0.75rem; color: var(--text); }
.skill-pool-count.over-budget { color: var(--ember); }
.skill-pool-legend { font-size: 0.78rem; color: var(--text-muted); font-style: italic; }

.skill-group-title {
  font-family: var(--font-head);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}
.skill-group-note {
  color: var(--text-muted);
  font-size: 0.62rem;
  text-transform: none;
  letter-spacing: 0.04em;
  font-family: var(--font-body);
  font-style: italic;
}
.skill-group { display: flex; flex-direction: column; gap: 0.2rem; }

.skill-row {
  display: grid;
  grid-template-columns: 1fr 3rem 1.5rem auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.1s;
}
.skill-row:hover { background: rgba(255,255,255,0.02); }
.skill-row.has-prof {
  border-color: var(--border);
  background: rgba(201,168,76,0.03);
}
.skill-row-name { font-size: 0.88rem; color: var(--text); }
.skill-row.has-prof .skill-row-name { color: var(--gold-bright); }
.skill-row-ability {
  font-family: var(--font-head);
  font-size: 0.58rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.skill-row-pips { display: flex; gap: 0.3rem; justify-content: center; }
.prof-pip {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1px solid var(--border-gold);
  background: transparent;
}
.prof-pip.filled { background: var(--gold); border-color: var(--gold); }
.skill-row-actions { display: flex; gap: 0.3rem; justify-content: flex-end; }

.btn-skill {
  font-family: var(--font-head);
  font-size: 0.57rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 0.2rem 0.45rem;
  border: 1px solid;
  transition: background 0.1s;
  white-space: nowrap;
}
.btn-skill-add {
  background: rgba(201,168,76,0.08);
  color: var(--gold);
  border-color: var(--border-gold);
}
.btn-skill-add:hover:not(:disabled) { background: rgba(201,168,76,0.18); }
.btn-skill-remove {
  background: rgba(180,60,0,0.08);
  color: #cc7744;
  border-color: rgba(180,60,0,0.3);
}
.btn-skill-remove:hover { background: rgba(180,60,0,0.15); }
.btn-skill.disabled, .btn-skill:disabled { opacity: 0.35; cursor: default; }
.skill-cost { color: var(--text-muted); font-size: 0.54rem; }
.skill-save-row {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* Background section */
.bg-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.bg-block:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.bg-label {
  font-family: var(--font-head);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.bg-text {
  font-size: 0.95rem;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.6;
}

/* ── CHARACTER TABS ────────────────────────────────────────────────────── */
.cs-tab-nav {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0.25rem;
  padding: 0 0.25rem;
  background: var(--bg-card);
  border-radius: 4px 4px 0 0;
}
.cs-tab {
  padding: 0.65rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: var(--font-head);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.cs-tab.active  { color: var(--gold); border-bottom-color: var(--gold); }
.cs-tab:hover:not(.active) { color: rgba(255,255,255,0.75); }

.bonfire-placeholder {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-dim);
}
.bonfire-glyph { font-size: 2.5rem; margin-bottom: 0.75rem; color: var(--gold); }
.bonfire-sub   { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.4rem; }

/* ── AUTH / LOGIN ──────────────────────────────────────────────────────── */
.login-card { max-width: 440px; margin: 2rem auto; }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  width: 100%; padding: 0.75rem 1rem;
  background: #fff; color: #3c4043;
  border: 1px solid #dadce0; border-radius: 4px;
  font-size: 0.9rem; font-family: var(--font-body); cursor: pointer;
  transition: background 0.15s;
}
.btn-google:hover { background: #f8f9fa; }
.google-icon { flex-shrink: 0; }

.login-divider {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 1rem 0; color: var(--text-muted); font-size: 0.8rem;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.login-tabs { display: flex; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.login-tab {
  flex: 1; padding: 0.5rem; background: transparent; border: none; border-bottom: 2px solid transparent;
  font-family: var(--font-head); font-size: 0.75rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted); cursor: pointer;
  transition: color 0.15s, border-color 0.15s; margin-bottom: -1px;
}
.login-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.login-error {
  margin-top: 0.75rem; padding: 0.5rem 0.75rem;
  background: rgba(180,50,50,0.15); border: 1px solid rgba(180,50,50,0.3);
  border-radius: 4px; color: #e07070; font-size: 0.85rem;
}

.login-section { margin-bottom: 0.5rem; }
.role-btn-group { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.5rem; }
.role-btn { font-size: 0.9rem; }

/* ── HEADER LOGOUT ─────────────────────────────────────────────────────── */
.site-header .header-inner { position: relative; }
.btn-logout {
  position: absolute; top: 0; right: 0;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); font-family: var(--font-head);
  font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.35rem 0.75rem; border-radius: 2px; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-logout:hover { color: var(--gold); border-color: var(--gold); }

/* ── CHARACTER CARDS (selection page) ─────────────────────────────────── */
.char-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; margin-bottom: 0.75rem;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-card); transition: border-color 0.15s;
}
.char-card:hover { border-color: var(--border-gold); }
.char-card-name { font-family: var(--font-head); font-size: 1.1rem; color: var(--gold); margin-bottom: 0.2rem; }
.char-card-meta { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.char-card-pos { flex: 1; max-width: 200px; }
.char-card-play {
  padding: 0.5rem 1.25rem; font-size: 0.8rem;
  text-decoration: none; flex-shrink: 0; margin-left: 1rem;
}

/* ── BONFIRE / LOADOUT ─────────────────────────────────────────────────── */
.bf-loadout { display: flex; flex-direction: column; gap: 1rem; }

.bf-group { }
.bf-group-title {
  font-family: var(--font-head); font-size: 0.7rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--gold-dim);
  padding-bottom: 0.3rem; margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.bf-slot {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0; border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.04));
  flex-wrap: wrap;
}
.bf-slot:last-child { border-bottom: none; }
.bf-slot-label {
  font-size: 0.78rem; color: #fff; width: 5rem; flex-shrink: 0;
}
.bf-slot-item { flex: 1; min-width: 0; }
.bf-item-name { display: block; font-size: 0.9rem; color: var(--gold); }
.bf-item-desc { display: block; font-size: 0.75rem; color: rgba(255,255,255,0.6); margin-top: 0.1rem; }
.bf-item-empty { font-size: 0.85rem; color: rgba(255,255,255,0.45); font-style: italic; }
.bf-slot-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

/* ── INVENTORY ─────────────────────────────────────────────────────────── */
.bf-inventory {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.bf-inventory-group { margin-bottom: 0.75rem; }
.bf-inventory-subtype {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.5);
  margin-bottom: 0.35rem;
}

.bf-picker {
  margin-top: 1.25rem; border: 1px solid var(--border-gold);
  border-radius: 4px; background: var(--bg-card); overflow: hidden;
}
.bf-picker-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.9rem; background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}
.bf-picker-title {
  font-family: var(--font-head); font-size: 0.72rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold);
}
.bf-search {
  display: block; width: 100%; padding: 0.55rem 0.9rem;
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); font-family: var(--font-body); font-size: 0.9rem;
  box-sizing: border-box;
}
.bf-search:focus { outline: none; background: rgba(255,255,255,0.02); }
.bf-picker-list { max-height: 320px; overflow-y: auto; }
.bf-picker-item {
  padding: 0.6rem 0.9rem; cursor: pointer;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.04));
  transition: background 0.12s;
}
.bf-picker-item:last-child { border-bottom: none; }
.bf-picker-item:hover { background: rgba(255,255,255,0.05); }
.bf-picker-item-name { font-size: 0.88rem; color: #fff; }
.bf-picker-item-desc { font-size: 0.75rem; color: rgba(255,255,255,0.55); margin-top: 0.15rem; }
.bf-picker-empty { padding: 1rem; text-align: center; color: rgba(255,255,255,0.5); font-size: 0.85rem; }

/* ── MAGIC / SPELLS ────────────────────────────────────────────────────── */
.bf-spell-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.bf-slot-pool {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0.5rem 0; flex-wrap: wrap;
}
.bf-affinity {
  font-size: 0.82rem; color: #fff;
  margin-bottom: 0.5rem;
  padding: 0.35rem 0.6rem;
  background: rgba(255,210,100,0.06);
  border: 1px solid rgba(255,210,100,0.15);
  border-radius: 3px;
  display: inline-block;
}
.bf-affinity strong { color: var(--gold); }
.bf-no-slots {
  font-size: 0.82rem; color: rgba(255,255,255,0.5);
  font-style: italic; padding: 0.5rem 0;
}
.bf-affinity-badge {
  font-size: 0.65em; color: var(--gold);
  margin-left: 0.3em; vertical-align: middle;
}
.bf-picker-disabled { opacity: 0.45; cursor: default; }
.bf-picker-disabled:hover { background: transparent !important; }
