/* 全局樣式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Arial", "Microsoft YaHei", sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
}

/* 標題區 */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 15px;
}

nav button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    margin: 0 5px;
    cursor: pointer;
    transition: background 0.3s;
}

nav button:hover {
    background-color: #2980b9;
}

/* 頁面切換 */
.page {
    display: none;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.page.active {
    display: block;
}

/* 模式選擇卡片 */
.mode-card {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin: 15px auto;
    max-width: 500px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.mode-card h3 {
    color: #27ae60;
    margin-bottom: 10px;
}

/* 遊戲運行頁 */
.status-bar {
    display: flex;
    justify-content: space-around;
    background-color: white;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.question {
    font-size: 2.5rem;
    margin: 30px 0;
    color: #2c3e50;
    min-height: 60px; /* 防止題目切換時抖動 */
}

.options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 500px;
    margin: 0 auto 20px;
}

.option {
    background-color: white;
    border: 2px solid #3498db;
    color: #333;
    font-size: 1.2rem;
    padding: 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.option:hover:not(.disabled) {
    background-color: #3498db;
    color: white;
}

/* 答題反饋樣式 */
.option.correct {
    background-color: #2ecc71;
    border-color: #27ae60;
    animation: flash 0.5s;
}

.option.wrong {
    background-color: #e74c3c;
    border-color: #c0392b;
}

.option.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

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

#pauseBtn {
    background-color: #f39c12;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

#pauseBtn.paused {
    background-color: #e74c3c;
}

#pauseBtn:hover {
    opacity: 0.9;
}

/* 結束頁 */
.result {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 500px;
    margin: 20px auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: left;
}

.result p {
    margin: 10px 0;
    font-size: 1.1rem;
}

#restartBtn {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 20px;
}

#restartBtn:hover {
    background-color: #219653;
}

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

.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
}

.close:hover {
    color: #333;
}

.modal-content h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.modal-content ul {
    margin-left: 20px;
    margin-top: 10px;
}

/* 頁腳 */
footer {
    text-align: center;
    margin-top: 50px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* 響應式適配 */
@media (max-width: 500px) {
    .question {
        font-size: 2rem;
    }

    .options {
        grid-template-columns: 1fr; /* 手機端選項縱向排列 */
    }

    .status-bar {
        flex-direction: column;
        gap: 5px;
    }
}