@font-face {
    font-family: "MiSans";
    src: url("/static/fonts/MiSans-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "MiSans";
    src: url("/static/fonts/MiSans-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "MiSans";
    src: url("/static/fonts/MiSans-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #040608;
    --panel: rgba(11, 16, 20, 0.82);
    --panel-strong: rgba(14, 20, 25, 0.92);
    --line: rgba(65, 214, 255, 0.22);
    --line-strong: rgba(84, 222, 255, 0.7);
    --text: #edf5fa;
    --muted: #8ca4b3;
    --accent: #54deff;
    --accent-soft: #15303a;
    --glow: rgba(54, 181, 255, 0.16);
    --danger: #ff8c7b;
    --font-ui: "MiSans", "MiSans VF", "MiSans Normal", "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
}

body {
    position: relative;
    overflow-x: hidden;
}

.background-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(84, 222, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(84, 222, 255, 0.03) 1px, transparent 1px);
    background-size: 42px 42px;
    pointer-events: none;
}

.background-glow {
    position: fixed;
    width: 42rem;
    height: 42rem;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    opacity: 0.8;
}

.background-glow-a {
    top: -10rem;
    right: -6rem;
    background: rgba(53, 117, 255, 0.15);
}

.background-glow-b {
    bottom: -14rem;
    left: -8rem;
    background: rgba(84, 222, 255, 0.12);
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1240px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.lang-switch {
    position: absolute;
    top: 1.2rem;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.25rem;
    padding: 0.72rem 1rem;
    border: 1px solid rgba(138, 232, 255, 0.36);
    border-radius: 999px;
    background: rgba(7, 16, 22, 0.78);
    color: #f7fbff;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-decoration: none;
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.lang-switch:hover {
    border-color: rgba(138, 232, 255, 0.65);
    background: rgba(12, 24, 31, 0.9);
}

.terminal-shell {
    display: grid;
    gap: 1.4rem;
}

.terminal-header,
.quiz-actions,
.entanglement-grid {
    display: grid;
    gap: 1rem;
}

.terminal-header,
.quiz-actions {
    grid-template-columns: 1fr auto;
    align-items: start;
}

.eyebrow,
.panel-label,
.entanglement-type {
    margin: 0 0 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    color: var(--accent);
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(2.2rem, 4vw, 4.3rem);
    line-height: 1.02;
    font-weight: 700;
}

h2 {
    font-size: clamp(1.6rem, 2vw, 2.4rem);
}

.lead {
    color: #d7e5ef;
    line-height: 1.75;
}

.status-pills,
.mission-strip,
.result-tags,
.quiz-signal,
.action-right {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.status-pills span,
.result-tags span,
.quiz-signal span,
.mission-chip,
.signal-card,
.axis-card,
.entanglement-card {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(19, 29, 35, 0.92), rgba(8, 12, 15, 0.92));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.status-pills span,
.quiz-signal span,
.result-tags span {
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.9rem;
}

.panel {
    position: relative;
    overflow: hidden;
    padding: 1.4rem;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--panel-strong), var(--panel));
    box-shadow: 0 18px 80px rgba(0, 0, 0, 0.35);
}

.panel::after {
    content: "";
    position: absolute;
    inset: auto 1.4rem 1.1rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
    opacity: 0.35;
}

.nickname-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.85rem;
    margin-top: 1.4rem;
}

input,
button,
.primary-link,
.ghost-link {
    border-radius: 0;
    font: inherit;
}

input {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(84, 222, 255, 0.3);
    background: rgba(4, 6, 8, 0.92);
    color: var(--text);
}

input:focus,
button:focus,
.option-button:focus,
.primary-link:focus,
.ghost-link:focus {
    outline: 2px solid rgba(84, 222, 255, 0.45);
    outline-offset: 2px;
}

button,
.primary-link,
.ghost-link,
.option-button {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(27, 41, 47, 1), rgba(8, 13, 16, 1));
    color: var(--text);
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover,
.primary-link:hover,
.ghost-link:hover,
.option-button:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

button,
.primary-link,
.ghost-link {
    padding: 0.9rem 1.2rem;
    text-decoration: none;
}

.ghost-button,
.ghost-link {
    color: var(--muted);
}

.mission-chip,
.signal-card,
.axis-card,
.entanglement-card {
    padding: 0.95rem 1rem;
}

.mission-chip span,
.signal-card span,
.axis-card span {
    display: block;
    color: var(--accent);
    font-size: 0.78rem;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}

.quiz-panel {
    gap: 1.4rem;
}

.quiz-meta,
.quiz-body {
    display: grid;
    gap: 1rem;
}

.progress-block {
    min-width: min(22rem, 100%);
}

.progress-block span {
    display: inline-block;
    margin-bottom: 0.45rem;
    color: var(--muted);
}

.progress-bar {
    width: 100%;
    height: 10px;
    border: 1px solid var(--line);
    background: rgba(84, 222, 255, 0.06);
}

.progress-bar div {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(84, 222, 255, 0.3), rgba(84, 222, 255, 0.95));
}

.question-prompt {
    font-size: clamp(1.45rem, 2vw, 2.2rem);
    line-height: 1.45;
}

.options {
    display: grid;
    gap: 0.8rem;
}

.option-button {
    width: 100%;
    padding: 1rem 1.1rem;
    text-align: left;
    line-height: 1.65;
}

.option-button.is-selected {
    border-color: var(--line-strong);
    background: linear-gradient(180deg, rgba(22, 49, 58, 1), rgba(9, 15, 19, 1));
}

.hint-text {
    color: var(--muted);
}

.hint-text:empty {
    display: none;
}

.quiz-actions {
    align-items: center;
}

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

.result-hero {
    display: grid;
    gap: 1.2rem;
}

.hero-copy {
    display: grid;
    gap: 0.95rem;
}

.result-heading-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.7rem 1rem;
}

.hero-image {
    width: 100%;
    min-height: 24rem;
    object-fit: cover;
    border: 1px solid var(--line);
}

.result-galaxy-name {
    font-size: clamp(2rem, 2.8vw, 3rem);
    line-height: 1.02;
}

.result-personality {
    font-size: clamp(1.45rem, 2.1vw, 2.1rem);
    line-height: 1.05;
    font-weight: 700;
    color: var(--accent);
}

.result-connection {
    color: #f2f7fb;
    font-size: 1.08rem;
    line-height: 1.9;
}

.result-description {
    display: grid;
    gap: 1rem;
}

.result-description-toggle {
    margin-top: 0;
}

.result-description-panel {
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(16, 25, 30, 0.9), rgba(8, 12, 15, 0.84));
}

.result-description-panel[hidden] {
    display: none;
}

.result-description-copy {
    color: #cedce6;
    line-height: 1.8;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.2rem;
}

.result-actions .primary-link,
.result-actions .ghost-link,
.result-actions .ghost-button {
    color: #f6fbff;
}

.result-shell-surprise .status-pills span:last-child {
    border-color: rgba(188, 115, 255, 0.45);
    color: #d7b0ff;
}

.landing-shell,
.quiz-page-shell,
.result-shell,
.explore-shell {
    max-width: 980px;
    margin: 0 auto;
}

.landing-panel {
    max-width: 760px;
    margin: 0 auto;
}

.landing-acknowledgements {
    width: min(38rem, 100%);
    margin-right: auto;
    text-align: left;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.75;
    opacity: 0.9;
}

.landing-acknowledgements p + p {
    margin-top: 0.35rem;
}

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

.explore-intro {
    padding: 1.2rem 1.4rem;
}

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

.explore-card {
    display: grid;
    gap: 0.85rem;
    padding: 0.85rem;
}

.explore-card:nth-child(1) {
    grid-column: span 12;
}

.explore-card:nth-child(2),
.explore-card:nth-child(3),
.explore-card:nth-child(4),
.explore-card:nth-child(5) {
    grid-column: span 6;
}

.explore-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border: 1px solid var(--line);
    background: rgba(84, 222, 255, 0.03);
}

.explore-card:nth-child(1) .explore-image {
    aspect-ratio: 16 / 7;
}

.explore-copy {
    display: grid;
    gap: 0.35rem;
}

.explore-caption {
    color: #d5e2ea;
    line-height: 1.55;
    word-break: break-word;
}

.explore-actions {
    margin-top: 0.1rem;
}

.entanglement-card strong {
    display: block;
    font-size: 1.3rem;
    margin-bottom: 0.15rem;
}

.entanglement-card em {
    display: block;
    color: var(--muted);
    margin-bottom: 0.95rem;
    font-style: normal;
}

.entanglement-card p {
    color: #cedce6;
    line-height: 1.75;
}

.entanglement-percent {
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.entanglement-meter {
    height: 10px;
    margin-bottom: 0.9rem;
    border: 1px solid var(--line);
    background: rgba(84, 222, 255, 0.05);
}

.entanglement-meter b {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 140, 123, 0.35), rgba(84, 222, 255, 0.92));
}

.fireworks-layer {
    position: fixed;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    overflow: hidden;
}

.firework-burst {
    position: absolute;
    width: 0;
    height: 0;
}

.firework-particle {
    position: absolute;
    left: 0;
    top: 0;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    box-shadow: 0 0 16px currentColor;
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
    animation: firework-burst 1.08s cubic-bezier(0.14, 0.8, 0.22, 1) forwards;
}

@keyframes firework-burst {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.15);
    }

    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(
            calc(-50% + var(--dx)),
            calc(-50% + var(--dy))
        ) scale(var(--scale, 1));
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 960px) {
    .entanglement-grid,
    .terminal-header,
    .quiz-actions {
        grid-template-columns: 1fr;
    }

    .nickname-form {
        grid-template-columns: 1fr;
    }

    .progress-block {
        min-width: 0;
    }

    .result-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

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

    .explore-card:nth-child(1),
    .explore-card:nth-child(2),
    .explore-card:nth-child(3),
    .explore-card:nth-child(4),
    .explore-card:nth-child(5) {
        grid-column: auto;
    }

    .explore-card:nth-child(1) .explore-image {
        aspect-ratio: 16 / 10;
    }

    .primary-link,
    .ghost-link {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 640px) {
    body {
        -webkit-text-size-adjust: 100%;
    }

    .page-shell {
        width: min(100% - 1rem, 100%);
        padding: 0.85rem 0 calc(1.2rem + env(safe-area-inset-bottom, 0px));
    }

    .panel {
        padding: 1rem;
    }

    .panel::after {
        inset: auto 1rem 0.9rem;
    }

    h1 {
        line-height: 1.12;
    }

    .eyebrow,
    .panel-label,
    .entanglement-type {
        letter-spacing: 0.1em;
    }

    .status-pills,
    .quiz-signal {
        gap: 0.55rem;
    }

    .status-pills span,
    .quiz-signal span {
        width: 100%;
        border-radius: 0;
        text-align: center;
    }

    .landing-panel {
        padding-bottom: 1.15rem;
    }

    .landing-acknowledgements {
        width: 100%;
        font-size: 0.78rem;
        line-height: 1.7;
        margin-right: 0;
        text-align: left;
    }

    .nickname-form {
        gap: 0.75rem;
    }

    input,
    button,
    .primary-link,
    .ghost-link {
        font-size: 16px;
        min-height: 3.25rem;
    }

    .question-prompt {
        font-size: 1.25rem;
        line-height: 1.6;
    }

    .quiz-body {
        padding-bottom: 5.6rem;
    }

    .option-button {
        padding: 1rem;
        line-height: 1.7;
        font-size: 0.98rem;
    }

    .progress-bar {
        height: 12px;
    }

    .hero-image {
        aspect-ratio: 4 / 3;
        min-height: 15rem;
    }

    .explore-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .explore-card {
        padding: 0.75rem;
    }

    .explore-image,
    .explore-card:nth-child(1) .explore-image {
        aspect-ratio: 4 / 3;
    }

    .result-actions {
        gap: 0.65rem;
    }

    .result-heading-row {
        align-items: flex-start;
    }

    .result-description-toggle {
        width: 100%;
    }

    .quiz-actions-single {
        position: sticky;
        bottom: 0;
        z-index: 3;
        margin: 0 -1rem -1rem;
        padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
        background: linear-gradient(180deg, rgba(4, 6, 8, 0), rgba(4, 6, 8, 0.94) 28%, rgba(4, 6, 8, 0.99));
        border-top: 1px solid rgba(84, 222, 255, 0.14);
    }

    .quiz-actions-single button {
        width: 100%;
    }

    .entanglement-grid {
        gap: 0.85rem;
    }

    .entanglement-card {
        padding: 0.9rem;
    }

    .entanglement-card strong {
        font-size: 1.12rem;
    }
}
