:root {
    --bg: #020914;
    --panel: rgba(4, 18, 32, 0.88);
    --panel-soft: rgba(6, 27, 45, 0.72);
    --cyan: #00eaff;
    --cyan-soft: rgba(0, 234, 255, 0.24);
    --pink: #ff3e96;
    --green: #38f2b1;
    --text: #edfaff;
    --muted: #8ba9b9;
    --line: rgba(0, 234, 255, 0.22);
    --mono: "Courier New", "SFMono-Regular", Consolas, monospace;
    --sans: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: var(--sans);
    background:
        linear-gradient(rgba(1, 9, 18, 0.68), rgba(1, 9, 18, 0.86)),
        url("../assets/backgrounds/bg_boot_dark_1920.webp") center / cover fixed;
}

button,
a {
    font: inherit;
}

button {
    cursor: pointer;
}

.test-shell {
    position: relative;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    overflow: hidden;
    isolation: isolate;
}

.test-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.025) 0,
        rgba(255, 255, 255, 0.025) 1px,
        transparent 2px,
        transparent 5px
    );
}

.ambient-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.2;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 234, 255, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 234, 255, 0.07) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 80%, transparent);
}

.test-header,
.test-footer {
    display: flex;
    width: min(1180px, calc(100% - 48px));
    margin-inline: auto;
    align-items: center;
    justify-content: space-between;
}

.test-header {
    min-height: 92px;
    padding-block: 18px;
    border-bottom: 1px solid var(--line);
}

.brand-link {
    display: block;
    width: min(280px, 44vw);
}

.brand-link img {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 16px rgba(0, 234, 255, 0.35));
}

.system-state {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--cyan);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.14em;
}

.state-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 12px var(--green);
}

.test-screen {
    display: none;
    width: min(1050px, calc(100% - 48px));
    margin: auto;
    padding-block: 42px;
}

.test-screen.is-active {
    display: block;
    animation: screen-in 0.42s ease both;
}

.exit-test-link {
    display: inline-flex;
    min-height: 38px;
    margin: 0 0 18px;
    padding: 9px 14px;
    align-items: center;
    justify-content: center;
    color: rgba(237, 250, 255, 0.76);
    border: 1px solid rgba(0, 234, 255, 0.28);
    border-radius: 6px;
    background: rgba(0, 18, 32, 0.52);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-decoration: none;
    box-shadow: inset 0 0 18px rgba(0, 234, 255, 0.05);
}

.exit-test-link:hover {
    color: var(--cyan);
    border-color: rgba(0, 234, 255, 0.52);
    background: rgba(0, 234, 255, 0.08);
}

@keyframes screen-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.screen-copy {
    max-width: 760px;
    margin: 0 auto 34px;
    text-align: center;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--cyan);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.18em;
}

.screen-copy h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 64px);
    line-height: 1.12;
    letter-spacing: 0;
    text-shadow: 0 0 26px rgba(0, 234, 255, 0.28);
}

.screen-copy > p:last-child {
    margin: 18px 0 0;
    color: rgba(237, 250, 255, 0.72);
    font-size: 17px;
}

.identity-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    max-width: 820px;
    margin: 0 auto 28px;
}

.identity-card {
    position: relative;
    min-height: 230px;
    padding: 28px;
    overflow: hidden;
    color: var(--text);
    text-align: left;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(8, 31, 49, 0.92), rgba(3, 13, 25, 0.94));
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.identity-card::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -70px;
    width: 190px;
    height: 190px;
    border: 1px solid rgba(0, 234, 255, 0.1);
    border-radius: 50%;
}

.identity-card:hover,
.identity-card[aria-checked="true"] {
    transform: translateY(-3px);
    border-color: rgba(0, 234, 255, 0.78);
    box-shadow: 0 0 28px rgba(0, 234, 255, 0.14), inset 0 0 28px rgba(0, 234, 255, 0.05);
}

.identity-card[aria-checked="true"]::before {
    content: "CHANNEL LOCKED";
    position: absolute;
    top: 16px;
    right: 18px;
    color: var(--green);
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.12em;
}

.identity-code {
    display: block;
    margin-bottom: 34px;
    color: var(--cyan);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.16em;
}

.identity-card strong {
    display: block;
    margin-bottom: 10px;
    font-size: 34px;
}

.identity-card span:not(.identity-code) {
    display: block;
    color: rgba(237, 250, 255, 0.72);
    font-size: 15px;
}

.identity-card em {
    display: inline-block;
    margin-top: 24px;
    color: var(--cyan);
    font-family: var(--mono);
    font-size: 11px;
    font-style: normal;
    letter-spacing: 0.08em;
}

.primary-action,
.secondary-action,
.text-action {
    min-height: 52px;
    border-radius: 6px;
}

.primary-action {
    display: flex;
    width: min(420px, 100%);
    min-height: 60px;
    margin-inline: auto;
    padding: 10px 24px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #001019;
    font-weight: 800;
    border: 1px solid var(--cyan);
    background: var(--cyan);
    box-shadow: 0 0 26px rgba(0, 234, 255, 0.25);
}

.primary-action span {
    margin-top: 2px;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.12em;
}

.primary-action:disabled {
    cursor: not-allowed;
    color: rgba(180, 205, 215, 0.42);
    border-color: rgba(139, 169, 185, 0.2);
    background: rgba(10, 25, 37, 0.72);
    box-shadow: none;
}

.question-status {
    display: grid;
    grid-template-columns: auto minmax(160px, 1fr) auto;
    gap: 20px;
    margin-bottom: 22px;
    align-items: center;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
}

.question-status > div:first-child {
    display: flex;
    gap: 12px;
}

.question-status strong {
    color: var(--text);
}

.progress-track {
    height: 4px;
    overflow: hidden;
    background: rgba(139, 169, 185, 0.15);
}

#progress-fill {
    width: 0;
    height: 100%;
    background: var(--cyan);
    box-shadow: 0 0 14px var(--cyan);
    transition: width 0.3s ease;
}

.question-panel {
    min-height: 560px;
    padding: clamp(28px, 5vw, 60px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(150deg, rgba(4, 22, 38, 0.96), rgba(2, 10, 20, 0.94));
    box-shadow: 0 18px 80px rgba(0, 0, 0, 0.35);
}

.question-panel h2 {
    max-width: 820px;
    margin: 0;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.28;
}

.question-prompt {
    margin: 14px 0 30px;
    color: rgba(237, 250, 255, 0.64);
    font-size: 16px;
}

.question-options {
    display: grid;
    gap: 12px;
}

.option-button {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 66px;
    padding: 13px 18px;
    align-items: center;
    color: rgba(237, 250, 255, 0.92);
    text-align: left;
    border: 1px solid rgba(0, 234, 255, 0.18);
    border-radius: 6px;
    background: rgba(4, 17, 30, 0.76);
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.option-button:hover,
.option-button:focus-visible {
    transform: translateX(4px);
    border-color: rgba(0, 234, 255, 0.7);
    background: rgba(0, 234, 255, 0.08);
    outline: none;
}

.option-index {
    color: var(--cyan);
    font-family: var(--mono);
    font-size: 12px;
}

.result-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.7fr);
    gap: 18px;
}

.result-report,
.result-actions {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.result-report {
    position: relative;
    overflow: hidden;
    padding: clamp(28px, 3.4vw, 42px) clamp(34px, 4.4vw, 56px);
}

.result-report::before {
    content: "";
    position: absolute;
    inset: 86px 8% auto;
    height: 360px;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 46%, rgba(0, 234, 255, 0.18), transparent 34%),
        radial-gradient(circle at 50% 64%, rgba(255, 62, 150, 0.12), transparent 30%);
    filter: blur(10px);
    opacity: 0.9;
}

.result-heading {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    color: rgba(237, 250, 255, 0.72);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
}

.result-heading span:last-child {
    color: var(--cyan);
}

.energy-readout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr);
    gap: 24px;
    margin: 30px 0 18px;
    align-items: end;
}

.result-illustration {
    position: relative;
    z-index: 1;
    width: min(440px, 76%);
    margin: 4px auto 16px;
    display: flex;
    height: 292px;
    overflow: visible;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.result-illustration::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 8px;
    width: 78%;
    height: 34%;
    z-index: -1;
    border-radius: 999px;
    background:
        radial-gradient(ellipse at center, rgba(0, 234, 255, 0.26), rgba(0, 234, 255, 0.08) 46%, transparent 72%);
    filter: blur(8px);
    transform: translateX(-50%);
}

.result-illustration::after {
    content: "";
    position: absolute;
    left: 16%;
    right: 16%;
    bottom: 18px;
    height: 1px;
    z-index: -1;
    background: linear-gradient(90deg, transparent, rgba(0, 234, 255, 0.42), transparent);
}

.result-illustration img {
    display: block;
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 292px;
    object-fit: contain;
    object-position: center center;
    filter:
        drop-shadow(0 0 18px rgba(0, 234, 255, 0.32))
        drop-shadow(0 18px 22px rgba(0, 0, 0, 0.38));
}

.energy-readout span {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 13px;
}

.energy-readout strong {
    color: var(--text);
    font-family: var(--mono);
    font-size: 28px;
}

.energy-readout b {
    color: var(--cyan);
    font-size: 56px;
    text-shadow: 0 0 24px rgba(0, 234, 255, 0.38);
}

.battery-shell {
    height: 14px;
    padding: 2px;
    border: 1px solid rgba(0, 234, 255, 0.38);
    background: rgba(0, 0, 0, 0.42);
}

#battery-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--pink), var(--cyan), var(--green));
    box-shadow: 0 0 12px rgba(0, 234, 255, 0.48);
    transition: width 0.8s ease;
}

.result-label {
    position: relative;
    z-index: 1;
    margin: 6px 0 8px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.1em;
}

#result-name {
    position: relative;
    z-index: 1;
    margin: 0;
    color: var(--cyan);
    font-size: clamp(48px, 7vw, 82px);
    line-height: 1.06;
    text-shadow: 0 0 28px rgba(0, 234, 255, 0.38);
}

.result-diagnosis {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 18px 0 22px;
    color: rgba(237, 250, 255, 0.9);
    font-size: clamp(18px, 2vw, 24px);
    line-height: 1.7;
}

.result-tags {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.result-tags span {
    padding: 8px 14px;
    color: var(--cyan);
    border: 1px solid rgba(0, 234, 255, 0.48);
    border-radius: 999px;
    background: rgba(0, 234, 255, 0.07);
    font-size: 14px;
}

.result-tags span:first-child {
    color: var(--green);
    border-color: rgba(56, 242, 177, 0.55);
}

.result-tags span:last-child {
    color: var(--pink);
    border-color: rgba(255, 62, 150, 0.55);
}

.result-actions {
    display: flex;
    padding: 30px;
    flex-direction: column;
    justify-content: center;
}

.result-actions h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.42;
}

.result-actions > p:not(.eyebrow):not(.result-feedback) {
    margin: 12px 0 28px;
    color: var(--muted);
    line-height: 1.7;
}

.result-actions .primary-action {
    width: 100%;
    margin-bottom: 10px;
}

.result-feedback {
    min-height: 22px;
    margin: 14px 0 0;
    color: var(--green);
    text-align: center;
    font-size: 12px;
    line-height: 1.55;
}

.secondary-action {
    width: 100%;
    padding: 10px 18px;
    color: var(--cyan);
    font-weight: 700;
    border: 1px solid rgba(0, 234, 255, 0.42);
    background: rgba(0, 234, 255, 0.06);
}

.text-action {
    width: 100%;
    padding: 10px 18px;
    color: rgba(237, 250, 255, 0.66);
    border: 0;
    background: transparent;
}

.test-footer {
    min-height: 62px;
    padding-block: 16px;
    color: rgba(139, 169, 185, 0.7);
    border-top: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.14em;
}

.test-footer strong {
    color: var(--cyan);
    font-weight: 500;
}

.share-dialog {
    width: min(460px, calc(100% - 28px));
    max-height: calc(100dvh - 28px);
    padding: 18px;
    color: var(--text);
    border: 1px solid rgba(0, 234, 255, 0.45);
    border-radius: 8px;
    background: #04101d;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.7);
}

.share-dialog::backdrop {
    background: rgba(0, 4, 10, 0.84);
    backdrop-filter: blur(8px);
}

.share-dialog-head {
    display: flex;
    margin-bottom: 14px;
    align-items: center;
    justify-content: space-between;
}

.share-dialog-head span,
.share-dialog-head strong {
    display: block;
}

.share-dialog-head span {
    color: var(--cyan);
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.15em;
}

.share-dialog-head strong {
    margin-top: 4px;
}

#close-share {
    width: 36px;
    height: 36px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 4px;
    background: transparent;
    font-size: 24px;
}

.share-preview {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #020914;
}

.share-preview img {
    display: block;
    width: 100%;
    max-height: 58dvh;
    object-fit: contain;
}

.share-dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.share-dialog-actions .primary-action {
    width: 100%;
    min-height: 52px;
}

.share-dialog-actions .text-action {
    grid-column: 1 / -1;
}

.share-feedback {
    min-height: 20px;
    margin: 4px 0 0;
    color: var(--green);
    text-align: center;
    font-size: 12px;
}

.quick-toast {
    position: fixed;
    left: 50%;
    bottom: max(28px, env(safe-area-inset-bottom));
    z-index: 30;
    max-width: min(460px, calc(100% - 36px));
    padding: 12px 18px;
    color: var(--green);
    border: 1px solid rgba(56, 242, 177, 0.44);
    border-radius: 999px;
    background: rgba(2, 12, 22, 0.92);
    box-shadow: 0 0 28px rgba(56, 242, 177, 0.16);
    font-size: 13px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.quick-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 760px) {
    .test-header,
    .test-footer,
    .test-screen {
        width: min(100% - 28px, 620px);
    }

    .test-header {
        min-height: 72px;
        padding-block: 12px;
    }

    .brand-link {
        width: min(210px, 58vw);
    }

    .system-state {
        font-size: 8px;
        letter-spacing: 0.08em;
    }

    .test-screen {
        padding-block: 24px;
    }

    .exit-test-link {
        width: 100%;
        margin-bottom: 14px;
        font-size: 11px;
    }

    .screen-copy {
        margin-bottom: 24px;
    }

    .screen-copy h1 {
        font-size: clamp(32px, 10vw, 46px);
    }

    .screen-copy > p:last-child {
        font-size: 14px;
    }

    .identity-options,
    .result-layout {
        grid-template-columns: 1fr;
    }

    .identity-card {
        min-height: 158px;
        padding: 20px;
    }

    .identity-code {
        margin-bottom: 18px;
    }

    .identity-card strong {
        font-size: 27px;
    }

    .identity-card em {
        margin-top: 14px;
    }

    .question-status {
        grid-template-columns: 1fr auto;
        gap: 10px;
    }

    .progress-track {
        grid-row: 2;
        grid-column: 1 / -1;
    }

    .question-panel {
        min-height: 0;
        padding: 24px 18px;
    }

    .question-panel h2 {
        font-size: 27px;
    }

    .option-button {
        min-height: 62px;
        padding-inline: 14px;
    }

    .result-report {
        padding: 24px 18px 28px;
    }

    .result-report::before {
        inset: 92px 4% auto;
        height: 300px;
    }

    .energy-readout {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 24px 0 30px;
    }

    .energy-readout b {
        font-size: 46px;
    }

    .result-illustration {
        width: min(320px, 88%);
        height: 236px;
        margin: 2px auto 16px;
        padding: 0;
    }

    .result-illustration img {
        max-width: 100%;
        max-height: 236px;
    }

    #result-name {
        font-size: clamp(42px, 13vw, 62px);
    }

    .result-diagnosis {
        font-size: 18px;
    }

    .result-actions {
        padding: 24px 18px;
    }

    .test-footer {
        min-height: 52px;
    }
}

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