:root {
    color-scheme: dark;
    --woe-bg: #070b12;
    --woe-surface: #101722;
    --woe-surface-2: #151f2c;
    --woe-text: #f5f1e8;
    --woe-muted: #abb7c4;
    --woe-fire: #ff8a3d;
    --woe-water: #45d8ff;
    --woe-earth: #9bd674;
    --woe-arcane: #b889ff;
    --woe-border: rgba(171, 183, 196, .18);
    --woe-radius: .55rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 10% 8%, rgba(255, 138, 61, .08), transparent 25rem),
        radial-gradient(circle at 92% 20%, rgba(69, 216, 255, .07), transparent 30rem),
        var(--woe-bg);
    color: var(--woe-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.65;
}

a { color: var(--woe-water); text-underline-offset: .2em; }
a:hover { color: #8ae8ff; }

:focus-visible {
    outline: 3px solid var(--woe-water) !important;
    outline-offset: 3px;
    box-shadow: none !important;
}

.skip-link {
    position: fixed;
    inset: .75rem auto auto .75rem;
    z-index: 1000;
    padding: .65rem 1rem;
    border-radius: .35rem;
    background: var(--woe-text);
    color: var(--woe-bg);
    transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

h1, h2, h3 {
    margin-block: 0 .7em;
    color: var(--woe-text);
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.08;
    text-wrap: balance;
}

h1 { max-width: 18ch; font-size: clamp(2.35rem, 7vw, 5.6rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.65rem, 3vw, 2.7rem); }
h3 { font-size: 1.15rem; }
p { margin-block: 0 1rem; }

.eyebrow {
    margin-bottom: 1rem;
    color: var(--woe-water);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
}

.lede {
    max-width: 63ch;
    color: var(--woe-muted);
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
}

.hero {
    position: relative;
    min-height: min(44rem, calc(100vh - 8rem));
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(18rem, .75fr);
    align-items: center;
    gap: clamp(2rem, 7vw, 7rem);
    padding-block: 1rem clamp(4rem, 8vw, 7rem);
}

.hero-copy { position: relative; z-index: 2; }

.hero h1 em {
    display: block;
    background: linear-gradient(90deg, var(--woe-fire), var(--woe-arcane) 50%, var(--woe-water));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    font-style: normal;
}

.hero-actions,
.page-actions {
    margin-top: 1.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.btn,
.button-primary,
.button-secondary {
    min-height: 2.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .68rem 1.15rem;
    border: 1px solid transparent;
    border-radius: .35rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.btn-primary,
.button-primary {
    background: var(--woe-text);
    color: #101722;
    border-color: var(--woe-text);
}

.btn-primary:hover,
.button-primary:hover { background: #fff; color: #070b12; transform: translateY(-1px); }

.btn-outline-primary,
.btn-outline-secondary,
.button-secondary {
    background: rgba(16, 23, 34, .7);
    color: var(--woe-text);
    border-color: rgba(69, 216, 255, .38);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.button-secondary:hover { background: rgba(69, 216, 255, .1); color: #fff; border-color: var(--woe-water); }

.element-visual {
    position: relative;
    width: min(29vw, 23rem);
    min-width: 18rem;
    aspect-ratio: 1;
    justify-self: center;
    display: grid;
    place-items: center;
    isolation: isolate;
}

.element-visual::before,
.element-visual::after {
    content: "";
    position: absolute;
    border-radius: 50%;
}

.element-visual::before {
    inset: 9%;
    border: 1px solid rgba(245, 241, 232, .22);
    box-shadow: 0 0 5rem rgba(184, 137, 255, .18), inset 0 0 4rem rgba(69, 216, 255, .08);
}

.element-visual::after {
    inset: 26%;
    background: radial-gradient(circle, rgba(245, 241, 232, .9) 0 2%, rgba(184, 137, 255, .38) 3%, rgba(184, 137, 255, .06) 42%, transparent 70%);
}

.world-ring {
    position: absolute;
    inset: 2%;
    border: 1px solid rgba(184, 137, 255, .2);
    border-radius: 50%;
    transform: rotate(-18deg);
}

.world-ring:nth-child(2) { inset: 16%; transform: rotate(32deg); border-color: rgba(69, 216, 255, .24); }

.world-core {
    width: 3.75rem;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border: 1px solid rgba(245, 241, 232, .45);
    border-radius: 50%;
    background: #101722;
    font: 700 1.6rem Georgia, serif;
    z-index: 2;
}

.element-node {
    position: absolute;
    width: .75rem;
    aspect-ratio: 1;
    border-radius: 50%;
    box-shadow: 0 0 1.25rem currentColor;
}

.element-fire { top: 7%; left: 47%; color: var(--woe-fire); background: currentColor; }
.element-water { right: 7%; top: 47%; color: var(--woe-water); background: currentColor; }
.element-earth { bottom: 7%; left: 47%; color: var(--woe-earth); background: currentColor; }
.element-arcane { left: 7%; top: 47%; color: var(--woe-arcane); background: currentColor; }

.section-heading { max-width: 46rem; margin-bottom: 2rem; }
.section-heading p { color: var(--woe-muted); }

.content-section { padding-block: clamp(3.5rem, 7vw, 6.5rem); border-top: 1px solid var(--woe-border); }
.content-section:first-child { border-top: 0; padding-top: 0; }

.surface,
.auth-card,
.state-panel,
.phase-card,
.account-panel {
    border: 1px solid var(--woe-border);
    border-radius: var(--woe-radius);
    background: linear-gradient(145deg, rgba(21, 31, 44, .92), rgba(16, 23, 34, .92));
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, .16);
}

.phase-preview,
.phase-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(15rem, .55fr);
    gap: 2rem;
    align-items: end;
    padding: clamp(1.4rem, 4vw, 2.5rem);
}

.phase-label { color: var(--woe-arcane); font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.phase-score { font: 700 clamp(2.8rem, 7vw, 5rem)/1 Georgia, serif; }
.phase-score small { display: block; margin-top: .5rem; color: var(--woe-muted); font: 500 .82rem/1.5 ui-sans-serif, system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }

.meter {
    width: 100%;
    height: .55rem;
    margin-block: 1.25rem .9rem;
    overflow: hidden;
    border-radius: 999px;
    background: #070b12;
    border: 1px solid rgba(171, 183, 196, .14);
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--woe-fire), var(--woe-arcane), var(--woe-water));
}

.phase-note { color: var(--woe-muted); font-size: .9rem; }

.capability-grid,
.account-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.capability-card {
    min-height: 10rem;
    padding: 1.35rem;
    border-top: 2px solid var(--accent, var(--woe-water));
    background: rgba(16, 23, 34, .72);
}

.capability-card:nth-child(4n+1) { --accent: var(--woe-fire); }
.capability-card:nth-child(4n+2) { --accent: var(--woe-water); }
.capability-card:nth-child(4n+3) { --accent: var(--woe-earth); }
.capability-card:nth-child(4n+4) { --accent: var(--woe-arcane); }
.capability-card p { color: var(--woe-muted); }

.page-hero { max-width: 52rem; padding-block: 1rem clamp(2.5rem, 5vw, 4rem); }
.page-hero h1 { font-size: clamp(2.5rem, 6vw, 4.8rem); }

.timeline {
    margin: 0;
    padding: 0;
    display: grid;
    gap: .85rem;
    list-style: none;
    counter-reset: milestone;
}

.timeline-item {
    position: relative;
    min-width: 0;
    padding: 1.2rem 1.25rem 1.2rem 4.1rem;
    counter-increment: milestone;
}

.timeline-item::before {
    content: counter(milestone, decimal-leading-zero);
    position: absolute;
    inset: 1.2rem auto auto 1.2rem;
    color: var(--woe-water);
    font: 700 .75rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
    letter-spacing: .08em;
}

.timeline-item h3 { margin-bottom: .35rem; overflow-wrap: anywhere; }
.timeline-meta { margin: 0; color: var(--woe-muted); font-size: .88rem; }
.status-mark { display: inline-flex; align-items: center; gap: .4rem; color: var(--woe-earth); }
.status-mark::before { content: ""; width: .45rem; aspect-ratio: 1; border-radius: 50%; background: currentColor; box-shadow: 0 0 .6rem currentColor; }

.state-panel,
.auth-card,
.account-panel { max-width: 48rem; padding: clamp(1.3rem, 4vw, 2.25rem); }
.auth-card { margin-block: clamp(1rem, 5vw, 4rem); }
.state-panel[role="alert"] { border-color: rgba(255, 138, 61, .5); }
.empty-state { color: var(--woe-muted); }

.details-list {
    display: grid;
    grid-template-columns: minmax(9rem, .42fr) minmax(0, 1fr);
    margin: 0;
}

.details-list dt,
.details-list dd { margin: 0; padding: .75rem 0; border-bottom: 1px solid var(--woe-border); overflow-wrap: anywhere; }
.details-list dt { color: var(--woe-muted); font-size: .83rem; letter-spacing: .04em; }

.character-list { margin: 1.25rem 0; padding: 0; display: grid; gap: .75rem; list-style: none; }
.character-list li { padding: 1rem 1.1rem; border: 1px solid var(--woe-border); background: rgba(16, 23, 34, .7); }

.text-danger,
.validation-message { color: #ffab78 !important; }
.alert { padding: 1rem 1.2rem; border: 1px solid rgba(255, 138, 61, .5); border-radius: var(--woe-radius); background: rgba(255, 138, 61, .08); color: var(--woe-text); }
.valid.modified:not([type=checkbox]) { outline: 2px solid var(--woe-earth); }
.invalid { outline: 2px solid var(--woe-fire); }

.blazor-error-boundary {
    padding: 1rem 1rem 1rem 3.5rem;
    border: 1px solid rgba(255, 138, 61, .5);
    border-radius: var(--woe-radius);
    background: rgba(255, 138, 61, .09);
    color: var(--woe-text);
}
.blazor-error-boundary::after { content: "Une erreur inattendue est survenue."; }

@media (max-width: 55rem) {
    .hero { min-height: auto; grid-template-columns: 1fr; }
    .element-visual { width: min(70vw, 22rem); grid-row: 1; }
    .phase-preview,
    .phase-overview { grid-template-columns: 1fr; align-items: start; }
    .capability-grid,
    .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 38rem) {
    h1 { font-size: clamp(2.2rem, 14vw, 3.6rem); }
    .hero { gap: 1.25rem; padding-top: 0; }
    .element-visual { min-width: 0; width: min(76vw, 17rem); }
    .hero-actions,
    .page-actions { display: grid; }
    .hero-actions > *,
    .page-actions > * { width: 100%; }
    .capability-grid,
    .account-grid { grid-template-columns: 1fr; }
    .phase-preview,
    .phase-overview { padding: 1.15rem; }
    .details-list { grid-template-columns: 1fr; }
    .details-list dt { padding-bottom: .15rem; border-bottom: 0; }
    .details-list dd { padding-top: 0; }
    .timeline-item { padding-left: 3.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
