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

:root {
    --danger-color: #dc3545;
    --danger-color-dark: #c82333;
    --danger-color-light: #f8d7da;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    position: relative;
    overflow-x: hidden;
}

/* 動畫背景元素 */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    opacity: 0.1;
    animation: float 20s infinite ease-in-out;
}

.shape:nth-child(1) {
    top: 10%;
    left: 10%;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, #fff 0%, transparent 70%);
    border-radius: 50%;
    animation-delay: 0s;
    animation-duration: 25s;
}

.shape:nth-child(2) {
    top: 20%;
    right: 10%;
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #fff 0%, transparent 50%);
    transform: rotate(45deg);
    animation-delay: -5s;
    animation-duration: 20s;
}

.shape:nth-child(3) {
    bottom: 20%;
    left: 20%;
    width: 100px;
    height: 100px;
    background: conic-gradient(from 0deg, #fff 0%, transparent 50%, #fff 100%);
    border-radius: 50%;
    animation-delay: -10s;
    animation-duration: 30s;
}

.shape:nth-child(4) {
    bottom: 30%;
    right: 20%;
    width: 40px;
    height: 40px;
    background: radial-gradient(ellipse, #fff 0%, transparent 70%);
    border-radius: 50%;
    animation-delay: -15s;
    animation-duration: 22s;
}

.shape:nth-child(5) {
    top: 50%;
    left: 5%;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #fff 0%, transparent 60%);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    animation-delay: -20s;
    animation-duration: 18s;
}

.shape:nth-child(6) {
    top: 70%;
    right: 5%;
    width: 90px;
    height: 90px;
    background: radial-gradient(circle, #fff 0%, transparent 80%);
    border-radius: 30%;
    animation-delay: -25s;
    animation-duration: 24s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.1;
    }
    25% {
        transform: translateY(-20px) rotate(90deg);
        opacity: 0.2;
    }
    50% {
        transform: translateY(-40px) rotate(180deg);
        opacity: 0.15;
    }
    75% {
        transform: translateY(-20px) rotate(270deg);
        opacity: 0.25;
    }
}

/* 粒子效果 */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: particleFloat 15s infinite linear;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 18s; }
.particle:nth-child(2) { left: 20%; animation-delay: -2s; animation-duration: 22s; }
.particle:nth-child(3) { left: 30%; animation-delay: -4s; animation-duration: 20s; }
.particle:nth-child(4) { left: 40%; animation-delay: -6s; animation-duration: 16s; }
.particle:nth-child(5) { left: 50%; animation-delay: -8s; animation-duration: 24s; }
.particle:nth-child(6) { left: 60%; animation-delay: -10s; animation-duration: 19s; }
.particle:nth-child(7) { left: 70%; animation-delay: -12s; animation-duration: 21s; }
.particle:nth-child(8) { left: 80%; animation-delay: -14s; animation-duration: 17s; }
.particle:nth-child(9) { left: 90%; animation-delay: -16s; animation-duration: 23s; }

@keyframes particleFloat {
    0% {
        top: 100%;
        opacity: 0;
        transform: scale(0.5);
    }
    10% {
        opacity: 1;
        transform: scale(1);
    }
    90% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        top: -10%;
        opacity: 0;
        transform: scale(0.5);
    }
}

/* 波浪動畫 */
.wave-animation {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120" preserveAspectRatio="none"><path d="M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z" opacity=".25" fill="%23ffffff"></path><path d="M0,0V15.81C13,36.92,27.64,56.86,47.69,72.05,99.41,111.27,165,111,224.58,91.58c31.15-10.15,60.09-26.07,89.67-39.8,40.92-19,84.73-46,130.83-49.67,36.26-2.85,70.9,9.42,98.6,31.56,31.77,25.39,62.32,62,103.63,73,40.44,10.79,81.35-6.69,119.13-24.28s75.16-39,116.92-43.05c59.73-5.85,113.28,22.88,168.9,38.84,30.2,8.66,59,6.17,87.09-7.5,22.43-10.89,48-26.93,60.65-49.24V0Z" opacity=".5" fill="%23ffffff"></path><path d="M0,0V5.63C149.93,59,314.09,71.32,475.83,42.57c43-7.64,84.23-20.12,127.61-26.46,59-8.63,112.48,12.24,165.56,35.4C827.93,77.22,886,95.24,951.2,90c86.53-7,172.46-45.71,248.8-84.81V0Z" fill="%23ffffff"></path></svg>') repeat-x;
    background-size: 1200px 120px;
    animation: waveMove 10s ease-in-out infinite;
    opacity: 0.1;
}

@keyframes waveMove {
    0%, 100% {
        background-position-x: 0;
    }
    50% {
        background-position-x: -1200px;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 20px;
    flex-wrap: nowrap;
    min-height: 60px;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav {
    display: flex;
    gap: 0.8rem;
    flex-shrink: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
    margin-bottom: -5px;
}

.nav::-webkit-scrollbar {
    height: 6px;
}

.nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.nav::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.nav::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.nav-btn {
    background: none;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 0.4rem 0.8rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.nav-btn:hover, .nav-btn.active {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Main Content */
.main {
    padding: 2rem 0;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* Cards */
.welcome-card, .step-card, .results-card, .leaderboard-card, .stats-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.welcome-card:hover, .step-card:hover, .results-card:hover, 
.leaderboard-card:hover, .stats-card:hover {
    transform: translateY(-5px);
}

.welcome-card {
    text-align: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.welcome-card h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.step-card h3 {
    color: #667eea;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Grade Selection */
.grade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.grade-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.grade-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.grade-btn.selected {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

/* Subject Selection */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.subject-btn {
    background: white;
    border: 3px solid #667eea;
    color: #667eea;
    padding: 1.5rem;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.subject-btn i {
    font-size: 2rem;
}

.subject-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.subject-btn.selected {
    background: #667eea;
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Topic Input */
.topic-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.topic-form label {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

#topic, #topic-advanced {
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1rem;
    transition: border-color 0.3s ease;
}

#topic:focus, #topic-advanced:focus {
    outline: none;
    border-color: #667eea;
}

#study-content {
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.3s ease;
}

#study-content:focus {
    outline: none;
    border-color: #667eea;
}

/* 學習內容歷史面板 */
.study-content-section {
    position: relative;
}

.content-input-area {
    position: relative;
}

.input-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    gap: 1rem;
}

.history-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    color: #667eea;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.char-counter {
    color: #666;
    font-size: 0.85rem;
}

.history-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-height: 400px;
    overflow: hidden;
    margin-top: 1rem;
}

.history-header {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-history-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-history-btn:hover {
    background: #e9ecef;
    color: #333;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.history-item {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.history-item:hover {
    background: #f8f9ff;
    border-color: #667eea;
    transform: translateY(-1px);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-item-topic {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.history-item-date {
    font-size: 0.8rem;
    color: #666;
}

.history-item-content {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 3em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.loading-message {
    text-align: center;
    color: #666;
    padding: 2rem;
    font-style: italic;
}

.no-history-message {
    text-align: center;
    color: #999;
    padding: 2rem;
    font-style: italic;
}

/* Mode Selection */
.mode-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Question Type Selection */
.question-type-selection {
    margin-bottom: 2rem;
}

.question-type-selection h4 {
    color: #667eea;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.type-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.type-btn {
    background: white;
    border: 3px solid #e9ecef;
    color: #666;
    padding: 1.5rem;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.type-btn i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.type-btn small {
    opacity: 0.8;
    font-size: 0.9rem;
}

.type-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.type-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.mode-btn {
    background: white;
    border: 3px solid #e9ecef;
    color: #666;
    padding: 1.5rem;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.mode-btn i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.mode-btn small {
    opacity: 0.8;
    font-size: 0.9rem;
}

.mode-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.mode-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.start-btn {
    background: linear-gradient(135deg, #55a3ff, #667eea);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 5px 15px rgba(85, 163, 255, 0.3);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(85, 163, 255, 0.4);
}

/* Selection Summary */
.selection-summary {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1rem;
    border-left: 4px solid #667eea;
}

.summary-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.summary-item {
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Quiz Section */
.quiz-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.quiz-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    width: 5%;
    transition: width 0.3s ease;
}

.progress-text {
    font-weight: 600;
    color: #667eea;
    min-width: 80px;
}

.quiz-info {
    text-align: center;
    font-weight: 500;
    color: #666;
}

.question-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.question-text {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    color: #333;
    line-height: 1.6;
}

.options-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-btn {
    background: white;
    border: 4px solid #e9ecef;
    padding: 1.5rem;
    border-radius: 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.4s ease;
    font-size: 1.2rem;
    font-weight: 500;
    position: relative;
    min-height: 70px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.option-btn:hover:not(.selected):not(.disabled) {
    border-color: #667eea;
    background: #f0f3ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.15);
    border-width: 3px;
}

.option-btn.selected {
    background: #4FC3F7 !important;
    color: #333 !important;
    border: 8px solid #29B6F6 !important;
    box-shadow: 
        0 20px 60px rgba(79, 195, 247, 0.8), 
        0 0 0 6px rgba(41, 182, 246, 0.5), 
        0 0 80px rgba(79, 195, 247, 0.4) !important;
    transform: translateY(-12px) scale(1.1) !important;
    font-weight: 900 !important;
    font-size: 1.4rem !important;
    animation: selectedMegaPulse 1s infinite ease-in-out !important;
    position: relative !important;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.7) !important;
    z-index: 1000 !important;
    outline: 4px solid rgba(255, 255, 255, 0.8) !important;
    outline-offset: 4px !important;
    padding-left: 4rem !important;
}

.option-btn.selected:not(.disabled)::before {
    content: "👉";
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    animation: fingerWave 0.8s infinite ease-in-out;
    z-index: 1001;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

@keyframes fingerWave {
    0%, 100% { 
        transform: translateY(-50%) rotate(-10deg);
        opacity: 0.8;
    }
    50% { 
        transform: translateY(-50%) rotate(10deg);
        opacity: 1;
    }
}

@keyframes selectedMegaPulse {
    0%, 100% { 
        transform: translateY(-12px) scale(1.1);
        box-shadow: 
            0 20px 60px rgba(79, 195, 247, 0.8), 
            0 0 0 6px rgba(41, 182, 246, 0.5), 
            0 0 80px rgba(79, 195, 247, 0.4);
    }
    50% { 
        transform: translateY(-15px) scale(1.15);
        box-shadow: 
            0 25px 80px rgba(79, 195, 247, 1), 
            0 0 0 10px rgba(41, 182, 246, 0.8), 
            0 0 120px rgba(79, 195, 247, 0.6);
    }
}

/* Removed duplicate shimmer effect */

@keyframes selectedShine {
    0%, 100% { filter: brightness(1) saturate(1); }
    50% { filter: brightness(1.2) saturate(1.3); }
}

@keyframes selectedShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Removed conflicting ::after rule */

@keyframes selectedGlow {
    0%, 100% { 
        opacity: 0.6; 
        transform: scale(1); 
        border-color: rgba(255, 71, 87, 0.6);
        box-shadow: 0 0 20px rgba(255, 71, 87, 0.4);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.05); 
        border-color: rgba(255, 71, 87, 1);
        box-shadow: 0 0 30px rgba(255, 71, 87, 0.8);
    }
}

@keyframes selectedPulse {
    0% { 
        transform: translateY(-8px) scale(1.05); 
        box-shadow: 0 15px 40px rgba(255, 71, 87, 0.6), 0 0 0 4px rgba(255, 71, 87, 0.4);
    }
    50% { 
        transform: translateY(-8px) scale(1.08); 
        box-shadow: 0 20px 50px rgba(255, 71, 87, 0.8), 0 0 0 6px rgba(255, 71, 87, 0.6);
    }
    100% { 
        transform: translateY(-8px) scale(1.05); 
        box-shadow: 0 15px 40px rgba(255, 71, 87, 0.6), 0 0 0 4px rgba(255, 71, 87, 0.4);
    }
}

@keyframes selectedBounce {
    0% { transform: translateY(-8px) scale(1); }
    30% { transform: translateY(-12px) scale(1.1); }
    60% { transform: translateY(-6px) scale(1.03); }
    100% { transform: translateY(-8px) scale(1.05); }
}

/* Replaced by new finger pointer */

@keyframes crownBounce {
    0%, 100% { transform: translateX(-50%) translateY(0px); }
    50% { transform: translateX(-50%) translateY(-3px); }
}

.option-btn.selected::after {
    content: "✓ 已選擇";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: #4CAF50;
    color: white;
    padding: 8px 15px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 700;
    animation: selectedMark 1s infinite ease-in-out;
    z-index: 1002;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.6);
    border: 2px solid white;
}

@keyframes selectedMark {
    0%, 100% { 
        transform: translateY(-50%) scale(1);
        box-shadow: 0 4px 15px rgba(76, 175, 80, 0.6);
    }
    50% { 
        transform: translateY(-50%) scale(1.1);
        box-shadow: 0 6px 20px rgba(76, 175, 80, 0.8);
    }
}

@keyframes fingerPoint {
    0%, 100% { 
        transform: translateY(-50%) translateX(0px); 
        opacity: 0.8;
    }
    50% { 
        transform: translateY(-50%) translateX(-10px); 
        opacity: 1;
    }
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(5deg); }
}

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

.option-btn.correct {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-color: #10b981;
    border-width: 5px;
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.5);
    transform: translateY(-5px) scale(1.02);
    font-weight: 700;
    animation: correctPulse 0.8s ease-out;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes correctPulse {
    0% { transform: translateY(-5px) scale(1); box-shadow: 0 12px 30px rgba(16, 185, 129, 0.5); }
    50% { transform: translateY(-5px) scale(1.05); box-shadow: 0 15px 35px rgba(16, 185, 129, 0.7); }
    100% { transform: translateY(-5px) scale(1.02); box-shadow: 0 12px 30px rgba(16, 185, 129, 0.5); }
}

.option-btn.correct::before {
    content: "🎉 ";
    font-size: 1.8rem;
    margin-right: 0.8rem;
    animation: celebrateBounce 0.8s ease-out;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

.option-btn.incorrect {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-color: #ef4444;
    border-width: 5px;
    box-shadow: 0 12px 30px rgba(239, 68, 68, 0.5);
    transform: translateY(-5px) scale(1.02);
    font-weight: 700;
    animation: incorrectShake 0.6s ease-out;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes incorrectShake {
    0%, 100% { transform: translateY(-5px) translateX(0) scale(1.02); }
    25% { transform: translateY(-5px) translateX(-5px) scale(1.02); }
    75% { transform: translateY(-5px) translateX(5px) scale(1.02); }
}

.option-btn.incorrect::before {
    content: "❌ ";
    font-size: 1.8rem;
    margin-right: 0.8rem;
    animation: errorPulse 0.6s ease-out;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

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

.option-btn.disabled {
    pointer-events: none;
    opacity: 0.7;
    filter: grayscale(0.3);
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

/* Short Answer Input */
.short-answer-input {
    width: 100%;
    padding: 1.5rem;
    border: 3px solid #e9ecef;
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s ease;
    background: white;
    color: #333;
    line-height: 1.5;
}

.short-answer-input:focus {
    outline: none;
    border-color: #667eea;
    background: #f8f9ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.short-answer-input::placeholder {
    color: #999;
    font-style: italic;
}

.short-answer-input.disabled {
    background: #f8f9fa;
    color: #666;
    cursor: not-allowed;
    opacity: 0.8;
}

.char-count-display {
    text-align: right;
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding-right: 0.5rem;
}

/* AI Grading Result */
.ai-grading-result {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.ai-score {
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.ai-feedback {
    margin-bottom: 0.5rem;
    color: #333;
    line-height: 1.4;
}

.ai-reasoning {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    font-style: italic;
}

.quiz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.quiz-navigation {
    display: flex;
    gap: 1rem;
}

.quiz-actions {
    display: flex;
    gap: 1rem;
}

.control-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    color: #666;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn:hover:not(:disabled) {
    background: #e9ecef;
    transform: translateY(-2px);
}

.control-btn.primary {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.control-btn.primary:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.control-btn.confirm {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.control-btn.confirm:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Answer Explanation */
.answer-explanation {
    margin-top: 2rem;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 1.5rem;
    border-left: 5px solid #667eea;
}

.result-indicator {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
}

.result-indicator.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.result-indicator.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.correct-answer {
    font-size: 1.1rem;
    color: #333;
}

.correct-answer strong {
    color: #28a745;
}

/* Results Section */
.score-display {
    text-align: center;
    margin: 2rem 0;
}

.score-circle {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    flex-direction: column;
    margin-bottom: 1rem;
}

.score-number {
    font-size: 3rem;
    font-weight: 700;
}

.score-total {
    font-size: 1.2rem;
    opacity: 0.8;
}

.score-percentage {
    font-size: 2rem;
    font-weight: 600;
    color: #667eea;
}

.results-details {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 600;
    color: #666;
}

.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.action-btn.secondary {
    background: #6c757d;
}

.action-btn.secondary:hover {
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
}

/* Name Input Section */
.name-input-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
    border: 2px solid #e9ecef;
}

.name-input-section h4 {
    color: #667eea;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.name-input-section p {
    color: #666;
    margin-bottom: 1.5rem;
}

.name-input-form {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.name-input-group {
    display: flex;
    align-items: center;
    position: relative;
}

#user-name {
    padding: 0.8rem 1rem;
    padding-right: 3rem;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 1rem;
    min-width: 200px;
    transition: border-color 0.3s ease;
}

#user-name:focus {
    outline: none;
    border-color: #667eea;
}

.clear-name-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.clear-name-btn:hover {
    background: #f0f0f0;
    color: #666;
    transform: scale(1.1);
}

.clear-name-btn:active {
    transform: scale(0.95);
}

.save-score-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.save-score-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.save-status {
    margin-top: 1rem;
    font-weight: 600;
}

.save-status.success {
    color: #28a745;
}

.save-status.error {
    color: #dc3545;
}

/* Leaderboard */
.leaderboard-filters {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.filter-group select {
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #667eea;
}

.clear-filter-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
}

.clear-filter-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.leaderboard-table {
    overflow-x: auto;
}

.leaderboard-item {
    display: grid;
    grid-template-columns: 50px 120px 1fr 80px 80px 100px 120px 150px;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    align-items: center;
}

.leaderboard-item:nth-child(odd) {
    background: #f8f9fa;
}

.leaderboard-rank {
    font-weight: 700;
    color: #667eea;
    font-size: 1.2rem;
}

.leaderboard-rank.top {
    color: #ffc107;
}

.leaderboard-score {
    font-weight: 600;
    color: #28a745;
}

.leaderboard-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-btn-small {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.action-btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.action-btn-small.review-btn {
    background: #28a745;
}

.action-btn-small.review-btn:hover {
    background: #218838;
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.3);
}

.action-btn-small.copy-btn {
    background: #ffc107;
    color: #333;
}

.action-btn-small.copy-btn:hover {
    background: #e0a800;
    box-shadow: 0 3px 10px rgba(255, 193, 7, 0.3);
}

.action-btn-small.delete-btn {
    background: #dc3545;
    color: white;
}

.action-btn-small.delete-btn:hover {
    background: #c82333;
    box-shadow: 0 3px 10px rgba(220, 53, 69, 0.3);
}

.review-notice {
    background: #fff3cd;
    color: #856404;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    text-align: center;
    font-weight: 600;
    border: 1px solid #ffeaa7;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.stat-item {
    text-align: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 2rem;
    border-radius: 15px;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.loading-spinner p {
    font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .grade-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .subject-grid {
        grid-template-columns: 1fr;
    }
    
    .quiz-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .quiz-navigation {
        justify-content: center;
    }

    .quiz-actions {
        justify-content: center;
    }

    .control-btn {
        justify-content: center;
    }

    .student-confirm-btn-enhanced {
        font-size: 1.1rem !important;
        padding: 12px 24px !important;
        min-width: 160px !important;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .leaderboard-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .welcome-card, .step-card, .results-card, .leaderboard-card, .stats-card {
        padding: 1rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
    }
    
    .score-number {
        font-size: 2rem;
    }
}

/* 預設題目頁面樣式 */
.presets-card {
    background: white;
    border: 3px solid #667eea;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.presets-card h2 {
    color: #667eea;
    margin-bottom: 10px;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
}

.presets-card > p {
    text-align: center;
    color: var(--secondary-text-color);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.preset-item {
    background: white;
    border: 3px solid #e9ecef;
    border-radius: 20px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.preset-item:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.15);
}

.preset-item h4 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preset-item .preset-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.preset-tag {
    background: var(--primary-color-light);
    color: var(--primary-color-darker);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.preset-content {
    color: var(--secondary-text-color);
    font-size: 0.9rem;
    margin-top: 10px;
    line-height: 1.4;
}

.preset-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    opacity: 1;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.delete-preset-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.delete-preset-btn:hover {
    background: var(--danger-color-dark);
}

.loading-message {
    text-align: center;
    color: var(--secondary-text-color);
    font-style: italic;
    padding: 40px;
    grid-column: 1 / -1;
}

/* 管理員控制區樣式 */
.admin-section {
    border-top: 2px solid var(--border-color);
    padding-top: 20px;
    text-align: center;
}

.admin-section h3 {
    color: var(--primary-color-darker);
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.admin-section .btn {
    margin: 0 10px;
}

/* 模態框樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border: 3px solid #667eea;
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    color: var(--secondary-text-color);
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: var(--primary-color);
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 30px;
    text-align: center;
    font-size: 2.4rem;
    font-weight: 700;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 12px;
    color: #333;
    font-weight: 700;
    font-size: 1.2rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 15px;
    border: 3px solid #e9ecef;
    border-radius: 15px;
    background: white;
    color: #333;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-form {
    text-align: center;
}

.login-form .btn {
    display: inline-block;
    margin: 0 auto;
}

.login-form input {
    margin-bottom: 25px;
    max-width: 400px;
    font-size: 1.3rem;
    padding: 18px;
}

.message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
}

.message.success {
    background: var(--success-color-light);
    color: var(--success-color-dark);
    border: 1px solid var(--success-color);
}

.message.error {
    background: var(--danger-color-light);
    color: var(--danger-color-dark);
    border: 1px solid var(--danger-color);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .presets-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .admin-section .btn {
        display: block;
        width: 100%;
        margin: 10px 0;
    }
}

/* ============ 問答比賽樣式 ============ */

.competitions-card {
    background: white;
    border: 3px solid var(--primary-color);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.competitions-card h2 {
    color: var(--primary-color);
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
}

.competitions-description {
    text-align: center;
    color: var(--secondary-text-color);
    font-size: 1.1rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

.competitions-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.competition-item {
    background: white;
    border: 3px solid #e9ecef;
    border-radius: 20px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.competition-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.competition-item h4 {
    color: #333;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.3;
}

.competition-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.competition-tag {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.competition-meta {
    color: var(--secondary-text-color);
    font-size: 0.9rem;
    margin-top: 10px;
    line-height: 1.4;
}

.competition-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 1;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.delete-competition-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.delete-competition-btn:hover {
    background: var(--danger-color-dark);
}

/* 比賽詳情頁面 */
.competition-info h2 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 10px;
}

.competition-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.meta-tag {
    background: white;
    color: #333;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.competition-start {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 30px;
}

.start-card {
    background: white;
    border: 3px solid var(--primary-color);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
}

.start-card h3 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.start-card p {
    color: var(--secondary-text-color);
    margin-bottom: 20px;
}

.competition-leaderboard {
    background: white;
    border: 3px solid #28a745;
    border-radius: 20px;
    padding: 30px;
}

.competition-leaderboard h3 {
    color: #28a745;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

.rankings-list {
    max-height: 400px;
    overflow-y: auto;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #f8f9fa;
    border-radius: 15px;
    margin-bottom: 10px;
    background: white;
    transition: all 0.2s ease;
}

.ranking-item:hover {
    border-color: #28a745;
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.1);
}

.ranking-position {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
}

.ranking-position.first {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
}

.ranking-position.second {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: #333;
}

.ranking-position.third {
    background: linear-gradient(135deg, #cd7f32, #d4a574);
    color: white;
}

.ranking-info {
    flex: 1;
}

.ranking-name {
    font-weight: 700;
    color: #333;
    font-size: 1.1rem;
}

.ranking-score {
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.ranking-stats {
    text-align: right;
    color: var(--secondary-text-color);
    font-size: 0.85rem;
}

/* 比賽進行中樣式 */
.competition-start,
.competition-leaderboard {
    animation: fadeIn 0.5s ease-in;
}

/* 比賽題目樣式 */
#competition-quiz .question-text {
    background: white !important;
    border: 3px solid var(--primary-color) !important;
    border-radius: 20px !important;
    padding: 30px !important;
    margin-bottom: 30px !important;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.1) !important;
}

#competition-quiz .question-text h3 {
    color: #333 !important;
    font-size: 1.4rem !important;
    font-weight: 600 !important;
    line-height: 1.6 !important;
    margin: 0 !important;
    text-align: center !important;
}

/* 確保比賽標題是黑色 */
#competition-detail .competition-info h2 {
    color: #333 !important;
    font-size: 2rem !important;
    margin-bottom: 10px !important;
}

/* 比賽確認按鈕樣式 */
#competition-confirm-btn {
    background: #28a745 !important; /* 將背景色改為綠色 */
    color: white !important;
    border: none !important;
    padding: 15px 30px !important;
    border-radius: 15px !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

#competition-confirm-btn:hover:not(:disabled) {
    background: #218838 !important; /* 調整 hover 時的背景色 */
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3) !important; /* 調整 hover 時的陰影 */
}

#competition-confirm-btn:disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .competitions-list {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .competition-start {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .competition-item {
        padding: 20px;
    }
    
    .competition-item h4 {
        font-size: 1.2rem;
    }
    
    .competitions-card {
        padding: 25px;
    }
    
    .competitions-card h2 {
        font-size: 2rem;
    }
}

/* 問答比賽題目區塊樣式 */
#competition-quiz .question-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

#competition-quiz .options-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.question-container h3 {
    color: #333 !important;
    font-size: 1.3rem !important;
    font-weight: 600 !important;
    line-height: 1.6 !important;
    margin-bottom: 2rem !important;
    text-align: left !important; /* 確保題目文字靠左對齊 */
}

/* 新增短答題輸入框的樣式，使其與多項選擇題的選項卡片風格一致 */
.competition-short-answer-input {
    width: 100%;
    padding: 1.5rem;
    border: 3px solid #e9ecef;
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s ease;
    background: white;
    color: #333;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.competition-short-answer-input:focus {
    outline: none;
    border-color: #667eea;
    background: #f8f9ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.competition-short-answer-input::placeholder {
    color: #999;
    font-style: italic;
}

/* 調整題目編號和計時器位置 */
#competition-quiz .question-info {
    background: white; /* 添加白色背景 */
    border-radius: 15px; /* 添加圓角 */
    padding: 1rem 1.5rem; /* 添加內邊距 */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08); /* 添加陰影 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
}

/* 將確認答案按鈕調整為右下角，並確保位置在短答題下方 */
#competition-quiz .quiz-controls {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* 為問題的選項添加樣式，使其與首頁的選項樣式一致 */
#competition-quiz .option-btn {
    background: white;
    border: 4px solid #e9ecef;
    padding: 1.5rem;
    border-radius: 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.4s ease;
    font-size: 1.2rem;
    font-weight: 500;
    position: relative;
    min-height: 70px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#competition-quiz .option-btn:hover:not(.selected):not(.disabled) {
    border-color: #667eea;
    background: #f0f3ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.15);
    border-width: 3px;
}

#competition-quiz .option-btn.selected {
    background: #4FC3F7 !important;
    color: #333 !important;
    border: 8px solid #29B6F6 !important;
    box-shadow: 
        0 20px 60px rgba(79, 195, 247, 0.8), 
        0 0 0 6px rgba(41, 182, 246, 0.5), 
        0 0 80px rgba(79, 195, 247, 0.4) !important;
    transform: translateY(-12px) scale(1.1) !important;
    font-weight: 900 !important;
    font-size: 1.4rem !important;
    animation: selectedMegaPulse 1s infinite ease-in-out !important;
    position: relative !important;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.7) !important;
    z-index: 1000 !important;
    outline: 4px solid rgba(255, 255, 255, 0.8) !important;
    outline-offset: 4px !important;
    padding-left: 4rem !important;
}

#competition-quiz .option-btn.selected::before {
    content: "👉";
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    animation: fingerWave 0.8s infinite ease-in-out;
    z-index: 1001;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

#competition-quiz .option-btn.selected::after {
    content: "✓ 已選擇";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: #4CAF50;
    color: white;
    padding: 8px 15px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 700;
    animation: selectedMark 1s infinite ease-in-out;
    z-index: 1002;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.6);
    border: 2px solid white;
}

#competition-quiz .option-btn.correct {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-color: #10b981;
    border-width: 5px;
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.5);
    transform: translateY(-5px) scale(1.02);
    font-weight: 700;
    animation: correctPulse 0.8s ease-out;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#competition-quiz .option-btn.correct::before {
    content: "🎉 ";
    font-size: 1.8rem;
    margin-right: 0.8rem;
    animation: celebrateBounce 0.8s ease-out;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

#competition-quiz .option-btn.incorrect {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-color: #ef4444;
    border-width: 5px;
    box-shadow: 0 12px 30px rgba(239, 68, 68, 0.5);
    transform: translateY(-5px) scale(1.02);
    font-weight: 700;
    animation: incorrectShake 0.6s ease-out;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#competition-quiz .option-btn.incorrect::before {
    content: "❌ ";
    font-size: 1.8rem;
    margin-right: 0.8rem;
    animation: errorPulse 0.6s ease-out;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

#competition-quiz .option-btn.disabled {
    pointer-events: none;
    opacity: 0.7;
    filter: grayscale(0.3);
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

/* 短答題的答案區塊樣式 */
#competition-answer-explanation.short-answer-feedback .explanation-content {
    padding: 1.5rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-top: 1rem;
}

#competition-answer-explanation.short-answer-feedback .result-indicator {
    padding: 1rem;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

#competition-answer-explanation.short-answer-feedback .ai-grading-result {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

#competition-answer-explanation.short-answer-feedback .ai-score {
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 0.5rem;
}

#competition-answer-explanation.short-answer-feedback .ai-feedback {
    margin-bottom: 0.5rem;
    color: #333;
    line-height: 1.4;
}

#competition-answer-explanation.short-answer-feedback .ai-reasoning {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    font-style: italic;
}

/* 調整比賽結果介面的排版和樣式 */
#competition-results .results-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#competition-results .score-display {
    margin: 2rem 0;
}

#competition-results .final-score {
    font-size: 3.5rem;
    font-weight: 700;
    color: #667eea;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
}

#competition-results .final-score span:last-child {
    font-size: 1.5rem;
    color: #666;
}

#competition-results .score-percentage {
    font-size: 2.5rem;
    font-weight: 600;
    color: #28a745;
    margin-top: 1rem;
}

#competition-results .completion-time {
    margin-top: 2rem;
    font-size: 1.2rem;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#competition-results .results-actions {
    margin-top: 2.5rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

#competition-results .btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 25px;
}

@media (max-width: 768px) {
    #competition-results .final-score {
        font-size: 3rem;
    }
    #competition-results .score-percentage {
        font-size: 2rem;
    }
    #competition-results .btn {
        width: 100%;
    }
    #competition-quiz .question-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    #competition-quiz .quiz-controls {
        justify-content: center;
    }
}
/* 登入牆樣式 */
.login-wall {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.login-wall.hidden {
    display: none;
}

.login-wall-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 1rem;
    text-align: center;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-wall-header h1 {
    color: #667eea;
    margin-bottom: 0.3rem;
    font-size: 2rem;
    font-weight: 700;
}

.login-wall-header p {
    color: #666;
    margin-bottom: 0.3rem;
    font-size: 1rem;
}

.login-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 0.5rem 0;
}

.login-option-card {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid transparent;
}

.login-option-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.login-option-card h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.login-option-card p {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.login-help {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(102, 126, 234, 0.2);
}

.login-help p {
    color: #666;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .login-wall-content {
        padding: 2rem;
        margin: 1rem;
    }

    .login-wall-header h1 {
        font-size: 2rem;
    }

    .login-options {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .login-option-card {
        padding: 1.5rem;
    }
}

/* 學生管理樣式 */
.student-management-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.management-actions {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.students-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.students-table th,
.students-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.students-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.students-table tr:hover {
    background-color: #f8f9ff;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff5252 0%, #d63031 100%);
    transform: translateY(-2px);
}

.empty-message,
.error-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.error-message {
    color: #e74c3c;
}

/* Excel 匯入匯出樣式 */
.import-area {
    margin: 2rem 0;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.import-card {
    background: white;
    padding: 2rem;
    border: 2px dashed #ddd;
    border-radius: 15px;
    transition: all 0.3s ease;
}

.import-card:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.file-upload-area {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 2rem;
    margin: 1rem 0;
    text-align: center;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.file-upload-area.dragover {
    border-color: #667eea;
    background: #e8ecff;
    transform: scale(1.02);
}

.upload-placeholder {
    color: #666;
}

.upload-placeholder i {
    font-size: 3rem;
    color: #ccc;
    margin-bottom: 1rem;
    display: block;
}

.file-info {
    font-size: 0.9rem;
    color: #888;
    margin-top: 0.5rem;
}

.file-selected {
    display: none;
    color: #27ae60;
    font-weight: 600;
}

.file-selected i {
    color: #27ae60;
    margin-right: 0.5rem;
}

.import-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.import-progress {
    margin-top: 1rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
    animation: progressPulse 1.5s infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.import-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.import-result.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.import-result.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.import-result.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.import-details {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.import-details ul {
    text-align: left;
    margin-top: 0.5rem;
}

/* 按鈕顏色變化 */
.btn-success {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #00a085 0%, #008f7a 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
}

.btn-info {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #0984e3 0%, #2d3436 100%);
}

@media (max-width: 768px) {
    .management-actions {
        flex-direction: column;
    }

    .students-table {
        font-size: 0.9rem;
    }

    .students-table th,
    .students-table td {
        padding: 0.7rem 0.5rem;
    }

    .action-buttons {
        flex-direction: column;
    }
}

/* 即時比賽主持人視圖樣式 */
.option-btn.host-view {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

.host-correct-answer {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    background: linear-gradient(135deg, #fef3c7 0%, #facc15 45%, #f97316 100%);
    border-radius: 20px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 12px 28px rgba(249, 115, 22, 0.25);
    color: #78350f;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.host-correct-answer .answer-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.host-correct-answer .answer-text {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.25);
    padding: 0.85rem 1rem;
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

/* 學生分數顯示樣式 */
.live-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.player-name {
    font-weight: bold;
    font-size: 1.1em;
}

.player-status {
    font-size: 0.9em;
    opacity: 0.9;
}

.player-status.pending {
    color: #ffc107;
}

.player-status.completed {
    color: #28a745;
}

.player-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.score-label {
    font-size: 0.8em;
    opacity: 0.8;
    margin-bottom: 5px;
}

.score-value {
    font-size: 2em;
    font-weight: bold;
    background: rgba(255,255,255,0.2);
    padding: 10px 15px;
    border-radius: 50%;
    min-width: 60px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* 主持人遊戲大廳樣式 */
.game-code-section {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 25px;
    color: white;
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.3);
}

.game-code-section h3 {
    font-size: 2.2rem;
    margin-bottom: 25px;
    color: white;
    text-shadow: 0 3px 6px rgba(0,0,0,0.3);
    font-weight: 800;
    letter-spacing: 1px;
}

.game-code-display {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 20px 40px;
    border-radius: 20px;
    margin: 20px 0;
    border: 3px solid rgba(255, 255, 255, 0.3);
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    font-family: 'Courier New', monospace;
    backdrop-filter: blur(10px);
    box-shadow:
        inset 0 0 30px rgba(255,255,255,0.1),
        0 8px 32px rgba(0,0,0,0.2);
}

.game-code-instruction {
    font-size: 1.3rem;
    margin-top: 20px;
    opacity: 0.95;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.players-section {
    margin-bottom: 30px;
}

.players-section h3 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: #2c3e50;
    text-align: center;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.enhanced-players-list {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 3px solid #e9ecef;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.enhanced-players-list .player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    margin: 10px 0;
    background: linear-gradient(135deg, #f8f9ff, #e3f2fd);
    border: 2px solid #e3f2fd;
    border-radius: 15px;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.enhanced-players-list .player-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.enhanced-players-list .player-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.enhanced-players-list .player-name::before {
    content: "🎮";
    font-size: 1.5rem;
}

.enhanced-players-list .player-status {
    background: #28a745;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.enhanced-players-list .loading-message {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
    font-size: 1.1rem;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .game-code-display {
        font-size: 3rem;
        letter-spacing: 0.3rem;
        padding: 15px 25px;
    }

    .game-code-section {
        padding: 20px;
        margin-bottom: 30px;
    }

    .game-code-section h3 {
        font-size: 1.8rem;
    }

    .game-code-instruction {
        font-size: 1.1rem;
    }

    .players-section h3 {
        font-size: 1.5rem;
    }

    .host-controls .btn, .host-controls-container .btn,
    .host-controls button, .host-controls-container button {
        font-size: 1rem !important;
        padding: 12px 24px !important;
        min-width: 120px !important;
    }

    .host-controls, .host-controls-container {
        gap: 12px;
        margin: 20px 0;
        padding: 15px 0;
        flex-direction: column;
        align-items: center;
    }

    .enhanced-players-list .player-item {
        font-size: 1.1rem;
        padding: 12px 15px;
    }

    .enhanced-players-list .player-name {
        font-size: 1.2rem;
    }
}

/* 學生端等待狀態區域 */
.player-status-section {
    text-align: center;
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #28a745, #20c997);
    border-radius: 20px;
    color: white;
    box-shadow: 0 10px 30px rgba(40, 167, 69, 0.3);
}

.waiting-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.waiting-status i {
    font-size: 3rem;
    animation: pulse 2s infinite;
}

.waiting-status p {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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

/* 響應式設計 - 學生端 */
@media (max-width: 768px) {
    .player-status-section {
        padding: 20px;
        margin-top: 20px;
    }

    .waiting-status i {
        font-size: 2.5rem;
    }

    .waiting-status p {
        font-size: 1.1rem;
    }
}

/* 增強的學生加入界面樣式 */
.join-form-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 20px;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.join-form-header h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.join-form-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

.form-group-enhanced {
    margin-bottom: 30px;
}

.form-group-enhanced label {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    text-align: left;
}

.form-group-enhanced label i {
    margin-right: 8px;
    color: #667eea;
}

.enhanced-input {
    width: 100%;
    padding: 18px 20px;
    font-size: 1.3rem;
    font-weight: 600;
    border: 3px solid #e9ecef;
    border-radius: 15px;
    transition: all 0.3s ease;
    background: white;
    text-align: center;
}

.enhanced-input:focus {
    outline: none;
    border-color: #667eea;
    background: #f8f9ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.game-code-input {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.3rem;
    font-size: 2rem;
    text-transform: uppercase;
}

.player-name-input {
    font-size: 1.4rem;
}

.btn-join-enhanced {
    width: 100%;
    padding: 20px 0;
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-join-enhanced:hover:not(:disabled) {
    background: linear-gradient(135deg, #218838, #17a2b8);
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(40, 167, 69, 0.4);
}

.btn-join-enhanced:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-join-enhanced i {
    font-size: 1.5rem;
    animation: rocket 2s infinite ease-in-out;
}

@keyframes rocket {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.message-enhanced {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    display: none;
}

.message-enhanced.error {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    display: block;
}

.message-enhanced.success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    display: block;
}

/* 響應式設計 - 增強的加入界面 */
@media (max-width: 768px) {
    .join-form-header {
        padding: 20px;
        margin-bottom: 30px;
    }

    .join-form-header h3 {
        font-size: 1.6rem;
    }

    .enhanced-input {
        padding: 15px 18px;
        font-size: 1.1rem;
    }

    .game-code-input {
        font-size: 1.6rem;
        letter-spacing: 0.2rem;
    }

    .player-name-input {
        font-size: 1.2rem;
    }

    .btn-join-enhanced {
        padding: 18px 0;
        font-size: 1.2rem;
    }
}

/* AI生成問題加載覆蓋層 */
.ai-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-in;
}

.ai-loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
    padding: 40px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.5s ease-out;
}

.ai-brain-animation {
    margin-bottom: 30px;
}

.ai-brain-animation i {
    font-size: 4rem;
    color: #fff;
    animation: brainPulse 2s infinite ease-in-out;
}

.ai-loading-content h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.ai-loading-content p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 30px;
    line-height: 1.5;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: dotsAnimation 1.5s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes brainPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes dotsAnimation {
    0%, 20% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.3;
    }
}

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

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

/* 響應式設計 - AI加載覆蓋層 */
@media (max-width: 768px) {
    .ai-loading-content {
        max-width: 300px;
        padding: 30px;
    }

    .ai-brain-animation i {
        font-size: 3rem;
    }

    .ai-loading-content h3 {
        font-size: 1.5rem;
    }

    .ai-loading-content p {
        font-size: 1rem;
    }
}

/* 新的卡通化登入牆樣式覆蓋 */
.login-wall {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%, #f093fb 100%);
    overflow-x: hidden;
    overflow-y: auto;
    padding: clamp(16px, 5vh, 32px) 16px;
}

.login-wall::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="40" r="3" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="80" r="2" fill="rgba(255,255,255,0.1)"/></svg>');
    animation: float 20s infinite linear;
}

@keyframes float {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-100px); }
}

.login-wall-content {
    background: rgba(255, 255, 255, 0.98) !important;
    border-radius: 28px !important;
    width: min(760px, 100%);
    max-width: 760px !important;
    padding: clamp(16px, 2vw, 24px) !important;
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(20px) !important;
    border: 3px solid rgba(255, 255, 255, 0.4) !important;
    animation: bounceIn 0.8s ease-out;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2vw, 24px);
    text-align: center;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.platform-logo {
    margin-bottom: clamp(8px, 1.8vw, 22px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 3.3rem;
    margin-bottom: 0.4rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.platform-logo h1 {
    color: #667eea !important;
    margin: 0 !important;
    font-size: 2.1rem !important;
    font-weight: 800 !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    white-space: nowrap !important;
}

.welcome-text {
    margin-bottom: clamp(8px, 2vw, 24px);
}

.welcome-text h2 {
    color: #333;
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.welcome-text p {
    color: #666;
    font-size: 1rem;
    margin: 0;
}

.login-options {
    gap: clamp(10px, 1.6vw, 20px) !important;
    margin: clamp(8px, 1.6vw, 20px) 0 !important;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    align-items: stretch;
}

.login-option-card {
    background: linear-gradient(145deg, #ffffff, #f8f9ff) !important;
    border: 3px solid transparent !important;
    border-radius: 22px !important;
    padding: clamp(1.25rem, 2.6vw, 1.7rem) !important;
    transition: all 0.4s ease !important;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 25px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.6) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    min-height: 100%;
}

.login-option-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.login-option-card:hover::before {
    left: 100%;
}

.student-card:hover {
    border-color: #4CAF50 !important;
    transform: translateY(-8px) scale(1.03) !important;
    box-shadow:
        0 15px 40px rgba(76, 175, 80, 0.3),
        0 0 0 3px rgba(76, 175, 80, 0.1) !important;
}

.teacher-card:hover {
    border-color: #FF9800 !important;
    transform: translateY(-8px) scale(1.03) !important;
    box-shadow:
        0 15px 40px rgba(255, 152, 0, 0.3),
        0 0 0 3px rgba(255, 152, 0, 0.1) !important;
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
    animation: wiggle 3s infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

.login-option-card h3 {
    color: #333 !important;
    margin-bottom: 0.15rem !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
}

.login-option-card p {
    color: #666 !important;
    font-size: 0.85rem !important;
    line-height: 1.45;
    margin-bottom: 0 !important;
    flex: 1;
}

.login-option-card button {
    width: 100%;
    max-width: 220px;
}

.btn-student {
    background: linear-gradient(135deg, #4CAF50, #45a049) !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 24px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3) !important;
    position: relative;
    overflow: hidden;
}

.btn-student:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4) !important;
}

.btn-teacher {
    background: linear-gradient(135deg, #FF9800, #f57c00) !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 24px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3) !important;
}

.btn-teacher:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.4) !important;
}

.help-bubble {
    background: linear-gradient(135deg, #FFE0B2, #FFCC02);
    border-radius: 20px;
    padding: 1rem;
    margin-top: 0.5rem;
    position: relative;
    box-shadow: 0 4px 15px rgba(255, 204, 2, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    text-align: center;
}

.help-icon {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

.help-bubble p {
    margin: 0;
    color: #333;
    font-size: 0.95rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .login-wall-content {
        padding: clamp(24px, 5vw, 36px) !important;
    }

    .platform-logo h1 {
        font-size: 2rem !important;
        white-space: normal !important;
    }

    .welcome-text h2 {
        font-size: 1.6rem;
    }

    .welcome-text p {
        font-size: 1.05rem;
    }

    .login-option-card {
        padding: 2rem !important;
    }
}

@media (max-width: 540px) {
    .login-wall {
        padding: 24px 12px;
    }

    .platform-logo h1 {
        font-size: 1.7rem !important;
    }

    .logo-icon {
        font-size: 3.2rem;
    }

    .welcome-text h2 {
        font-size: 1.4rem;
    }

    .welcome-text p {
        font-size: 0.95rem;
    }

    .login-option-card {
        padding: 1.75rem !important;
    }

    .btn-student,
    .btn-teacher {
        padding: 12px 24px !important;
        font-size: 1rem !important;
    }
}

/* 學生登入模態框樣式 */
.student-login-modal {
    max-width: 500px !important;
    border-radius: 25px !important;
    background: linear-gradient(145deg, #ffffff, #f0f4ff) !important;
    border: 3px solid #4CAF50 !important;
    box-shadow:
        0 25px 50px rgba(76, 175, 80, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.6) !important;
}

.student-login-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-radius: 20px;
    color: white;
}

.login-avatar {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

.student-login-header h2 {
    color: white !important;
    margin-bottom: 0.5rem !important;
    font-size: 2rem !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.student-login-header p {
    color: rgba(255,255,255,0.9);
    margin: 0;
    font-size: 1rem;
}

.student-login-form {
    padding: 1rem;
}

.form-group-left {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group-left label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.student-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    transition: all 0.3s ease;
    background: white;
    box-sizing: border-box;
}

.student-input:focus {
    outline: none;
    border-color: #4CAF50;
    background: #f9fff9;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    transform: translateY(-2px);
}

.login-button-section {
    text-align: center;
    margin-top: 2rem;
}

.btn-student-login {
    background: linear-gradient(135deg, #4CAF50, #45a049) !important;
    color: white !important;
    border: none !important;
    padding: 18px 40px !important;
    border-radius: 25px !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3) !important;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn-student-login:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.4) !important;
}

.btn-student-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-student-login:hover::before {
    left: 100%;
}

/* 新增學生模態框樣式 */
#add-student-modal .modal-content {
    max-width: 450px !important;
    width: 90% !important;
    padding: 25px !important;
}

#add-student-modal h2 {
    font-size: 1.8rem !important;
    margin-bottom: 20px !important;
}

#add-student-modal .form-group {
    margin-bottom: 15px !important;
}

#add-student-modal .form-group label {
    font-size: 0.95rem !important;
    margin-bottom: 5px !important;
}

#add-student-modal input,
#add-student-modal select {
    padding: 10px !important;
    font-size: 0.95rem !important;
}

#add-student-modal .btn {
    padding: 12px 25px !important;
    font-size: 1rem !important;
}

/* 即時比賽提交按鈕樣式 */
.live-submit-container {
    text-align: right;
    margin: 20px 0;
    padding: 15px 0;
}

.live-submit-button {
    font-size: 1.2rem !important;
    padding: 15px 30px !important;
    min-width: 200px !important;
    font-weight: bold !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3) !important;
    border: none !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    background: linear-gradient(45deg, #28a745, #34ce57) !important;
    color: white !important;
}

.live-submit-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4) !important;
    background: linear-gradient(45deg, #218838, #28a745) !important;
}

.live-submit-button:active {
    transform: translateY(0) !important;
}

.live-submit-button i {
    margin-right: 8px;
    font-size: 1.1em;
}

/* 主持人控制按鈕容器 */
.host-controls, .host-controls-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
    padding: 20px 0;
    border-top: 2px solid #e9ecef;
}

.host-controls {
    flex-wrap: wrap;
}

/* 主持人控制按鈕統一樣式 */
.host-controls .btn, .host-controls-container .btn,
.host-controls button, .host-controls-container button {
    font-size: 1.2rem !important;
    padding: 16px 32px !important;
    min-width: 160px !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    border: none !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    overflow: hidden !important;
    text-transform: none !important;
    letter-spacing: 0.5px !important;
}

/* 開始答題按鈕 */
.host-controls .btn-success, #host-start-quiz-btn {
    background: linear-gradient(45deg, #28a745, #20c997) !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4) !important;
}

.host-controls .btn-success:hover, #host-start-quiz-btn:hover {
    background: linear-gradient(45deg, #218838, #1ba085) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.5) !important;
}

.host-controls .btn-success:disabled, #host-start-quiz-btn:disabled {
    background: linear-gradient(45deg, #6c757d, #5a6268) !important;
    color: #dee2e6 !important;
    box-shadow: 0 3px 10px rgba(108, 117, 125, 0.3) !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* 取消遊戲按鈕 */
.host-controls .btn-danger, #host-cancel-game-btn {
    background: linear-gradient(45deg, #dc3545, #c82333) !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4) !important;
}

.host-controls .btn-danger:hover, #host-cancel-game-btn:hover {
    background: linear-gradient(45deg, #c82333, #a02230) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.5) !important;
}

/* 按鈕動畫效果 */
@keyframes buttonPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.host-controls .btn:not(:disabled):active,
.host-controls-container .btn:not(:disabled):active,
.host-controls button:not(:disabled):active,
.host-controls-container button:not(:disabled):active {
    animation: buttonPulse 0.3s ease;
}

/* 遊戲代碼閃爍動畫 */
@keyframes codeGlow {
    0% { box-shadow: inset 0 0 30px rgba(255,255,255,0.1), 0 8px 32px rgba(0,0,0,0.2); }
    50% { box-shadow: inset 0 0 30px rgba(255,255,255,0.2), 0 8px 32px rgba(102, 126, 234, 0.4); }
    100% { box-shadow: inset 0 0 30px rgba(255,255,255,0.1), 0 8px 32px rgba(0,0,0,0.2); }
}

.game-code-display {
    animation: codeGlow 3s ease-in-out infinite;
}

/* 玩家列表標題動畫 */
.players-section h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 2px;
}

/* 增強的主持人下一題按鈕 */
.host-next-btn-enhanced {
    font-size: 1.3rem !important;
    padding: 16px 32px !important;
    min-width: 160px !important;
    font-weight: bold !important;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4) !important;
    border: none !important;
    border-radius: 12px !important;
    background: linear-gradient(45deg, #667eea, #764ba2) !important;
    color: white !important;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease !important;
}

.host-next-btn-enhanced:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05) !important;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5) !important;
    background: linear-gradient(45deg, #5a6fd8, #6c5ce7) !important;
}

.host-next-btn-enhanced:active:not(:disabled) {
    transform: translateY(-1px) scale(1.02) !important;
}

.host-next-btn-enhanced i {
    margin-right: 10px;
    font-size: 1.2em;
    animation: pulse-arrow 2s infinite ease-in-out;
}

.host-next-btn-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

.host-next-btn-enhanced:hover::before {
    left: 100%;
}

/* 增強的結束比賽按鈕 */
.host-finish-btn-enhanced {
    font-size: 1.2rem !important;
    padding: 14px 28px !important;
    min-width: 140px !important;
    font-weight: bold !important;
    border-radius: 12px !important;
}

/* 學生確認提交按鈕增強樣式 */
.student-confirm-btn-enhanced {
    font-size: 1.2rem !important;
    padding: 14px 28px !important;
    min-width: 180px !important;
    font-weight: bold !important;
    box-shadow: 0 4px 14px rgba(40, 167, 69, 0.4) !important;
    border: none !important;
    border-radius: 10px !important;
    background: linear-gradient(45deg, #28a745, #34ce57) !important;
    color: white !important;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease !important;
}

.student-confirm-btn-enhanced:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.03) !important;
    box-shadow: 0 6px 18px rgba(40, 167, 69, 0.5) !important;
    background: linear-gradient(45deg, #218838, #28a745) !important;
}

.student-confirm-btn-enhanced:active:not(:disabled) {
    transform: translateY(0) scale(1.01) !important;
}

.student-confirm-btn-enhanced i {
    margin-right: 8px;
    font-size: 1.1em;
    animation: pulse-check 2s infinite ease-in-out;
}

/* 確認圖標脈動動畫 */
@keyframes pulse-check {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

/* 箭頭脈動動畫 */
@keyframes pulse-arrow {
    0%, 100% {
        transform: translateX(0);
        opacity: 1;
    }
    50% {
        transform: translateX(5px);
        opacity: 0.8;
    }
}

/* 響應式調整 */
@media (max-width: 768px) {
    .live-submit-button {
        font-size: 1.1rem !important;
        padding: 12px 25px !important;
        min-width: 180px !important;
    }

    .host-controls-container {
        flex-direction: column;
        align-items: flex-end;
        gap: 10px;
    }

    .host-next-btn-enhanced {
        font-size: 1.2rem !important;
        padding: 14px 28px !important;
        min-width: 140px !important;
    }

    .host-finish-btn-enhanced {
        font-size: 1.1rem !important;
        padding: 12px 24px !important;
        min-width: 120px !important;
    }
}

/* 系統縮放功能 */
body {
    transform-origin: top left;
    /* 移除固定縮放，改由JavaScript動態控制 */
}

/* 縮放控制按鈕 - 與導航按鈕保持一致的設計 */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

.zoom-btn {
    background: none;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 0.4rem 0.8rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    min-width: 36px;
    height: 36px;
}

.zoom-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.zoom-level {
    color: #667eea;
    font-size: 0.85rem;
    min-width: 42px;
    text-align: center;
    font-weight: 600;
    background: none;
    border: 2px solid #667eea;
    padding: 0.3rem 0.6rem;
    border-radius: 25px;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .zoom-controls {
        margin-left: 0.5rem;
        gap: 0.3rem;
    }

    .zoom-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
        min-width: 30px;
        height: 30px;
    }

    .zoom-level {
        font-size: 0.75rem;
        min-width: 36px;
        padding: 0.25rem 0.4rem;
    }
}

@media (max-width: 480px) {
    .header .container {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .nav {
        gap: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .zoom-controls {
        margin-left: 0;
        gap: 0.25rem;
    }
}

/* 學生端即時得分和排名顯示 */
.live-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.student-live-stats {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    animation: slideInFromTop 0.5s ease-out;
}

.student-live-stats:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.live-score-display,
.live-rank-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.live-score-display i,
.live-rank-display i {
    font-size: 1.1rem;
    opacity: 0.9;
}

.score-label,
.rank-label {
    font-weight: 500;
    font-size: 0.9rem;
}

.score-value,
.rank-value {
    font-weight: 700;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.score-value {
    color: #ffd700;
    transition: all 0.3s ease;
}

.score-value.updated {
    animation: scoreUpdate 0.6s ease;
}

.rank-value {
    color: #ffa500;
    transition: all 0.3s ease;
}

.rank-value.updated {
    animation: rankUpdate 0.6s ease;
}

@keyframes scoreUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #ffff00; }
    100% { transform: scale(1); }
}

@keyframes rankUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #ff8c00; }
    100% { transform: scale(1); }
}

/* 即時得分和排名的響應式設計 */
@media (max-width: 768px) {
    .live-progress {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .student-live-stats {
        gap: 1rem;
        padding: 0.6rem 1rem;
        width: 100%;
        justify-content: space-between;
    }

    .progress-info {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .student-live-stats {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .live-score-display,
    .live-rank-display {
        justify-content: space-between;
        width: 100%;
    }
}

/* 增強按鈕動畫效果 */
@keyframes buttonPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes buttonGlow {
    0% { box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3); }
    50% { box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6); }
    100% { box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3); }
}

@keyframes buttonShine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes buttonBounce {
    0%, 20%, 60%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    80% { transform: translateY(-1px); }
}

/* 功能按鈕顏色系統 */
:root {
    --primary-color: #4f46e5;        /* 主要功能 - 靛藍 */
    --success-color: #10b981;        /* 成功/開始 - 綠色 */
    --warning-color: #f59e0b;        /* 警告/重要 - 橙色 */
    --danger-color: #ef4444;         /* 危險/刪除 - 紅色 */
    --info-color: #3b82f6;          /* 信息/查看 - 藍色 */
    --host-color: #8b5cf6;          /* 主持功能 - 紫色 */
    --join-color: #06b6d4;          /* 加入功能 - 青色 */
}

/* 增強所有主要按鈕樣式 - 更大更顯眼 */
.start-btn, .action-btn, .save-score-btn, .control-btn.confirm,
.btn-primary, .btn-success, .btn-warning, .btn-info, .btn-student, .btn-teacher,
.btn-student-login, .btn-join-enhanced, .student-confirm-btn-enhanced {
    position: relative;
    overflow: hidden;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 1.2rem 2.4rem;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateZ(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: none;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
}

/* 主要功能按鈕 - 靛藍色 */
.btn-primary, .start-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

/* 成功/開始按鈕 - 綠色 */
.btn-success, .action-btn {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

/* 警告/重要按鈕 - 橙色 */
.btn-warning, .save-score-btn {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

/* 危險按鈕 - 紅色 */
.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

/* 信息按鈕 - 藍色 */
.btn-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

/* 學生相關按鈕 - 特殊漸變 */
.btn-student, .btn-student-login {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
}

/* 教師相關按鈕 */
.btn-teacher {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

/* 主持遊戲按鈕 - 紫色 */
.btn-join-enhanced {
    background: linear-gradient(135deg, var(--join-color) 0%, #0891b2 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
    font-size: 1.3rem;
    padding: 1.4rem 2.8rem;
}

/* 確認按鈕增強 */
.student-confirm-btn-enhanced, .control-btn.confirm {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    font-size: 1.25rem;
    padding: 1.3rem 2.6rem;
}

.start-btn:hover, .action-btn:hover, .save-score-btn:hover,
.control-btn.confirm:hover, .btn-primary:hover, .btn-success:hover,
.btn-warning:hover, .btn-info:hover, .btn-student:hover, .btn-teacher:hover,
.btn-student-login:hover, .btn-join-enhanced:hover:not(:disabled),
.student-confirm-btn-enhanced:hover:not(:disabled) {
    animation: buttonPulse 0.6s ease-in-out, buttonGlow 1.5s ease-in-out infinite;
    transform: translateY(-3px) scale(1.02);
    background-position: 100% center;
}

.start-btn:active, .action-btn:active, .save-score-btn:active,
.control-btn.confirm:active, .btn-primary:active, .btn-success:active,
.btn-warning:active, .btn-info:active, .btn-student:active, .btn-teacher:active,
.btn-student-login:active, .btn-join-enhanced:active:not(:disabled),
.student-confirm-btn-enhanced:active:not(:disabled) {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

/* 為重要按鈕添加閃光效果 */
.start-btn::before, .btn-primary::before, .btn-success::before,
.btn-warning::before, .btn-info::before,
.btn-student::before, .btn-teacher::before, .btn-student-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.start-btn:hover::before, .btn-primary:hover::before, .btn-success:hover::before,
.btn-warning:hover::before, .btn-info:hover::before,
.btn-student:hover::before, .btn-teacher:hover::before, .btn-student-login:hover::before {
    left: 100%;
}

/* 增強導航按鈕 */
.nav-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn:hover {
    animation: buttonBounce 0.6s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 增強年級和科目選擇按鈕 */
.grade-btn, .subject-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.grade-btn:hover, .subject-btn:hover {
    animation: buttonPulse 0.4s ease;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.grade-btn.selected, .subject-btn.selected {
    animation: buttonGlow 2s ease-in-out infinite;
}

/* 增強選項按鈕 */
.option-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.option-btn:hover:not(.selected):not(.disabled) {
    animation: buttonPulse 0.3s ease;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.option-btn.selected {
    animation: buttonGlow 1.5s ease-in-out infinite;
}

/* 增強控制按鈕 */
.control-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.control-btn:hover:not(:disabled) {
    animation: buttonBounce 0.4s ease;
}

/* 特殊按鈕閃爍效果 */
@keyframes importantButtonBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.btn-warning, .btn-danger {
    animation: importantButtonBlink 2s ease-in-out infinite;
}

.btn-warning:hover, .btn-danger:hover {
    animation: buttonPulse 0.4s ease, buttonGlow 1s ease-in-out infinite;
}

/* 響應式動畫調整 */
@media (prefers-reduced-motion: reduce) {
    .start-btn, .action-btn, .save-score-btn, .control-btn.confirm,
    .btn-primary, .btn-success, .btn-warning, .btn-info, .btn-student, .btn-teacher,
    .btn-student-login, .btn-join-enhanced, .student-confirm-btn-enhanced,
    .nav-btn, .grade-btn, .subject-btn, .option-btn, .control-btn {
        animation: none !important;
        transition: all 0.2s ease !important;
    }
}

@media (max-width: 768px) {
    .start-btn:hover, .action-btn:hover, .btn-primary:hover {
        transform: translateY(-2px) scale(1.01);
    }

    /* 在小屏幕上減少動畫複雜度 */
    .shape {
        animation-duration: 15s !important;
    }

    .particle {
        animation-duration: 12s !important;
    }

    .wave-animation {
        height: 60px;
        animation-duration: 8s;
    }
}

@media (max-width: 480px) {
    /* 在很小的屏幕上進一步簡化動畫 */
    .floating-shapes .shape:nth-child(n+4) {
        display: none;
    }

    .particles .particle:nth-child(n+6) {
        display: none;
    }

    .wave-animation {
        height: 40px;
    }
}

/* 為不支持動畫的設備關閉動畫 */
@media (prefers-reduced-motion: reduce) {
    .animated-background,
    .floating-shapes,
    .particles,
    .wave-animation {
        display: none !important;
    }
}

/* 特別增強競賽相關按鈕 */
.live-competition-section {
    margin-top: 2rem;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    border-left: 6px solid #667eea;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.live-competition-options {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* 即時比賽按鈕特別增強 */
#host-game-btn {
    background: linear-gradient(135deg, var(--host-color, #8b5cf6) 0%, #7c3aed 100%) !important;
    color: white !important;
    font-size: 1.4rem !important;
    font-weight: 800 !important;
    padding: 1.8rem 3.2rem !important;
    border-radius: 20px !important;
    border: none !important;
    cursor: pointer;
    box-shadow: 0 12px 35px rgba(139, 92, 246, 0.5) !important;
    transform: translateZ(0);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    min-height: 80px !important;
    min-width: 200px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1rem !important;
    text-transform: none !important;
    position: relative;
    overflow: hidden;
}

#join-game-btn {
    background: linear-gradient(135deg, var(--join-color, #06b6d4) 0%, #0891b2 100%) !important;
    color: white !important;
    font-size: 1.4rem !important;
    font-weight: 800 !important;
    padding: 1.8rem 3.2rem !important;
    border-radius: 20px !important;
    border: none !important;
    cursor: pointer;
    box-shadow: 0 12px 35px rgba(6, 182, 212, 0.5) !important;
    transform: translateZ(0);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    min-height: 80px !important;
    min-width: 200px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1rem !important;
    text-transform: none !important;
    position: relative;
    overflow: hidden;
}

/* 新增比賽按鈕 */
#add-competition-btn {
    background: linear-gradient(135deg, var(--success-color, #10b981) 0%, #059669 100%) !important;
    color: white !important;
    font-size: 1.3rem !important;
    font-weight: 700 !important;
    padding: 1.5rem 2.8rem !important;
    border-radius: 18px !important;
    border: none !important;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4) !important;
    min-height: 70px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.8rem !important;
    text-transform: none !important;
}

/* 按鈕懸停效果 */
#host-game-btn:hover {
    transform: translateY(-5px) scale(1.05) !important;
    box-shadow: 0 20px 50px rgba(139, 92, 246, 0.6) !important;
    animation: buttonPulse 0.6s ease-in-out, buttonGlow 1.5s ease-in-out infinite;
}

#join-game-btn:hover {
    transform: translateY(-5px) scale(1.05) !important;
    box-shadow: 0 20px 50px rgba(6, 182, 212, 0.6) !important;
    animation: buttonPulse 0.6s ease-in-out, buttonGlow 1.5s ease-in-out infinite;
}

#add-competition-btn:hover {
    transform: translateY(-3px) scale(1.03) !important;
    box-shadow: 0 15px 40px rgba(16, 185, 129, 0.5) !important;
    animation: buttonPulse 0.4s ease;
}

/* 按鈕圖標增強 */
#host-game-btn i, #join-game-btn i, #add-competition-btn i {
    font-size: 1.6rem !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* 響應式設計 */
@media (max-width: 768px) {
    .live-competition-options {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }

    #host-game-btn, #join-game-btn {
        min-width: 180px !important;
        font-size: 1.2rem !important;
        padding: 1.5rem 2.5rem !important;
    }

    #add-competition-btn {
        font-size: 1.1rem !important;
        padding: 1.3rem 2.2rem !important;
    }
}

/* 增強即時比賽計時器和題號顯示 */
.live-progress {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 3px solid #667eea;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* 增強題號顯示 */
#live-current-question {
    font-size: 2.2rem !important;
    font-weight: 900 !important;
    color: #4f46e5 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#live-total-questions {
    font-size: 1.8rem !important;
    font-weight: 700 !important;
    color: #6b7280;
}

/* 增強計時器顯示 */
.question-timer, #live-question-timer {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white !important;
    font-size: 1.8rem !important;
    font-weight: 900 !important;
    padding: 1rem 2rem !important;
    border-radius: 50px !important;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4) !important;
    border: 3px solid rgba(255, 255, 255, 0.3) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    min-width: 200px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

#live-question-timer span {
    font-size: 2rem !important;
    font-weight: 900 !important;
    display: inline-block;
    min-width: 50px;
    text-align: center;
}

/* 最後5秒特效 */
.timer-warning {
    animation: timerWarning 1s ease-in-out infinite !important;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    box-shadow: 0 0 30px rgba(220, 38, 38, 0.8) !important;
    transform: scale(1.1) !important;
}

.timer-critical {
    animation: timerCritical 0.5s ease-in-out infinite !important;
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%) !important;
    box-shadow: 0 0 40px rgba(185, 28, 28, 1) !important;
    transform: scale(1.15) !important;
}

@keyframes timerWarning {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4), 0 0 20px rgba(220, 38, 38, 0.6);
    }
    50% {
        box-shadow: 0 8px 25px rgba(239, 68, 68, 0.8), 0 0 30px rgba(220, 38, 38, 0.9);
    }
}

@keyframes timerCritical {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(239, 68, 68, 0.8), 0 0 30px rgba(185, 28, 28, 1);
        transform: scale(1.15);
    }
    50% {
        box-shadow: 0 8px 25px rgba(239, 68, 68, 1), 0 0 50px rgba(185, 28, 28, 1);
        transform: scale(1.2);
    }
}

/* 計時器數字跳動效果 */
.timer-tick {
    animation: timerTick 0.3s ease-out;
}

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

/* 時間到的特效 */
.timer-finished {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%) !important;
    color: #d1d5db !important;
    animation: none !important;
    transform: scale(1) !important;
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.3) !important;
}

/* 顯示答案按鈕 */
.show-answer-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: white !important;
    font-size: 1.3rem !important;
    font-weight: 700 !important;
    padding: 1.2rem 2.4rem !important;
    border-radius: 16px !important;
    border: none !important;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    min-height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.8rem !important;
    margin-left: 1rem;
}

.show-answer-btn:hover {
    transform: translateY(-3px) scale(1.03) !important;
    box-shadow: 0 12px 35px rgba(245, 158, 11, 0.6) !important;
    animation: buttonPulse 0.4s ease;
}

.show-answer-btn:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: 0 4px 15px rgba(156, 163, 175, 0.3) !important;
    animation: none !important;
}

/* 下一題按鈕被禁用時的樣式 */
#host-next-live-question-btn:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%) !important;
    color: #d1d5db !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: 0 4px 15px rgba(156, 163, 175, 0.3) !important;
    animation: none !important;
}

#host-finish-live-game-btn:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%) !important;
    color: #d1d5db !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: 0 4px 15px rgba(156, 163, 175, 0.3) !important;
    animation: none !important;
}

/* AI評分顯示樣式 */
.ai-evaluation-section {
    animation: slideInUp 0.5s ease-out;
}

.ai-reasoning, .ai-feedback {
    transition: all 0.3s ease;
}

.ai-reasoning:hover, .ai-feedback:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.student-answer {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.ai-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* 針對短答題答案顯示的特殊樣式 */
.short-answer-input {
    background: #f8f9fa !important;
    border: 2px solid #e9ecef !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
}

.short-answer-input:disabled {
    opacity: 0.8 !important;
}

/* 即時比賽AI評分結果顯示 */
.ai-evaluation-result {
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    margin: 1.5rem 0;
    overflow: hidden;
    animation: slideInUp 0.6s ease-out;
    border: 2px solid #e9ecef;
}

.ai-evaluation-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 1rem 1.5rem;
    text-align: center;
}

.ai-evaluation-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.ai-evaluation-content {
    padding: 1.5rem;
}

.score-display {
    text-align: center;
    margin-bottom: 1.5rem;
}

.score-circle.correct {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.score-circle.incorrect {
    background: linear-gradient(135deg, #dc3545, #fd7e14);
}

.score-status {
    margin-top: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
}

.ai-reasoning, .ai-feedback {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.ai-reasoning h4, .ai-feedback h4 {
    margin: 0 0 0.8rem 0;
    color: #495057;
    font-size: 1rem;
    font-weight: 600;
}

.reasoning-content, .feedback-content {
    color: #6c757d;
    line-height: 1.6;
    font-size: 0.95rem;
}

.competition-score {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    border-radius: 10px;
    color: #2d3436;
    margin-top: 1rem;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .ai-evaluation-result {
        margin: 1rem;
        border-radius: 10px;
    }

    .ai-evaluation-content {
        padding: 1rem;
    }

    .score-circle {
        width: 120px;
        height: 120px;
    }

    .score-number {
        font-size: 2.5rem;
    }
}

/* 版權信息Footer樣式 */
.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    margin-top: 50px;
    text-align: center;
    border-top: 3px solid #4a5eb8;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer .copyright {
    font-size: 0.95rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.footer .school-info {
    font-size: 0.85rem;
    margin: 0;
    opacity: 0.9;
    font-weight: 300;
}

@media (max-width: 768px) {
    .footer {
        padding: 15px 0;
        margin-top: 30px;
    }

    .footer .copyright {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .footer .school-info {
        font-size: 0.8rem;
        line-height: 1.3;
    }
}
