:root {
    color-scheme: dark;
    --bg: #09090b;
    --panel: rgba(24, 24, 27, 0.78);
    --panel-strong: #18181b;
    --text: #fafafa;
    --muted: #a1a1aa;
    --line: rgba(255, 255, 255, 0.10);
    --accent-1: #2ea7ff;
    --accent-2: #7c3cff;
    --accent-3: #f01886;
    --accent-4: #ff4b1f;
    --accent-5: #ffb000;
    --radius: 24px;
    --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 15%, rgba(46, 167, 255, 0.16), transparent 30rem),
        radial-gradient(circle at 83% 18%, rgba(255, 75, 31, 0.14), transparent 28rem),
        var(--bg);
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 72px 0 44px;
}

.hero {
    text-align: center;
}

/* Main logo */

.main-logo-link {
    display: block;
    width: min(100%, 980px);
    margin: 0 auto;
    text-decoration: none;
}

.main-logo {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
}

/* Smaller logo used on age and methodology pages */

.small-logo-link {
    display: block;
    width: min(100%, 420px);
    margin: 0 0 36px;
    text-decoration: none;
}

.small-logo {
    display: block;
    width: 100%;
    height: auto;
}

/* Main calculator */

.tagline {
    max-width: 660px;
    margin: 28px auto 30px;
    color: var(--muted);
    font-size: clamp(1rem, 2.4vw, 1.2rem);
}

.calculator-card {
    width: min(860px, 100%);
    margin: 0 auto;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.calculator-card > label {
    display: block;
    margin-bottom: 12px;
    text-align: left;
    font-weight: 750;
}

.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
    gap: 12px;
}

input,
select,
button,
.button-secondary,
.button-coffee {
    min-height: 52px;
    border-radius: 14px;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    padding: 0 15px;
    color: var(--text);
    background: #111114;
    outline: none;
}

input:focus,
select:focus {
    border-color: rgba(124, 60, 255, 0.9);
    box-shadow: 0 0 0 4px rgba(124, 60, 255, 0.17);
}

button {
    border: 0;
    padding: 0 24px;
    color: #fff;
    background: linear-gradient(100deg, var(--accent-2), var(--accent-3), var(--accent-4));
    font-weight: 850;
    cursor: pointer;
}

button:disabled {
    cursor: progress;
    opacity: 0.66;
}

.privacy-hint,
.error {
    margin: 12px 2px 0;
    text-align: left;
    color: var(--muted);
    font-size: 0.88rem;
}

.error {
    color: #fda4af;
}

/* Results */

.results {
    padding-top: 64px;
    scroll-margin-top: 24px;
}

.age-summary {
    display: flex;
    justify-content: center;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 26px;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.25rem);
}

.age-summary strong {
    color: var(--text);
    font-size: clamp(2.4rem, 8vw, 5.2rem);
    line-height: 1;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.result-card {
    min-height: 230px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

.result-card--main {
    background:
        linear-gradient(var(--panel-strong), var(--panel-strong)) padding-box,
        linear-gradient(120deg, var(--accent-1), var(--accent-3), var(--accent-5)) border-box;
    border: 1px solid transparent;
}

.eyebrow {
    display: block;
    margin-bottom: 20px;
    color: #d4d4d8;
    font-size: 0.76rem;
    font-weight: 850;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.result-card h2 {
    margin: 0;
    font-size: clamp(1.35rem, 2.6vw, 2rem);
    line-height: 1.22;
}

.keep-going {
    margin: 32px 0 20px;
    text-align: center;
    font-size: clamp(1.4rem, 3.6vw, 2.25rem);
    font-weight: 900;
}

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

.button-secondary,
.button-coffee {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 22px;
    text-decoration: none;
    font-weight: 800;
}

.button-secondary {
    border: 1px solid var(--line);
    background: #18181b;
}

.button-coffee {
    color: #171717;
    background: #facc15;
}

.button-coffee[aria-disabled="true"] {
    opacity: 0.65;
    pointer-events: none;
}

/* Age and methodology pages */

.record-page {
    width: min(820px, 100%);
    margin: 0 auto;
    padding: clamp(24px, 5vw, 52px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.record-page h1 {
    margin: 0 0 24px;
    font-size: clamp(2rem, 6vw, 4.5rem);
    line-height: 1.02;
    letter-spacing: -0.045em;
}

.record-page h2 {
    margin-top: 34px;
}

.answer-lead {
    font-size: clamp(1.18rem, 2.6vw, 1.55rem);
    line-height: 1.55;
}

.fact-box {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 20px;
    margin: 32px 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #111114;
}

.fact-box span {
    color: var(--muted);
}

.fact-box strong {
    font-size: clamp(1.45rem, 4vw, 2.4rem);
}

.method-note,
.source-line {
    color: var(--muted);
}

.record-cta {
    margin-top: 40px;
    padding: 28px;
    border-radius: 20px;
    background: linear-gradient(
        120deg,
        rgba(46, 167, 255, 0.13),
        rgba(240, 24, 134, 0.12),
        rgba(255, 176, 0, 0.10)
    );
}

.button-link {
    display: inline-flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    padding: 0 20px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(100deg, var(--accent-2), var(--accent-3), var(--accent-4));
    text-decoration: none;
    font-weight: 850;
}

.editorial-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.editorial-list article {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #111114;
}

.editorial-list article > div {
    min-width: 0;
}

.editorial-list p {
    margin: 6px 0 0;
    color: var(--muted);
}

.editorial-list span {
    flex: 0 0 auto;
    color: var(--muted);
    white-space: nowrap;
}

.age-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 30px;
}

.age-nav a {
    color: var(--text);
}

/* Footer */

footer {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px 16px 36px;
    color: var(--muted);
    font-size: 0.9rem;
}

footer a {
    color: inherit;
}

/* Tablets and phones */

@media (max-width: 780px) {
    .page-shell {
        width: min(100% - 22px, 680px);
        padding-top: 42px;
    }

    .main-logo-link {
        width: 100%;
        max-width: 620px;
    }

    .calculator-card {
        padding: 16px;
    }

    .form-row,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .result-card {
        min-height: 0;
    }

    button {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .small-logo-link {
        width: min(100%, 340px);
        margin-bottom: 24px;
    }

    .fact-box {
        align-items: flex-start;
        flex-direction: column;
    }

    .editorial-list article {
        flex-direction: column;
        gap: 8px;
    }

    .editorial-list span {
        white-space: normal;
    }

    .age-nav {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 390px) {
    .page-shell {
        width: min(100% - 18px, 680px);
    }

    .tagline {
        margin-top: 20px;
    }

    .main-logo-link {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}