:root {
    --bg-1: #fff4d7;
    --bg-2: #d8efff;
    --bg-3: #ffd8bc;
    --text: #17314b;
    --muted: #41617b;
    --surface: rgb(255 255 255 / 0.7);
    --surface-border: rgb(255 255 255 / 0.86);
    --accent: #ff6a2f;
    --accent-2: #0ea58e;
    --accent-soft: rgb(255 106 47 / 0.14);
    --shadow: 0 22px 52px rgb(18 49 76 / 0.16);
    --radius-lg: 24px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Bricolage Grotesque", sans-serif;
    color: var(--text);
    background: linear-gradient(125deg, var(--bg-1), var(--bg-2) 46%, var(--bg-3));
    overflow-x: hidden;
}

.bg-layer {
    position: fixed;
    border-radius: 50%;
    filter: blur(72px);
    opacity: 0.5;
    pointer-events: none;
    z-index: -1;
    animation: drift 16s ease-in-out infinite;
}

.bg-a {
    width: 44vw;
    height: 44vw;
    left: -12vw;
    top: -16vw;
    background: color-mix(in srgb, var(--accent) 72%, white);
}

.bg-b {
    width: 38vw;
    height: 38vw;
    right: -10vw;
    bottom: -16vw;
    background: color-mix(in srgb, var(--accent-2) 72%, white);
    animation-delay: -8s;
}

.site-header,
.section,
.site-footer {
    width: min(1120px, 92vw);
    margin-inline: auto;
}

.site-header {
    margin-top: 22px;
    padding: 14px 16px;
    border: 1px solid var(--surface-border);
    border-radius: 999px;
    background: var(--surface);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 10px;
    z-index: 20;
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.04rem;
    letter-spacing: 0.01em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-links a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.96rem;
}

.nav-links a:hover {
    color: var(--text);
}

.site-main {
    padding-block: 18px 30px;
}

.section {
    margin-top: 16px;
}

.hero {
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface-border);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: clamp(20px, 4vw, 42px);
}

.kicker {
    margin: 0;
    font-family: "JetBrains Mono", monospace;
    letter-spacing: 0.16em;
    font-size: 0.78rem;
    color: var(--muted);
}

h1 {
    margin: 14px 0 12px;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 0.97;
    max-width: 15ch;
}

.hero-copy {
    margin: 0;
    color: var(--muted);
    max-width: 63ch;
    font-size: 1.06rem;
}

.hero-actions {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn,
button {
    border: 0;
    border-radius: 12px;
    text-decoration: none;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    padding: 10px 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary,
button {
    background: var(--accent);
    color: white;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 45%, transparent);
}

.btn-ghost {
    background: rgb(255 255 255 / 0.65);
    color: var(--text);
    border: 1px solid rgb(24 53 76 / 0.15);
}

.btn:hover,
button:hover {
    transform: translateY(-2px);
}

.live-bar {
    margin-top: 22px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgb(255 255 255 / 0.66);
    border: 1px solid rgb(24 53 76 / 0.14);
    border-radius: 999px;
    padding: 8px 12px;
    font-family: "JetBrains Mono", monospace;
    color: var(--muted);
}

.live-bar strong {
    color: var(--text);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.stat-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--surface-border);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 18px;
}

.stat-card h2 {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2.15rem);
}

.stat-card p {
    margin: 6px 0 0;
    color: var(--muted);
}

.section-heading h2,
.calculator-copy h2,
.join-copy h2 {
    margin: 10px 0 8px;
    font-size: clamp(1.6rem, 3.5vw, 2.5rem);
}

.program-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.program-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--surface-border);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.program-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.program-card h3 {
    margin: 8px 0;
}

.program-card p {
    margin: 0;
    color: var(--muted);
}

.program-card span {
    display: inline-block;
    margin-top: 14px;
    padding: 6px 9px;
    border-radius: 999px;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.8rem;
    background: var(--accent-soft);
}

.calculator {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 14px;
}

.calculator-copy,
.calculator-shell {
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface-border);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: clamp(18px, 3vw, 28px);
}

.calculator-copy p {
    color: var(--muted);
    margin: 0;
    max-width: 50ch;
}

.calc-points {
    margin: 14px 0 0;
    padding-left: 18px;
    color: var(--muted);
    display: grid;
    gap: 8px;
}

.calc-screen {
    border-radius: 14px;
    border: 1px solid rgb(23 49 75 / 0.2);
    background: rgb(255 255 255 / 0.84);
    padding: 12px;
    min-height: 96px;
    display: grid;
    align-content: center;
}

.calc-expression,
.calc-result {
    margin: 0;
    text-align: right;
    font-family: "JetBrains Mono", monospace;
    word-break: break-all;
}

.calc-expression {
    color: var(--muted);
    font-size: 0.96rem;
    min-height: 1.4em;
}

.calc-result {
    margin-top: 4px;
    font-size: clamp(1.55rem, 4vw, 2rem);
    color: var(--text);
    font-weight: 700;
}

.calc-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.calc-grid .calc-btn {
    border: 1px solid rgb(23 49 75 / 0.2);
    border-radius: 11px;
    background: rgb(255 255 255 / 0.88);
    color: var(--text);
    box-shadow: none;
    font-family: "JetBrains Mono", monospace;
    font-weight: 700;
    padding: 12px 10px;
}

.calc-grid .calc-btn:hover {
    transform: translateY(-1px);
}

.calc-grid .calc-btn-operator {
    background: rgb(255 255 255 / 0.96);
    color: color-mix(in srgb, var(--accent) 62%, #152a4a);
}

.calc-grid .calc-btn-action {
    background: color-mix(in srgb, var(--accent-soft) 55%, white);
    color: #223f5e;
}

.calc-grid .calc-btn-equals {
    grid-column: span 2;
    background: linear-gradient(110deg, var(--accent), var(--accent-2));
    color: white;
    border: 0;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 48%, transparent);
}

.calc-status {
    margin: 10px 0 0;
    min-height: 1.3em;
    color: var(--accent-2);
    font-weight: 600;
    font-size: 0.92rem;
}

.calc-status.is-error {
    color: #b3342a;
}

.join {
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface-border);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: clamp(18px, 3vw, 28px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
}

.join-copy p {
    color: var(--muted);
    margin: 0;
    max-width: 40ch;
}

.join-form {
    display: grid;
    gap: 8px;
}

.join-form label {
    font-family: "JetBrains Mono", monospace;
    color: var(--muted);
    font-size: 0.82rem;
}

input {
    border: 1px solid rgb(23 49 75 / 0.2);
    border-radius: 10px;
    background: rgb(255 255 255 / 0.88);
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
}

.form-message {
    min-height: 1.3em;
    margin: 3px 0 0;
    font-size: 0.92rem;
    color: var(--accent-2);
    font-weight: 600;
}

.site-footer {
    margin-top: 24px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 20px;
    color: var(--muted);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.82rem;
}

.reveal {
    opacity: 0;
    transform: translateY(18px);
}

.reveal.is-visible {
    animation: reveal-up 620ms ease forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes reveal-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes drift {
    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(12px, -14px);
    }
}

@media (max-width: 980px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .program-grid {
        grid-template-columns: 1fr;
    }

    .join {
        grid-template-columns: 1fr;
    }

    .calculator {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .site-header {
        border-radius: 18px;
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-links {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
    }

    .nav-links a,
    .nav-links button {
        text-align: center;
    }

    h1 {
        max-width: 100%;
    }
}