/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* 背景裝飾 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 10;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    padding: 25px;
    text-align: center;
    color: #fff;
    position: relative;
}

/* 返回首頁按鈕 */
.back-home-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.back-home-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.95;
    font-weight: 500;
}

/* 游戏区域 */
.game-area {
    padding: 25px;
}

/* 計分板样式 */
.score-board {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 35px;
    flex-wrap: wrap;
}

.score {
    padding: 18px 25px;
    border-radius: 20px;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    min-width: 120px;
}

.correct-score {
    background: linear-gradient(135deg, #32CD32 0%, #228B22 100%);
}

.wrong-score {
    background: linear-gradient(135deg, #FF6347 0%, #DC143C 100%);
}

.total-score {
    background: linear-gradient(135deg, #4169E1 0%, #1E90FF 100%);
}

.score-label {
    display: block;
    font-size: 1rem;
    margin-bottom: 5px;
    opacity: 0.9;
}

.score-unit {
    font-size: 1rem;
    margin-left: 5px;
    opacity: 0.9;
}

/* 游戏说明 */
.instruction {
    text-align: center;
    font-size: 1.4rem;
    color: #555;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #F0F8FF 0%, #E6E6FA 100%);
    border-radius: 20px;
    border-left: 6px solid #4169E1;
    font-weight: 600;
}

/* 排隊場景样式 */
.queue-scene {
    background: linear-gradient(135deg, #FFFACD 0%, #F0E68C 100%);
    border-radius: 25px;
    padding: 40px;
    margin-bottom: 30px;
    border: 3px solid #FFD700;
}

.queue-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: #FF6347;
    margin-bottom: 30px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.queue-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.queue-direction {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.direction-label {
    font-size: 1.2rem;
    font-weight: 600;
    color: #4169E1;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
}

.direction-arrow {
    font-size: 2rem;
    animation: bounce 2s ease-in-out infinite;
}

.children-queue {
    display: flex;
    gap: 40px;
    align-items: center;
}

.child {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    padding: 25px 20px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.child:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.child.highlight {
    border-color: #FF69B4;
    background: linear-gradient(135deg, #FFE4E1 0%, #FFF0F5 100%);
    transform: scale(1.1);
    animation: glow 1.5s ease-in-out infinite alternate;
}

.child-avatar {
    font-size: 4rem;
    margin-bottom: 15px;
    /* 移除 transform，因為新的 emoji 本身就是朝向左邊的 */
}

.child-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    background: linear-gradient(135deg, #FFB6C1 0%, #FFA07A 100%);
    padding: 8px 16px;
    border-radius: 15px;
    color: white;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
}

/* 問題显示 */
.question {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #FFE4B5 0%, #FFDAB9 100%);
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(255, 165, 0, 0.3);
    border: 2px solid #FFA500;
}

/* 選項按鈕 */
.answer-options {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.option-btn {
    background: linear-gradient(135deg, #87CEEB 0%, #4682B4 100%);
    border: none;
    border-radius: 25px;
    padding: 25px 35px;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(70, 130, 180, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 150px;
}

.option-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 30px rgba(70, 130, 180, 0.6);
}

.option-btn.correct {
    background: linear-gradient(135deg, #32CD32 0%, #228B22 100%);
    animation: correctPulse 0.8s ease-in-out;
}

.option-btn.wrong {
    background: linear-gradient(135deg, #FF6347 0%, #DC143C 100%);
    animation: wrongShake 0.8s ease-in-out;
}

.option-text {
    font-size: 1.4rem;
}

.option-icon {
    font-size: 1.8rem;
}

/* 控制按鈕 */
.controls {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 18px 35px;
    border: none;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    min-width: 140px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, #FF69B4 0%, #FF1493 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #32CD32 0%, #228B22 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: white;
}

/* 反饋訊息 */
.feedback {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 25px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    border: 3px solid transparent;
}

.feedback.show {
    opacity: 1;
    transform: translateY(0);
}

.feedback.correct {
    background: linear-gradient(135deg, #E8F5E8 0%, #D4F4D4 100%);
    color: #2D5016;
    border-color: #32CD32;
}

.feedback.wrong {
    background: linear-gradient(135deg, #FFE8E8 0%, #FFD4D4 100%);
    color: #8B0000;
    border-color: #FF6347;
}

.feedback.encouraging {
    background: linear-gradient(135deg, #E6F3FF 0%, #CCE7FF 100%);
    color: #003D82;
    border-color: #4169E1;
}


/* 動畫效果 */
@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

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

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

@keyframes glow {
    0% { box-shadow: 0 10px 25px rgba(255, 105, 180, 0.3); }
    100% { box-shadow: 0 15px 35px rgba(255, 105, 180, 0.6); }
}

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

.celebration {
    animation: celebration 2s ease-in-out;
}

@keyframes celebration {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-10deg) scale(1.1); }
    50% { transform: rotate(10deg) scale(1.2); }
    75% { transform: rotate(-5deg) scale(1.1); }
    100% { transform: rotate(0deg) scale(1); }
}

/* 響應式設計 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        margin: 5px;
        border-radius: 20px;
    }
    
    .header {
        padding: 20px 15px;
    }
    
    .back-home-btn {
        top: 10px;
        left: 10px;
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1.1rem;
    }
    
    .game-area {
        padding: 20px 15px;
    }
    
    .score-board {
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .score {
        padding: 12px 18px;
        font-size: 1.1rem;
        min-width: 100px;
    }
    
    .instruction {
        font-size: 1.2rem;
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .queue-scene {
        padding: 25px 15px;
        margin-bottom: 20px;
    }
    
    .queue-title {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .queue-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .children-queue {
        gap: 20px;
    }
    
    .child {
        padding: 20px 15px;
    }
    
    .child-avatar {
        font-size: 3rem;
        margin-bottom: 10px;
    }
    
    .child-name {
        font-size: 1.2rem;
        padding: 6px 12px;
    }
    
    .question {
        font-size: 1.4rem;
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .answer-options {
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .option-btn {
        padding: 20px 25px;
        font-size: 1.2rem;
        min-width: 130px;
    }
    
    .controls {
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .btn {
        padding: 15px 25px;
        font-size: 1.1rem;
        min-width: 120px;
    }
    
    .feedback {
        font-size: 1.2rem;
        padding: 20px;
        margin-bottom: 15px;
    }
}

/* iPhone 專用優化 (320px - 414px) */
@media (max-width: 414px) {
    body {
        padding: 8px;
        min-height: 100vh;
        display: flex;
        align-items: center;
    }
    
    .container {
        margin: 0;
        width: 100%;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    .header {
        padding: 15px 12px;
    }
    
    .back-home-btn {
        top: 8px;
        left: 8px;
        font-size: 0.75rem;
        padding: 5px 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .game-area {
        padding: 15px 12px;
    }
    
    .score-board {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .score {
        padding: 10px 15px;
        font-size: 1rem;
        min-width: 90px;
    }
    
    .instruction {
        font-size: 1.1rem;
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .queue-scene {
        padding: 20px 12px;
        margin-bottom: 15px;
    }
    
    .queue-title {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .children-queue {
        gap: 15px;
    }
    
    .child {
        padding: 15px 10px;
    }
    
    .child-avatar {
        font-size: 2.5rem;
        margin-bottom: 8px;
    }
    
    .child-name {
        font-size: 1.1rem;
        padding: 5px 10px;
    }
    
    .question {
        font-size: 1.3rem;
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .answer-options {
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .option-btn {
        padding: 18px 20px;
        font-size: 1.1rem;
        min-width: 110px;
    }
    
    .controls {
        gap: 12px;
        margin-bottom: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 1rem;
        min-width: 100px;
    }
    
    .feedback {
        font-size: 1.1rem;
        padding: 15px;
        margin-bottom: 10px;
    }
}

/* iPad 專用優化 (768px - 1024px) */
@media (min-width: 415px) and (max-width: 1024px) {
    body {
        padding: 15px;
        min-height: 100vh;
        display: flex;
        align-items: center;
    }
    
    .container {
        margin: 0 auto;
        width: 100%;
        max-width: 900px;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    .header {
        padding: 25px 20px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .game-area {
        padding: 25px 20px;
    }
    
    .score-board {
        gap: 20px;
        margin-bottom: 25px;
    }
    
    .queue-scene {
        padding: 30px 20px;
        margin-bottom: 25px;
    }
    
    .children-queue {
        gap: 30px;
    }
    
    .child-avatar {
        font-size: 3.5rem;
    }
    
    .question {
        font-size: 1.5rem;
        padding: 25px;
        margin-bottom: 25px;
    }
    
    .answer-options {
        gap: 25px;
        margin-bottom: 25px;
    }
    
    .option-btn {
        padding: 22px 30px;
        font-size: 1.3rem;
        min-width: 140px;
    }
    
    .controls {
        gap: 20px;
        margin-bottom: 25px;
    }
    
    .btn {
        padding: 16px 30px;
        font-size: 1.2rem;
        min-width: 130px;
    }
}

/* 特殊效果 */
.floating-elements {
    position: absolute;
    pointer-events: none;
    font-size: 1.5rem;
    opacity: 0.6;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* 成功慶祝效果 */
.success-celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    z-index: 1000;
    animation: celebrationBurst 2s ease-out;
    pointer-events: none;
}

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