/**
 * 澳门校车安全沉浸式体验系统 - 主样式表
 * Cyberpunk Education Style - Vertical 1080×1920
 */

/* CSS Variables */
:root {
    --primary: #00D4FF;
    --secondary: #7B2FFF;
    --accent: #FF2D92;
    --warning: #FF6B35;
    --success: #00FF88;
    --bg-dark: #0A0A1A;
    --bg-panel: rgba(15, 15, 35, 0.85);
    --text-primary: #FFFFFF;
    --text-secondary: #B8C4D4;
    --font-display: 'Orbitron', 'Microsoft YaHei', sans-serif;
    --font-body: 'Rajdhani', 'Microsoft YaHei', sans-serif;
    
    /* Screen colors for 3 screens */
    --screen-a: #00D4FF;
    --screen-b: #00FF88;
    --screen-c: #FF6B35;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* 粒子背景 */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* 扫描线效果 */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
}

/* 主容器 */
#app {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* 屏幕通用 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* ==================== 待机画面 ==================== */
.standby-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 48px;
}

.logo-section {
    text-align: center;
    margin-bottom: 48px;
}

.logo-glow {
    width: 200px;
    height: 200px;
    margin: 0 auto 32px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    opacity: 0.5;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.main-title {
    font-family: var(--font-display);
    font-size: 64px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px var(--primary);
    letter-spacing: 4px;
}

.sub-title {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 16px;
    letter-spacing: 8px;
}

/* 瓦令教练头像 */
.walin-avatar {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 32px auto;
}

.walin-avatar.small {
    width: 80px;
    height: 80px;
}

.walin-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid var(--screen-a);
    animation: ring-pulse 2s ease-in-out infinite;
}

.walin-avatar.green .walin-ring { border-color: var(--screen-b); }
.walin-avatar.orange .walin-ring { border-color: var(--screen-c); }

@keyframes ring-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

.walin-face {
    position: absolute;
    top: 20%;
    left: 20%;
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.walin-avatar.small .walin-face { font-size: 24px; }

.walin-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

/* 语言选择器 */
.language-selector {
    display: flex;
    gap: 16px;
    margin: 32px 0;
}

.lang-btn {
    padding: 12px 24px;
    background: var(--bg-panel);
    border: 2px solid var(--primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.lang-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 20px var(--primary);
}

.lang-btn.active {
    background: var(--primary);
    color: var(--bg-dark);
    box-shadow: 0 0 30px var(--primary);
}

/* 模式选择器 */
.mode-selector {
    display: flex;
    gap: 32px;
    margin: 48px 0;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px 48px;
    background: var(--bg-panel);
    border: 3px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.mode-btn .mode-icon {
    font-size: 48px;
}

.mode-btn .mode-text {
    font-family: var(--font-display);
    font-size: 24px;
    color: var(--text-primary);
}

.mode-btn.solo {
    border-color: var(--screen-a);
}

.mode-btn.solo:hover, .mode-btn.solo.active {
    background: rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 30px var(--screen-a);
}

.mode-btn.team {
    border-color: var(--screen-b);
}

.mode-btn.team:hover, .mode-btn.team.active {
    background: rgba(0, 255, 136, 0.2);
    box-shadow: 0 0 30px var(--screen-b);
}

.copyright {
    position: absolute;
    bottom: 32px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==================== 匹配画面 ==================== */
.matching-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 48px;
}

.matching-title {
    font-family: var(--font-display);
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 32px;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.matching-timer {
    font-family: var(--font-display);
    font-size: 96px;
    font-weight: 900;
    color: var(--warning);
    text-shadow: 0 0 30px var(--warning);
    margin-bottom: 64px;
}

.matching-players {
    display: flex;
    gap: 48px;
    margin-bottom: 64px;
}

.player-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.player-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--text-secondary);
    animation: avatar-idle 2s ease-in-out infinite;
}

.player-avatar.p1 { border-color: var(--screen-a); background: radial-gradient(circle, var(--screen-a), transparent); }
.player-avatar.p2 { border-color: var(--screen-b); background: radial-gradient(circle, var(--screen-b), transparent); }
.player-avatar.p3 { border-color: var(--screen-c); background: radial-gradient(circle, var(--screen-c), transparent); }

.player-avatar.ready {
    animation: avatar-ready 0.5s ease-in-out infinite;
    box-shadow: 0 0 30px currentColor;
}

@keyframes avatar-idle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes avatar-ready {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.player-status {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--text-secondary);
}

.player-status.ready {
    color: var(--success);
}

.cancel-btn {
    padding: 16px 48px;
    background: transparent;
    border: 2px solid var(--accent);
    border-radius: 8px;
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    background: rgba(255, 45, 146, 0.2);
    box-shadow: 0 0 20px var(--accent);
}

/* ==================== 关卡通用 ==================== */
.level-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.level-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--primary);
}

.level-badge {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 900;
}

.level-title {
    font-family: var(--font-display);
    font-size: 32px;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary);
}

.level-timer {
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 15px var(--primary);
}

.level-timer.warning {
    color: var(--warning);
    animation: timer-blink 0.5s ease-in-out infinite;
}

@keyframes timer-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.scene-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.interaction-area {
    height: 20%;
    min-height: 200px;
    padding: 24px;
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    border-top: 2px solid var(--secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.instruction {
    font-family: var(--font-body);
    font-size: 24px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-align: center;
}

.feedback-area {
    min-height: 48px;
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    text-align: center;
}

.feedback-area.correct {
    color: var(--success);
    text-shadow: 0 0 20px var(--success);
}

.feedback-area.wrong {
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent);
}

.bottom-bar {
    height: 20%;
    min-height: 150px;
    padding: 16px 32px;
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 2px solid var(--primary);
}

.walin-coach {
    flex: 0 0 auto;
}

.stars-display {
    display: flex;
    gap: 16px;
}

.star-slot {
    width: 48px;
    height: 48px;
    background: #333;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.star-slot.earned {
    background: #FFD700;
    box-shadow: 0 0 20px #FFD700;
    animation: star-earn 0.5s ease-out;
}

@keyframes star-earn {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ==================== 第1关-等候场景 ==================== */
.bus-stop-scene {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1a3a5c 0%, #2d5a7b 50%, #4a8fa8 100%);
    position: relative;
}

.school-entrance {
    position: absolute;
    bottom: 60%;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 300px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.school-entrance::before {
    content: '学校';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: 28px;
    color: #FFD700;
}

.school-bus {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 200px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 20px 20px 10px 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.school-bus::before {
    content: '校车';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: 24px;
    color: #333;
}

.waiting-zones {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
}

.zone {
    width: 150px;
    height: 100px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-size: 18px;
    color: white;
}

.zone-safe {
    background: rgba(0, 255, 136, 0.4);
    border: 3px solid var(--success);
}

.zone-safe:hover {
    background: rgba(0, 255, 136, 0.6);
    box-shadow: 0 0 30px var(--success);
}

.zone-danger {
    background: rgba(255, 45, 146, 0.4);
    border: 3px solid var(--accent);
}

.zone-danger:hover {
    background: rgba(255, 45, 146, 0.6);
    box-shadow: 0 0 30px var(--accent);
}

.zone-normal {
    background: rgba(0, 212, 255, 0.4);
    border: 3px solid var(--primary);
}

.zone-normal:hover {
    background: rgba(0, 212, 255, 0.6);
    box-shadow: 0 0 30px var(--primary);
}

.zone.selected {
    animation: zone-select 0.5s ease-out;
    transform: scale(1.1);
}

@keyframes zone-select {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1.1); }
}

/* ==================== 第3关-乘车场景 ==================== */
.bus-interior-scene {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #2a2a4a 0%, #1a1a3a 100%);
    position: relative;
    overflow: hidden;
}

.bus-window {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 50%;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(123, 47, 255, 0.3));
    border: 4px solid var(--primary);
    border-radius: 20px;
    overflow: hidden;
}

.road-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 50%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    animation: road-move 2s linear infinite;
}

@keyframes road-move {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.student-silhouette {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 150px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50px 50px 20px 20px;
}

.quiz-container {
    width: 100%;
    padding: 16px;
}

.quiz-question {
    font-family: var(--font-body);
    font-size: 24px;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-panel);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.quiz-option {
    padding: 20px;
    background: var(--bg-panel);
    border: 2px solid var(--secondary);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.quiz-option:hover {
    background: rgba(123, 47, 255, 0.3);
    box-shadow: 0 0 20px var(--secondary);
}

.quiz-option.correct {
    background: rgba(0, 255, 136, 0.3);
    border-color: var(--success);
    box-shadow: 0 0 20px var(--success);
}

.quiz-option.wrong {
    background: rgba(255, 45, 146, 0.3);
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent);
}

/* ==================== 结果画面 ==================== */
.result-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 48px;
}

.result-title {
    font-family: var(--font-display);
    font-size: 64px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 48px;
    animation: result-appear 1s ease-out;
}

@keyframes result-appear {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.result-stars {
    display: flex;
    gap: 32px;
    margin-bottom: 48px;
}

.result-stars .star-slot {
    width: 80px;
    height: 80px;
    font-size: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-stars .star-slot.earned::after {
    content: '⭐';
}

.result-score {
    text-align: center;
    margin-bottom: 48px;
}

.score-label {
    font-family: var(--font-body);
    font-size: 24px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.score-value {
    font-family: var(--font-display);
    font-size: 96px;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 30px var(--primary);
}

.result-message {
    font-family: var(--font-body);
    font-size: 28px;
    color: var(--text-secondary);
    margin-bottom: 48px;
    text-align: center;
}

.result-actions {
    display: flex;
    gap: 32px;
}

.action-btn {
    padding: 20px 48px;
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn.replay {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
}

.action-btn.replay:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--primary);
}

.action-btn.home {
    background: transparent;
    border: 3px solid var(--text-secondary);
    color: var(--text-secondary);
}

.action-btn.home:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 20px var(--primary);
}

/* ==================== Canvas通用 ==================== */
canvas {
    display: block;
    touch-action: none;
}

/* ==================== 响应式适配 ==================== */
@media (max-width: 1080px) {
    .main-title { font-size: 48px; }
    .sub-title { font-size: 24px; }
    .mode-selector { flex-direction: column; gap: 16px; }
    .mode-btn { padding: 24px 32px; }
}

/* ==================== 色盲友好 ==================== */
.colorblind-mode .zone-safe {
    background: rgba(0, 100, 200, 0.4);
    border: 3px solid #0064C8;
}

.colorblind-mode .zone-danger {
    background: rgba(255, 150, 0, 0.4);
    border: 3px solid #FF9600;
}

/* ==================== 动画类 ==================== */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.bounce {
    animation: bounce 0.5s ease-out;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ==================== GPU加速 ==================== */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* ==================== 玻璃拟态 ==================== */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==================== 霓虹效果 ==================== */
.neon-text {
    text-shadow: 
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 20px currentColor,
        0 0 40px currentColor;
}

.neon-border {
    box-shadow: 
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 20px currentColor;
}
