/* 响应式适配 CSS */

/* 基础视口设置 */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* 小屏幕手机 (320px - 374px) */
@media screen and (max-width: 374px) {
    .container {
        padding: 15px;
        max-width: 100%;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .login-content {
        padding: 20px;
    }
    
    .user-info {
        padding: 15px;
    }
    
    .avatar {
        width: 50px;
        height: 50px;
    }
    
    .user-details h3 {
        font-size: 16px;
    }
    
    .menu-item {
        padding: 15px;
    }
    
    .menu-icon {
        font-size: 32px;
    }
    
    .menu-item h3 {
        font-size: 16px;
    }
    
    .stats-panel {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    .quiz-header {
        padding: 15px;
    }
    
    .question-content {
        padding: 20px;
    }
    
    #questionText {
        font-size: 16px;
    }
    
    .option {
        padding: 12px;
        font-size: 14px;
    }
    
    .timer-circle {
        width: 50px;
        height: 50px;
    }
    
    .timer-circle::before {
        width: 38px;
        height: 38px;
    }
    
    #timerText {
        font-size: 16px;
    }
    
    .result-content, .explanation-content {
        padding: 20px;
        margin-top: 30px;
    }
    
    .score-display h1 {
        font-size: 40px;
    }
    
    .result-indicator {
        font-size: 50px;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    .ranking-item, .history-item {
        padding: 12px;
    }
    
    .rank-number {
        width: 25px;
        height: 25px;
        font-size: 12px;
        margin-right: 10px;
    }
    
    .rank-name {
        font-size: 14px;
    }
    
    .rank-score {
        font-size: 12px;
    }
}

/* 中等屏幕手机 (375px - 413px) */
@media screen and (min-width: 375px) and (max-width: 413px) {
    .container {
        max-width: 375px;
        padding: 18px;
    }
    
    .login-header {
        margin: 50px 0 35px 0;
    }
    
    .menu-items {
        gap: 12px;
    }
    
    .quiz-header {
        padding: 18px;
    }
    
    .question-content {
        padding: 22px;
    }
}

/* 大屏幕手机 (414px+) */
@media screen and (min-width: 414px) and (max-width: 767px) {
    .container {
        max-width: 414px;
        padding: 20px;
    }
    
    .login-header {
        margin: 60px 0 40px 0;
    }
    
    .login-header h1 {
        font-size: 30px;
    }
    
    .menu-items {
        gap: 18px;
    }
    
    .menu-item {
        padding: 22px;
    }
    
    .menu-icon {
        font-size: 45px;
    }
    
    .quiz-header {
        padding: 22px;
    }
    
    .question-content {
        padding: 28px;
    }
    
    #questionText {
        font-size: 19px;
    }
    
    .timer-circle {
        width: 65px;
        height: 65px;
    }
    
    .timer-circle::before {
        width: 50px;
        height: 50px;
    }
    
    #timerText {
        font-size: 20px;
    }
}

/* 平板设备 (768px - 1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .container {
        max-width: 500px;
        padding: 30px;
    }
    
    .login-header {
        margin: 80px 0 50px 0;
    }
    
    .login-header h1 {
        font-size: 36px;
    }
    
    .subtitle {
        font-size: 18px;
    }
    
    .login-content {
        padding: 40px;
    }
    
    .menu-items {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .menu-item {
        padding: 30px;
    }
    
    .menu-icon {
        font-size: 50px;
    }
    
    .menu-item h3 {
        font-size: 20px;
    }
    
    .menu-item p {
        font-size: 15px;
    }
    
    .stats-panel {
        padding: 25px;
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    .stat-label {
        font-size: 14px;
    }
    
    .quiz-header {
        padding: 30px;
    }
    
    .question-content {
        padding: 35px;
    }
    
    #questionText {
        font-size: 22px;
        margin-bottom: 25px;
    }
    
    .option {
        padding: 18px;
        font-size: 18px;
    }
    
    .timer-circle {
        width: 80px;
        height: 80px;
    }
    
    .timer-circle::before {
        width: 62px;
        height: 62px;
    }
    
    #timerText {
        font-size: 24px;
    }
    
    .result-content, .explanation-content {
        padding: 40px;
        margin-top: 60px;
    }
    
    .score-display h1 {
        font-size: 60px;
    }
    
    .result-indicator {
        font-size: 80px;
    }
    
    #explanationQuestion {
        font-size: 22px;
    }
    
    .correct-answer h3, .explanation-text h3 {
        font-size: 18px;
    }
    
    .correct-answer p, .explanation-text p {
        font-size: 16px;
    }
    
    .ranking-list, .history-list {
        gap: 15px;
    }
    
    .ranking-item, .history-item {
        padding: 20px;
    }
    
    .rank-number {
        width: 35px;
        height: 35px;
        font-size: 16px;
        margin-right: 20px;
    }
    
    .rank-name {
        font-size: 18px;
    }
    
    .rank-score {
        font-size: 16px;
    }
    
    .rank-time {
        font-size: 14px;
    }
}

/* 桌面设备 (1025px+) */
@media screen and (min-width: 1025px) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    }
    
    .page {
        position: relative;
        width: 450px;
        height: 800px;
        max-height: 90vh;
        border-radius: 30px;
        overflow: hidden;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        border: 8px solid #333;
    }
    
    .container {
        max-width: 100%;
        padding: 25px;
        height: 100%;
        overflow-y: auto;
    }
    
    .login-header {
        margin: 60px 0 40px 0;
    }
    
    .login-header h1 {
        font-size: 32px;
    }
    
    .subtitle {
        font-size: 16px;
    }
    
    .menu-items {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .menu-item:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    }
    
    /* 鼠标悬停效果增强 */
    .login-btn:hover,
    .submit-btn:not(:disabled):hover,
    .next-btn:hover,
    .action-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    }
    
    .tab-btn:hover {
        background: rgba(102, 126, 234, 0.1);
    }
    
    .option:hover {
        transform: translateX(5px);
    }
    
    .ranking-item:hover,
    .history-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    }
    
    /* 桌面端滚动条样式 */
    .container::-webkit-scrollbar {
        width: 6px;
    }
    
    .container::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 3px;
    }
    
    .container::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }
    
    .container::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }
}

/* 横屏适配 */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .login-header {
        margin: 20px 0;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
    
    .login-content {
        padding: 20px;
    }
    
    .user-info {
        margin: 10px 0;
    }
    
    .menu-items {
        margin: 15px 0;
        gap: 10px;
    }
    
    .menu-item {
        padding: 15px;
    }
    
    .menu-icon {
        font-size: 30px;
        margin-bottom: 5px;
    }
    
    .stats-panel {
        margin-top: 15px;
        padding: 15px;
    }
    
    .quiz-header {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .question-content {
        padding: 20px;
        margin-bottom: 15px;
    }
    
    .result-content, .explanation-content {
        margin-top: 20px;
        padding: 25px;
    }
    
    .score-display h1 {
        font-size: 36px;
    }
    
    .result-indicator {
        font-size: 40px;
        margin-bottom: 15px;
    }
}

/* 超高分辨率设备 */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
    .avatar {
        border-width: 2px;
    }
    
    .progress-bar {
        height: 6px;
    }
    
    .option {
        border-width: 1px;
    }
    
    .action-btn {
        border-width: 1px;
    }
    
    /* 1px 边框问题解决 */
    .input-group input {
        border-width: 0.5px;
    }
    
    .ranking-item, .history-item {
        border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
    }
}

/* 深色模式适配（如果设备支持） */
@media (prefers-color-scheme: dark) {
    /* 这里可以添加深色模式样式 */
    .modal-content {
        background: #2a2a2a;
        color: white;
    }
    
    .modal-content h3 {
        color: white;
    }
    
    .modal-content p {
        color: #ccc;
    }
}

/* 减少动画效果（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .login-content,
    .user-info,
    .menu-item,
    .stats-panel,
    .quiz-header,
    .question-content,
    .result-content,
    .explanation-content,
    .ranking-item,
    .history-item {
        border: 2px solid #000;
    }
    
    .option {
        border-width: 2px;
    }
    
    .option:hover {
        border-color: #000;
        background: #f0f0f0;
        color: #000;
    }
}
