/* ── Character Creation Wizard ── */

.wizard-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-wizard);
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: backdrop-in 0.18s ease;
}

.wizard-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  animation: window-in 0.24s var(--ease-out);
}

/* ── Header ── */
.wizard-header {
  flex-shrink: 0;
  padding: 1.25rem 1.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

#wizard-title {
  font-size: 1.25rem;
  color: var(--gold);
  margin: 0.75rem 0 0.2rem;
}

#wizard-subtitle {
  font-size: 0.82rem;
  margin: 0;
}

/* ── Header layout ── */
.wizard-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ── Step progress ── */
.wizard-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 0.25rem;
}

.wizard-step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  cursor: default;
}

.wizard-step-dot span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.wizard-step-dot label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.wizard-step-dot.active span {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: #fff;
}

.wizard-step-dot.done span {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.wizard-step-dot.done label,
.wizard-step-dot.active label {
  color: var(--text);
}

.wizard-step-sep {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 0.5rem;
  margin-bottom: 1.1rem; /* align with dot centers */
  max-width: 60px;
}

/* ── Body ── */
.wizard-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.wizard-body.wizard-anim-step > * { animation: tab-content-in 0.18s var(--ease-out); }

/* ── Card grid (class & race steps) ── */
.wizard-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.65rem;
}

.wizard-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 0.9rem;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  user-select: none;
}

.wizard-card:hover {
  border-color: var(--gold-dim);
  background: var(--surface);
  transform: translateY(-1px);
}
.wizard-card:active { transform: translateY(0) scale(0.98); }

.wizard-card.selected {
  border-color: var(--gold);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--gold-dim);
}

.wizard-card-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.wizard-card-parent {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: -0.15rem;
}

.wizard-card-tag {
  font-size: 0.68rem;
  color: var(--gold);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wizard-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 0.2rem;
  flex: 1;
}

.wizard-card-badge {
  margin-top: 0.4rem;
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.1rem 0.5rem;
  color: var(--text-muted);
  align-self: flex-start;
}

.wizard-card.selected .wizard-card-badge {
  border-color: var(--gold-dim);
  color: var(--gold);
}

/* ── Scores step ── */
.wizard-scores-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  min-height: 1.2em;
}

.wizard-score-pool {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wizard-score-tile {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), opacity var(--transition);
  user-select: none;
  color: var(--text);
}

.wizard-score-tile:hover:not(.used) {
  border-color: var(--gold-dim);
  background: var(--surface);
}
.wizard-score-tile:active:not(.used) { transform: scale(0.94); }

.wizard-score-tile.held {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: #fff;
  transform: scale(1.08);
}

.wizard-score-tile.used {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.wizard-stat-slots {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.wizard-stat-row {
  display: grid;
  grid-template-columns: 160px 1fr 52px 40px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: border-color var(--transition);
}

.wizard-stat-label {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.wizard-stat-abbr {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  min-width: 36px;
}

.wizard-stat-full {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.wizard-stat-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-stat-slot {
  width: 52px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  color: var(--text-muted);
  user-select: none;
}

.wizard-stat-slot.filled {
  color: var(--text);
  border-color: var(--gold-dim);
}

.wizard-stat-slot.ready {
  border-color: var(--gold);
  border-style: dashed;
  animation: slot-pulse 1s ease-in-out infinite alternate;
}

@keyframes slot-pulse {
  from { background: var(--bg); }
  to   { background: color-mix(in srgb, var(--bg) 80%, var(--gold-dim) 20%); }
}

.wizard-stat-mod {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  min-width: 32px;
}

/* ── Review step ── */
.wizard-review-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.wizard-review-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.wizard-review-sub {
  font-size: 0.75rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.1rem;
}

.wizard-combat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

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

.wizard-review-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 0.35rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.wizard-review-stat-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.wizard-review-stat-score {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
  margin: 0.15rem 0;
}

.wizard-review-stat-mod {
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

/* ── Custom class / race text entry ── */
.wizard-custom-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0.25rem 0 0;
}

/* ── Score mode toggle (standard / custom) ── */
.wizard-mode-toggle {
  display: flex;
  gap: 0.5rem;
}

.wizard-mode-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.wizard-mode-btn:hover {
  border-color: var(--gold-dim);
  color: var(--text);
}

.wizard-mode-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: color-mix(in srgb, var(--surface-2) 85%, var(--gold-dim) 15%);
}

/* ── Custom stat number inputs ── */
.wizard-stat-input {
  width: 52px;
  height: 36px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--bg);
  border: 2px solid var(--gold-dim);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0;
}

.wizard-stat-input:focus {
  outline: none;
  border-color: var(--gold);
}

/* ── Custom combat row (HP/AC/Speed inputs on review) ── */
.wizard-custom-combat {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.wizard-custom-combat-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.wizard-custom-combat-input {
  width: 72px;
  height: 48px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
}

.wizard-custom-combat-input:focus {
  outline: none;
  border-color: var(--gold);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .wizard-card-grid { grid-template-columns: repeat(2, 1fr); }
  .wizard-review-stats { grid-template-columns: repeat(3, 1fr); }
  .wizard-stat-row { grid-template-columns: 120px 1fr 48px 36px; }
}

/* The game page's mobile breakpoint (css/layout.css), kept here rather than in
   that page's mobile block because the creator page uses the wizard too. */
@media (max-width: 860px) {
  .wizard-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }
}
