:root {
    --lwl-ink: #0f172a;
    --lwl-slate: #334155;
    --lwl-slate-soft: #475569;
    --lwl-cream: #fff9ef;
    --lwl-cream-2: #fdf2df;
    --lwl-mist: #f6f7fb;
    --lwl-border: rgba(15, 23, 42, 0.08);
    --lwl-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
    --lwl-pill: linear-gradient(
        90deg,
        rgba(245, 158, 11, 0.22),
        rgba(251, 113, 133, 0.18),
        rgba(56, 189, 248, 0.16)
    );
    --lwl-dark-card: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.92));
}

.lwl-scene {
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
    color: var(--lwl-ink);
    background: radial-gradient(circle at top, #fffaf1, #f2ede0 55%, #e9edf5 100%);
    min-height: 60vh;
    padding: 56px 16px;
    line-height: 1.8;
}

.lwl-cinematic {
    max-width: 980px;
    margin: 0 auto;
}

.lwl-card {
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--lwl-shadow);
    border: 1px solid var(--lwl-border);
}

.lwl-card--cream {
    background: linear-gradient(180deg, var(--lwl-cream), var(--lwl-cream-2));
}

.lwl-card--dark {
    background: var(--lwl-dark-card);
    color: #f8fafc;
}

.lwl-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.lwl-pill--banner {
    background: var(--lwl-pill);
    color: var(--lwl-ink);
    margin-bottom: 18px;
}

.lwl-pill--element {
    background: rgba(15, 23, 42, 0.06);
    color: var(--lwl-slate);
    font-size: 12px;
}

.lwl-header {
    text-align: center;
    margin-bottom: 24px;
}

.lwl-title {
    font-size: 30px;
    line-height: 1.3;
    color: var(--lwl-ink);
}

.lwl-subtitle {
    color: var(--lwl-slate);
    margin-top: 10px;
    font-size: 15px;
    line-height: 1.75;
}

.lwl-progress {
    margin: 20px 0 28px;
}

.lwl-progress-bar {
    position: relative;
    height: 6px;
    background: rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.lwl-progress-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.7), rgba(251, 113, 133, 0.7), rgba(56, 189, 248, 0.7));
    transition: width 0.4s ease;
}

.lwl-progress-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.lwl-progress-dots span {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--lwl-slate-soft);
    background: rgba(255, 255, 255, 0.7);
    transition: transform 0.3s ease, background 0.3s ease;
}

.lwl-progress-dots span.active {
    background: var(--lwl-pill);
    color: var(--lwl-ink);
    transform: translateY(-2px);
}

.lwl-step {
    display: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.lwl-step.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.lwl-step-title {
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--lwl-slate);
    margin-bottom: 16px;
}

.lwl-field-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.lwl-journey-wizard .lwl-origin-trait-wrap {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    overflow: visible;
    justify-self: stretch;
    flex-basis: 100%;
}

.lwl-origin-trait-wrap .lwl-origin-label {
    display: block;
    width: 100%;
    text-align: center;
    margin-bottom: 8px;
    color: var(--lwl-slate);
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    font-size: 12px;
}

.lwl-field {
    display: flex;
    flex-direction: column;
    font-size: 14px;
    color: var(--lwl-slate);
    line-height: 1.7;
}

.lwl-input {
    margin-top: 6px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    background: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    color: var(--lwl-ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lwl-input:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.6);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.lwl-trait-chooser {
    position: relative;
    padding: 6px 4px;
    border-radius: 18px;
    width: 100%;
    min-width: 0;
    overflow: visible;
}

.lwl-trait-chooser::before {
    content: "";
    position: absolute;
    inset: -14px;
    border-radius: 22px;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.28s ease;
}

.lwl-trait-chooser.is-selected::before {
    opacity: 0.12;
}

.lwl-trait-chooser[data-trait="Observer"].is-selected::before {
    background:
        radial-gradient(circle at 30% 30%, rgba(120, 130, 190, 0.2), transparent 55%),
        radial-gradient(circle at 70% 60%, rgba(120, 130, 190, 0.2), transparent 60%);
}

.lwl-trait-chooser[data-trait="Strategist"].is-selected::before {
    background:
        repeating-linear-gradient(0deg, rgba(110, 140, 155, 0.16) 0, rgba(110, 140, 155, 0.16) 1px, transparent 1px, transparent 18px),
        repeating-linear-gradient(90deg, rgba(110, 140, 155, 0.12) 0, rgba(110, 140, 155, 0.12) 1px, transparent 1px, transparent 18px);
}

.lwl-trait-chooser[data-trait="Builder"].is-selected::before {
    background:
        linear-gradient(90deg, rgba(120, 155, 120, 0.18) 0, rgba(120, 155, 120, 0.18) 1px, transparent 1px) 0 0/24px 24px,
        linear-gradient(0deg, rgba(120, 155, 120, 0.12) 0, rgba(120, 155, 120, 0.12) 1px, transparent 1px) 0 0/24px 24px;
}

.lwl-trait-chooser[data-trait="Wanderer"].is-selected::before {
    background:
        repeating-linear-gradient(12deg, rgba(200, 165, 90, 0.18) 0, rgba(200, 165, 90, 0.18) 1px, transparent 1px, transparent 16px),
        repeating-linear-gradient(-12deg, rgba(200, 165, 90, 0.12) 0, rgba(200, 165, 90, 0.12) 1px, transparent 1px, transparent 20px);
}

.lwl-trait-chooser[data-trait="Guardian"].is-selected::before {
    background:
        radial-gradient(circle at 50% 20%, rgba(190, 120, 120, 0.22), transparent 60%),
        radial-gradient(circle at 50% 80%, rgba(190, 120, 120, 0.14), transparent 55%);
}

.lwl-trait-chooser[data-trait="Alchemist"].is-selected::before {
    background:
        radial-gradient(circle at 20% 40%, rgba(155, 120, 190, 0.2) 0 2px, transparent 3px),
        radial-gradient(circle at 60% 25%, rgba(155, 120, 190, 0.2) 0 2px, transparent 3px),
        radial-gradient(circle at 75% 65%, rgba(155, 120, 190, 0.18) 0 2px, transparent 3px),
        radial-gradient(circle at 35% 70%, rgba(155, 120, 190, 0.16) 0 2px, transparent 3px);
}

.lwl-trait-pills {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: visible;
    padding: 0;
    margin: 6px 0 0;
}

.lwl-trait-pillbtn {
    --accent: rgba(120, 130, 190, 0.7);
    --accent_bg: rgba(120, 130, 190, 0.18);
    --accent_bd: rgba(120, 130, 190, 0.35);
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.45)), var(--accent_bg);
    border: 1px solid var(--accent_bd);
    color: rgba(0, 0, 0, 0.72);
    font-size: 13px;
    font-weight: 550;
    letter-spacing: 0.25px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.06);
    transition: transform 0.26s ease, opacity 0.26s ease, box-shadow 0.26s ease, border-color 0.26s ease;
    min-height: 30px;
}

.lwl-trait-chooser:not(.is-selected) .lwl-trait-pillbtn {
    margin: 0;
    flex: 0 0 auto;
}

.lwl-trait-pillbtn::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 999px;
    background: radial-gradient(circle at 50% 50%, var(--accent_bg) 0%, transparent 62%);
    opacity: 0;
    filter: blur(10px);
    z-index: -1;
    transition: opacity 0.22s ease;
    pointer-events: none;
}

.lwl-trait-chooser:not(.is-selected) .lwl-trait-pillbtn:hover,
.lwl-trait-chooser:not(.is-selected) .lwl-trait-pillbtn:focus-visible {
    border-color: var(--accent_bd);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--accent_bd);
    transform: translateY(-1px);
}

.lwl-trait-chooser:not(.is-selected) .lwl-trait-pillbtn:hover::after,
.lwl-trait-chooser:not(.is-selected) .lwl-trait-pillbtn:focus-visible::after {
    opacity: 1;
}

.lwl-trait-pillbtn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7), 0 0 0 6px var(--accent_bd);
}

.lwl-trait-pillbtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.08);
}

.lwl-trait-pillbtn[data-trait="Observer"] {
    --accent: rgba(120, 130, 190, 0.7);
    --accent_bg: rgba(120, 130, 190, 0.18);
    --accent_bd: rgba(120, 130, 190, 0.35);
}

.lwl-trait-pillbtn[data-trait="Strategist"] {
    --accent: rgba(110, 140, 155, 0.75);
    --accent_bg: rgba(110, 140, 155, 0.18);
    --accent_bd: rgba(110, 140, 155, 0.35);
}

.lwl-trait-pillbtn[data-trait="Builder"] {
    --accent: rgba(120, 155, 120, 0.75);
    --accent_bg: rgba(120, 155, 120, 0.18);
    --accent_bd: rgba(120, 155, 120, 0.35);
}

.lwl-trait-pillbtn[data-trait="Wanderer"] {
    --accent: rgba(200, 165, 90, 0.7);
    --accent_bg: rgba(200, 165, 90, 0.2);
    --accent_bd: rgba(200, 165, 90, 0.36);
}

.lwl-trait-pillbtn[data-trait="Guardian"] {
    --accent: rgba(190, 120, 120, 0.7);
    --accent_bg: rgba(190, 120, 120, 0.2);
    --accent_bd: rgba(190, 120, 120, 0.35);
}

.lwl-trait-pillbtn[data-trait="Alchemist"] {
    --accent: rgba(155, 120, 190, 0.75);
    --accent_bg: rgba(155, 120, 190, 0.2);
    --accent_bd: rgba(155, 120, 190, 0.36);
}

.lwl-trait-pillbtn.is-selected {
    margin-left: auto;
    margin-right: auto;
    transform: scale(1.05);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--accent_bd);
}

.lwl-trait-chooser.is-selected .lwl-trait-pillbtn:not(.is-selected) {
    margin: 0;
}

.lwl-trait-pillbtn.is-hiding {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
}

.lwl-trait-pillbtn.is-hidden {
    display: none;
}

.lwl-trait-detail {
    position: relative;
    z-index: 1;
    margin-top: 14px;
    display: grid;
    justify-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(6px);
    filter: blur(2px);
    transition: opacity 0.24s ease, transform 0.24s ease, filter 0.24s ease;
}

@media (min-width: 900px) {
    .lwl-trait-pills {
        flex-wrap: nowrap;
    }

    .lwl-trait-pillbtn {
        padding: 7px 11px;
        font-size: 12.5px;
    }
}

@media (max-width: 899px) {
    .lwl-trait-pills {
        flex-wrap: wrap;
        gap: 8px;
        overflow: visible;
    }
}

.lwl-trait-detail.is-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.lwl-trait-desc-pill {
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    line-height: 1.3;
    max-width: 460px;
    text-align: center;
    background: var(--accent_bg, rgba(255, 255, 255, 0.6));
    border: 1px solid var(--accent_bd, rgba(0, 0, 0, 0.08));
    color: var(--lwl-slate);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

.lwl-trait-reset {
    background: none;
    border: none;
    padding: 0;
    font-size: 12.5px;
    color: var(--lwl-slate-soft);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(15, 23, 42, 0.2);
    text-underline-offset: 3px;
}

.lwl-trait-reset:hover {
    color: var(--lwl-ink);
}

.lwl-guardian-field.is-required .lwl-input {
    border-color: rgba(251, 113, 133, 0.6);
    box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.15);
}

.lwl-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 26px;
    flex-wrap: wrap;
}

.lwl-button {
    border-radius: 999px;
    padding: 12px 22px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    background: #fff;
    color: var(--lwl-ink);
    font-size: 14px;
    letter-spacing: 0.3px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 160px;
    text-align: center;
}

.lwl-button--primary {
    background: var(--lwl-pill);
    border-color: rgba(15, 23, 42, 0.05);
}

.lwl-button--ghost {
    background: rgba(255, 255, 255, 0.7);
}

.lwl-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.lwl-consent {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    font-size: 14px;
    color: var(--lwl-slate);
}

.lwl-fate {
    margin-top: 22px;
    padding: 20px;
}

.lwl-fate-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--lwl-slate);
}

.lwl-fate-body {
    margin-top: 10px;
    display: grid;
    gap: 10px;
    text-align: center;
}

.lwl-fate-sign {
    font-size: 26px;
    color: var(--lwl-ink);
}

.lwl-fate-copy {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
    min-height: 150px;
    transition: opacity 0.24s ease, transform 0.24s ease, filter 0.24s ease;
}

.lwl-fate-meaning,
.lwl-fate-learning,
.lwl-fate-journey {
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--lwl-slate-soft);
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.lwl-fate-learning {
    font-style: italic;
    color: #506473;
}

.lwl-fate-journey {
    color: #4a5a68;
}

.lwl-fate-element-bar {
    width: 56px;
    height: 2px;
    border-radius: 999px;
    background: var(--lwl-element-border, rgba(15, 23, 42, 0.18));
    margin-left: auto;
    margin-right: auto;
}

.lwl-fate .lwl-pill--element {
    position: relative;
    overflow: hidden;
    background: var(--lwl-element-bg, rgba(15, 23, 42, 0.06));
    border: 1px solid var(--lwl-element-border, rgba(15, 23, 42, 0.18));
    color: var(--lwl-element-text, var(--lwl-slate));
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding-left: 12px;
    padding-right: 12px;
    margin-left: auto;
    margin-right: auto;
}

.lwl-fate--revealing .lwl-fate-copy {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(2px);
}

.lwl-fate--revealed .lwl-fate-copy {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.lwl-fate--revealing .lwl-pill--element::after {
    content: "";
    position: absolute;
    top: -40%;
    left: -120%;
    width: 160%;
    height: 180%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
    animation: lwl-pill-sheen 0.4s ease-out;
    pointer-events: none;
}

@keyframes lwl-pill-sheen {
    0% { transform: translateX(0); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: translateX(120%); opacity: 0; }
}

.lwl-fate[data-element="earth"] {
    --lwl-element-bg: rgba(120, 150, 110, 0.15);
    --lwl-element-border: rgba(120, 150, 110, 0.35);
    --lwl-element-text: #4f6b4f;
}

.lwl-fate[data-element="fire"] {
    --lwl-element-bg: rgba(210, 120, 80, 0.18);
    --lwl-element-border: rgba(210, 120, 80, 0.35);
    --lwl-element-text: #8a3f1f;
}

.lwl-fate[data-element="air"] {
    --lwl-element-bg: rgba(160, 190, 210, 0.18);
    --lwl-element-border: rgba(160, 190, 210, 0.35);
    --lwl-element-text: #4f6b7a;
}

.lwl-fate[data-element="water"] {
    --lwl-element-bg: rgba(90, 130, 160, 0.20);
    --lwl-element-border: rgba(90, 130, 160, 0.35);
    --lwl-element-text: #2f4e66;
}

.lwl-footer {
    text-align: center;
    margin-top: 18px;
}

.lwl-footer a {
    color: var(--lwl-slate);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.lwl-footer a:hover {
    border-bottom-color: rgba(15, 23, 42, 0.2);
}

.lwl-journey-messages {
    margin-bottom: 16px;
}

.lwl-error,
.lwl-success,
.lwl-journey-message {
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
    margin-bottom: 10px;
}

.lwl-journey-error {
    background: rgba(239, 68, 68, 0.1);
    color: #7f1d1d;
}

.lwl-journey-notice {
    background: rgba(14, 165, 233, 0.08);
    color: #0f172a;
}

.lwl-journey-hp {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
}

.lwl-awakening {
    text-align: center;
    box-shadow: 0 12px 26px rgba(59, 130, 246, 0.12);
}

.lwl-loading {
    position: relative;
    height: 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
    margin-top: 20px;
}

.lwl-loading span {
    position: absolute;
    inset: 0;
    width: 40%;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.7), rgba(251, 191, 36, 0.7));
    animation: lwl-loading 1.2s ease-in-out infinite;
}

@keyframes lwl-loading {
    0% { transform: translateX(-80%); }
    50% { transform: translateX(80%); }
    100% { transform: translateX(180%); }
}

@media (max-width: 720px) {
    .lwl-card {
        padding: 24px;
    }

    .lwl-title {
        font-size: 24px;
    }

    .lwl-button {
        min-width: 140px;
        width: 100%;
    }

    .lwl-actions {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lwl-fate-copy {
        transition: none;
    }
    .lwl-fate--revealing .lwl-fate-copy,
    .lwl-fate--revealed .lwl-fate-copy {
        opacity: 1;
        transform: none;
        filter: none;
    }
    .lwl-fate--revealing .lwl-pill--element::after {
        animation: none;
    }

    .lwl-trait-pill {
        transition: none;
    }

    .lwl-trait-pill.is-revealing,
    .lwl-trait-pill.is-revealed {
        transform: none;
        filter: none;
    }

    .lwl-trait-pillbtn,
    .lwl-trait-detail {
        transition: none;
    }

    .lwl-trait-pillbtn.is-selected {
        transform: none;
    }

    .lwl-trait-pillbtn.is-hiding {
        transform: none;
        opacity: 0;
    }

    .lwl-trait-chooser:not(.is-selected) .lwl-trait-pillbtn:hover,
    .lwl-trait-chooser:not(.is-selected) .lwl-trait-pillbtn:focus-visible {
        transform: none;
    }

    .lwl-trait-pillbtn::after {
        transition: none;
    }

    .lwl-trait-detail {
        transform: none;
        filter: none;
    }
}
