/* File Purpose: Schema-driven character-creation UI styles for the VN runtime.
 * Primary Functions/Classes: .vn-char-creation container + .vn-cc-* field types
 * (text, pill, multi-pill, select, slider, stat-allocator).
 * Inputs and Outputs (I/O): Consumes the DOM emitted by SceneDirector._showCharCreation;
 * outputs the form layout, focus visuals, and stat-pool indicator.
 *
 * Previously housed inside vn-dialogue.css; extracted here on 2026-05-13 alongside
 * the Wave B schema-driven char-creation refactor so the dialogue stylesheet stays
 * focused on dialogue, and so author-designated extra fields don't bloat vn-dialogue.
 */

.vn-char-creation {
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
    background: rgba(12, 14, 22, 0.86);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.vn-cc-title {
    text-align: center;
    color: #e0e0f0;
    font-size: 1.35rem;
    font-family: inherit;
    margin-bottom: 4px;
    font-weight: 600;
}

.vn-cc-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
    margin-top: -8px;
    margin-bottom: 4px;
}

.vn-cc-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vn-cc-label {
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.vn-cc-help {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.74rem;
    font-style: italic;
}

/* === Text input === */

.vn-cc-input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.95);
    font-family: inherit;
    font-size: 1rem;
    text-align: center;
    outline: none;
}

.vn-cc-input:focus {
    border-color: rgba(138, 180, 248, 0.6);
}

/* === Pills (single + multi) === */

.vn-cc-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.vn-cc-pill {
    flex: 1 1 auto;
    min-width: max-content;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px 14px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    text-align: left;
}

.vn-cc-pill .vn-cc-pill-desc {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.72rem;
    font-weight: 400;
}

.vn-cc-pill.active {
    background: rgba(138, 180, 248, 0.22);
    border-color: rgba(138, 180, 248, 0.6);
    color: #fff;
}

.vn-cc-pill:focus-visible {
    outline: 2px solid #8ab4f8;
    outline-offset: 1px;
}

/* === Select dropdown === */

.vn-cc-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.vn-cc-select {
    flex: 1 1 calc(50% - 6px);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 8px 10px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
}

/* === Slider === */

.vn-cc-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vn-cc-slider-row input[type="range"] {
    flex: 1;
}

.vn-cc-slider-value {
    min-width: 36px;
    text-align: right;
    color: rgba(255, 255, 255, 0.9);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* === Stat allocator === */

.vn-cc-allocator {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vn-cc-stat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.9rem;
}

.vn-cc-stat-row span:first-child {
    width: 80px;
    text-transform: capitalize;
}

.vn-cc-stat-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.78);
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vn-cc-stat-btn:hover {
    background: rgba(138, 180, 248, 0.18);
}

.vn-cc-stat-value {
    min-width: 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.vn-cc-points {
    color: rgba(138, 180, 248, 0.78);
    font-size: 0.78rem;
    margin-left: 8px;
}

/* === Submit row === */

.vn-cc-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.vn-cc-start {
    flex: 1;
    background: linear-gradient(135deg, #4a6fa5, #5a3d8a);
    border: none;
    border-radius: 6px;
    padding: 12px 22px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease;
}

.vn-cc-start:hover {
    transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
    .vn-cc-pill,
    .vn-cc-start,
    .vn-cc-stat-btn {
        transition: none !important;
        transform: none !important;
    }
}

/* === Mobile === */

@media (max-width: 540px) {
    .vn-char-creation {
        max-width: 96vw;
        padding: 12px;
        gap: 10px;
    }
    .vn-cc-title {
        font-size: 1.2rem;
    }
    .vn-cc-select {
        flex: 1 1 100%;
    }
    .vn-cc-pill {
        font-size: 0.82rem;
    }
}

/* === Tier 1: Visual creator (silhouette pane + swatch chips) ===
 * The two-pane layout activates when the schema carries `visual.silhouette: true`
 * (default for the legacy adapter). On wide viewports the pane sits to the left;
 * on narrow viewports it stacks above the form. The silhouette responds to
 * field choices through CSS custom properties (--silhouette-skin, --silhouette-hair,
 * --silhouette-shirt) — explicit fills per Breaker #7, never blind hue-rotate.
 */

.vn-char-creation.has-visual {
    max-width: 880px;
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    align-items: start;
    gap: 18px;
}

.vn-cc-portrait-pane {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.vn-cc-portrait-frame {
    width: 100%;
    max-width: 260px;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.18));
    display: flex;
    align-items: center;
    justify-content: center;
}

.vn-cc-portrait-frame svg,
.vn-cc-portrait-frame img,
.vn-cc-portrait-frame video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vn-cc-portrait-status {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-align: center;
    min-height: 1.2em;
}

.vn-cc-form-pane {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0; /* let children shrink in the grid track */
}

/* Swatch chips — explicit fill per swatch, no hue-rotate */
.vn-cc-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.vn-cc-swatch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 6px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.82rem;
    cursor: pointer;
    font-family: inherit;
    min-height: 32px;
}

.vn-cc-swatch-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.vn-cc-swatch.active {
    background: rgba(138, 180, 248, 0.22);
    border-color: rgba(138, 180, 248, 0.6);
    color: #fff;
}

.vn-cc-swatch:focus-visible {
    outline: 2px solid #8ab4f8;
    outline-offset: 1px;
}

/* Pronoun/genderWord parity tooltip (Breaker #8) */
.vn-cc-prompt-preview {
    margin-top: 6px;
    padding: 8px 10px;
    background: rgba(138, 180, 248, 0.08);
    border-left: 2px solid rgba(138, 180, 248, 0.4);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    line-height: 1.4;
}

.vn-cc-prompt-preview strong {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .vn-cc-portrait-frame svg,
    .vn-cc-portrait-frame img {
        transition: none !important;
    }
}

/* Stack on narrow viewports — portrait above form */
@media (max-width: 720px) {
    .vn-char-creation.has-visual {
        grid-template-columns: 1fr;
        max-width: 96vw;
    }
    .vn-cc-portrait-pane {
        position: static;
    }
    .vn-cc-portrait-frame {
        max-width: 200px;
    }
}

/* === Tier 2: portrait generation buttons + identity splash === */

.vn-cc-portrait-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    width: 100%;
}

.vn-cc-portrait-btn {
    flex: 1 1 auto;
    min-height: 36px;
    padding: 6px 10px;
    background: rgba(138, 180, 248, 0.14);
    border: 1px solid rgba(138, 180, 248, 0.4);
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.vn-cc-portrait-btn:hover:not(:disabled) {
    background: rgba(138, 180, 248, 0.28);
    border-color: rgba(138, 180, 248, 0.7);
}

.vn-cc-portrait-btn:focus-visible {
    outline: 2px solid #8ab4f8;
    outline-offset: 1px;
}

.vn-cc-portrait-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.vn-cc-portrait-gen {
    background: rgba(76, 175, 80, 0.18);
    border-color: rgba(76, 175, 80, 0.5);
}
.vn-cc-portrait-gen:hover:not(:disabled) {
    background: rgba(76, 175, 80, 0.30);
}

/* Identity splash — 2.5s full-bleed fade-in when the player submits with a
 * generated portrait. Cynic kill-criterion render hook: guarantees the
 * portrait reaches the stage at least once even in first-person POV stories.
 */
.vn-cc-identity-splash {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 10, 18, 0.92);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.vn-cc-identity-splash.visible {
    opacity: 1;
}

.vn-cc-identity-splash img {
    max-width: min(80vw, 480px);
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
    .vn-cc-identity-splash {
        transition: none;
    }
}

/* === "You" tray section (Wave C integration) === */

.vn-you-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    padding: 8px;
}

.vn-you-frame {
    width: 100%;
    max-width: 200px;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.18));
    display: flex;
    align-items: center;
    justify-content: center;
}

.vn-you-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vn-you-portrait-empty::after {
    content: 'No portrait yet';
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.78rem;
}

.vn-you-meta {
    text-align: center;
}

.vn-you-name {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}

.vn-you-pronouns {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 2px;
}

.vn-you-block {
    width: 100%;
}

.vn-you-block h4 {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.55);
    margin: 6px 0 4px 0;
    font-weight: 600;
}

.vn-you-block ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
}

.vn-you-block li {
    padding: 2px 0;
}

.vn-you-edit {
    margin-top: 4px;
    width: 100%;
    padding: 8px 12px;
    background: rgba(138, 180, 248, 0.18);
    border: 1px solid rgba(138, 180, 248, 0.5);
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    min-height: 36px;
}

.vn-you-edit:hover {
    background: rgba(138, 180, 248, 0.28);
}

.vn-you-edit:focus-visible {
    outline: 2px solid #8ab4f8;
    outline-offset: 1px;
}

/* === Tier 3: tweak buttons + popover menu === */

.vn-cc-tweak-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 8px;
    position: relative;
}

.vn-cc-tweak-btn {
    flex: 1 1 auto;
    min-height: 32px;
    padding: 5px 8px;
    background: rgba(255, 200, 100, 0.10);
    border: 1px solid rgba(255, 200, 100, 0.35);
    border-radius: 4px;
    color: rgba(255, 235, 200, 0.92);
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
}

.vn-cc-tweak-btn:hover:not(:disabled) {
    background: rgba(255, 200, 100, 0.22);
}

.vn-cc-tweak-btn:focus-visible {
    outline: 2px solid #ffc864;
    outline-offset: 1px;
}

.vn-cc-tweak-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.vn-cc-tweak-btn-open {
    background: rgba(255, 200, 100, 0.3);
    border-color: rgba(255, 200, 100, 0.65);
}

.vn-cc-tweak-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 5;
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
    background: rgba(20, 22, 32, 0.96);
    border: 1px solid rgba(255, 200, 100, 0.35);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.vn-cc-tweak-menu-item {
    flex: 1 1 auto;
    min-height: 28px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
}

.vn-cc-tweak-menu-item:hover {
    background: rgba(255, 200, 100, 0.18);
    border-color: rgba(255, 200, 100, 0.5);
}

/* === Tier 4: animate button + cost-confirm modal === */

.vn-cc-portrait-animate {
    width: 100%;
    background: linear-gradient(135deg, rgba(216, 122, 247, 0.18), rgba(138, 180, 248, 0.18));
    border-color: rgba(216, 122, 247, 0.5);
    color: rgba(255, 230, 255, 0.92);
}

.vn-cc-portrait-animate:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(216, 122, 247, 0.32), rgba(138, 180, 248, 0.32));
}

.vn-cc-animate-modal {
    position: fixed;
    inset: 0;
    z-index: 105;
    background: rgba(8, 10, 18, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vn-cc-animate-modal-card {
    max-width: 420px;
    width: 90vw;
    background: rgba(20, 22, 32, 0.98);
    border: 1px solid rgba(216, 122, 247, 0.45);
    border-radius: 10px;
    padding: 22px;
    color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

.vn-cc-animate-modal-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.05rem;
}

.vn-cc-animate-modal-card p {
    margin: 6px 0;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.78);
}

.vn-cc-animate-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    justify-content: flex-end;
}

.vn-cc-animate-cancel,
.vn-cc-animate-confirm {
    min-height: 36px;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.vn-cc-animate-cancel {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.85);
}

.vn-cc-animate-confirm {
    background: linear-gradient(135deg, rgba(216, 122, 247, 0.4), rgba(138, 180, 248, 0.4));
    border: 1px solid rgba(216, 122, 247, 0.7);
    color: #fff;
    font-weight: 600;
}

.vn-cc-animate-confirm:focus-visible,
.vn-cc-animate-cancel:focus-visible {
    outline: 2px solid #d87af7;
    outline-offset: 1px;
}
