@import url("https://fonts.googleapis.com/css2?family=ZCOOL+XiaoWei&family=Noto+Sans+SC:wght@300;400;500;700&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
    --bg: #08080e;
    --s1: #0e0e1a;
    --s2: #141424;
    --s3: #1a1a2e;
    --accent: #8b5cf6;
    --accent2: #a78bfa;
    --glow: #c4b5fd;
    --neon: #7c3aed;
    --text: #ede9ff;
    --muted: #6d6a8a;
    --line: rgba(139, 92, 246, 0.15);
    --linew: rgba(255, 255, 255, 0.05);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Noto Sans SC", sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

.page {
    position: relative;
    z-index: 1;
}

/* ==============================
   蠕动蛆背景 Canvas
============================== */
#worm-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
}

/* 前景渐变遮罩，让内容更易读 */
.page-overlay {
    position: fixed;
    inset: 0;
    background: 
    radial-gradient(ellipse 55% 50% at 50% 50%, rgba(8, 8, 14, 0.3) 0%, rgba(8, 8, 14, 0.5) 100%);
    pointer-events: none;
    z-index: 0;
}

/* ==============================
   INTRO
============================== */
#intro {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    position: relative;
    z-index: 1;
}

.intro-badge {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--glow);
    border: 1px solid rgba(196, 181, 253, 0.25);
    background: rgba(139, 92, 246, 0.08);
    padding: 0.4rem 1.2rem;
    border-radius: 999px;
    margin-bottom: 2.5rem;
    animation: fadeUp 0.6s ease both;
}

.intro-title {
    font-family: "ZCOOL XiaoWei", serif;
    font-size: clamp(4.5rem, 13vw, 10rem);
    line-height: 0.9;
    margin-bottom: 1rem;
    animation: fadeUp 0.6s 0.1s ease both;
    background: linear-gradient(160deg, #fff 20%, var(--glow) 55%, var(--accent) 90%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 40px rgba(139, 92, 246, 0.4));
}

.intro-sub {
    font-size: 0.95rem;
    color: var(--muted);
    max-width: 400px;
    line-height: 1.9;
    margin: 1.5rem 0 2.5rem;
    animation: fadeUp 0.6s 0.2s ease both;
}

.intro-sub em {
    color: var(--glow);
    font-style: normal;
}

.intro-stats {
    display: flex;
    gap: 0;
    margin-bottom: 3rem;
    animation: fadeUp 0.6s 0.3s ease both;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(139, 92, 246, 0.04);
    backdrop-filter: blur(12px);
}

.stat-item {
    flex: 1;
    padding: 1.1rem 1.5rem;
    text-align: center;
    border-right: 1px solid var(--line);
}
.stat-item:last-child {
    border-right: none;
}

.stat-num {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--glow);
    display: block;
    line-height: 1;
}

.stat-label {
    font-size: 0.62rem;
    color: var(--muted);
    margin-top: 0.4rem;
    letter-spacing: 0.04em;
    display: block;
}

.btn-start {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--neon), var(--accent2));
    color: #fff;
    border: none;
    padding: 1rem 3.5rem;
    border-radius: 999px;
    cursor: pointer;
    animation: fadeUp 0.6s 0.4s ease both;
    transition:
        transform 0.2s,
        box-shadow 0.2s,
        filter 0.2s;
    box-shadow:
        0 0 30px rgba(124, 58, 237, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    position: relative;
    overflow: hidden;
}

.btn-start::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.08);
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 999px;
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 55px rgba(124, 58, 237, 0.65),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    filter: brightness(1.1);
}
.btn-start:hover::after {
    opacity: 1;
}
.btn-start:active {
    transform: translateY(0);
}

.warning-text {
    margin-top: 1.5rem;
    font-size: 0.68rem;
    color: rgba(139, 92, 246, 0.4);
    animation: fadeUp 0.6s 0.5s ease both;
    letter-spacing: 0.05em;
}

/* ==============================
   QUIZ
============================== */
#quiz {
    display: none;
    min-height: 100vh;
    padding: 2.5rem 1rem 5rem;
    position: relative;
    z-index: 1;
}

.quiz-header {
    max-width: 720px;
    margin: 0 auto 2.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.quiz-progress-wrap {
    flex: 1;
}

.quiz-progress-label {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.68rem;
    color: var(--muted);
    margin-bottom: 0.7rem;
    display: flex;
    justify-content: space-between;
    letter-spacing: 0.04em;
}

.quiz-progress-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: visible;
    position: relative;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon), var(--accent2));
    border-radius: 999px;
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.quiz-progress-fill::after {
    content: "";
    position: absolute;
    right: -3px;
    top: -3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--glow);
    box-shadow:
        0 0 10px var(--accent2),
        0 0 20px var(--accent);
}

.quiz-category-badge {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.62rem;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.cat-A {
    background: rgba(251, 146, 60, 0.1);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.2);
}
.cat-B {
    background: rgba(96, 165, 250, 0.1);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.2);
}
.cat-C {
    background: rgba(52, 211, 153, 0.1);
    color: #6ee7b7;
    border: 1px solid rgba(52, 211, 153, 0.2);
}
.cat-D {
    background: rgba(244, 114, 182, 0.1);
    color: #f9a8d4;
    border: 1px solid rgba(244, 114, 182, 0.2);
}
.cat-E {
    background: rgba(167, 139, 250, 0.1);
    color: #c4b5fd;
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.question-card {
    max-width: 720px;
    margin: 0 auto;
    background: rgba(14, 14, 26, 0.75);
    backdrop-filter: blur(20px);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 2.5rem 2.5rem 2rem;
    position: relative;
    overflow: hidden;
}

.question-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent2), var(--glow), transparent);
    opacity: 0.6;
}

.question-num {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.65rem;
    color: var(--accent2);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 1.2rem;
}

.question-text {
    font-size: 1.15rem;
    line-height: 1.75;
    margin-bottom: 2rem;
    font-weight: 400;
    color: var(--text);
}

.options-grid {
    display: grid;
    gap: 0.65rem;
}

.option-btn {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--muted);
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    font-family: "Noto Sans SC", sans-serif;
    transition: all 0.18s ease;
    line-height: 1.5;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.option-btn:hover {
    border-color: rgba(139, 92, 246, 0.45);
    background: rgba(139, 92, 246, 0.07);
    color: var(--text);
    transform: translateX(3px);
}

.option-btn.selected {
    border-color: var(--accent2);
    background: rgba(139, 92, 246, 0.13);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.2);
}

.option-btn.selected::after {
    content: "✓";
    position: absolute;
    right: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--glow);
    font-size: 0.85rem;
    font-weight: 700;
}

.option-label {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: rgba(139, 92, 246, 0.5);
    min-width: 1.1rem;
    padding-top: 0.18rem;
    flex-shrink: 0;
    transition: color 0.18s;
}

.option-btn:hover .option-label,
.option-btn.selected .option-label {
    color: var(--accent2);
}

.quiz-nav {
    max-width: 720px;
    margin: 1.5rem auto 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.btn-nav {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--muted);
    padding: 0.65rem 1.5rem;
    border-radius: 999px;
    cursor: pointer;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.18s;
}
.btn-nav:hover {
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--text);
}
.btn-nav:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.btn-next {
    background: linear-gradient(135deg, var(--neon), var(--accent2));
    border: none;
    color: #fff;
    padding: 0.65rem 2.2rem;
    border-radius: 999px;
    cursor: pointer;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: all 0.18s;
    box-shadow: 0 0 18px rgba(124, 58, 237, 0.35);
}
.btn-next:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.5);
}
.btn-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

#answered-count {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.04em;
}

.anti-cheat-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: rgba(14, 14, 26, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: var(--glow);
    padding: 0.75rem 1.6rem;
    border-radius: 999px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.8rem;
    z-index: 999;
    transition: transform 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    backdrop-filter: blur(12px);
}
.anti-cheat-toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ==============================
   RESULT
============================== */
#result {
    display: none;
    min-height: 100vh;
    padding: 4rem 1.5rem;
    position: relative;
    z-index: 1;
}

.result-wrap {
    max-width: 680px;
    margin: 0 auto;
    text-align: center;
}

.result-level-badge {
    display: inline-block;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 0.4rem 1.2rem;
    border-radius: 999px;
    margin-bottom: 2rem;
}

.result-creature {
    font-size: 5.5rem;
    display: block;
    margin-bottom: 1rem;
    animation: wormPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.6));
}

@keyframes wormPop {
    0% {
        transform: scale(0.2) rotate(-15deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.15) rotate(5deg);
    }
    75% {
        transform: scale(0.95) rotate(-2deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.result-title {
    font-family: "ZCOOL XiaoWei", serif;
    font-size: clamp(2.2rem, 6vw, 4rem);
    line-height: 1.1;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #fff 30%, var(--glow) 70%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 分数环 */
.result-score-ring {
    width: 180px;
    height: 180px;
    margin: 2rem auto;
    position: relative;
}
.result-score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.result-score-ring .ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 10;
}
.result-score-ring .ring-fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-score-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.result-score-num {
    font-family: "Space Grotesk", sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1;
    color: var(--glow);
}

.result-score-label {
    font-size: 0.65rem;
    color: var(--muted);
    margin-top: 0.25rem;
    letter-spacing: 0.08em;
}

.result-desc {
    font-size: 1rem;
    line-height: 1.9;
    color: var(--muted);
    margin: 1.5rem auto 2.5rem;
    max-width: 520px;
}

/* 维度卡片 */
.dimension-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem;
    margin: 0 0 2rem;
    text-align: left;
}

.dim-card {
    background: rgba(14, 14, 26, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
}

.dim-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.8rem;
}
.dim-icon {
    font-size: 1.1rem;
}
.dim-name {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
}

.dim-bar-wrap {
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.45rem;
}
.dim-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
}
.dim-score-text {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.68rem;
    color: var(--muted);
}

.dim-comment {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0.5rem 0 2rem;
    text-align: left;
    opacity: 0;
    transition: opacity 0.6s ease 0.7s;
}

.dim-comment-top {
    display: block;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--text);
    padding: 1rem 1.2rem;
    background: rgba(139, 92, 246, 0.07);
    border: 1px solid rgba(139, 92, 246, 0.18);
    border-radius: 12px;
    border-left: 3px solid var(--accent2);
}

.dim-comment-low {
    display: block;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--muted);
    padding: 0.8rem 1.2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--linew);
    border-radius: 12px;
}

.self-coef-tag {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.68rem;
    color: rgba(196, 181, 253, 0.5);
    border: 1px solid rgba(139, 92, 246, 0.15);
    background: rgba(139, 92, 246, 0.05);
    padding: 0.4rem 1rem;
    border-radius: 999px;
    display: inline-block;
    margin-bottom: 2.5rem;
    opacity: 0;
    transition: opacity 0.6s ease 1.2s;
    letter-spacing: 0.03em;
}

.result-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.btn-retry {
    background: linear-gradient(135deg, var(--neon), var(--accent2));
    border: none;
    color: #fff;
    padding: 0.85rem 2.2rem;
    border-radius: 999px;
    cursor: pointer;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    transition: all 0.2s;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.35);
}
.btn-retry:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.55);
}

.btn-share {
    background: transparent;
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: var(--muted);
    padding: 0.85rem 2.2rem;
    border-radius: 999px;
    cursor: pointer;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-share:hover {
    border-color: rgba(139, 92, 246, 0.5);
    color: var(--text);
}

.copied-tip {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.7rem;
    color: #6ee7b7;
    margin-top: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s;
    letter-spacing: 0.05em;
}
.copied-tip.show {
    opacity: 1;
}

/* ==============================
   ANIMATIONS
============================== */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.question-card.entering {
    animation: slideIn 0.28s ease;
}

@keyframes glitch {
    0% {
        transform: translateX(0);
        filter: none;
    }
    20% {
        transform: translateX(-4px);
        filter: hue-rotate(90deg);
    }
    40% {
        transform: translateX(4px);
    }
    60% {
        transform: translateX(-2px);
        filter: hue-rotate(-90deg);
    }
    80% {
        transform: translateX(2px);
    }
    100% {
        transform: translateX(0);
        filter: none;
    }
}
.result-title.glitch {
    animation: glitch 0.4s ease;
}

@media (max-width: 600px) {
    .dimension-grid {
        grid-template-columns: 1fr;
    }
    .question-card {
        padding: 1.8rem 1.2rem 1.5rem;
    }
    .intro-stats {
        flex-wrap: wrap;
    }
    .stat-item {
        min-width: 40%;
    }
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
}
