:root {
    color-scheme: dark;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-synthesis: none;
    color: #f9f2e5;
    background: var(--night);
    --night: #091322;
    --panel: #122036;
    --inset: #0b1729;
    --ink: #f9f2e5;
    --muted: #bac8d8;
    --gold: #f0cc83;
    --gold-light: #ffe3a7;
    --line: #3a4a61;
    --gold-line: #806c4d;
    --fir: #234439;
    --fir-light: #2f5548;
    --fir-line: #658e77;
    --shadow: 0 16px 48px #02081166;
    --serif: Georgia, "Times New Roman", serif;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    isolation: isolate;
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    background:
        linear-gradient(180deg, #09132230, #09132255 54%, #09132238),
        url("winter-night.jpg") center bottom / cover no-repeat;
    content: "";
    pointer-events: none;
}

header {
    border-bottom: 1px solid var(--gold-line);
    background: #0a1627f5;
}

.mast,
main {
    width: min(1040px, calc(100% - 48px));
    margin-inline: auto;
}

.mast {
    min-height: 70px;
    padding-block: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--gold-light);
    font: 500 1.5rem / 1 var(--serif);
}

.brand img {
    width: 34px;
    height: 34px;
}

nav,
.actions,
.tabs,
.inline,
.foot,
.heading {
    display: flex;
    align-items: center;
    gap: 14px;
}

nav {
    gap: clamp(14px, 3vw, 26px);
}

a,
.text {
    color: var(--gold);
    font-weight: 650;
    text-decoration: none;
}

a:hover,
.text:hover {
    color: var(--gold-light);
    text-decoration: underline;
    text-underline-offset: .2em;
}

main {
    padding: 54px 0 72px;
}

.narrow {
    max-width: 660px;
}

.auth {
    max-width: 460px;
    margin: 5vh auto;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font: 500 clamp(2rem, 5vw, 3.8rem) / 1.1 var(--serif);
    letter-spacing: -.042em;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

h2 {
    margin: 30px 0 16px;
    font-size: 1.25rem;
    letter-spacing: -.025em;
}

.card h2 {
    margin: 0;
}

.card h1 + p,
.card h2 + p,
.card h3 + p {
    margin-top: 12px;
}

p,
small {
    color: var(--muted);
    line-height: 1.6;
}

.eyebrow {
    margin-block: 0 11px;
    color: var(--gold);
    font-size: .73rem;
    font-weight: 750;
    letter-spacing: .13em;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.heading,
.foot,
.surveyrow,
.barlabel {
    justify-content: space-between;
}

.heading,
.actions {
    flex-wrap: wrap;
}

.heading small {
    color: var(--gold);
}

.back {
    display: inline-block;
    margin-bottom: 24px;
}

.stats {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    margin: 28px 0;
    padding: 20px 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--inset);
    box-shadow: var(--shadow);
}

.stats > div {
    padding-inline: 18px;
}

.stats > div + div {
    border-inline-start: 1px solid var(--line);
}

.stats strong {
    display: block;
    color: var(--gold);
    font: 500 2.25rem / 1.25 var(--serif);
    overflow-wrap: anywhere;
}

.stats small,
.surveyrow small {
    display: block;
}

.card,
.surveyrow {
    padding: clamp(22px, 4vw, 36px);
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.surveyrow {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 10px 0;
    padding: 17px 21px;
    color: var(--ink);
    overflow-wrap: anywhere;
}

a.surveyrow:hover {
    border-color: var(--gold-line);
    background: #1a2a41;
    color: var(--ink);
    text-decoration: none;
}

.surveyrow small {
    font-weight: 400;
}

.surveyrow > span {
    color: var(--gold);
    white-space: nowrap;
}

.empty a {
    display: inline-block;
    margin-top: 16px;
}

.stack {
    display: grid;
    gap: 18px;
}

.auth form,
.heading + .card,
h1 + .stack {
    margin-top: 24px;
}

label {
    display: grid;
    gap: 7px;
    font-size: .92rem;
    font-weight: 650;
}

input,
textarea,
select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #667790;
    border-radius: 8px;
    background: var(--inset);
    color: var(--ink);
    font: inherit;
}

input::placeholder,
textarea::placeholder {
    color: #9aabc0;
    opacity: 1;
}

textarea {
    resize: vertical;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--gold);
    color: #172133;
    font: 700 .94rem / 1.3 "Segoe UI", system-ui, sans-serif;
    text-align: center;
    cursor: pointer;
    transition: background-color .16s, border-color .16s, transform .16s;
}

.button:hover,
button:not(:disabled):hover {
    background: var(--gold-light);
    color: #172133;
    text-decoration: none;
}

button:not(:disabled):active {
    transform: translateY(1px);
}

button:disabled {
    opacity: .54;
    cursor: default;
}

.alt,
.tabs button {
    border-color: var(--fir-line);
    background: var(--fir);
    color: var(--ink);
}

.alt:not(:disabled):hover,
.tabs button:not(:disabled):hover {
    background: var(--fir-light);
    color: var(--ink);
}

button.text {
    padding-inline: 7px;
    background: transparent;
    color: var(--gold);
}

button.text:not(:disabled):hover {
    background: #1e2c43;
    color: var(--gold-light);
    text-decoration: underline;
}

.danger,
.error {
    border: 1px solid #9d6164;
    background: #512d3b;
    color: #ffe4df;
}

.danger:not(:disabled):hover {
    background: #683848;
    color: #ffe4df;
}

.error,
.notice {
    padding: 14px;
    border-radius: 10px;
}

.notice,
.seal {
    border: 1px solid var(--fir-line);
    background: var(--fir);
}

.notice p {
    margin: 5px 0 12px;
    color: var(--ink);
}

.invitation-link {
    margin: -3px 0 18px;
}

.inline {
    align-items: end;
}

.inline label,
.inline input {
    flex: 1;
    min-width: 0;
}

.tabs {
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--inset);
}

.tabs button:not(.active) {
    border-color: transparent;
    background: transparent;
}

.tabs button.active,
.tabs button.active:hover {
    border-color: var(--fir-line);
    background: var(--fir);
    color: var(--ink);
}

.pill {
    padding: 5px 10px;
    border: 1px solid var(--fir-line);
    border-radius: 20px;
    background: var(--fir);
    color: var(--ink);
    font-size: .8rem;
}

.chart {
    margin-top: 16px;
}

.chart h2 {
    margin-bottom: 18px;
}

.barlabel {
    display: flex;
    gap: 12px;
    margin: 12px 0 5px;
    overflow-wrap: anywhere;
}

progress {
    display: block;
    width: 100%;
    height: 8px;
    border: 0;
    border-radius: 10px;
    background: #2f4058;
    color: var(--gold);
    accent-color: var(--gold);
}

progress::-webkit-progress-bar {
    border-radius: 10px;
    background: #2f4058;
}

progress::-webkit-progress-value {
    border-radius: 10px;
    background: var(--gold);
    transition: width .22s;
}

progress::-moz-progress-bar {
    border-radius: 10px;
    background: var(--gold);
}

.seal {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    margin-bottom: 18px;
    border-radius: 50%;
    color: var(--gold);
    font-size: 1.65rem;
}

:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 4px;
}

.participation-shell {
    position: relative;
}

.participation-main {
    position: relative;
    z-index: 1;
    min-height: 100svh;
    width: min(660px, calc(100% - 36px));
    display: grid;
    align-content: center;
    padding-block: clamp(28px, 5vh, 56px) 48px;
}

.participation-main:has(.question) {
    align-content: start;
}

.participation-main > .card {
    background-color: color-mix(in srgb, var(--panel) 84%, transparent);
    backdrop-filter: blur(4px);
}

.participation-main > .heading {
    padding-inline: 2px;
}

.participation-main > .heading strong {
    overflow-wrap: anywhere;
}

.participation-main > .heading + progress {
    margin: 12px 0 19px;
}

.participation-main h1[tabindex="-1"]:focus {
    outline: none;
}

.participation-main > .error {
    margin-top: 16px;
}

.welcome {
    position: relative;
    padding: clamp(42px, 8vw, 77px) clamp(24px, 8vw, 70px);
    border-color: var(--gold-line);
    background-image: radial-gradient(ellipse at 50% 0, #263840a6 0, transparent 65%);
    box-shadow: 0 25px 100px #020912a6;
    text-align: center;
}

.welcome::before {
    position: absolute;
    inset: 9px;
    border: 1px solid #f0cc8330;
    border-radius: 9px;
    content: "";
    pointer-events: none;
}

.welcome-mark {
    display: grid;
    width: 62px;
    height: 62px;
    place-items: center;
    margin: 0 auto 24px;
    border: 1px solid var(--gold-line);
    border-radius: 50%;
    background: var(--fir);
    color: var(--gold-light);
    font: 2rem / 1 var(--serif);
    box-shadow: 0 0 25px #f0cc8324;
}

.welcome h1 {
    font-size: clamp(2.45rem, 8vw, 4.8rem);
}

.welcome h1 + p {
    max-width: 36ch;
    margin: 18px auto 0;
    text-wrap: pretty;
}

.welcome button {
    min-height: 48px;
    margin-top: 26px;
    padding-inline: 22px;
}

.question,
.finish,
.welcome {
    animation: arrive .25s ease-out both;
}

.choices {
    display: grid;
    gap: 10px;
    margin-block: 24px;
}

.choice {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 49px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--inset);
    cursor: pointer;
    overflow-wrap: anywhere;
    transition: background-color .16s, border-color .16s;
}

.choice:hover,
.choice.picked {
    border-color: var(--fir-line);
    background: var(--fir);
}

.choice input {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--gold);
    cursor: pointer;
}

.foot {
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.snow {
    position: fixed;
    z-index: 2;
    inset: calc(-1 * var(--snow-tile-height)) 0 0;
    background-size: var(--snow-tile-width) var(--snow-tile-height);
    pointer-events: none;
    animation-name: fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.snow-far {
    --snow-tile-width: 211px;
    --snow-tile-height: 241px;
    background-image:
        radial-gradient(circle at 18% 16%, #e4eff6 1px, transparent 1.6px),
        radial-gradient(circle at 81% 28%, #e4eff6 1px, transparent 1.6px),
        radial-gradient(circle at 42% 58%, #f5f7ff .8px, transparent 1.5px),
        radial-gradient(circle at 91% 77%, #e4eff6 .7px, transparent 1.4px),
        radial-gradient(circle at 11% 92%, #f5f7ff 1px, transparent 1.8px);
    opacity: .38;
    animation-duration: 28s;
}

.snow-near {
    --snow-tile-width: 337px;
    --snow-tile-height: 313px;
    background-image:
        radial-gradient(circle at 17% 22%, #f5f7ff 1.6px, transparent 2.7px),
        radial-gradient(circle at 74% 44%, #e4eff6 1.3px, transparent 2.5px),
        radial-gradient(circle at 36% 83%, #f5f7ff 1.2px, transparent 2.2px);
    opacity: .6;
    animation-duration: 19s;
    animation-delay: -7s;
}

@keyframes fall {
    to {
        transform: translateY(var(--snow-tile-height));
    }
}

@keyframes arrive {
    from {
        opacity: .55;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before {
        animation: none !important;
        transition: none !important;
    }

    .snow {
        display: none;
    }
}

@media (max-width: 600px) {
    .mast,
    main {
        width: calc(100% - 32px);
    }

    main {
        padding-top: 32px;
    }

    .participation-main {
        align-content: start;
        padding-block: max(16px, env(safe-area-inset-top)) 32px;
    }

    .participation-main > .heading + progress {
        margin-block: 9px 13px;
    }

    .participation-main > .welcome {
        padding-block: 32px;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-flow: row;
        gap: 14px 0;
    }

    .stats > div + div {
        border-inline-start: 0;
    }

    .surveyrow,
    .inline,
    .foot {
        flex-wrap: wrap;
    }

    .inline label {
        flex-basis: 100%;
    }

    .surveyrow .actions {
        gap: 6px;
    }

    .foot {
        gap: 8px;
    }

    .auth {
        margin-top: 2vh;
    }
}
