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

/* 基础样式 - 全屏4:3设计 */
body {
    font-family: 'Microsoft YaHei', 'Arial', sans-serif;
    background-color: #000;
    color: #000;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

/* 背景色变化样式 */
.background-green-flash {
    background-color: #4CAF50;
}

.background-green {
    background-color: #4CAF50;
}

.background-red-flash {
    background-color: #f44336;
}

.background-red {
    background-color: #f44336;
}

/* 4:3比例容器 */
.container {
    width: 100vmin;
    height: 75vmin; /* 4:3 比例 */
    background-color: white;
    margin: 0;
    padding: 1vh; /* 减少内边距 */
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* 页面通用样式 - 全屏4:3适配 */
.page {
    background-color: white;
    padding: 1vh 2vw; /* 减少内边距 */
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

.hidden {
    display: none;
}

/* 暂停按钮样式 */
.pause-button {
    background-color: #ff9800;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 15px;
    margin: 0 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.pause-button:hover {
    background-color: #f57c00;
}

.pause-button:active {
    transform: scale(0.95);
}

/* 题库分组按钮样式 */
.quiz-group-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

.quiz-group-button {
    background-color: rgb(7, 18, 221); /* RGB 0712DD */
    color: white;
    border: none;
    border-radius: 8px;
    padding: 20px 40px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 300px;
    text-align: center;
}

.quiz-group-button:hover {
    background-color: rgb(5, 14, 177);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.quiz-group-button:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* 标题样式 - 大屏幕适配 */
h1 {
    font-size: 4.5vh; /* 稍微减小字体大小 */
    margin-bottom: 1vh; /* 减少底部边距 */
    color: #000;
    text-align: center;
    max-width: 90vw;
    word-wrap: break-word;
}

h2 {
    font-size: 3vh; /* 稍微减小字体大小 */
    margin-bottom: 1.5vh; /* 减少底部边距 */
    color: #000;
    text-align: center;
    line-height: 1.4;
    max-width: 90vw;
    word-wrap: break-word;
}

h3 {
    font-size: 2.5vh;
    margin: 2vh 0;
    color: #000;
}

/* 段落样式 - 大屏幕适配 */
p {
    font-size: 2vh;
    margin-bottom: 2vh;
    text-align: center;
}

/* 按钮组样式 - 大屏幕适配 */
.search-container {
    display: flex;
    gap: 1vw; /* 减少间距 */
    margin: 2vh auto; /* 减少外边距 */
    max-width: 60vw;
}

/* 答题页面搜索样式 */
.quiz-search {
    margin: 0;
    max-width: 35vw;
}

#search-input {
    flex: 1;
    padding: 2vh 2vw;
    font-size: 2.5vh;
    border: 2px solid #4a5568;
    border-radius: 8px;
    background-color: #ffffff;
    color: #333;
}

#search-button {
    padding: 2vh 4vw;
    font-size: 2.5vh;
    background-color: #4a5568;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#search-button:hover {
    background-color: #2d3748;
}

.button-group {
    display: flex;
    gap: 2vw;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 3vh;
    width: 90vw;
}

/* 通用按钮样式 - 大屏幕适配 */
button {
    font-size: 2vh; /* 稍微减小字体大小 */
    padding: 1vh 2vw; /* 减少内边距 */
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #0A29E1;
    color: white;
    min-width: 16vw; /* 稍微减小最小宽度 */
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

button:hover {
    background-color: #0B30F0;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: #cccccc;
    color: #666;
    cursor: not-allowed;
    transform: none;
}

/* 答题页面样式 - 大屏幕适配 */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 95vw;
    margin-bottom: 1vh; /* 减少底部边距 */
    font-size: 2vh; /* 稍微减小字体大小 */
    flex-wrap: wrap;
}

.question-number, .question-difficulty {
    padding: 0.8vh 1.5vw;
    font-weight: bold;
    color: #000;
}

/* 得分显示样式 */
.score {
    font-size: 4vh; /* 稍微减小字体大小 */
    font-weight: bold;
    text-align: center;
    margin: 1vh 0; /* 减少上下边距 */
    color: #0A29E1;
    padding: 0.5vh 0; /* 减少内边距 */
}

/* 题目信息样式 */
.question-number,
.question-difficulty {
    padding: 0.8vh 1.5vw;
    font-weight: bold;
}

.question-container {
    width: 95vw;
    margin-bottom: 1vh; /* 减少底部边距 */
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 选项容器改为一行两个排列 */
.options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1vh; /* 减少间距 */
    margin: 1.5vh auto; /* 减少上下边距 */
    flex: 1;
    max-width: 85vw; /* 稍微增加最大宽度 */
}

/* 选项变为圆角矩形 */
.option {
    font-size: 2.8vh; /* 稍微减小字体大小 */
    font-weight: bold;
    text-align: center;
    padding: 2vh 3vw; /* 减少内边距 */
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 1.5rem;
    transition: all 0.3s ease;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    word-wrap: break-word;
    min-height: 12vh; /* 减少最小高度 */
}

.option:hover:not(:disabled) {
    background-color: #e9ecef;
    border-color: #0A29E1;
    transform: scale(1.05);
}

.option.correct {
    background-color: #e8f5e9;
    color: #2e7d32;
    font-weight: bold;
    border-color: #4CAF50;
}

.option.incorrect {
    background-color: #ffebee;
    color: #c62828;
    font-weight: bold;
    border-color: #f44336;
}

/* 题目字体调整（更紧凑） */
.question-container h2 {
    font-size: 4vh; /* 稍微减小字体大小 */
    font-weight: bold;
    margin-bottom: 1.5vh; /* 减少底部边距 */
    width: 100%;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: center;
    line-height: 1.3;
}

.feedback {
    font-size: 1.8vh; /* 稍微减小字体大小 */
    font-weight: bold;
    text-align: center;
    margin: 1vh 0; /* 减少上下边距 */
    min-height: 4vh; /* 减少最小高度 */
    padding: 1vh;
    border-radius: 8px;
    max-width: 85vw;
    margin-left: auto;
    margin-right: auto;
}

.feedback:before {
    margin-right: 10px;
    font-size: 1.8rem;
}

.feedback.correct {
    color: white;
    background-color: #4CAF50;
}

.feedback.correct:before {
    content: '✅';
}

.feedback.incorrect {
    color: white;
    background-color: #f44336;
}

.feedback.incorrect:before {
    content: '❌';
}

/* 提示按钮和文本 - 大屏幕适配 */
.hint-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1vh 0; /* 减少上下边距 */
}

.hint-button {
    background-color: #ff9800;
    font-size: 1.8vh; /* 稍微减小字体大小 */
    padding: 1vh 2vw; /* 减少内边距 */
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 16vw; /* 稍微减小最小宽度 */
}

.hint-button:hover {
    background-color: #e68900;
    transform: translateY(-2px);
}

.hint {
    font-size: 1.8vh; /* 稍微减小字体大小 */
    margin-top: 0.5vh; /* 减少顶部边距 */
    padding: 1vh;
    display: none;
    color: #333;
    background-color: #fff3cd;
    border-left: 4px solid #ff9800;
    border-radius: 8px;
    max-width: 85vw;
    text-align: center;
}

.hint.show {
    display: block;
}

/* 移动到得分下方的导航按钮 */
.navigation-buttons {
    display: flex;
    gap: 1vw; /* 减少间距 */
    justify-content: center;
    margin: 1vh 0; /* 减少上下边距 */
}

#prev-button, #next-button {
    font-size: 2vh; /* 稍微减小字体大小 */
    padding: 1.2vh 3vw; /* 减少内边距 */
    min-width: 18vw; /* 稍微减小最小宽度 */
    font-weight: bold;
}

/* 答题控制按钮 - 大屏幕适配 */
.quiz-controls {
    display: flex;
    gap: 1vw; /* 减少间距 */
    justify-content: center;
    width: 100%;
    margin: 0.5vh 0 1vh 0; /* 减少上下边距 */
}

.quiz-controls button {
    font-size: 1.8vh; /* 稍微减小字体大小 */
    padding: 1vh 2vw; /* 减少内边距 */
}

/* 按钮图标 */
.button-group button:before, .quiz-controls button:before {
    margin-right: 8px;
}

#start-quiz:before {
    content: '▶';
}

#random-quiz:before {
    content: '🔀';
}

#prev-question:before {
    content: '◀';
}

#next-question:before {
    content: '▶';
}

#restart-quiz:before {
    content: '🔄';
}

#end-quiz:before {
    content: '⏹';
}

#back-to-home:before {
    content: '🏠';
}

.hint-button:before {
    content: '💡';
}

/* 结算页面样式 - 大屏幕适配 */
.result-stats {
    padding: 3vh;
    margin: 2vh auto;
    width: 80vw;
    background-color: #f8f9fa;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-stats p {
    text-align: center;
    margin-bottom: 2vh;
    font-size: 4vh;
    font-weight: bold;
    color: #000;
    width: 100%;
}

.result-stats span {
    font-weight: bold;
    color: #000;
}

.result-details {
    width: 90vw;
    margin: 1vh 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

#answer-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    margin-top: 1.5vh;
    flex: 1;
}

.answer-indicator {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.answer-indicator.correct {
    background-color: #4CAF50;
    color: white;
    border: none;
}

.answer-indicator.incorrect {
    background-color: #f44336;
    color: white;
    border: none;
}

.answer-indicator.unanswered {
    background-color: #95a5a6;
    color: white;
    border: none;
}

/* 大屏幕优化（电视机4:3全屏） */
@media (min-width: 1024px) {
    body {
        font-size: 18px;
        height: 100vh;
        width: 100vw;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        background-color: #000;
    }
    
    .container {
        height: 100vh;
        width: 100vw;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .page {
        height: 100vh;
        width: 100vw;
        padding: 3vh 5vw;
        overflow: hidden;
    }
    
    /* 针对4:3屏幕的特别调整 */
    @media (aspect-ratio: 4/3) {
        .page {
            width: 100vw;
            height: 100vh;
            padding: 2vh 3vw;
            box-sizing: border-box;
        }
        
        /* 标题大小调整 */
        h1 {
            font-size: 5vh;
            margin-bottom: 1.5vh;
        }
        
        h2 {
            font-size: 3.5vh;
            margin-bottom: 2vh;
            line-height: 1.3;
        }
        
        /* 按钮大小调整 */
        button {
            font-size: 2.2vh;
            padding: 1.5vh 3vw;
            min-width: 20vw;
        }
        
        /* 选项大小调整 */
        .option {
            font-size: 2.2vh;
            padding: 2vh 3vw;
            min-height: 10vh;
            text-align: center;
            justify-content: center;
        }
        
        /* 答题头部调整 */
        .quiz-header {
            flex-wrap: wrap;
            gap: 1vh;
        }
        
        /* 按钮组和控制按钮调整 */
        .button-group,
        .quiz-controls {
            gap: 1.5vh;
        }
        
        /* 答题统计调整 */
        .result-stats p {
            font-size: 2.2vh;
        }
        
        /* 答案汇总网格调整 */
        #answer-summary {
            grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
            gap: 8px;
        }
        
        .answer-indicator {
            width: 45px;
            height: 45px;
            font-size: 1.2rem;
        }
    }
    
    /* 确保内容不超出屏幕 */
    .question-container,
    .result-stats,
    .result-details {
        flex-shrink: 0;
        width: 90vw;
    }
    
    #answer-summary {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 10px;
    }
    
    /* 隐藏所有可能出现的滚动条 */
    * {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    *::-webkit-scrollbar {
        display: none;
    }
}

/* 响应式设计 - 针对4:3屏幕的更小尺寸调整 */
@media (max-width: 800px) {
    h1 {
        font-size: 3rem;
        color: #000;
    }
    
    h2 {
        font-size: 2rem;
        color: #000;
    }
    
    .option {
        font-size: 1.5rem;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .button-group {
        flex-direction: column;
        width: 100%;
    }
    
    button {
        width: 100%;
        border: none;
        background-color: #0A29E1;
        color: white;
    }

    .hint-button {
        background-color: #ff9800;
        color: white;
        border: none;
    }
}