:root {
    color-scheme: light;
    --ink: #122330;
    --muted: #607482;
    --line: #cbd9e2;
    --line-strong: #9fb5c3;
    --paper: #ffffff;
    --soft: #f3f8fb;
    --background: #eaf2f7;
    --blue: #0878bd;
    --blue-dark: #075687;
    --cyan: #20b9ec;
    --green: #187354;
    --green-soft: #eaf7f1;
    --red: #b53045;
    --red-soft: #fff0f2;
    --amber: #9a6509;
    --amber-soft: #fff7e5;
    --shadow: 0 24px 80px rgba(38, 71, 91, 0.12);
    --radius: 4px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
    font-family: "Segoe UI", Inter, Arial, Helvetica, sans-serif;
    color: var(--ink);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(118deg, rgba(255, 255, 255, 0.74), transparent 55%),
        radial-gradient(circle at 89% 2%, rgba(32, 185, 236, 0.17), transparent 29rem),
        var(--background);
    line-height: 1.5;
}

body::before {
    position: fixed;
    z-index: 0;
    inset: 0;
    content: "";
    pointer-events: none;
    opacity: 0.5;
    background-image:
        linear-gradient(rgba(8, 120, 189, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(8, 120, 189, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, #000, transparent 78%);
}

button,
input {
    font: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(8, 120, 189, 0.34);
    outline-offset: 3px;
}

.topbar,
.shell,
.footer {
    position: relative;
    z-index: 1;
}

.topbar {
    width: min(1240px, calc(100% - 48px));
    min-height: 92px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.brand > span:last-child {
    display: grid;
    gap: 1px;
}

.brand strong {
    font-size: 0.96rem;
    letter-spacing: 0.16em;
    font-weight: 700;
}

.brand small {
    color: var(--muted);
    font-size: 0.6rem;
    letter-spacing: 0.2em;
}

.brand-mark {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    position: relative;
    transform: rotate(45deg);
    border: 1px solid var(--blue);
}

.brand-mark i {
    position: absolute;
    display: block;
    background: var(--blue);
}

.brand-mark i:nth-child(1) {
    width: 13px;
    height: 13px;
}

.brand-mark i:nth-child(2) {
    width: 3px;
    height: 38px;
    opacity: 0.2;
}

.brand-mark i:nth-child(3) {
    width: 38px;
    height: 3px;
    opacity: 0.2;
}

.system-state {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.64rem;
    letter-spacing: 0.17em;
    font-weight: 700;
}

.state-dot {
    width: 12px;
    height: 12px;
    border: 3px solid var(--cyan);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(32, 185, 236, 0.12);
}

.state-game-over .state-dot {
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(181, 48, 69, 0.1);
}

.state-complete .state-dot {
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(24, 115, 84, 0.1);
}

.state-reward-unavailable .state-dot {
    border-color: var(--amber);
    box-shadow: 0 0 0 4px rgba(154, 101, 9, 0.1);
}

.shell {
    width: min(1120px, calc(100% - 48px));
    margin: 42px auto 30px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--blue);
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.2em;
}

.hero {
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(330px, 0.8fr);
    min-height: 430px;
    border: 1px solid var(--line);
    background: var(--paper);
    box-shadow: var(--shadow);
}

.hero-copy {
    padding: clamp(34px, 6vw, 72px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero h1 {
    max-width: 720px;
    margin: 0;
    font-size: clamp(3.3rem, 7.5vw, 6.4rem);
    line-height: 0.93;
    font-weight: 260;
    letter-spacing: -0.065em;
}

.hero h1 strong {
    color: var(--blue);
    font-weight: 650;
}

.intro {
    max-width: 610px;
    margin: 28px 0 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.75;
}

.rules-strip {
    margin-top: 38px;
    padding-top: 21px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px 27px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.65rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.rules-strip span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.rules-strip b {
    color: var(--blue);
    font-size: 0.58rem;
}

.hero-visual {
    position: relative;
    min-height: 430px;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: #d9f3ff;
    background:
        linear-gradient(rgba(25, 70, 96, 0.84), rgba(11, 39, 55, 0.92)),
        repeating-linear-gradient(120deg, transparent 0 13px, rgba(255, 255, 255, 0.04) 14px 15px);
}

.hero-visual::before,
.hero-visual::after {
    position: absolute;
    content: "";
    pointer-events: none;
}

.hero-visual::before {
    inset: 16px;
    border: 1px solid rgba(143, 216, 247, 0.18);
}

.hero-visual::after {
    width: 1px;
    height: 100%;
    background: rgba(143, 216, 247, 0.12);
}

.orbit {
    position: absolute;
    border: 1px solid rgba(115, 211, 251, 0.38);
    border-radius: 50%;
}

.orbit-one {
    width: 268px;
    height: 268px;
}

.orbit-two {
    width: 360px;
    height: 130px;
    transform: rotate(-27deg);
}

.core {
    z-index: 1;
    width: 132px;
    height: 132px;
    display: grid;
    place-items: center;
    transform: rotate(45deg);
    border: 1px solid rgba(132, 220, 255, 0.7);
    background: rgba(33, 142, 193, 0.22);
    box-shadow: 0 0 56px rgba(32, 185, 236, 0.23);
}

.core span {
    transform: rotate(-45deg);
    font-size: 0.67rem;
    letter-spacing: 0.28em;
    margin-left: 0.28em;
}

.coordinates {
    position: absolute;
    right: 30px;
    bottom: 25px;
    color: rgba(196, 232, 246, 0.58);
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.57rem;
    line-height: 1.65;
    text-align: right;
    letter-spacing: 0.12em;
}

.profile-section {
    margin-top: 32px;
    padding: clamp(27px, 4vw, 44px);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
}

.section-heading {
    margin-bottom: 25px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 350;
    letter-spacing: -0.04em;
}

.section-heading > p {
    max-width: 360px;
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.65;
    text-align: right;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.profile-card {
    position: relative;
    min-width: 0;
    padding: clamp(23px, 4vw, 34px);
    border: 1px solid var(--line);
    background: var(--paper);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.profile-card.is-ready:hover {
    transform: translateY(-3px);
    border-color: var(--blue);
    box-shadow: 0 16px 40px rgba(32, 78, 105, 0.1);
}

.profile-card::after {
    position: absolute;
    inset: -1px auto auto -1px;
    width: 74px;
    height: 3px;
    content: "";
    background: var(--blue);
}

.profile-card.is-locked::after {
    background: var(--line-strong);
}

.profile-topline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.15em;
}

.availability {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.availability i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
}

.is-locked .availability i {
    background: var(--line-strong);
}

.avatar,
.mini-avatar {
    display: grid;
    place-items: center;
    color: var(--blue);
    border: 1px solid var(--blue);
    background: var(--soft);
    transform: rotate(45deg);
}

.avatar {
    width: 68px;
    height: 68px;
    margin: 34px 0 27px 7px;
    font-size: 1.75rem;
    font-weight: 300;
}

.avatar > span,
.mini-avatar > span {
    transform: rotate(-45deg);
}

.avatar,
.mini-avatar {
    line-height: 1;
}

.avatar::selection,
.mini-avatar::selection {
    background: transparent;
}

.profile-card h3 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 320;
    letter-spacing: -0.04em;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 23px 0;
}

.profile-stats div {
    padding: 13px 14px;
    border-left: 2px solid var(--line);
    background: var(--soft);
}

.profile-stats dt {
    color: var(--muted);
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.profile-stats dd {
    margin: 4px 0 0;
    font-weight: 700;
    font-size: 0.86rem;
}

.start-form {
    margin: 0;
}

.primary-button,
.choice-button,
.text-button {
    border-radius: 0;
    cursor: pointer;
}

.primary-button {
    width: 100%;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 18px;
    border: 1px solid var(--blue);
    color: #fff;
    background: var(--blue);
    font-size: 0.71rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: background 160ms ease, border-color 160ms ease;
}

.primary-button:hover:not(:disabled) {
    border-color: var(--blue-dark);
    background: var(--blue-dark);
}

.primary-button:disabled {
    cursor: not-allowed;
    border-color: #bbc9d1;
    color: #70818c;
    background: #dce5ea;
}

.unavailable-text {
    min-height: 74px;
    margin: 24px 0;
    color: var(--muted);
    font-size: 0.87rem;
    line-height: 1.65;
}

form[data-submitted="true"] button {
    pointer-events: none;
    opacity: 0.74;
}

.notice {
    margin: 0 0 22px;
    padding: 15px 18px;
    border-left: 3px solid var(--blue);
    color: var(--blue-dark);
    background: #e9f5fc;
    font-size: 0.9rem;
}

.notice-success {
    border-color: var(--green);
    color: #145b43;
    background: var(--green-soft);
}

.notice-error {
    border-color: var(--red);
    color: #8d2939;
    background: var(--red-soft);
}

.notice-info {
    border-color: var(--blue);
}

.game-panel {
    padding: clamp(25px, 5vw, 50px);
    border: 1px solid var(--line);
    background: var(--paper);
    box-shadow: var(--shadow);
}

.game-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 26px;
    border-bottom: 1px solid var(--line);
}

.player-lockup {
    display: flex;
    align-items: center;
    gap: 22px;
}

.mini-avatar {
    width: 52px;
    height: 52px;
    font-size: 1.2rem;
}

.player-lockup .eyebrow {
    margin-bottom: 3px;
}

.player-lockup h1 {
    margin: 0;
    font-size: 2.2rem;
    line-height: 1;
    font-weight: 350;
}

.text-button {
    min-height: 38px;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid var(--line-strong);
    color: var(--blue);
    background: transparent;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.text-button:hover {
    color: var(--blue-dark);
    border-color: var(--blue-dark);
}

.hud {
    margin: 26px 0;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.65fr);
    gap: 18px;
}

.progress-block,
.lives-block {
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid var(--line);
    background: var(--soft);
}

.hud-label {
    margin-bottom: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    color: var(--muted);
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.hud-label strong {
    color: var(--ink);
    font-size: 0.72rem;
}

progress {
    width: 100%;
    height: 8px;
    display: block;
    appearance: none;
    overflow: hidden;
    border: 0;
    background: #d6e2e9;
}

progress::-webkit-progress-bar {
    background: #d6e2e9;
}

progress::-webkit-progress-value {
    background: linear-gradient(90deg, var(--blue), var(--cyan));
}

progress::-moz-progress-bar {
    background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.hearts {
    min-height: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.heart {
    color: var(--red);
    font-size: 1.05rem;
    line-height: 1;
}

.heart.is-lost {
    color: #bdc9d0;
}

.more-lives {
    margin-left: 3px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
}

.question-card {
    padding: clamp(24px, 5vw, 48px);
    border: 1px solid var(--line);
    border-top: 3px solid var(--blue);
    background:
        linear-gradient(130deg, rgba(243, 248, 251, 0.8), rgba(255, 255, 255, 0.94)),
        var(--paper);
}

.question-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
}

.question-text {
    max-width: 900px;
    margin: clamp(31px, 6vw, 58px) 0;
    color: var(--ink);
    font-size: clamp(2.1rem, 6.5vw, 4.8rem);
    line-height: 1.08;
    font-weight: 310;
    letter-spacing: -0.045em;
    overflow-wrap: anywhere;
}

.answer-form label,
.choice-fieldset legend {
    display: block;
    margin: 0 0 10px;
    padding: 0;
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

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

.answer-row input {
    min-width: 0;
    min-height: 54px;
    padding: 13px 17px;
    border: 1px solid var(--line-strong);
    border-radius: 0;
    color: var(--ink);
    background: var(--paper);
}

.answer-row input:focus {
    border-color: var(--blue);
}

.answer-row .primary-button {
    width: auto;
    min-width: 160px;
}

.choice-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
}

.choice-button {
    min-width: 0;
    min-height: 68px;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--line-strong);
    color: var(--ink);
    background: var(--paper);
    text-align: left;
    transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.choice-button:hover {
    transform: translateY(-2px);
    border-color: var(--blue);
    color: var(--blue-dark);
    background: #eef8fd;
}

.choice-button i {
    color: var(--blue);
    font-style: normal;
    font-size: 1.15rem;
}

.end-card {
    min-height: 490px;
    padding: clamp(35px, 7vw, 78px) clamp(24px, 6vw, 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-top: 3px solid var(--blue);
    background: linear-gradient(140deg, #f1f9fd, #fff);
    text-align: center;
}

.end-card h2 {
    max-width: 750px;
    margin: 0;
    font-size: clamp(2.7rem, 7vw, 5.6rem);
    line-height: 1;
    font-weight: 350;
    letter-spacing: -0.055em;
}

.end-card > p:not(.eyebrow):not(.reward-note) {
    max-width: 650px;
    margin: 23px auto;
    color: var(--muted);
}

.end-card form {
    width: min(100%, 360px);
    margin-top: 18px;
}

.end-symbol {
    width: 76px;
    height: 76px;
    margin-bottom: 34px;
    display: grid;
    place-items: center;
    transform: rotate(45deg);
    border: 1px solid var(--blue);
    color: var(--blue);
    background: rgba(8, 120, 189, 0.06);
    font-size: 2.4rem;
    font-weight: 250;
}

.end-game-over {
    border-top-color: var(--red);
    background: linear-gradient(140deg, var(--red-soft), #fff);
}

.end-game-over .eyebrow,
.end-game-over .end-symbol {
    color: var(--red);
    border-color: var(--red);
}

.end-success {
    border-top-color: var(--green);
    background: linear-gradient(140deg, var(--green-soft), #fff);
}

.end-success .eyebrow,
.end-success .end-symbol {
    color: var(--green);
    border-color: var(--green);
}

.end-warning {
    border-top-color: var(--amber);
    background: linear-gradient(140deg, var(--amber-soft), #fff);
}

.end-warning .eyebrow,
.end-warning .end-symbol {
    color: var(--amber);
    border-color: var(--amber);
}

.reward-code {
    max-width: 100%;
    margin: 6px auto 16px;
    padding: 16px 24px;
    display: block;
    overflow-wrap: anywhere;
    border-top: 1px solid #86b9a7;
    border-bottom: 1px solid #86b9a7;
    color: var(--green);
    background: rgba(255, 255, 255, 0.62);
    font-family: Consolas, "Courier New", monospace;
    font-size: clamp(2rem, 7vw, 4.5rem);
    font-weight: 500;
    letter-spacing: 0.08em;
}

.reward-note {
    max-width: 650px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 0.78rem;
}

.footer {
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 8px 0 34px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    font-size: 0.55rem;
    letter-spacing: 0.13em;
}

.footer-admin-link {
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
}

.footer-admin-link:hover {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 4px;
}

@media (max-width: 820px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .hero-visual {
        min-height: 240px;
    }

    .hero h1 {
        font-size: clamp(3rem, 12vw, 5.2rem);
    }

    .hud {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .topbar,
    .shell,
    .footer {
        width: calc(100% - 28px);
    }

    .topbar {
        min-height: 76px;
    }

    .system-state span:last-child {
        display: none;
    }

    .hero-copy {
        padding: 34px 23px;
    }

    .hero h1 {
        font-size: clamp(2.75rem, 14vw, 4.2rem);
    }

    .hero-visual {
        min-height: 205px;
    }

    .orbit-one {
        width: 180px;
        height: 180px;
    }

    .orbit-two {
        width: 250px;
        height: 90px;
    }

    .core {
        width: 92px;
        height: 92px;
    }

    .profile-section,
    .game-panel {
        padding: 22px 17px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-heading > p {
        text-align: left;
    }

    .profile-grid,
    .choice-grid {
        grid-template-columns: 1fr;
    }

    .game-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .answer-row {
        grid-template-columns: 1fr;
    }

    .answer-row .primary-button {
        width: 100%;
    }

    .question-card {
        padding: 25px 18px;
    }

    .question-text {
        margin: 35px 0;
        font-size: clamp(2rem, 11vw, 3.4rem);
    }

    .end-card {
        min-height: 450px;
    }

    .footer {
        flex-direction: column;
        line-height: 1.7;
    }
}

@media (max-width: 390px) {
    .brand strong {
        font-size: 0.82rem;
    }

    .brand small {
        font-size: 0.52rem;
    }

    .brand-mark {
        width: 27px;
        height: 27px;
    }

    .shell {
        margin-top: 26px;
    }

    .rules-strip {
        flex-direction: column;
    }

    .profile-stats {
        grid-template-columns: 1fr;
    }

    .player-lockup {
        gap: 15px;
    }

    .mini-avatar {
        width: 43px;
        height: 43px;
    }
}

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