/* ── Identity System Styles ──────────────────────────────────
   Character creation wizard, identity editing, destiny card.
   All accent colors via CSS variables — no hardcoded hex.
   ────────────────────────────────────────────────────────── */

/* ── Progress Dots ─────────────────────────────────────────── */
.wizard-progress {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.wizard-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.wizard-dot.active {
    background: var(--accent-1);
    box-shadow: 0 0 8px var(--accent-1-dim);
    transform: scale(1.2);
}

.wizard-dot.completed {
    background: var(--text-accent);
}

/* ── Step Containers ───────────────────────────────────────── */
.wizard-step {
    display: none;
    animation: fadeInStep 0.3s ease;
}

.wizard-step.active {
    display: block;
}

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

.step-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.step-header h2 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.step-header p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.step-section {
    margin-bottom: 1.5rem;
}

.step-section label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* ── Pill Selector ─────────────────────────────────────────── */
.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.pill-btn {
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-inset);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.pill-btn:hover {
    border-color: var(--accent-copper);
    color: var(--text-primary);
}

.pill-btn.selected {
    border-color: var(--accent-1);
    background: var(--accent-1-dim);
    color: var(--text-accent);
    font-weight: 500;
}

/* ── Icon Card Grid ────────────────────────────────────────── */
.icon-card-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

@media (max-width: 600px) {
    .icon-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 380px) {
    .icon-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.icon-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.7rem 0.4rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-inset);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    min-height: 70px;
}

.icon-card:hover {
    border-color: var(--accent-copper);
    background: var(--bg-card);
}

.icon-card.selected {
    border-color: var(--accent-1);
    background: var(--accent-1-dim);
    box-shadow: 0 0 12px var(--accent-1-dim);
}

.icon-card .card-icon {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.icon-card.selected .card-icon {
    color: var(--text-accent);
}

.icon-card .card-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

.icon-card.selected .card-label {
    color: var(--text-accent);
    font-weight: 500;
}

/* "Other / Custom" card */
.icon-card.other-card {
    border-style: dashed;
}

.icon-card.other-card.selected {
    border-style: solid;
}

/* ── Custom Input (appears when "Other" selected) ──────────── */
.custom-input-wrap {
    display: none;
    margin-top: 0.5rem;
}

.custom-input-wrap.visible {
    display: block;
}

.custom-input-wrap textarea,
.custom-input-wrap input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    resize: vertical;
}

.custom-input-wrap textarea:focus,
.custom-input-wrap input:focus {
    outline: none;
    border-color: var(--accent-1);
}

.custom-input-wrap .char-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 0.2rem;
    font-family: var(--font-mono);
}

/* ── Wizard Navigation ─────────────────────────────────────── */
.wizard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    gap: 0.75rem;
}

.wizard-nav .btn-skip {
    font-size: 0.82rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    font-family: var(--font-body);
}

.wizard-nav .btn-skip:hover {
    color: var(--text-secondary);
}

/* ── Random Soul Button ────────────────────────────────────── */
.random-soul-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-copper);
    background: var(--accent-1-dim);
    color: var(--text-accent);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.random-soul-btn:hover {
    background: var(--accent-2-dim);
    border-color: var(--accent-1);
    box-shadow: 0 0 12px var(--accent-1-dim);
}

.random-soul-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2) rotate(15deg); }
}

.random-soul-btn.loading i {
    animation: sparkle 0.8s ease infinite;
}

/* ── Identity Display (Character Sheet) ────────────────────── */
.identity-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

@media (max-width: 500px) {
    .identity-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.identity-cell {
    padding: 0.5rem 0.65rem;
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.identity-cell .id-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
    margin-bottom: 0.15rem;
}

.identity-cell .id-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.identity-history {
    padding: 0.6rem 0.75rem;
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.identity-history.truncated {
    max-height: 3.6em;
    overflow: hidden;
    position: relative;
}

.identity-history.truncated::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.5em;
    background: linear-gradient(transparent, var(--bg-inset));
}

.identity-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--text-accent);
    cursor: pointer;
    margin-top: 0.3rem;
    border: none;
    background: none;
    font-family: var(--font-body);
    padding: 0;
}

.identity-toggle:hover {
    text-decoration: underline;
}

/* ── Destiny Card ──────────────────────────────────────────── */
.destiny-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-top: 0.75rem;
}

.destiny-card .destiny-narrative {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--accent-1);
    background: var(--accent-1-dim);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.destiny-mods-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}

@media (max-width: 400px) {
    .destiny-mods-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.destiny-mod-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.82rem;
}

.destiny-mod-cell .mod-stat {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.destiny-mod-cell .mod-base {
    font-weight: 600;
    font-family: var(--font-mono);
}

.destiny-mod-cell .mod-base.positive {
    color: #22c55e;
}

.destiny-mod-cell .mod-base.negative {
    color: #ef4444;
}

.destiny-mod-cell .mod-base.neutral {
    color: var(--text-muted);
}

.destiny-mod-cell .mod-growth {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.destiny-mod-cell .mod-growth.boosted {
    color: #22c55e;
}

.destiny-mod-cell .mod-growth.reduced {
    color: #ef4444;
}

/* ── Identity Section Header ───────────────────────────────── */
.identity-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.identity-section-header h3 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    margin: 0;
}

.identity-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-inset);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.identity-edit-btn:hover {
    border-color: var(--accent-1);
    color: var(--text-accent);
}

.identity-remaining {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Review Summary (Step 5) ───────────────────────────────── */
.identity-review {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.82rem;
}

.identity-review .review-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
}

.identity-review .review-row:last-child {
    border-bottom: none;
}

.identity-review .review-label {
    color: var(--text-muted);
    min-width: 70px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.identity-review .review-value {
    color: var(--text-primary);
}

/* ── Form Input (shared) ───────────────────────────────────── */
.identity-section-header .form-input,
#identity-edit .form-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
}

#identity-edit .form-input:focus {
    outline: none;
    border-color: var(--accent-1);
}

/* ── Scaling Pending Spinner ───────────────────────────────── */
.scaling-pending {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    background: var(--accent-1-dim);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    color: var(--text-accent);
    margin-top: 0.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }


/* ═══════════════════════════════════════════════════════════
   ART-BACKED ICON CARDS
   Extends .icon-card with background art layer
   Usage: <div class="icon-card icon-card-art" style="--card-art-url: url(...)">
   ═══════════════════════════════════════════════════════════ */

.icon-card-art {
    position: relative;
    overflow: hidden;
}

.icon-card-art::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--card-art-url);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.10;
    transition: opacity 0.3s ease;
    z-index: 0;
    pointer-events: none;
    border-radius: inherit;
}

.icon-card-art:hover::before {
    opacity: 0.18;
}

.icon-card-art.selected::before {
    opacity: 0.22;
}

.icon-card-art > * {
    position: relative;
    z-index: 1;
}

.icon-card-art:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent-1) 15%, transparent);
}

.icon-card-art.selected {
    border-color: var(--accent-1);
    background: var(--accent-1-dim);
    box-shadow: 0 0 16px var(--accent-1-dim),
                0 4px 12px color-mix(in srgb, var(--accent-1) 20%, transparent);
}

.icon-card-art .card-label {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
}

/* Light mode: hue-shift + higher opacity */
[data-theme="light"] .icon-card-art::before {
    filter: hue-rotate(180deg) brightness(0.85);
    opacity: 0.16;
}
[data-theme="light"] .icon-card-art:hover::before {
    opacity: 0.26;
}
[data-theme="light"] .icon-card-art.selected::before {
    opacity: 0.30;
}


/* ═══════════════════════════════════════════════════════════
   ENHANCED RANDOM SOUL BUTTON
   Premium art-backed button with glow animation
   ═══════════════════════════════════════════════════════════ */

.random-soul-btn-enhanced {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid color-mix(in srgb, var(--accent-1) 60%, transparent);
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--accent-1) 18%, var(--bg-card)),
        color-mix(in srgb, var(--accent-1) 8%, var(--bg-card))
    );
    color: var(--text-accent);
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 0;
    animation: soul-btn-glow 3s ease-in-out infinite;
}

.random-soul-btn-enhanced::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--btn-art-url);
    background-size: cover;
    background-position: center;
    opacity: 0.12;
    transition: opacity 0.3s ease;
    z-index: -1;
    pointer-events: none;
}

.random-soul-btn-enhanced:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: var(--accent-1);
    box-shadow: 0 6px 24px color-mix(in srgb, var(--accent-1) 35%, transparent);
    animation: none;
}

.random-soul-btn-enhanced:hover::before {
    opacity: 0.20;
}

.random-soul-btn-enhanced:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
}

.random-soul-btn-enhanced.loading i {
    animation: sparkle 0.8s ease infinite;
}

@keyframes soul-btn-glow {
    0%, 100% { box-shadow: 0 2px 12px color-mix(in srgb, var(--accent-1) 15%, transparent); }
    50% { box-shadow: 0 4px 24px color-mix(in srgb, var(--accent-1) 30%, transparent); }
}


/* ═══════════════════════════════════════════════════════════
   STAT & INFO CELL ART BACKGROUNDS
   Add background art to stat cells and info cells on review step
   ═══════════════════════════════════════════════════════════ */

.stat-cell-art {
    position: relative;
    overflow: hidden;
}

.stat-cell-art::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--card-art-url);
    background-size: cover;
    background-position: center;
    opacity: 0.08;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: inherit;
}

.stat-cell-art:hover::after {
    opacity: 0.14;
}

.info-cell-art {
    position: relative;
    overflow: hidden;
}

.info-cell-art::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--card-art-url);
    background-size: cover;
    background-position: center;
    opacity: 0.08;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: inherit;
}

.info-cell-art:hover::after {
    opacity: 0.14;
}

/* Light mode overrides for stat/info cells */
[data-theme="light"] .stat-cell-art::after,
[data-theme="light"] .info-cell-art::after {
    filter: hue-rotate(180deg) brightness(0.85);
    opacity: 0.12;
}
[data-theme="light"] .stat-cell-art:hover::after,
[data-theme="light"] .info-cell-art:hover::after {
    opacity: 0.20;
}
