/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #e0e0e0;
    overflow: hidden;
}

/* 加载界面 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 1s ease;
}

.loading-overlay.done {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-text {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.loading-hint {
    font-size: 12px;
    color: #444;
    margin-top: 10px;
    min-height: 18px;
}

.loading-bar-wrap {
    width: 200px;
    height: 2px;
    background: #222;
    border-radius: 1px;
    overflow: hidden;
}

.loading-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ff6b9d, #c084fc);
    transition: width 0.3s ease;
}

/* 时钟 */
.clock {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 14px;
    color: #666;
    font-family: 'Courier New', monospace;
    z-index: 100;
    transition: color 0.3s ease;
}

.clock.warning {
    color: #ff6b9d;
    animation: clockPulse 1s infinite;
}

.clock.stopped {
    color: #ff4444;
}

@keyframes clockPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 角落弹窗 */
.corner-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    max-width: 250px;
    padding: 12px 16px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(255, 107, 157, 0.3);
    border-radius: 8px;
    font-size: 13px;
    color: #ff6b9d;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    z-index: 200;
    backdrop-filter: blur(10px);
}

.corner-popup.show {
    opacity: 1;
    transform: translateY(0);
}

/* 红光闪烁 */
.red-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(255, 0, 0, 0.1) 100%);
    opacity: 0;
    pointer-events: none;
    z-index: 150;
    transition: opacity 0.2s ease;
}

.red-flash.active {
    opacity: 1;
    animation: redFlash 0.3s ease;
}

@keyframes redFlash {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* VHS噪点 */
.vhs-noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    opacity: 0;
    pointer-events: none;
    z-index: 160;
    transition: opacity 0.5s ease;
}

.vhs-noise.active {
    opacity: 0.3;
}

/* 主测评容器 */
.quiz-container {
    background: rgba(20, 20, 40, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.8s ease;
    transition: all 1s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 头部信息 */
.quiz-header {
    text-align: center;
    margin-bottom: 30px;
}

.quiz-title {
    font-size: 28px;
    font-weight: 300;
    color: #fff;
    margin-bottom: 8px;
    letter-spacing: 4px;
    transition: all 0.5s ease;
}

.quiz-subtitle {
    font-size: 14px;
    color: #888;
    margin-bottom: 24px;
    letter-spacing: 2px;
}

.progress-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#progressText {
    font-size: 13px;
    color: #666;
    letter-spacing: 1px;
}

.progress-bar {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
    overflow: hidden;
}

.progress-fill {
    width: 3.33%;
    height: 100%;
    background: linear-gradient(90deg, #ff6b9d, #c084fc);
    transition: width 0.5s ease;
}

/* 题目区域 */
.question-area {
    margin-bottom: 30px;
}

.question-text {
    font-size: 18px;
    font-weight: 400;
    color: #fff;
    line-height: 1.8;
    margin-bottom: 24px;
    min-height: 60px;
    transition: all 0.3s ease;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 15px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-family: inherit;
}

.option-btn:hover {
    background: rgba(255, 107, 157, 0.1);
    border-color: rgba(255, 107, 157, 0.3);
    transform: translateX(4px);
    color: #fff;
}

.option-btn.selected {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.3), rgba(192, 132, 252, 0.3));
    border-color: rgba(255, 107, 157, 0.5);
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.2);
}

.option-btn.correct {
    background: linear-gradient(135deg, rgba(107, 255, 157, 0.3), rgba(132, 252, 192, 0.3));
    border-color: rgba(107, 255, 157, 0.5);
}

.option-btn.wrong {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
}

/* 导航按钮 */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.nav-btn {
    padding: 14px 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: #888;
    font-family: inherit;
    letter-spacing: 1px;
}

.prev-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.prev-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.next-btn {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.2), rgba(192, 132, 252, 0.2));
    border-color: rgba(255, 107, 157, 0.3);
    color: #ff6b9d;
}

.next-btn:hover {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.3), rgba(192, 132, 252, 0.3));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.2);
}

/* 提交按钮 */
.submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.3), rgba(192, 132, 252, 0.3));
    color: #ff6b9d;
    border: 1px solid rgba(255, 107, 157, 0.3);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    font-family: inherit;
    letter-spacing: 2px;
}

.submit-btn:hover {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.4), rgba(192, 132, 252, 0.4));
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.3);
}

/* 弹窗系统 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 500;
    backdrop-filter: blur(5px);
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal {
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid rgba(255, 107, 157, 0.3);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(255, 107, 157, 0.2);
}

.modal-content {
    font-size: 16px;
    color: #fff;
    line-height: 1.8;
    margin-bottom: 24px;
}

.modal-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.3), rgba(192, 132, 252, 0.3));
    border: 1px solid rgba(255, 107, 157, 0.3);
    border-radius: 8px;
    color: #ff6b9d;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.modal-btn:hover {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.4), rgba(192, 132, 252, 0.4));
}

/* 弹窗选项按钮 */
.modal-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.modal-option-btn {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 107, 157, 0.3);
    border-radius: 8px;
    color: #ff6b9d;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.modal-option-btn:hover {
    background: rgba(255, 107, 157, 0.2);
    border-color: rgba(255, 107, 157, 0.5);
}

/* 结果页面 */
.result-container {
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid rgba(255, 107, 157, 0.2);
    border-radius: 16px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.result-content {
    font-size: 16px;
    color: #e0e0e0;
    line-height: 1.8;
}

.result-content h2 {
    color: #ff6b9d;
    font-weight: 300;
    letter-spacing: 4px;
    margin-bottom: 24px;
}

.result-content .compatibility {
    font-size: 48px;
    font-weight: 300;
    color: #ff6b9d;
    margin: 20px 0;
}

.result-content .result-text {
    white-space: pre-line;
    text-align: left;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-top: 20px;
}

.result-btn {
    margin-top: 30px;
    padding: 14px 32px;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.3), rgba(192, 132, 252, 0.3));
    border: 1px solid rgba(255, 107, 157, 0.3);
    border-radius: 10px;
    color: #ff6b9d;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    letter-spacing: 2px;
}

.result-btn:hover {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.4), rgba(192, 132, 252, 0.4));
    transform: translateY(-3px);
}

/* 结尾彩蛋 */
.elysia-ending {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: 600;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.elysia-slideshow {
    width: 100%;
    height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.elysia-slideshow img {
    max-width: 90%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0;
    position: absolute;
    transition: opacity 1.5s ease;
}

.elysia-slideshow img.active {
    opacity: 1;
}

.elysia-text {
    font-size: 18px;
    color: #ff6b9d;
    text-align: center;
    padding: 20px;
    letter-spacing: 2px;
    line-height: 1.8;
    opacity: 0;
    transition: opacity 1s ease;
}

.elysia-text.show {
    opacity: 1;
}

/* 特效动画 */
@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* 文字闪烁 */
.text-flicker {
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* 渐变文字 */
.gradient-text {
    background: linear-gradient(90deg, #ff6b9d, #c084fc, #ff6b9d);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient 3s linear infinite;
}

@keyframes gradient {
    to {
        background-position: 200% center;
    }
}

/* 爱莉西雅主题 */
body.elysia-theme {
    background: linear-gradient(135deg, #1a0a1e 0%, #2d1b3e 50%, #0a0a1e 100%);
}

body.elysia-theme .quiz-container {
    border-color: rgba(255, 107, 157, 0.3);
    box-shadow: 0 0 40px rgba(255, 107, 157, 0.1);
}

body.elysia-theme .quiz-title {
    color: #ff6b9d;
}

body.elysia-theme .option-btn.selected {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.4), rgba(192, 132, 252, 0.4));
}

/* 增强的抖动效果 */
@keyframes shake-intense {
    0%, 100% { transform: translateX(0) rotate(0); }
    10% { transform: translateX(-8px) rotate(-1deg); }
    20% { transform: translateX(8px) rotate(1deg); }
    30% { transform: translateX(-6px) rotate(-0.5deg); }
    40% { transform: translateX(6px) rotate(0.5deg); }
    50% { transform: translateX(-4px) rotate(-0.3deg); }
    60% { transform: translateX(4px) rotate(0.3deg); }
    70% { transform: translateX(-3px) rotate(-0.2deg); }
    80% { transform: translateX(3px) rotate(0.2deg); }
    90% { transform: translateX(-2px) rotate(-0.1deg); }
}

@keyframes glitch-intense {
    0% { transform: translate(0); clip-path: inset(0 0 0 0); }
    5% { transform: translate(-5px, 3px); clip-path: inset(20% 0 60% 0); }
    10% { transform: translate(5px, -3px); clip-path: inset(40% 0 20% 0); }
    15% { transform: translate(-3px, -5px); clip-path: inset(60% 0 10% 0); }
    20% { transform: translate(3px, 5px); clip-path: inset(10% 0 80% 0); }
    25% { transform: translate(0); clip-path: inset(0 0 0 0); }
    100% { transform: translate(0); clip-path: inset(0 0 0 0); }
}

/* 数据失帧效果 */
@keyframes scanline {
    0% { background-position: 0 0; }
    100% { background-position: 0 100%; }
}

.scanline-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(255, 107, 157, 0.03) 2px,
        rgba(255, 107, 157, 0.03) 4px
    );
    animation: scanline 8s linear infinite;
    pointer-events: none;
    z-index: 170;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.scanline-effect.active {
    opacity: 1;
}

/* 颜色偏移效果 */
@keyframes color-shift {
    0%, 100% { text-shadow: none; }
    25% { text-shadow: -2px 0 #ff6b9d, 2px 0 #c084fc; }
    50% { text-shadow: 2px 0 #ff6b9d, -2px 0 #c084fc; }
    75% { text-shadow: -1px 1px #ff6b9d, 1px -1px #c084fc; }
}

.color-shift-active {
    animation: color-shift 0.3s ease;
}

/* 屏幕边缘发光 */
.edge-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 165;
    opacity: 0;
    transition: opacity 0.5s ease;
    box-shadow: inset 0 0 100px rgba(255, 107, 157, 0.2);
}

.edge-glow.active {
    opacity: 1;
}

/* 角落弹窗增强动画 */
@keyframes popup-glitch {
    0% { transform: translateY(0); opacity: 1; }
    10% { transform: translateY(-2px) translateX(2px); opacity: 0.8; }
    20% { transform: translateY(2px) translateX(-2px); opacity: 1; }
    30% { transform: translateY(-1px) translateX(1px); opacity: 0.9; }
    40% { transform: translateY(1px) translateX(-1px); opacity: 1; }
    50% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(0); opacity: 1; }
}

.corner-popup.show {
    animation: popup-glitch 0.5s ease;
}

/* 老式电视机失帧效果 */
.vhs-distortion {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 180;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vhs-distortion.active {
    opacity: 1;
}

/* 黑白横条闪烁 */
.vhs-bars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 4px,
        rgba(0, 0, 0, 0.8) 4px,
        rgba(0, 0, 0, 0.8) 6px,
        transparent 6px,
        transparent 20px
    );
    animation: vhs-bars-scroll 0.1s linear infinite;
}

@keyframes vhs-bars-scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-20px); }
}

/* 画面撕裂效果 */
.vhs-tear {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        180deg,
        transparent 0%,
        transparent 30%,
        rgba(255, 107, 157, 0.1) 30%,
        rgba(255, 107, 157, 0.1) 32%,
        transparent 32%,
        transparent 60%,
        rgba(192, 132, 252, 0.1) 60%,
        rgba(192, 132, 252, 0.1) 62%,
        transparent 62%,
        transparent 100%
    );
    animation: vhs-tear-move 0.5s ease-in-out infinite;
}

@keyframes vhs-tear-move {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 随机噪点 */
.vhs-static {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.4'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    animation: vhs-static-move 0.05s steps(10) infinite;
}

@keyframes vhs-static-move {
    0% { background-position: 0 0; }
    10% { background-position: -50px -50px; }
    20% { background-position: 50px 50px; }
    30% { background-position: -30px 30px; }
    40% { background-position: 30px -30px; }
    50% { background-position: -70px 10px; }
    60% { background-position: 70px -10px; }
    70% { background-position: 10px 70px; }
    80% { background-position: -10px -70px; }
    90% { background-position: 40px 40px; }
    100% { background-position: 0 0; }
}

/* 画面抖动 */
.vhs-jitter {
    animation: vhs-jitter 0.05s steps(2) infinite;
}

@keyframes vhs-jitter {
    0% { transform: translate(0, 0) skewX(0); }
    25% { transform: translate(-2px, 1px) skewX(0.5deg); }
    50% { transform: translate(2px, -1px) skewX(-0.5deg); }
    75% { transform: translate(-1px, -2px) skewX(0.3deg); }
    100% { transform: translate(0, 0) skewX(0); }
}

/* 偶尔黑屏 */
.vhs-blackout {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0;
    animation: vhs-blackout-flash 8s ease-in-out infinite;
}

@keyframes vhs-blackout-flash {
    0%, 45%, 55%, 100% { opacity: 0; }
    48%, 52% { opacity: 1; }
}

/* 水平同步问题 */
.vhs-hsync {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        transparent 40%,
        rgba(255, 255, 255, 0.1) 40%,
        rgba(255, 255, 255, 0.1) 60%,
        transparent 60%,
        transparent 100%
    );
    animation: vhs-hsync-move 0.3s linear infinite;
}

@keyframes vhs-hsync-move {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 老式电视机边框 */
.vhs-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.8);
    border-radius: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .quiz-container {
        padding: 24px;
        margin: 20px;
    }

    .quiz-title {
        font-size: 24px;
    }

    .question-text {
        font-size: 16px;
    }

    .option-btn {
        padding: 14px 16px;
        font-size: 14px;
    }

    .nav-btn {
        padding: 12px 24px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .quiz-container {
        padding: 20px;
        margin: 16px;
    }

    .quiz-title {
        font-size: 20px;
    }

    .question-text {
        font-size: 15px;
    }

    .option-btn {
        padding: 12px 14px;
        font-size: 13px;
    }

    .nav-btn {
        padding: 10px 20px;
        font-size: 12px;
    }
}
