/* SAGE Legend character generator — styles.
 * Extracted 2026-04-28 from sage_character_generator.html.
 * Edit this file directly. Loaded via <link rel="stylesheet">
 * from sage_character_generator.html.
 */

/* ═══════════════════════════════════════════════════════════════
   SAGE Legend Character Generator — Styles
   Dark fantasy theme with gold/amber accents
   ═══════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;            /* dark-themed native form controls + dropdowns */
  --bg-darkest: #0f0f1a;
  --bg-dark: #1a1a2e;
  --bg-mid: #232340;
  --bg-card: #2a2a48;
  --bg-card-hover: #33335a;
  --bg-card-selected: #3a2a1a;
  --gold: #d4a853;
  --gold-light: #e8c878;
  --gold-dim: #a07830;
  --cream: #e8e0d0;
  --cream-dim: #b0a898;
  --cream-dark: #888070;
  --red: #c44040;
  --green: #40a858;
  --error: #e04848;
  --success: #48c868;
  --beacon-red: #dc4444;
  --beacon-blue: #4488dd;
  --beacon-green: #44bb66;
  --beacon-purple: #9944cc;
  --beacon-orange: #dd8833;
  --beacon-yellow: #ddcc33;
  --font-title: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-body: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --transition: 0.25s ease;
  --radius: 6px;
  --radius-lg: 10px;
}

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

/* Dark-themed native form controls / dropdowns across the generator.
   Per Rome 2026-05-25. */
select { color-scheme: dark; }
select option {
  background: var(--bg-dark);
  color: var(--cream);
}

html { font-size: 15px; }

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

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-darkest); }
::-webkit-scrollbar-thumb { background: var(--bg-mid); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ─── LAYOUT ─────────────────────────────────────────────── */

#app {
  display: flex;
  /* Per Rome 2026-04-26: switched min-height → height so .content-area's
     overflow:auto becomes the scroll container.  With min-height, content
     past the viewport spilled out and body scrolled, which made
     position:sticky inside .content-area never latch.  Now content-area
     scrolls internally and sticky elements (.bp-bar-container,
     .cp-tracker) stay pinned to the top while the player scrolls. */
  height: 100vh;
}

#sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg-dark);
  border-right: 1px solid var(--bg-mid);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition), opacity var(--transition);
  z-index: 10;
}

#sidebar.collapsed {
  margin-left: -280px;
  opacity: 0;
  pointer-events: none;
}

#sidebar-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
#sidebar-toggle:hover { background: var(--gold-dim); color: var(--bg-darkest); }

/* Home link — returns to index.html (the SAGE tools landing page).
   Fixed next to the sidebar toggle so it's always visible even when
   the sidebar is collapsed. */
#home-link {
  position: fixed;
  top: 12px;
  left: 56px;
  z-index: 20;
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-family: var(--font-title);
  font-size: 0.78rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition), color var(--transition);
}
#home-link:hover { background: var(--gold-dim); color: var(--bg-darkest); }

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  /* Top padding accounts for the fixed Home + hamburger buttons (48px
     button band + 12px breathing room) so the first character card
     doesn't slide underneath them when the sidebar opens. */
  padding: 60px 12px 12px;
}

.sidebar-char-item {
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
}
.sidebar-char-item:hover { border-color: var(--gold-dim); background: var(--bg-card-hover); }
.sidebar-char-item.active { border-color: var(--gold); background: var(--bg-card-selected); }
.sidebar-char-item .char-name {
  color: var(--cream);
  font-weight: 600;
  font-size: 0.93rem;
}
.sidebar-char-item .char-arch {
  color: var(--cream-dim);
  font-size: 0.8rem;
  margin-top: 2px;
}
.sidebar-char-item .char-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--bg-mid);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ─── STEP INDICATOR ─────────────────────────────────────── */

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--bg-mid);
  gap: 0;
  flex-wrap: wrap;
}

.step-dot {
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all var(--transition);
}

.step-dot .dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--bg-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cream-dark);
  transition: all var(--transition);
}

.step-dot .step-label {
  font-size: 0.75rem;
  color: var(--cream-dark);
  margin-left: 6px;
  margin-right: 6px;
  transition: color var(--transition);
  white-space: nowrap;
}

.step-dot.completed .dot {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--bg-darkest);
}
.step-dot.completed .step-label { color: var(--gold); }

.step-dot.active .dot {
  background: var(--gold);
  border-color: var(--gold-light);
  color: var(--bg-darkest);
  box-shadow: 0 0 12px rgba(212, 168, 83, 0.4);
}
.step-dot.active .step-label { color: var(--gold-light); font-weight: 600; }

.step-connector {
  width: 20px;
  height: 2px;
  background: var(--bg-mid);
  transition: background var(--transition);
}
.step-connector.filled { background: var(--gold-dim); }

/* ─── MAIN CONTENT ───────────────────────────────────────── */

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 30px 40px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* Generator-scoped override for the gear cart's sticky positioning.
   sage_gear_ui.css declares .gp-cart-bar { top: 0 } which sticks the bar
   at the .content-area padding-top edge (30px below the visible top of
   the scroll viewport). On the sheet this is correct because there's a
   header to clear. On the generator's Equipment step there is no nav
   bar above to clear, so we pull the sticky bar up by 30px (matching
   .content-area's padding-top) to land flush with the viewport top.
   Per Rome 2026-05-10. */
#builder-gear-host .gp-cart-bar {
  top: -30px;
}

.page-title {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 2rem;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.page-subtitle {
  text-align: center;
  color: var(--cream-dim);
  font-size: 0.95rem;
  margin-bottom: 30px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.section-title {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1.3rem;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--gold-dim);
  padding-bottom: 6px;
}

.overview-text {
  background: var(--bg-dark);
  border-left: 3px solid var(--gold-dim);
  padding: 14px 18px;
  margin-bottom: 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--cream-dim);
  font-size: 0.9rem;
  line-height: 1.7;
}
.overview-text p { margin-bottom: 10px; }
.overview-text p:last-child { margin-bottom: 0; }

/* ─── BUTTONS ────────────────────────────────────────────── */

.btn {
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--gold);
  color: var(--bg-darkest);
}
.btn-primary:hover { background: var(--gold-light); box-shadow: 0 0 12px rgba(212, 168, 83, 0.3); }
.btn-primary:disabled { background: var(--cream-dark); cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--cream);
  border: 1px solid var(--cream-dark);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--cream); }

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  font-size: 0.78rem;
  padding: 4px 10px;
}
.btn-danger:hover { background: var(--error); color: #fff; }

.btn-small {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-ghost {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
}
.btn-ghost:hover { background: var(--gold-dim); color: var(--bg-darkest); }

/* ─── NAVIGATION BAR ─────────────────────────────────────── */

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 40px;
  background: var(--bg-dark);
  border-top: 1px solid var(--bg-mid);
}

/* ─── CARDS ──────────────────────────────────────────────── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.card:hover {
  border-color: var(--gold-dim);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.card.selected {
  border-color: var(--gold);
  background: var(--bg-card-selected);
  box-shadow: 0 0 16px rgba(212, 168, 83, 0.2);
}
.card .card-title {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1.1rem;
  margin-bottom: 6px;
}
.card .card-desc {
  color: var(--cream-dim);
  font-size: 0.82rem;
  line-height: 1.5;
}
.card .card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg-darkest);
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}
.card.selected .card-check { display: flex; }

/* Flaw / Directive cards - wider */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.choice-card {
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  cursor: pointer;
  transition: all var(--transition);
}
.choice-card:hover {
  border-color: var(--gold-dim);
  background: var(--bg-card-hover);
}
.choice-card.selected {
  border-color: var(--gold);
  background: var(--bg-card-selected);
}
.choice-card .choice-title {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1rem;
  margin-bottom: 4px;
}
.choice-card .choice-desc {
  color: var(--cream-dim);
  font-size: 0.85rem;
}

/* Behavior cards with beacon/tone info */
.behavior-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.behavior-card {
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
}
.behavior-card:hover {
  border-color: var(--gold-dim);
  background: var(--bg-card-hover);
}
.behavior-card.selected {
  border-color: var(--gold);
  background: var(--bg-card-selected);
}
.behavior-card .beh-name {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1.05rem;
  margin-bottom: 4px;
}
.behavior-card .beh-desc {
  color: var(--cream-dim);
  font-size: 0.85rem;
  margin-bottom: 10px;
}
.behavior-card .beh-mods {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mod-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.mod-tag.positive { background: rgba(68, 200, 100, 0.15); color: var(--success); border: 1px solid rgba(68, 200, 100, 0.3); }
.mod-tag.negative { background: rgba(224, 72, 72, 0.15); color: var(--error); border: 1px solid rgba(224, 72, 72, 0.3); }

/* ─── MASTER-DETAIL LAYOUT (Archetype step) ────────────── */

.master-detail {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  min-height: 500px;
}

.master-list {
  width: 220px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.master-item {
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 10px 16px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--cream);
  position: relative;
}
.master-item:hover {
  border-color: var(--gold-dim);
  background: var(--bg-card-hover);
}
.master-item.browsing {
  border-color: var(--gold-dim);
  background: var(--bg-card-hover);
  color: var(--gold-light);
}
.master-item.confirmed {
  border-color: var(--gold);
  background: var(--bg-card-selected);
  color: var(--gold);
}
.master-item.confirmed::after {
  content: "\2713";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.85rem;
}

.detail-view {
  flex: 1;
  background: var(--bg-dark);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius-lg);
  padding: 28px;
  overflow-y: auto;
  max-height: 70vh;
  animation: fadeIn 0.3s ease;
}

.detail-view .detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bg-mid);
}

.detail-view .detail-header h2 {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1.6rem;
  margin: 0;
}

.detail-placeholder {
  flex: 1;
  background: var(--bg-dark);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cream-dark);
  font-style: italic;
  font-size: 1rem;
}

/* ─── DETAIL PANEL (generic) ────────────────────────────── */

.detail-panel {
  background: var(--bg-dark);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 20px;
  animation: fadeIn 0.3s ease;
}

.detail-panel h3 {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.detail-section {
  margin-bottom: 16px;
}
.detail-section h4 {
  font-family: var(--font-title);
  color: var(--gold-dim);
  font-size: 0.95rem;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.detail-section p {
  color: var(--cream-dim);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.trope-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.trope-item {
  background: var(--bg-card);
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--bg-mid);
}
.trope-item .trope-name {
  color: var(--gold);
  font-weight: 600;
  font-size: 0.88rem;
}
.trope-item .trope-desc {
  color: var(--cream-dark);
  font-size: 0.78rem;
  font-style: italic;
}

/* ─── BEACON VISUALIZATION ───────────────────────────────── */

.beacon-display {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.beacon-bar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.beacon-bar-track {
  width: 36px;
  height: 140px;
  background: var(--bg-darkest);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--bg-mid);
}

.beacon-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 0 0 16px 16px;
  transition: height 0.5s ease, background 0.3s ease;
}

.beacon-bar-value {
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 6px;
}

.beacon-bar-label {
  font-size: 0.72rem;
  color: var(--cream-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* ─── TONE DISPLAY ───────────────────────────────────────── */

.tone-display {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
}

.tone-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 10px 16px;
  text-align: center;
  min-width: 100px;
  border: 1px solid var(--bg-mid);
}
.tone-item .tone-name {
  font-size: 0.78rem;
  color: var(--cream-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.tone-item .tone-value {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 2px;
}
.tone-item .tone-value.positive { color: var(--success); }
.tone-item .tone-value.negative { color: var(--error); }
.tone-item .tone-value.neutral { color: var(--cream-dark); }

/* ─── SUMMARY ────────────────────────────────────────────── */

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.summary-block {
  background: var(--bg-dark);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.summary-block h3 {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1.1rem;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--bg-mid);
  padding-bottom: 6px;
}
.summary-block .summary-value {
  color: var(--cream);
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.summary-block .summary-label {
  color: var(--cream-dark);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-full {
  grid-column: 1 / -1;
}

.validation-status {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-weight: 600;
}
.validation-status.valid {
  background: rgba(68, 200, 100, 0.1);
  border: 1px solid rgba(68, 200, 100, 0.3);
  color: var(--success);
}
.validation-status.invalid {
  background: rgba(224, 72, 72, 0.1);
  border: 1px solid rgba(224, 72, 72, 0.3);
  color: var(--error);
}
.validation-errors {
  margin-top: 8px;
  font-weight: 400;
  font-size: 0.85rem;
}
.validation-errors li { margin-bottom: 4px; }

/* ─── START SCREEN ───────────────────────────────────────── */

.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
}

.start-screen .logo-title {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 2.8rem;
  letter-spacing: 4px;
  margin-bottom: 4px;
  text-shadow: 0 0 20px rgba(212, 168, 83, 0.3);
}
.start-screen .logo-subtitle {
  font-family: var(--font-title);
  color: var(--cream-dim);
  font-size: 1.1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 40px;
}

.start-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  width: 100%;
  max-width: 380px;
}

.start-actions input[type="text"] {
  width: 100%;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 2px solid var(--bg-mid);
  border-radius: var(--radius);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
  text-align: center;
  outline: none;
  transition: border-color var(--transition);
}
.start-actions input[type="text"]:focus {
  border-color: var(--gold);
}
.start-actions input[type="text"]::placeholder {
  color: var(--cream-dark);
}

.divider-text {
  color: var(--cream-dark);
  font-size: 0.85rem;
  position: relative;
  width: 100%;
  text-align: center;
  margin: 8px 0;
}
.divider-text::before, .divider-text::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: var(--bg-mid);
}
.divider-text::before { left: 0; }
.divider-text::after { right: 0; }

.file-input-wrap {
  position: relative;
  width: 100%;
}
.file-input-wrap input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ─── ANIMATIONS ─────────────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.35s ease;
}

/* ─── MODAL ──────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}
.modal-box {
  background: var(--bg-dark);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.modal-box h3 {
  font-family: var(--font-title);
  color: var(--gold);
  margin-bottom: 12px;
}
.modal-box p {
  color: var(--cream-dim);
  margin-bottom: 18px;
  font-size: 0.92rem;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── RESPONSIVE ─────────────────────────────────────────── */

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: 1fr; }
  .summary-full { grid-column: 1; }
  .beacon-display { grid-template-columns: repeat(3, 1fr); }
  .behavior-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  #sidebar { width: 240px; min-width: 240px; }
  #sidebar.collapsed { margin-left: -240px; }
  .content-area { padding: 20px; }
  .nav-bar { padding: 12px 20px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .step-dot .step-label { display: none; }
}

/* ─── QUALITY GRID ───────────────────────────────────────── */

.quality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.quality-card {
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.quality-card:hover {
  border-color: var(--gold-dim);
  background: var(--bg-card-hover);
}
.quality-card.selected {
  border-color: var(--gold);
  background: var(--bg-card-selected);
}
.quality-card .quality-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.quality-card .quality-name {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 0.95rem;
  line-height: 1.25;
}
.quality-card .quality-type {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(200, 160, 80, 0.12);
  color: var(--gold-dim);
  border: 1px solid rgba(200, 160, 80, 0.3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Detail panel for the currently-selected quality */
.quality-detail {
  margin-top: 8px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
}
.quality-detail.empty {
  border-left-color: var(--bg-mid);
  color: var(--cream-dim);
  font-style: italic;
}
.quality-detail .qd-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.quality-detail .qd-name {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1.2rem;
}
.quality-detail .qd-type {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(200, 160, 80, 0.15);
  color: var(--gold);
  border: 1px solid rgba(200, 160, 80, 0.4);
}
.quality-detail .qd-desc {
  color: var(--cream);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ─── PHASE 2: CULTURE & SPECIES ─────────────────────────── */

.culture-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  margin-bottom: 20px;
  background: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--bg-mid);
}
.culture-info .info-label {
  font-size: 0.8rem;
  color: var(--cream-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.culture-info .info-value {
  font-size: 0.95rem;
  color: var(--cream);
  margin-bottom: 6px;
}

.attr-step-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.attr-step-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  padding: 8px 10px;
  text-align: center;
}
.attr-step-card .attr-abbr {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1rem;
  font-weight: 700;
}
.attr-step-card .attr-step-num {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--cream);
}
.attr-step-card .attr-tier {
  font-size: 0.7rem;
  color: var(--cream-dark);
}
.attr-step-card .attr-range {
  font-size: 0.75rem;
  color: var(--cream-dim);
}

.trait-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.trait-card {
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-align: left;
  transition: all var(--transition);
}
.trait-card:hover {
  border-color: var(--gold);
  background: var(--bg-card-hover);
}
.trait-card .trait-name {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 0.95rem;
  line-height: 1.25;
  margin-bottom: 6px;
}
.trait-card .trait-desc {
  color: var(--cream-dim);
  font-size: 0.85rem;
  line-height: 1.55;
}

.race-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.race-card {
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.race-card .rc-name {
  font-family: var(--font-title);
  color: var(--cream);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.3px;
}
.race-card .rc-region {
  font-size: 0.74rem;
  color: var(--gold-dim);
  font-style: italic;
  letter-spacing: 0.3px;
}
.race-card .rc-desc {
  font-size: 0.85rem;
  color: var(--cream-dim);
  line-height: 1.45;
  margin-top: 2px;
}
.race-card.selected .rc-name,
.race-card.selected .rc-region {
  color: var(--gold);
}
.race-card.selected .rc-desc {
  color: var(--cream);
}
  text-align: center;
  font-family: var(--font-title);
  color: var(--cream);
  font-size: 0.95rem;
}
.race-card:hover {
  border-color: var(--gold-dim);
  background: var(--bg-card-hover);
}
.race-card.selected {
  border-color: var(--gold);
  background: var(--bg-card-selected);
  color: var(--gold);
}

.species-factors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.species-factor {
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  padding: 8px 10px;
  text-align: center;
}
.species-factor .factor-label {
  font-size: 0.75rem;
  color: var(--cream-dark);
  text-transform: uppercase;
}
.species-factor .factor-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cream);
}

.name-inputs {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 16px;
}
.name-inputs .name-field {
  flex: 1;
}
.name-inputs .name-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--cream-dim);
  margin-bottom: 4px;
}
.name-inputs .name-field input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  color: var(--cream);
  font-size: 0.95rem;
  font-family: var(--font-body);
  transition: border-color var(--transition);
}
.name-inputs .name-field input:focus {
  outline: none;
  border-color: var(--gold);
}

.culture-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  color: var(--cream);
  font-size: 0.95rem;
  font-family: var(--font-body);
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.culture-select:focus {
  outline: none;
  border-color: var(--gold);
}
.culture-select option {
  background: var(--bg-dark);
  color: var(--cream);
}

.sub-selection {
  background: var(--bg-dark);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}
.sub-selection h4 {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1rem;
  margin-bottom: 10px;
}
.sub-selection select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  color: var(--cream);
  font-size: 0.9rem;
  font-family: var(--font-body);
  margin-bottom: 8px;
}
.sub-selection select option {
  background: var(--bg-dark);
  color: var(--cream);
}

.maker-toggles {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.maker-toggle {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--cream);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition);
}
.maker-toggle:hover {
  border-color: var(--gold-dim);
  background: var(--bg-card-hover);
}
.maker-toggle.selected {
  border-color: var(--gold);
  background: var(--bg-card-selected);
  color: var(--gold);
}

.bonus-text {
  color: var(--gold);
  font-size: 0.8rem;
  margin-top: 4px;
}

.resistances-display {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.resistance-badge {
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 0.85rem;
}
.resistance-badge .res-type {
  color: var(--cream-dim);
}
.resistance-badge .res-val {
  color: var(--gold);
  font-weight: 700;
}

/* ─── HELPER ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-gold { color: var(--gold); }
.text-dim { color: var(--cream-dark); }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }

/* ─── PHASE 3: BACKGROUNDS ──────────────────────────────────── */

.bp-bar-container {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-dark);
  border-radius: var(--radius-lg);
  border: 1px solid var(--bg-mid);
  margin-bottom: 24px;
  /* Sticky bar — locks the BP budget to the top of the viewport while the
     player scrolls through the Background page. Per Rome 2026-04-26. */
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.bp-bar-label {
  font-family: var(--font-title);
  font-size: 0.8rem;
  color: var(--cream-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}
.bp-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-mid);
  border-radius: 3px;
  overflow: hidden;
}
.bp-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gold);
  transition: width 0.4s ease, background 0.3s ease;
}
.bp-bar-fill.overspent { background: var(--red); }
.bp-bar-number {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--gold);
  min-width: 32px;
  text-align: right;
}
.bp-bar-number.overspent { color: var(--red); }
.bp-bar-suffix {
  font-size: 0.8rem;
  color: var(--cream-dark);
  white-space: nowrap;
}
.bp-error {
  color: var(--red);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 8px;
  padding: 8px;
  background: rgba(224, 72, 72, 0.1);
  border-radius: var(--radius);
}
.bg-attr-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .bg-attr-grid { grid-template-columns: repeat(2, 1fr); }
}
.bg-attr-cell {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 10px;
  border: 1px solid var(--bg-mid);
}
.bg-attr-cell .attr-name {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 0.85rem;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bg-attr-cell .attr-name .base-step {
  font-size: 0.7rem;
  color: var(--cream-dark);
}
.bg-attr-btns {
  display: flex;
  gap: 4px;
}
.bg-attr-btns button {
  flex: 1;
  padding: 4px 2px;
  font-size: 0.7rem;
  border-radius: 3px;
  border: 1px solid var(--bg-mid);
  background: var(--bg-dark);
  color: var(--cream-dim);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.bg-attr-btns button:hover:not(:disabled):not(.active) { background: var(--bg-card-hover); border-color: var(--cream-dark); }
.bg-attr-btns button.active { background: var(--bg-card-selected); border-color: var(--gold); color: var(--gold); }
.bg-attr-btns button:disabled { opacity: 0.35; cursor: not-allowed; }
.bg-attr-btns button.negative.active { border-color: var(--gold-dim); color: var(--gold-dim); background: rgba(160,120,48,0.15); }
.bg-cob-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 800px) {
  .bg-cob-grid { grid-template-columns: 1fr; }
}
.bg-cob-category {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--bg-mid);
}
.bg-cob-category h4 {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.bg-cob-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition);
  margin-bottom: 4px;
}
.bg-cob-option:hover:not(.disabled) { background: var(--bg-card-hover); }
.bg-cob-option.selected { background: var(--bg-card-selected); border-left: 3px solid var(--gold); }
.bg-cob-option.disabled { opacity: 0.35; cursor: not-allowed; }
.bg-cob-option .cob-name { flex: 1; font-size: 0.85rem; }
.bg-cob-option .cob-desc { font-size: 0.75rem; color: var(--cream-dim); }
.bp-tag {
  font-family: var(--font-title);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(212, 168, 83, 0.15);
  color: var(--gold);
  white-space: nowrap;
}
.bp-tag.negative {
  background: rgba(212, 168, 83, 0.25);
  color: var(--gold-light);
}
.bg-section-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--gold);
  margin: 28px 0 12px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--bg-mid);
}
.bg-section-subtitle {
  font-size: 0.8rem;
  color: var(--cream-dark);
  margin-bottom: 12px;
}
.bg-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.bg-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.bg-card:hover:not(.disabled) { border-color: var(--cream-dark); background: var(--bg-card-hover); }
.bg-card.selected { border-color: var(--gold); background: var(--bg-card-selected); }
.bg-card.disabled { opacity: 0.35; cursor: not-allowed; }
.bg-card .card-title { font-family: var(--font-title); color: var(--cream); font-size: 0.9rem; margin-bottom: 4px; }
.bg-card .card-bp { font-family: var(--font-title); color: var(--gold); font-size: 0.8rem; margin-bottom: 4px; }
.bg-card .card-detail { font-size: 0.75rem; color: var(--cream-dim); line-height: 1.4; }
.bg-card .card-req { font-size: 0.75rem; color: var(--gold-dim); font-style: italic; margin-bottom: 4px; }
.bg-card .card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.bg-card .card-tags span {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-mid);
  color: var(--cream-dim);
}
.bg-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.bg-adhoc-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.bg-adhoc-row select {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-card);
  color: var(--cream);
  border: 1px solid var(--bg-mid);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.bg-adhoc-row select option { background: var(--bg-dark); }
.bg-adhoc-row .btn-remove {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}
.bg-adhoc-row .btn-remove:hover { background: var(--red); color: #fff; }
.bg-pursuit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--bg-mid);
  margin-bottom: 6px;
}
.bg-pursuit-row .pursuit-name { flex: 1; font-size: 0.9rem; }
.bg-pursuit-row .pursuit-note { font-size: 0.75rem; color: var(--cream-dim); flex: 2; }
.bg-pursuit-row .pursuit-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bg-pursuit-row .pursuit-controls button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--bg-mid);
  background: var(--bg-dark);
  color: var(--cream);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.bg-pursuit-row .pursuit-controls button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.bg-pursuit-row .pursuit-controls button:disabled { opacity: 0.3; cursor: not-allowed; }
.bg-pursuit-row .pursuit-count {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--gold);
  min-width: 20px;
  text-align: center;
}
.bg-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.bg-summary-stat {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  border: 1px solid var(--bg-mid);
}
.bg-summary-stat .stat-label { font-size: 0.75rem; color: var(--cream-dark); text-transform: uppercase; letter-spacing: 1px; }
.bg-summary-stat .stat-value { font-family: var(--font-title); font-size: 1.4rem; color: var(--gold); margin-top: 4px; }
.bg-benefit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.bg-benefit-list .benefit-tag {
  padding: 3px 10px;
  background: var(--bg-mid);
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--cream);
}

/* ═══════════════════════════════════════════════════════════════════
   PHASE 4: MECHANICAL CREATION CSS
   ═══════════════════════════════════════════════════════════════════ */

/* ─── CP TRACKER ─────────────────────────────────────────────── */
.cp-tracker {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  margin-bottom: 20px;
  /* Sticky tracker — locks the CP bar to the top of the viewport while the
     player scrolls Skills / Focuses / Attributes / Disciplines pages. Same
     pattern as the .bp-bar-container on the Background page. Per Rome
     2026-04-26. */
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.cp-tracker .cp-label { font-size: 0.75rem; color: var(--cream-dark); text-transform: uppercase; letter-spacing: 1px; }
.cp-tracker .cp-bar {
  flex: 1;
  height: 10px;
  background: var(--bg-mid);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.cp-tracker .cp-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.3s ease, background 0.3s ease;
  background: var(--gold);
}
.cp-tracker .cp-bar-fill.over { background: var(--burgundy); }
.cp-tracker .cp-values {
  display: flex;
  gap: 12px;
  font-family: var(--font-title);
  font-size: 1rem;
}
.cp-tracker .cp-spent { color: var(--cream); }
.cp-tracker .cp-remaining { color: var(--gold); }
.cp-tracker .cp-remaining.over { color: var(--burgundy); }

/* ─── ATTRIBUTE GRID ─────────────────────────────────────────── */
.attr-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .attr-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .attr-grid { grid-template-columns: 1fr; } }
.attr-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  transition: border-color var(--transition);
}
.attr-card:hover { border-color: var(--gold-dim); }
.attr-card .attr-name {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: 2px;
}
.attr-card .attr-step {
  font-size: 0.7rem;
  color: var(--cream-dark);
  margin-bottom: 8px;
}
.attr-card .attr-level-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}
.attr-card .attr-level-controls button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--bg-mid);
  background: var(--bg-dark);
  color: var(--cream);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.attr-card .attr-level-controls button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.attr-card .attr-level-controls button:disabled { opacity: 0.3; cursor: not-allowed; }
.attr-card .attr-level-value {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: var(--cream);
  min-width: 32px;
}
.attr-card .attr-cost {
  font-size: 0.75rem;
  color: var(--cream-dark);
}
.attr-card .attr-mods {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--cream-dim);
}

/* ─── SKILLS & FOCUSES ───────────────────────────────────────── */
.skills-container { margin-bottom: 20px; }
.skill-row {
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  transition: border-color var(--transition);
}
.skill-row:hover { border-color: var(--gold-dim); }
.skill-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.skill-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.skill-row .skill-name {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--cream);
}
.skill-row .skill-attr {
  font-size: 0.7rem;
  color: var(--cream-dark);
  padding: 1px 6px;
  background: var(--bg-mid);
  border-radius: 3px;
}
.skill-row .skill-type {
  font-size: 0.65rem;
  color: var(--cream-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.skill-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.skill-level-select {
  background: var(--bg-dark);
  border: 1px solid var(--bg-mid);
  border-radius: 4px;
  color: var(--cream);
  padding: 4px 8px;
  font-size: 0.85rem;
  cursor: pointer;
}
.skill-level-select:focus { border-color: var(--gold); outline: none; }
.skill-row .skill-cp {
  font-size: 0.8rem;
  color: var(--gold);
  min-width: 40px;
  text-align: right;
}
.skill-focuses {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--bg-mid);
}
.focus-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 4px 20px;
}
.focus-row .focus-name {
  font-size: 0.85rem;
  color: var(--cream-dim);
}
.focus-row .focus-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.focus-level-select {
  background: var(--bg-dark);
  border: 1px solid var(--bg-mid);
  border-radius: 4px;
  color: var(--cream);
  padding: 3px 6px;
  font-size: 0.8rem;
  cursor: pointer;
}
.focus-level-select:focus { border-color: var(--gold); outline: none; }
.focus-row .focus-cp {
  font-size: 0.75rem;
  color: var(--gold-dim);
  min-width: 30px;
  text-align: right;
}
.skills-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.skills-filter .filter-btn {
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid var(--bg-mid);
  background: var(--bg-card);
  color: var(--cream-dark);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.skills-filter .filter-btn:hover { border-color: var(--gold-dim); color: var(--cream); }
.skills-filter .filter-btn.active { border-color: var(--gold); color: var(--gold); background: var(--bg-mid); }

/* ─── ABILITIES & TALENTS ────────────────────────────────────── */
.disc-section {
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.disc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
}
.disc-header:hover { background: var(--bg-mid); }
.disc-header .disc-name {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--gold);
}
.disc-header .disc-info {
  font-size: 0.75rem;
  color: var(--cream-dark);
}
.disc-body { padding: 0 16px 12px; }
.disc-description {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--cream);
  padding: 10px 12px 12px;
  margin: 0 0 8px;
  border-left: 3px solid var(--gold);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 4px 4px 0;
  font-style: italic;
}
.disc-tier-label {
  font-size: 0.7rem;
  color: var(--cream-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 10px 0 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--bg-mid);
}
.ability-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background var(--transition);
}
.ability-row:hover { background: rgba(255,255,255,0.03); }
.ability-row .ability-name {
  font-size: 0.9rem;
  color: var(--cream);
  flex: 1;
}
.ability-row .ability-cost {
  font-size: 0.8rem;
  color: var(--cream-dark);
  margin-right: 10px;
}
.ability-row .ability-action {
  font-size: 0.7rem;
  color: var(--cream-dim);
  margin-right: 10px;
}
.ability-row button {
  padding: 3px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--bg-mid);
  background: var(--bg-dark);
  color: var(--cream);
  cursor: pointer;
  transition: all var(--transition);
}
.ability-row button:hover { border-color: var(--gold); color: var(--gold); }
.ability-row button.purchased {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--bg-dark);
}
.ability-row.locked { opacity: 0.4; pointer-events: none; }
.ability-row.core-ability { border-left: 3px solid var(--gold-dim); margin-left: -3px; }
.ability-row .ability-name.expandable { cursor: pointer; user-select: none; }
.ability-row .ability-name.expandable:hover { color: var(--gold); }
.ability-row .ability-chevron {
  display: inline-block;
  width: 10px;
  font-size: 0.7rem;
  color: var(--cream-dim);
  margin-right: 2px;
}
.ability-name.expandable:hover .ability-chevron { color: var(--gold); }
.ability-detail {
  padding: 8px 12px 10px 28px;
  margin: 0 8px 8px;
  background: rgba(255,255,255,0.02);
  border-left: 2px solid var(--gold-dim);
  border-radius: 0 4px 4px 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--cream-dim);
  cursor: pointer;
  transition: background 0.12s;
}
.ability-detail:hover { background: rgba(255,255,255,0.04); }
.ability-detail .ability-action {
  font-size: 0.72rem;
  color: var(--gold-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.ability-detail .ability-desc { color: var(--cream); }

.comp-section {
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.comp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
}
.comp-header:hover { background: var(--bg-mid); }
.comp-header .comp-name {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--gold);
}
.comp-header .comp-info {
  font-size: 0.75rem;
  color: var(--cream-dark);
}
.comp-body { padding: 0 16px 12px; }
.talent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background var(--transition);
}
.talent-row:hover { background: rgba(255,255,255,0.03); }
.talent-row .talent-name {
  font-size: 0.9rem;
  color: var(--cream);
  flex: 1;
}
.talent-row .talent-cp {
  font-size: 0.8rem;
  color: var(--cream-dark);
  margin-right: 10px;
}
.talent-row button {
  padding: 3px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--bg-mid);
  background: var(--bg-dark);
  color: var(--cream);
  cursor: pointer;
  transition: all var(--transition);
}
.talent-row button:hover { border-color: var(--gold); color: var(--gold); }
.talent-row button.purchased {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--bg-dark);
}

/* ─── DERIVED VALUES ─────────────────────────────────────────── */
.derived-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 700px) { .derived-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 400px) { .derived-grid { grid-template-columns: repeat(2, 1fr); } }
.derived-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.derived-card .derived-label {
  font-size: 0.65rem;
  color: var(--cream-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.derived-card .derived-value {
  font-family: var(--font-title);
  font-size: 1.5rem;
  color: var(--gold);
}
.derived-section-title {
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: var(--cream-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--bg-mid);
}

/* ─── PHASE 4 SECTION TABS ───────────────────────────────────── */
.mech-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--bg-mid);
}
.mech-tab {
  padding: 10px 20px;
  font-family: var(--font-title);
  font-size: 0.9rem;
  color: var(--cream-dark);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.mech-tab:hover { color: var(--cream); }
.mech-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.mech-tab .tab-cp {
  font-size: 0.7rem;
  color: var(--cream-dim);
  margin-left: 6px;
}


/* ─── Modifier Watch (builder QA widget) ────────────────────────
   Slide-out right-margin panel showing every engine modifier active
   for the in-progress character.  Click the vertical "MODIFIERS"
   chip to expand or collapse.  Per Rome 2026-04-27. */

.mod-watch {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 360px;
  background: var(--bg-dark);
  border-left: 1px solid var(--bg-mid);
  display: flex;
  z-index: 30;
  transition: transform 0.25s ease;
  font-family: var(--font-body);
  box-shadow: -3px 0 12px rgba(0, 0, 0, 0.45);
}
.mod-watch-collapsed {
  transform: translateX(calc(100% - 38px));
}
.mod-watch-toggle {
  position: absolute;
  top: 0;
  left: 0;
  width: 38px;
  height: 100vh;
  background: var(--bg-darkest);
  border: none;
  border-left: 1px solid var(--bg-mid);
  border-right: 1px solid var(--bg-mid);
  color: var(--gold-dim);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 14px;
  font-family: var(--font-title);
  letter-spacing: 2px;
  font-size: 0.78rem;
  transition: background 0.2s, color 0.2s;
}
.mod-watch-toggle:hover {
  background: var(--bg-card);
  color: var(--gold-light);
}
.mod-watch-chevron {
  font-size: 1.4rem;
  line-height: 1;
  transition: transform 0.25s ease;
}
.mod-watch-collapsed .mod-watch-chevron {
  transform: rotate(180deg);
}
.mod-watch-vertical-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-transform: uppercase;
  font-weight: 600;
}
.mod-watch-body {
  margin-left: 38px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mod-watch-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--bg-mid);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.mod-watch-title {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.mod-watch-count {
  font-family: monospace;
  color: var(--cream-dim);
  font-size: 0.85rem;
}
#mod-watch-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 22px;
  font-size: 0.82rem;
  color: var(--cream);
}
.mw-fam {
  margin-top: 12px;
}
.mw-fam:first-child { margin-top: 0; }
.mw-fam-head {
  font-family: var(--font-title);
  color: var(--gold-dim);
  font-size: 0.74rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 8px 0 4px;
  border-bottom: 1px dashed rgba(160,120,48,0.25);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.mw-fam-count {
  color: var(--cream-dark);
  font-family: monospace;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.5px;
}
.mw-src {
  margin-top: 8px;
  padding-left: 4px;
}
.mw-src-name {
  color: var(--cream);
  font-weight: 600;
  font-size: 0.84rem;
  margin-bottom: 3px;
}
.mw-mod {
  margin-left: 8px;
  font-size: 0.78rem;
  color: var(--cream-dim);
  line-height: 1.4;
  display: flex;
  gap: 6px;
}
.mw-mod-effect {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: monospace;
  font-size: 0.74rem;
  color: var(--gold-light);
}
.mw-mod-text {
  flex: 1;
  font-style: italic;
  color: var(--cream-dark);
}
.mw-snapshot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--bg-mid);
}
.mw-snapshot h4 {
  font-family: var(--font-title);
  color: var(--gold-dim);
  font-size: 0.74rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.mw-snap-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  padding: 2px 0;
  color: var(--cream-dim);
}
.mw-snap-key { color: var(--cream-dark); }
.mw-snap-val {
  color: var(--cream);
  font-family: monospace;
  font-size: 0.76rem;
}
.mw-snap-val.zero { color: var(--cream-dark); opacity: 0.5; }
.mw-empty {
  padding: 16px 12px;
  color: var(--cream-dark);
  font-style: italic;
  font-size: 0.82rem;
  text-align: center;
}
.mod-watch ::-webkit-scrollbar { width: 6px; }
.mod-watch ::-webkit-scrollbar-thumb { background: var(--bg-mid); border-radius: 3px; }
.mod-watch ::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1280px) {
  /* On narrower screens, fully retract the panel until clicked. */
  .mod-watch { width: 320px; }
}


/* Prereq badges on background pick cards (Initiation / Specialization /
   Experience).  Renders below the BP cost.  Per Rome 2026-04-27. */
.card-prereq {
  display: inline-block;
  font-family: var(--font-title);
  font-size: 0.7rem;
  letter-spacing: 0.6px;
  padding: 2px 8px;
  border-radius: 3px;
  margin-top: 6px;
  text-transform: uppercase;
}
.card-prereq.met {
  background: rgba(110, 160, 100, 0.18);
  color: #94c890;
  border: 1px solid rgba(110, 160, 100, 0.4);
}
.card-prereq.unmet {
  background: rgba(180, 80, 60, 0.22);
  color: #e09080;
  border: 1px solid rgba(180, 80, 60, 0.55);
}
.card-prereq.advisory {
  background: rgba(180, 140, 60, 0.18);
  color: #e0c490;
  border: 1px solid rgba(180, 140, 60, 0.4);
}
.card-prereq .prereq-current {
  font-family: monospace;
  font-size: 0.78em;
  font-weight: 400;
  letter-spacing: 0;
  margin-left: 4px;
  text-transform: none;
  opacity: 0.85;
}
.bg-card.disabled .card-prereq {
  opacity: 0.85;
}


/* Continue-button lock state — Rome 2026-04-27.  When BP/CP is over the
   budget on any step, the Continue button switches from greying out
   individual picker cards to a single locked button at the bottom.  The
   .over-budget-lock class paints it burnt-orange-on-dark so the player
   immediately knows what's blocking. */
.btn.btn-primary.over-budget-lock,
.btn.btn-primary.over-budget-lock:disabled {
  background: rgba(180, 80, 60, 0.22) !important;
  color: #e09080 !important;
  border: 1px solid rgba(180, 80, 60, 0.65) !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
  font-family: var(--font-title) !important;
  letter-spacing: 1.5px !important;
  text-transform: uppercase !important;
  font-weight: 700 !important;
}
.btn.btn-primary.over-budget-lock::before {
  content: '🔒 ';
  margin-right: 4px;
  font-size: 0.85em;
}


/* Phase 10l (Rome 2026-05-05): Step 15 — Starting Spells picker. */
/* Phase Spells-5e (Rome 2026-05-13): budget bar sticks to the top as the
   player scrolls through the class/school list so the budget+remaining is
   always visible.
   Top offset = .content-area padding-top (30px) so the bar pins flush at
   its starting position and never slides up under the step-indicator nav.
   Negative -30px margin-top + matching padding compensate so the layout
   doesn't gain extra whitespace above. */
.spell-budget-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-card);  /* solid, not gradient with transparency */
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  position: sticky;
  top: 0;
  /* Solid coverage above the bar so the slide-up zone has no transparent gap */
  margin-top: -30px;
  padding-top: 42px;            /* 30px reclaim + 12px original padding */
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
}
.spell-budget-bar.over-budget {
  border-color: var(--red, #c44040);
  box-shadow: 0 0 8px rgba(196, 64, 64, 0.4);
}
.spell-budget-bar .sbb-cell {
  text-align: center;
}
.spell-budget-bar .sbb-label {
  font-size: 0.74rem;
  color: var(--cream-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.spell-budget-bar .sbb-val {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--gold-light);
}
.spell-budget-bar .sbb-cell-remaining .sbb-val { color: var(--green, #40a858); }
.spell-budget-bar .sbb-cell-remaining.over .sbb-val { color: var(--red, #c44040); }

.spell-pick-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.spell-class-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-mid);
  border-radius: 4px;
  padding: 10px 14px;
}
.spell-class-summary {
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  list-style: none;
  padding: 4px 0;
}
.spell-class-summary::-webkit-details-marker { display: none; }
.spell-class-summary::before {
  content: '▸';
  color: var(--gold-dim);
  margin-right: 6px;
  display: inline-block;
  transition: transform 0.15s;
}
.spell-class-card[open] .spell-class-summary::before { transform: rotate(90deg); }
.spell-class-summary .hint {
  color: var(--cream-dim);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: normal;
  letter-spacing: 0;
  text-transform: none;
  margin-left: 4px;
}

.spell-school-block {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--bg-mid);
}
.spell-school-head {
  font-family: var(--font-title);
  color: var(--gold-light);
  font-size: 0.92rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin: 6px 0;
}
.spell-school-head .hint {
  color: var(--cream-dim);
  font-size: 0.74rem;
  font-family: var(--font-body);
  font-weight: normal;
  letter-spacing: 0;
  text-transform: none;
  margin-left: 4px;
}

.spell-pick-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.spell-pick-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.spell-pick-row:last-child { border-bottom: none; }
.spell-pick-row.is-picked {
  background: rgba(212, 168, 83, 0.06);
  border-left: 2px solid var(--gold-dim);
  padding-left: 6px;
}
.spell-pick-btn {
  flex: 0 0 auto;
  min-width: 70px;
  background: transparent;
  border: 1px solid var(--bg-mid);
  color: var(--cream);
  border-radius: 3px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font-title);
  letter-spacing: 0.4px;
}
.spell-pick-btn.pick:hover:not(:disabled) {
  background: rgba(90, 170, 90, 0.18);
  border-color: rgba(90, 170, 90, 0.5);
  color: #b8d8a8;
}
.spell-pick-btn.unpick {
  background: rgba(212, 168, 83, 0.18);
  border-color: rgba(212, 168, 83, 0.5);
  color: var(--gold-light);
}
.spell-pick-btn.unpick:hover {
  background: rgba(216, 128, 128, 0.18);
  border-color: rgba(216, 128, 128, 0.5);
  color: #e0a0a0;
}
.spell-pick-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.spell-pick-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.spell-pick-meta strong { color: var(--cream); font-size: 0.92rem; }
.spell-pick-stats {
  color: var(--cream-dim);
  font-size: 0.74rem;
  font-family: 'Courier New', monospace;
}
.spell-pick-desc {
  margin-top: 3px;
  color: var(--cream-dim);
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.4;
}

/* "Over Budget" lock-out treatment shared with Equipment step */
.btn.over-budget-lock {
  background: rgba(196, 64, 64, 0.25);
  border-color: var(--red, #c44040);
  cursor: not-allowed;
}

/* ─── Phase 11 — Advanced Character start banner ─────────────────── */
.adv-start-banner {
  background: rgba(212,168,83,0.06);
  border: 1px solid var(--gold-dim, #a07830);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 8px 0 24px;
  max-width: 480px;
}
.adv-start-eyebrow {
  font-family: var(--font-title, "Palatino Linotype", serif);
  color: var(--gold-dim, #a07830);
  font-size: 0.72rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.adv-start-title {
  font-family: var(--font-title, "Palatino Linotype", serif);
  color: var(--gold-light, #e8c878);
  font-size: 1.1rem;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.adv-start-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
  margin-bottom: 10px;
}
.adv-start-grid div {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
}
.adv-start-grid div span { color: var(--cream-dim, #b0a898); }
.adv-start-grid div strong { color: var(--gold-light, #e8c878); font-weight: 600; }
.adv-start-note {
  font-size: 0.78rem;
  color: var(--cream-dim, #b0a898);
  font-style: italic;
  line-height: 1.4;
  border-top: 1px solid rgba(212,168,83,0.15);
  padding-top: 8px;
}
