/* ==========================================================================
   Character Creation Wizard - Floating Overlay
   ========================================================================== */

.wizard-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.2s ease-out;
}

.wizard-window {
  background: var(--bg-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 90vw;
  max-width: 960px;
  height: 85vh;
  max-height: 800px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

/* ---------- Header ---------- */

.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.wizard-header-title {
  font-family: 'Newsreader', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.wizard-header-step {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wizard-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.wizard-close:hover {
  color: var(--text);
  background: var(--surface-hover);
}

/* ---------- Progress bar ---------- */

.wizard-progress {
  height: 3px;
  background: var(--border);
  flex-shrink: 0;
}

.wizard-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* ---------- Body (split pane) ---------- */

.wizard-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.wizard-left {
  width: 38%;
  min-width: 260px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wizard-right {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

/* ---------- Left pane sections ---------- */

.wizard-search-box {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.wizard-search-box input {
  width: 100%;
  font-size: 0.9rem;
}

.wizard-browse-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.wizard-browse-item {
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.wizard-browse-item:hover {
  background: var(--surface-hover);
}

.wizard-browse-item.is-active {
  background: var(--surface);
  border-left-color: var(--accent);
}

.wizard-browse-item.is-selected {
  background: rgba(217, 119, 6, 0.08);
  border-left-color: var(--accent);
}

.wizard-browse-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.wizard-browse-item-snippet {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-selection-summary {
  flex-shrink: 0;
  padding: 0.6rem 0.75rem;
  border-top: 2px solid var(--accent);
  background: var(--surface);
  font-size: 0.8rem;
}

.wizard-selection-summary-title {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.wizard-selection-summary-detail {
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---------- Right pane: rendered markdown ---------- */

.wizard-right h1,
.wizard-right h2,
.wizard-right h3,
.wizard-right h4 {
  font-family: 'Newsreader', serif;
  color: var(--text);
  margin-top: 1rem;
}

.wizard-right h1 { font-size: 1.5rem; margin-top: 0; }
.wizard-right h2 { font-size: 1.15rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
.wizard-right h3 { font-size: 1rem; }

.wizard-right p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0.5rem 0;
}

.wizard-right ul, .wizard-right ol {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding-left: 1.25rem;
  line-height: 1.65;
}

.wizard-right table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.5rem 0;
}

.wizard-right th,
.wizard-right td {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  text-align: left;
}

.wizard-right th {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.wizard-right td {
  color: var(--text-secondary);
}

.wizard-right strong {
  color: var(--text);
}

.wizard-right blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.4rem 0.75rem;
  margin: 0.5rem 0;
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.wizard-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.95rem;
  text-align: center;
  padding: 2rem;
}

/* ---------- Subrace picker ---------- */

.wizard-subrace-card {
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.wizard-subrace-card:hover {
  transform: translateY(-1px);
}

.wizard-subrace-card.is-selected {
  box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(217, 119, 6, 0.15);
}

/* ---------- Footer ---------- */

.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.wizard-footer-left,
.wizard-footer-right {
  display: flex;
  gap: 0.5rem;
}

/* ---------- Ability scores step ---------- */

.wizard-ability-method {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.wizard-ability-method .btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.wizard-ability-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.wizard-ability-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
}

.wizard-ability-card-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.wizard-ability-card-score input {
  width: 3.5rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.wizard-ability-card-mod {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.wizard-ability-card-bonus {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 0.15rem;
}

.wizard-pb-counter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.wizard-pb-counter button {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wizard-pb-counter button:hover {
  background: var(--surface-hover);
}

.wizard-points-remaining {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.wizard-points-remaining strong {
  color: var(--accent);
  font-size: 1.1rem;
}

/* ---------- Standard Array drag assignment ---------- */

.wizard-array-pool {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  justify-content: center;
}

.wizard-array-badge {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s;
}

.wizard-array-badge.is-used {
  opacity: 0.3;
  cursor: default;
}

/* ---------- Details step ---------- */

.wizard-details-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 500px;
}

.wizard-details-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
  display: block;
}

.wizard-details-form textarea {
  min-height: 3rem;
}

/* ---------- Equipment step ---------- */

.wizard-equip-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.wizard-equip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.wizard-equip-item-source {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---------- Review step ---------- */

.wizard-review-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.wizard-review-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.wizard-review-card h4 {
  margin: 0 0 0.35rem 0;
  font-size: 0.85rem;
  color: var(--accent);
  font-family: 'Newsreader', serif;
}

.wizard-review-card p,
.wizard-review-card div {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 700px) {
  .wizard-window {
    width: 98vw;
    height: 95vh;
    max-height: none;
    border-radius: var(--radius);
  }

  .wizard-body {
    flex-direction: column;
  }

  .wizard-left {
    width: 100%;
    min-width: 0;
    max-height: 40%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .wizard-right {
    flex: 1;
  }

  .wizard-ability-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wizard-review-grid {
    grid-template-columns: 1fr;
  }
}
