.character-app { margin-bottom: var(--space-2xl); }
.character-form { display: grid; }
.character-form .card { container-type: inline-size; background: var(--color-surface); border-radius: 12px; padding: var(--space-md) var(--space-lg); box-shadow: var(--shadow-sm); }
.character-form .section-title { margin: 0 0 var(--space-md) 0; color: var(--color-secondary); }
.character-form label { display: grid; z-index: 1; padding: var(--space-xs); font-size: 14px; color: var(--color-text); grid-template-columns: 1fr auto auto; align-items: center; column-gap: 6px; }
.character-form label > input,
.character-form label > textarea { grid-column: 1 / -1; }
.character-form label .reset-field { grid-column: 3; grid-row: 1; }
.character-form label .equip-btn { padding: 4px 8px; border-radius: 6px; }
.character-form label.inventory-weapon { grid-template-columns: auto auto 1fr auto; }
.character-form label.inventory-weapon > span { grid-column: 1; grid-row: 1; align-self: start; }
.character-form label.inventory-weapon > .equip-btn { grid-column: 2; grid-row: 1; margin-left: 8px; }
.character-form label.inventory-weapon > input[type="text"] { grid-column: 1 / -1; grid-row: 2; }
.character-form input[type="text"],
.character-form input[type="number"] { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--color-border); font-weight: 800; font-size: 16px; font-family: var(--font-display); background: var(--color-surface-elev); color: var(--color-text); }
.character-form textarea { width: 100%; padding: 10px 12px; font-family: var(--font-body); border-radius: 8px; border: 1px solid var(--color-border); background: var(--color-surface-elev); color: var(--color-text); }
.character-form .grid { display: grid; gap: var(--space-md); }
.character-form .grid-1 { grid-template-columns: 1fr; }

/* Container-queried dual column grid for sections like Domain Cards */
.character-form .duo-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-md); }
@container (min-width: 560px) { .character-form .duo-grid { grid-template-columns: repeat(2, 1fr); } }

/* Flexible field flows for card internals */
.flow { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: end; }
.flow.nowrap { flex-wrap: nowrap; }
.flow > label { flex: 1 1 var(--field-basis, 260px); min-width: min(100%, var(--field-min, 200px)); }
.flow.nowrap > label.field-grow { flex: 1 1 auto; min-width: 0; }
.flow.nowrap > label.field-mod { flex: 0 0 72px; min-width: 60px; }
.field-xs { --field-basis: 95px; --field-min: 80px; }
.field-sm { --field-basis: 170px; --field-min: 150px; }
.field-md { --field-basis: 240px; --field-min: 200px; }
.field-lg { --field-basis: 320px; --field-min: 280px; }
.field-xl { --field-basis: 480px; --field-min: 360px; }
.field-grow { flex: 2 1 var(--field-basis, 280px); }
.field-mod { --field-basis: 72px; --field-min: 60px; }
.field-full { flex-basis: 100%; }

.sextet-grid { 
  display: grid; 
  grid-template-columns: repeat(1, 1fr); 
  gap: var(--space-sm); 
  align-items: end; 
}
.sextet-grid > label { min-width: 0; }
@container (min-width: 190px) { .sextet-grid { grid-template-columns: repeat(2, 1fr); } }
@container (min-width: 285px) { .sextet-grid { grid-template-columns: repeat(3, 1fr); } }
@container (min-width: 570px) { .sextet-grid { grid-template-columns: repeat(6, 1fr); } }

.triplet-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  align-items: end;
}
.triplet-grid > label { min-width: 0; }
/* Never show 2 columns; jump from 1 to 3 when there's room (~80px each + gap) */
@container (min-width: 285px) { .triplet-grid { grid-template-columns: repeat(3, 1fr); } }

.input-with-action { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.reset-field, .lock-field { padding: 4px 6px; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--color-border); border-radius: 6px; background: transparent; cursor: pointer; color: var(--color-text); font-size: 12px; }
.reset-field::before { content: '↺'; }
.lock-field::before { content: '🔒'; }
.lock-field[aria-pressed="false"]::before { content: '🔓'; }
.lock-field:hover, .reset-field:hover { background: var(--color-accent); }
.character-form label .lock-field { grid-column: 2; grid-row: 1; }
.derived-warning { color: var(--color-accent); font-size: 12px; }

.inventory-list .inventory-row { display: grid; grid-template-columns: auto 1fr auto; padding: var(--space-xs); gap: 8px; align-items: center; margin-bottom: 8px; position: relative; }
.inventory-list .inventory-row:last-of-type { grid-template-columns: auto 1fr; }
.inventory-list .inventory-row.has-overlay { grid-template-columns: auto 1fr; }
.drag-handle { cursor: grab; color: var(--color-text); padding: 8px 4px; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.drag-handle:hover { background: var(--color-surface-elev); }
.drag-handle:active { cursor: grabbing; }
.drag-handle::before { content: '⋮⋮'; font-size: 12px; line-height: 1; letter-spacing: -2px; }
.remove-row { border: 1px solid var(--color-border); background: transparent; border-radius: 8px; padding: 17px 10px; cursor: pointer; color: var(--color-text); }
.remove-row:hover { background: var(--color-accent); }
.inventory-list .inventory-row.dragging { opacity: 0.5; }
.inventory-list .inventory-row.drag-over { border-top: 2px solid var(--color-accent); }

/* Abilities list rows (mirror inventory/consumables) */
.abilities-list .ability-row { display: grid; grid-template-columns: auto 1fr auto; padding: var(--space-xs); gap: 8px; align-items: center; margin-bottom: 8px; position: relative; }
.abilities-list .ability-row.dragging { opacity: 0.5; }
.abilities-list .ability-row.drag-over { border-top: 2px solid var(--color-accent); }
.abilities-list .ability-label { 
  width: 100%; 
  padding: 10px 12px; 
  border-radius: 8px; 
  border: 1px solid var(--color-border); 
  background: var(--color-surface-elev); 
  color: var(--color-text); 
  font-weight: 800; 
  font-size: 16px; 
  font-family: var(--font-display); 
  text-decoration: none;
  display: flex;
}
.abilities-list .ability-label:hover { background: var(--color-primary); text-decoration: underline; }
.abilities-list .ability-row .summary { grid-column: 2 / -1; }
/* Clamp long ability summaries */
.abilities-list .summary .feature-text { 
  display: -webkit-box; 
  line-clamp: 3;
  -webkit-line-clamp: 3; 
  -webkit-box-orient: vertical; 
  overflow: hidden; 
}

/* Display label styling for existing inventory/consumable rows */
.inventory-list .item-label { 
  width: 100%; 
  padding: 10px 12px; 
  border-radius: 8px; 
  border: 1px solid var(--color-border); 
  background: var(--color-surface-elev); 
  color: var(--color-text); 
  font-weight: 800; 
  font-size: 16px; 
  font-family: var(--font-display); 
  text-decoration: none;
  display: flex;
}

/* Place Open link for inventory rows similarly to equipment labels */
.inventory-list .summary-link {
  position: absolute;
  right: 6px; /* default for items (no counter) */
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  padding: var(--space-xs);
  border-radius: 6px;
  background: transparent;
}

.inventory-list .item-label:hover { background: var(--color-primary); text-decoration: underline; }

/* Tight number input for consumable counts */
.inventory-list .count-input { width: 44px; padding: 4px 6px; height: 28px; }
/* Overlay variant: pin inside the label at top-right and size to content */
.inventory-list .count-input.overlay { 
  width: 6.3ch;
  height: 49px;
  right: 6px;
  top: 6px;
}

/* Make summary rows span full width under the grid */
.inventory-list .inventory-row .summary {
  position: relative;
  grid-column: 2 / -1;
}

.summary .content-card { padding: 0px; box-shadow: var(--shadow-sm); border-radius: 8px; text-decoration: none; background: var(--color-surface); }
.summary .feature-row, .summary .card-meta { margin-top: 0px; }
.summary .content-card .card-meta .meta-row .meta-value,
.summary .content-card .card-meta .feature-row .feature-text { color: var(--color-text-light); padding: var(--space-xs); }
.summary .summary-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; margin-bottom: 4px; }
.summary .summary-head h4 { margin: 0; color: var(--color-secondary); }
.summary .summary-link { font-size: 0.9rem; border: 1px solid var(--color-border); padding: var(--space-xs); border-radius: 6px; position:absolute; right: var(--space-xs); top: var(--space-xs); }

/* Position meta summary normally under its field */
.flow > .summary { 
  position: relative; 
  margin-top: -16px; 
  left: 6px;
}
/* Ensure labels establish a positioning context when needed */
.flow > label { position: relative; }

/* Place the Open link inside the label's grid, top-right */
.character-form label .summary-link { 
  position: absolute;
  right: 6px; 
  top: -2px; 
  font-size: 0.9rem; 
  border: 1px solid var(--color-border); 
  padding: var(--space-xs); 
  border-radius: 6px; 
  background: transparent; 
  text-decoration: none; 
}

.character-form label .summary-link:hover { background: var(--color-primary); text-decoration: underline; }

.typeahead-menu { position: fixed; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; box-shadow: var(--shadow-sm); z-index: 9999; max-height: 240px; overflow: auto; display: none; }
.typeahead-item { padding: 8px 10px; cursor: pointer; }
.typeahead-item[aria-selected="true"], .typeahead-item:hover { background: var(--color-surface-elev); }

/* Affordance for typeahead inputs: subtle chevron like cards */
input.typeahead { padding-right: 60px; position: relative; }
input.typeahead::after { content: ''; }
/* Use a wrapper label as positioning context and draw chevron inside the input area */
.character-form label:has(> input.typeahead) { position: relative; }
.character-form label:has(> input.typeahead)::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  pointer-events: none;
  opacity: .7;
  font-size: 14px;
  color: var(--color-secondary);
  transition: transform .15s ease;
}
.character-form label:has(> input.typeahead.is-open)::after { transform: rotate(180deg); }

/* Clear button for typeahead fields */
.character-form label .typeahead-clear {
  position: absolute;
  right: 26px; /* leave room for chevron at 10px */
  top: 50%;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--color-text);
  font-size: 12px;
}
.character-form label .typeahead-clear::before { content: '✕'; font-size: 12px; line-height: 1; }
.character-form label .typeahead-clear:hover { background: var(--color-accent); }

/* Also show chevrons for standalone typeahead inputs used in add rows */
.inline-add { position: relative; }
.inline-add::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: .7;
  font-size: 14px;
  color: var(--color-secondary);
  transition: transform .15s ease;
}
.inline-add:has(input.typeahead.is-open)::after { transform: translateY(-50%) rotate(180deg); }
/* Clear button inside inline-add rows */
.inline-add .typeahead-clear {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--color-text);
  font-size: 12px;
}
.inline-add .typeahead-clear::before { content: '✕'; font-size: 12px; line-height: 1; }
.inline-add .typeahead-clear:hover { background: var(--color-accent); }

/* Inventory/consumables trailing add rows */
.inventory-list .inventory-row:has(> input.typeahead) { position: relative; }
.inventory-list .inventory-row:has(> input.typeahead)::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: .7;
  font-size: 14px;
  color: var(--color-secondary);
  transition: transform .15s ease;
}
.inventory-list .inventory-row:has(> input.typeahead.is-open)::after { transform: translateY(-50%) rotate(180deg); }
/* Clear button for inventory trailing add rows */
.inventory-list .inventory-row .typeahead-clear {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--color-text);
  font-size: 12px;
}
.inventory-list .inventory-row .typeahead-clear::before { content: '✕'; font-size: 12px; line-height: 1; }
.inventory-list .inventory-row .typeahead-clear:hover { background: var(--color-accent); }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--color-surface); border: 1px solid var(--color-border); padding: 10px 14px; border-radius: 10px; opacity: 0; transform: translateY(8px); transition: all .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

/* Header */
.char-header { display: grid; grid-template-columns: fit-content(100%) 1fr fit-content(100%); gap: var(--space-sm); align-items: center; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; padding: 8px; min-width: 0; }
.char-header__left { display:flex; align-items:center; gap:8px; }
.char-header__center { display:flex; justify-content:center; align-items:center; gap:8px; min-width: 0; }
.char-header__right { display:flex; justify-content:flex-end; align-items:center; gap:8px; flex-wrap:wrap; min-width: 0; }
.header-btn { padding: 8px 12px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface-elev); color: var(--color-text); cursor: pointer; }
.header-btn:hover { background: var(--color-primary); }
.header-btn.secondary { background: transparent; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--color-border); background: var(--color-surface-elev); cursor: pointer; position: relative; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #ff3b3b, 0 0 8px 2px #ff3b3b99; border-color: #ff3b3b;}
.icon-btn::before { content: '🔓'; font-size: 16px; }
.icon-btn[aria-pressed="true"] { background: var(--color-surface); box-shadow: none; border-color: var(--color-border); }
.icon-btn[aria-pressed="true"]::before { content: '🔐'; }

/* Subtle pulse to draw attention to Builder button when sheet lacks a name */
@keyframes dh-attn-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 187, 0, .6); } 70% { box-shadow: 0 0 0 10px rgba(255, 187, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 187, 0, 0); } }
.header-btn.attention { position: relative; animation: dh-attn-pulse 1.6s ease-out infinite; border-color: #e0a100; background: var(--color-surface-elev); }

/* Description toggle visual (uses eye emoji) */
.icon-btn.desc-toggle { box-shadow: none; border-color: var(--color-border); }
.icon-btn.desc-toggle::before { content: '🐵'; }
.icon-btn.desc-toggle[aria-pressed="true"]::before { content: '🙈'; }

/* Hide summaries when descriptions are toggled off */
[data-hide-descriptions="true"] .summary { display: none !important; }
[data-hide-descriptions="true"] .summary-link { display: none !important; }

/* Info bar */
.info-bar { margin-top: var(--space-md); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow-sm); display: flex; gap: 10px; align-items: center; justify-content: center; }
.ib-main { display: flex; gap: 6px; min-width: 0; }
.ib-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;}
.ib-stat { background: var(--color-surface-elev); border: 1px solid var(--color-border); border-radius: 10px; padding: 8px; display: grid; gap: 4px; }
.ib-chip { padding: 6px 8px; grid-auto-flow: column; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 6px; }
.ib-chip .stat-label { white-space: nowrap; }
.ib-chip .stat-value { justify-self: end; }
.stat-label { font-size: 11px; color: var(--color-text-light); font-weight: 1000; display: flex; align-items: baseline; gap: 6px; }
.stat-sub { color: var(--color-text); opacity: .8; font-weight: 600; }
.stat-value { font-weight: 800; font-size: 16px; font-family: var(--font-display); color: var(--color-text); }
.ib-resources { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;}
.ib-pips .pip-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(12px, 14px); gap: 6px; align-items: center; }
.pip { width: 16px; height: 16px; border: 1px solid var(--color-border); background: var(--color-surface); cursor: pointer; position: relative; border-radius: 3px; }
.pip.circle { border-radius: 999px; }
.pip.diamond { transform: rotate(45deg); border-radius: 0; }
.pip.filled { background: var(--color-primary); border-color: var(--color-primary); }
.pip:hover { box-shadow: 0 0 0 2px var(--color-primary) inset; }


/* Collapsible Cards */
.ccard { border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-surface); padding: 0; overflow: visible; }
.ccard + .ccard { margin-top: var(--space-md); }
.ccard > summary { list-style: none; cursor: pointer; padding: 12px 14px; color: var(--color-secondary); display: flex; align-items: center; justify-content: space-between; }
.ccard > summary h3 { margin: 0; font-size: 16px; font-weight: 700; }
.ccard > summary::after { content: '▾'; transition: transform .15s ease; opacity: .8; }
.ccard[open] > summary::after { transform: rotate(180deg); }
.ccard > summary::-webkit-details-marker { display: none; }
.ccard[open] > summary { border-bottom: 1px solid var(--color-border); }
.ccard .ccard-body { padding: var(--space-md); }

/* Full-bleed tool page enhancements */
.content-page.is-fullbleed .container { max-width: none; padding: 0 var(--space-sm); }
.content-page.is-fullbleed .character-app { margin-bottom: var(--space-xl); }
.content-page.is-fullbleed .page-intro { margin-bottom: var(--space-md) !important; }


/* Lock mode states */
[data-locked="true"] .character-form input:not(#g-handfuls):not(#g-bags):not(#g-chests):not(#eq-primary):not(#eq-secondary):not(#eq-armor):not(#eq-inv-weapon-0):not(#eq-inv-weapon-1):not(.typeahead),
[data-locked="true"] .character-form textarea,
[data-locked="true"] .character-form .reset-field { pointer-events: none; opacity: 0.6; }
[data-locked="true"] .inline-add button { pointer-events: none; opacity: 0.6; }

/* Character switch dropdown */
.character-switch { position: relative; width: 100%; }
.switch-btn { padding: 3px 12px; border: 1px solid var(--color-border); border-radius: 8px; font-weight: 800; font-size: 16px; font-family: var(--font-display); background: var(--color-surface-elev); color: var(--color-text); width: 100%; position: relative; padding-right: 32px; }
.switch-btn::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: .8;
  font-size: 14px;
  color: var(--color-secondary);
  transition: transform .15s ease;
}
.switch-btn[aria-expanded="true"]::after { transform: translateY(-50%) rotate(180deg); }
.switch-menu { display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; box-shadow: var(--shadow-sm); max-height: 260px; overflow: auto; z-index: 10; }
.switch-menu.open { display: block; }
.switch-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; }
.switch-item:hover { background: var(--color-surface-elev); }
.switch-delete { border: 1px solid var(--color-border); border-radius: 6px; padding: 4px 6px; background: transparent; color: var(--color-danger, var(--color-text)); }
.switch-delete:hover { background: var(--color-accent); }
.switch-new { padding: 8px 10px; font-weight: 600; }

/* Responsive card layout using flex: dynamic columns with minimal heuristics */
.content-page.is-fullbleed .character-form { 
  display: flex; 
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--space-md);
}

/* Reduce visual gap after full-width section labels */
.flow > label.field-full + .inventory-list,
.flow > label.field-full + #consumables-container,
.flow > label.field-full + .abilities-list { margin-top: -8px; }
.content-page.is-fullbleed .character-form > details.ccard { 
  margin: 0;
  /* Grow to fill rows evenly; prefer ~3 columns, clamp width sensibly */
  flex: 1 1 clamp(320px, 33.33%, 560px);
  min-width: 300px;
  display: flex;
  flex-direction: column;
}
/* When a card is collapsed, don't stretch it to row height */
.content-page.is-fullbleed .character-form > details.ccard:not([open]) {
  align-self: flex-start;
}
/* Enable equal-height bodies */
.content-page.is-fullbleed .character-form > details.ccard .ccard-body { flex: 1 1 auto; display: flex; }
.content-page.is-fullbleed .character-form > details.ccard .ccard-body > .card { flex: 1 1 auto; }

@media (max-width: 900px) {
  .char-header { grid-template-columns: 1fr; }
  .char-header__center { justify-content:flex-start; }
  .char-header__right { justify-content:center; }
  .content-page.is-fullbleed .character-form > details.ccard { flex-basis: 100%; min-width: 0; }
}


/* Wizard Overlays */
.wizard-overlay { position: fixed; inset: 0; z-index: 10000; display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr; }
.wizard-overlay.hidden { display: none; }
.wizard-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.wizard { position: relative; margin: auto; width: min(980px, calc(100% - 24px)); max-height: calc(100% - 24px); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; box-shadow: var(--shadow-md); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; z-index: 1; }
.wizard-head { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--color-border); }
.wizard-head h3 { margin: 0; color: var(--color-secondary); }
.wizard-steps { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.wizard-step-chip { padding: 4px 8px; border: 1px solid var(--color-border); border-radius: 999px; font-size: 12px; cursor: pointer; background: var(--color-surface-elev); color: var(--color-text); }
.wizard-step-chip.active { background: var(--color-primary); border-color: var(--color-primary); }
.wizard-step-chip.done { opacity: .8; }
.wizard-close { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--color-border); background: var(--color-surface-elev); cursor: pointer; }
.wizard-close:hover { background: var(--color-primary); }
.wizard-body { padding: 12px; overflow: auto; }
.wizard-foot { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--color-border); }
.wizard-foot .spacer { height: 1px; }
.wizard-section { border: 1px solid var(--color-border); border-radius: 10px; padding: 12px; background: var(--color-surface); }
.wizard-row { display: grid; gap: var(--space-sm); }
.wizard-row + .wizard-row { margin-top: var(--space-sm); }
.wizard-actions { display: flex; gap: 8px; justify-content: flex-end; }
.wizard-banner { position: absolute; left: 50%; transform: translateX(-50%); bottom: 10px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; padding: 6px 10px; box-shadow: var(--shadow-sm); color: var(--color-text); display: none; z-index: 2; }
.wizard-banner.show { display: block; }
.wizard-banner.info { border-color: var(--color-border); }
.wizard-banner.warning { border-color: #c98f22; background: #c98f2215; }
.wizard-banner.success { border-color: #36a269; background: #36a26915; }
.wizard-banner.error { border-color: #bb3b3b; background: #bb3b3b15; }

/* Guide overlay (bottom bar + highlight ring) */
.guide-overlay { position: fixed; inset: 0; z-index: 12000; pointer-events: none; }
.guide-overlay.hidden { display: none; }
.guide-mask { position: absolute; inset: 0; pointer-events: none; }
.guide-shade { position: absolute; background: rgba(0,0,0,.4); pointer-events: auto; }
.guide-highlight { position: absolute; border: 2px solid var(--color-primary); border-radius: 10px; box-shadow: 0 0 0 4px rgba(0,0,0,.2); pointer-events: none; }
.guide-bar { pointer-events: auto; position: fixed; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; box-shadow: 0 6px 16px rgba(0,0,0,.15); display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 12px; padding: 10px 12px; }
.guide-bar__left { display: grid; gap: 4px; }
.guide-title { color: var(--color-secondary); font-weight: 800; }
.guide-desc { color: var(--color-text); opacity: .95; font-size: 14px; }
.guide-bar__center { display: block; grid-column: 1 / -1; max-height: min(50vh, 320px); overflow: auto; }
.guide-bar__right { display: flex; gap: 8px; align-items: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Level-up advancement chooser: responsive grid that avoids overflow */
.adv-chooser { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; align-items: stretch; max-height: inherit; }
.adv-chooser label { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface-elev); width: 100%; box-sizing: border-box; }
.adv-chooser input[type="checkbox"] { accent-color: var(--color-primary); }

@media (max-width: 600px) {
  .adv-chooser { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Feature field locks (specialization/mastery) */
.feature-locked { position: relative; }
.feature-locked > textarea,
.feature-locked > input { opacity: .6; pointer-events: none; }
.feature-locked .reset-field { opacity: .6; pointer-events: none; }
.feature-locked .lock-field { opacity: 1; pointer-events: auto; }
.feature-locked::after { content: 'Locked until unlocked by advancement or manual toggle'; position: absolute; right: 60px; top: 0px; font-size: 12px; color: var(--color-text-light); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 6px; padding: 2px 6px; pointer-events: none; }
/* Unlocked state just ensures normal interaction and hides helper text */
.feature-unlocked::after { display: none; }
