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

body {
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    background-color: #f9f3e9;
    color: #333;
    background-image: url('https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=colorful%20cartoon%20classroom%20background%20for%20children&image_size=landscape_16_9');
    background-size: cover;
    background-position: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 15px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 100%;
}

header h1 {
    color: #ff6b6b;
    font-size: 2em;
    text-shadow: 3px 3px 0px #ffffff;
    animation: bounce 1s infinite alternate;
    margin-bottom: 6px;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

.ipad-container {
    width: 100%;
    margin: 0;
}

.ipad-screen {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    padding: 20px;
    position: relative;
    overflow: visible;
    border: none;
    display: flex;
    flex-direction: column;
    min-height: auto;
}

.ipad-screen::before {
    display: none;
}

#game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: visible;
    align-items: center;
}

.question-area {
    width: 100%;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.answer-area {
    width: 100%;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#level-selector {
    text-align: center;
    margin: 20px 0;
    flex-shrink: 0;
}

#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px dashed #ff6b6b;
}

#game-title {
    color: #ff6b6b;
    font-size: 2em;
    text-shadow: 2px 2px 0px #ffffff;
}

#game-stats {
    display: flex;
    gap: 30px;
    font-size: 1.2em;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#game-content {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 30px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.welcome {
    font-size: 1.4em;
    color: #666;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.welcome-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    animation: pulse 2s infinite;
}

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

#audio-control {
    margin: 20px 0;
}

#audio-btn {
    padding: 15px 30px;
    font-size: 1.2em;
    background-color: #4ecdc4;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    margin: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

#audio-btn:hover {
    background-color: #45b7aa;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 15px 0;
    width: 100%;
    max-width: 700px;
}

.option-btn {
    padding: 16px;
    font-size: 1.3em;
    background-color: #f9f9f9;
    border: 3px solid #ffd93d;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.option-btn:hover {
    background-color: #fff3cd;
    border-color: #ffc107;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.option-btn.correct {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
    animation: celebrate 0.5s ease-in-out;
}

.option-btn.incorrect {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
    animation: shake 0.5s ease-in-out;
}

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

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

.image-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background-color: #f9f9f9;
    border: 3px solid #ffd93d;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.image-option:hover {
    background-color: #fff3cd;
    border-color: #ffc107;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.image-option img {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.image-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 500px;
}

#input-container {
    margin: 30px 0;
    width: 100%;
    max-width: 500px;
}

#answer-input {
    width: 100%;
    padding: 20px;
    font-size: 1.5em;
    border: 3px solid #4ecdc4;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

#submit-btn {
    margin-top: 20px;
    padding: 15px 40px;
    font-size: 1.2em;
    background-color: #4ecdc4;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

#submit-btn:hover {
    background-color: #45b7aa;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.letter-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.letter-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5em;
    font-weight: bold;
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.letter-btn:hover {
    background-color: #ee5a52;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.letter-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.match-container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin: 30px 0;
}

.words-container, .images-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 45%;
}

.match-item {
    padding: 15px;
    background-color: #f9f9f9;
    border: 3px solid #ffd93d;
    border-radius: 10px;
    cursor: grab;
    text-align: center;
    font-size: 1.2em;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.match-item:active {
    cursor: grabbing;
}

.match-item.matched {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
    animation: celebrate 0.5s ease-in-out;
}

#game-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

#back-btn {
    padding: 15px 30px;
    font-size: 1.2em;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

#back-btn {
    background-color: #6c757d;
    color: white;
}

#back-btn:hover {
    background-color: #5a6268;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.feedback {
    margin: 20px 0;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.3em;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    animation: slideIn 0.5s ease-in-out;
}

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

.feedback.correct {
    background-color: #d4edda;
    color: #155724;
    border: 3px solid #c3e6cb;
}

.feedback.incorrect {
    background-color: #f8d7da;
    color: #721c24;
    border: 3px solid #f5c6cb;
}

#level-selector {
    text-align: center;
    margin: 30px 0;
}

#level-selector h3 {
    color: #ff6b6b;
    font-size: 1.5em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0px #ffffff;
}

/* level-btn 样式已迁移到 level-card */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 5vh auto;
    padding: 40px;
    border: 5px solid #ff6b6b;
    border-radius: 20px;
    width: 80%;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalAppear 0.5s ease-in-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalAppear {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    color: #ff6b6b;
    font-size: 2em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0px #ffffff;
}

.modal-content button {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 1.2em;
    background-color: #4ecdc4;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.modal-content button:hover {
    background-color: #45b7aa;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

#report-content {
    font-size: 1.2em;
    line-height: 1.6;
    text-align: left;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 15px;
    border: 3px dashed #ffd93d;
}

@media (max-width: 768px) {
    .ipad-screen {
        padding: 12px;
        border-radius: 12px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    #game-title {
        font-size: 1.5em;
    }
    
    #game-stats {
        flex-direction: column;
        gap: 10px;
        font-size: 1em;
    }
    
    .options {
        grid-template-columns: 1fr;
    }
    
    .match-container {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .words-container, .images-container {
        width: 100%;
    }
    
    #game-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    #game-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    #back-btn {
        width: 100%;
    }
    
    .level-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .letter-buttons {
        gap: 5px;
    }
    
    .letter-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
}


/* ========== 登录/注册界面 ========== */

.auth-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 400px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-card h2 {
    color: #ff6b6b;
    margin-bottom: 25px;
    font-size: 1.8em;
}

.auth-card input {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 15px;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1.1em;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.auth-card input:focus {
    outline: none;
    border-color: #4ecdc4;
}

.auth-card button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: #4ecdc4;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 5px;
}

.auth-card button[type="submit"]:hover {
    background: #45b7aa;
    transform: translateY(-2px);
}

.auth-error {
    color: #dc3545;
    font-size: 0.95em;
    min-height: 20px;
    margin-bottom: 10px;
}

.auth-switch {
    margin-top: 20px;
    color: #666;
}

.auth-switch a {
    color: #4ecdc4;
    text-decoration: none;
    font-weight: bold;
}


/* ========== 用户栏 ========== */

#user-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

#user-bar span {
    font-weight: bold;
    color: #333;
}

#user-bar button {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
}

#overview-btn {
    background: #4ecdc4;
    color: white;
}

#overview-btn:hover {
    background: #45b7aa;
}

#logout-btn {
    background: #6c757d;
    color: white;
}

#logout-btn:hover {
    background: #5a6268;
}


/* ========== 单元卡片 ========== */

.level-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
}

.level-card {
    background: white;
    border: 3px solid #ffd93d;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.level-card:hover {
    border-color: #ffc107;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.level-card-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.level-card-stats {
    display: flex;
    justify-content: space-around;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
}

.level-card-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.level-card-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4, #6bcb77);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.level-history-btn {
    padding: 6px 14px;
    font-size: 0.85em;
    background: transparent;
    border: 2px solid #4ecdc4;
    color: #4ecdc4;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.level-history-btn:hover {
    background: #4ecdc4;
    color: white;
}


/* ========== 学习总览页 ========== */

.overview-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px dashed #ff6b6b;
}

.overview-header h2 {
    color: #ff6b6b;
    font-size: 1.8em;
}

.overview-header button {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    margin-left: 10px;
}

.overview-header button:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.overview-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
}

.summary-number {
    font-size: 2em;
    font-weight: bold;
}

.summary-label {
    font-size: 0.9em;
    margin-top: 5px;
    opacity: 0.9;
}

.overview-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.chart-card h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1em;
}


/* ========== 历史成绩表格 ========== */

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.history-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.history-table th, .history-table td {
    padding: 12px 15px;
    text-align: center;
}

.history-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.history-table tbody tr:hover {
    background: #e8f4f8;
}


/* ========== 响应式补充 ========== */

@media (max-width: 768px) {
    .overview-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .overview-charts {
        grid-template-columns: 1fr;
    }

    .level-buttons {
        grid-template-columns: repeat(3, 1fr);
    }

    #user-bar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .overview-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}


/* ========== AI 设置模态框 ========== */

.ai-settings-content {
    max-width: 500px;
    width: 90%;
    text-align: left;
    border-color: #667eea;
}

.ai-settings-desc {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 20px;
    line-height: 1.5;
    text-align: center;
}

.ai-form-group {
    margin-bottom: 16px;
}

.ai-form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    color: #333;
    font-size: 0.95em;
}

.ai-optional {
    font-weight: normal;
    color: #888;
    font-size: 0.85em;
}

.ai-form-group select,
.ai-form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.ai-form-group select:focus,
.ai-form-group input:focus {
    border-color: #667eea;
    outline: none;
}

.ai-config-status {
    margin: 12px 0;
    font-size: 0.9em;
    min-height: 24px;
}

.ai-status-ok { color: #28a745; }
.ai-status-err { color: #dc3545; }
.ai-status-none { color: #888; }

.ai-settings-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.ai-settings-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.ai-settings-actions button:first-child {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.ai-settings-actions button:first-child:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.ai-settings-actions .btn-secondary {
    background: #e8e8e8;
    color: #333;
}

.ai-settings-actions .btn-secondary:hover {
    background: #d0d0d0;
}


/* ========== AI 报告/提示模态框 ========== */

.ai-report-content {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.ai-hint-content {
    max-width: 650px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.ai-report-body {
    min-height: 120px;
    margin: 16px 0;
}

.ai-report-md {
    line-height: 1.8;
    color: #333;
    font-size: 0.95em;
}

.ai-report-md h1,
.ai-report-md h2,
.ai-report-md h3 {
    color: #667eea;
    margin: 16px 0 8px;
}

.ai-report-md ul,
.ai-report-md ol {
    padding-left: 24px;
}

.ai-report-md li {
    margin-bottom: 6px;
}

.ai-report-md pre {
    background: #f4f4f4;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    white-space: pre-wrap;
}

.ai-report-md strong {
    color: #ff6b6b;
}

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
}

.ai-loading p {
    color: #666;
    font-size: 0.95em;
}

.ai-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e8e8e8;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.ai-error {
    text-align: center;
    padding: 20px;
    color: #dc3545;
}

.ai-error button {
    margin-top: 12px;
    padding: 8px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95em;
}


/* ========== AI 智能推荐卡片 ========== */

.ai-recommendation-card {
    background: linear-gradient(135deg, #667eea15, #764ba215);
    border: 2px solid #667eea40;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.ai-rec-header {
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 12px;
}

.ai-rec-unit {
    margin-bottom: 12px;
}

.ai-rec-unit strong {
    font-size: 1.1em;
    color: #333;
}

.ai-rec-unit p {
    color: #555;
    margin-top: 4px;
}

.ai-rec-advice {
    background: white;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 14px;
    color: #444;
    line-height: 1.6;
    border-left: 4px solid #667eea;
}

.ai-rec-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-rec-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-rec-bar-label {
    font-size: 0.9em;
    color: #333;
    min-width: 70px;
}

.ai-rec-bar-track {
    flex: 1;
    height: 14px;
    background: #e8e8e8;
    border-radius: 7px;
    overflow: hidden;
}

.ai-rec-bar-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.6s ease;
}

.ai-rec-bar-value {
    font-size: 0.85em;
    color: #666;
    min-width: 50px;
    text-align: right;
}


/* ========== 错题本列表 ========== */

.mistake-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mistake-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s;
}

.mistake-item:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mistake-word {
    font-size: 1.15em;
    font-weight: bold;
    color: #dc3545;
    min-width: 90px;
}

.mistake-info {
    flex: 1;
    color: #666;
    font-size: 0.9em;
}

.btn-ai-hint {
    padding: 6px 14px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    white-space: nowrap;
    transition: all 0.3s;
}

.btn-ai-hint:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.35);
}


/* ========== overview header buttons ========== */

.overview-header-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.overview-header-btns button {
    padding: 10px 16px;
    font-size: 0.95em;
}

.chart-card-wide {
    grid-column: 1 / -1;
}


/* ========== 响应式补充 ========== */

@media screen and (max-width: 600px) {
    .mistake-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .ai-rec-bar-label {
        min-width: 55px;
        font-size: 0.8em;
    }

    .overview-header-btns {
        justify-content: center;
    }

    .spaced-cards {
        grid-template-columns: 1fr;
    }
}


/* ========== 间隔复习计划 ========== */

.spaced-desc {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95em;
}

.spaced-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.spaced-card {
    border-radius: 14px;
    padding: 18px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

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

.spaced-due {
    border-color: #ff6b6b;
    background: #fff5f5;
}

.spaced-soon {
    border-color: #ffc107;
    background: #fffbf0;
}

.spaced-ok {
    border-color: #28a745;
    background: #f5fff7;
}

.spaced-new {
    border-color: #d0d0d0;
    background: #fafafa;
}

.spaced-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.spaced-icon {
    font-size: 1.2em;
}

.spaced-card-body p {
    color: #444;
    margin-bottom: 6px;
}

.spaced-acc,
.spaced-attempts {
    display: inline-block;
    font-size: 0.85em;
    color: #888;
    margin-right: 12px;
}

.spaced-go-btn {
    margin-top: 10px;
    padding: 8px 18px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    transition: all 0.3s;
}

.spaced-go-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.4);
}


/* ========== 排行榜 ========== */

.my-rank-card {
    background: linear-gradient(135deg, #ffd93d20, #ff6b6b20);
    border: 2px solid #ffd93d;
    border-radius: 14px;
    padding: 16px 24px;
    margin-bottom: 20px;
    font-size: 1.1em;
    text-align: center;
}

.my-rank-card strong {
    color: #ff6b6b;
    font-size: 1.2em;
}

.leaderboard-table tr:nth-child(1) td {
    background: #fff8e1;
}

.leaderboard-table tr:nth-child(2) td {
    background: #f5f5f5;
}

.leaderboard-table tr:nth-child(3) td {
    background: #fff3e0;
}


/* ========== 管理员面板 ========== */

.admin-section {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.admin-section h3 {
    color: #333;
    margin-bottom: 16px;
    font-size: 1.2em;
}

.admin-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.admin-input {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s;
}

.admin-input:focus {
    border-color: #667eea;
}

.admin-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95em;
    transition: transform 0.2s;
}

.admin-actions .btn-primary:hover {
    transform: translateY(-2px);
}

.admin-actions .btn-secondary {
    background: #e8e8e8;
    color: #333;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95em;
}

.admin-stats {
    color: #666;
    margin-bottom: 12px;
    font-size: 0.9em;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.admin-table th {
    background: #f8f8f8;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid #eee;
    font-weight: 600;
    color: #555;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.admin-table tr:hover td {
    background: #f8f9ff;
}

.admin-table code {
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.95em;
    letter-spacing: 1px;
}

.status-used {
    color: #999;
    font-size: 0.85em;
}

.status-unused {
    color: #28a745;
    font-weight: bold;
    font-size: 0.85em;
}

.role-admin {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
}

.role-user {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
}

.btn-small {
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8em;
    margin: 0 2px;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-small:hover {
    opacity: 0.85;
}

.leaderboard-me td {
    background: #e3f2fd !important;
    font-weight: bold;
}

/* ========== 管理员表单 ========== */

.admin-profile-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.admin-form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-form-row label {
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
}

.admin-form-row input {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9em;
    width: 180px;
}

.admin-form-row input:focus {
    border-color: #667eea;
    outline: none;
}

.admin-profile-form .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    height: fit-content;
}

/* ========== 学生链接 ========== */

.student-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.student-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* ========== 学生详情 ========== */

.mistake-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.mistake-tag {
    background: #fff3e0;
    color: #e65100;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

.mistake-tag small {
    color: #bf360c;
    font-weight: 700;
}

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

/* 答题详情展开面板 */
.score-detail-row td {
    padding: 0 !important;
    background: #fafbff;
}

.score-detail-panel {
    padding: 12px;
    border-top: 2px dashed #667eea;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.detail-table th {
    background: #eef1ff;
    padding: 8px 10px;
    text-align: center;
    font-weight: 600;
    color: #555;
}

.detail-table td {
    padding: 6px 10px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.detail-table tr.detail-wrong td {
    background: #fff5f5;
    color: #c62828;
}


/* ========== 触摸设备禁用 hover 粘滞 ========== */

@media (hover: none) {
    .option-btn:hover {
        background-color: #f9f9f9;
        border-color: #ffd93d;
        transform: none;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    }

    .image-option:hover {
        background-color: #f9f9f9;
        border-color: #ffd93d;
        transform: none;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    }

    .letter-btn:hover {
        background-color: #ff6b6b;
        transform: none;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    }

    .level-card:hover {
        border-color: #ffd93d;
        transform: none;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    }

    .match-item:hover {
        transform: none;
    }

    .level-history-btn:hover {
        background: transparent;
        color: #4ecdc4;
    }

    #audio-btn:hover,
    #submit-btn:hover,
    #back-btn:hover {
        transform: none;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    }
}


/* ========== 手机端适配 (iPhone 16: 393×852) ========== */

@media (max-width: 480px) {
    /* 基础布局 */
    body {
        background-image: none;
        background-color: #f0f2f5;
    }

    .container {
        padding: 0;
    }

    /* 头部 */
    header {
        border-radius: 0;
        padding: 10px 12px;
        margin-bottom: 6px;
    }

    header h1 {
        font-size: 1.3em;
        animation: none;
        margin-bottom: 4px;
    }

    /* 用户栏 */
    #user-bar {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }

    #user-bar span {
        width: 100%;
        text-align: center;
        font-size: 0.95em;
    }

    #user-bar button {
        padding: 6px 10px;
        font-size: 0.78em;
        border-radius: 15px;
    }

    /* 登录卡片 */
    .auth-screen {
        min-height: auto;
        padding: 20px 12px;
    }

    .auth-card {
        padding: 24px 16px;
        border-radius: 16px;
        max-width: 100%;
    }

    .auth-card h2 {
        font-size: 1.4em;
        margin-bottom: 18px;
    }

    .auth-card input {
        padding: 12px 14px;
        font-size: 1em;
        margin-bottom: 10px;
    }

    .auth-card button[type="submit"] {
        padding: 12px;
        font-size: 1.05em;
    }

    /* 游戏主界面 */
    .ipad-container {
        width: 100%;
    }

    .ipad-screen {
        padding: 10px;
        border-radius: 0;
        box-shadow: none;
    }

    /* 游戏头部 */
    #game-header {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    #game-title {
        font-size: 1.3em;
    }

    #game-stats {
        font-size: 0.9em;
        gap: 15px;
        padding: 6px 14px;
        border-radius: 15px;
    }

    /* 游戏内容区 */
    #game-content {
        padding: 14px;
        min-height: auto;
        margin-bottom: 12px;
        border-radius: 14px;
    }

    /* 题目和答题区 */
    .question-area {
        padding: 8px;
    }

    .question-area h3 {
        font-size: 1.05em;
        line-height: 1.4;
    }

    .question-area img {
        max-width: 180px;
        max-height: 180px;
        border-radius: 10px;
    }

    /* 选项按钮 - 手机单列全宽 */
    .options {
        grid-template-columns: 1fr;
        gap: 10px;
        max-width: 100%;
    }

    .option-btn {
        padding: 14px 16px;
        font-size: 1.05em;
        border-radius: 12px;
        border-width: 2px;
        -webkit-tap-highlight-color: transparent;
    }

    .option-btn:active {
        background-color: #fff3cd;
        transform: scale(0.97);
    }

    /* 图片选项 */
    .image-options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        max-width: 100%;
    }

    .image-option {
        padding: 8px;
        border-width: 2px;
        border-radius: 10px;
    }

    .image-option img {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        max-width: 140px;
        max-height: 140px;
    }

    /* 播放按钮 */
    #audio-btn {
        padding: 12px 24px;
        font-size: 1em;
        margin: 8px;
    }

    /* 输入框 */
    #input-container {
        margin: 12px 0;
        max-width: 100%;
    }

    #answer-input {
        padding: 14px;
        font-size: 1.2em;
        border-width: 2px;
        border-radius: 12px;
    }

    #submit-btn {
        padding: 12px 30px;
        font-size: 1em;
        margin-top: 12px;
    }

    /* 字母拼写按钮 */
    .letter-buttons {
        gap: 6px;
        margin: 12px 0;
    }

    .letter-btn {
        width: 38px;
        height: 38px;
        font-size: 1.1em;
        border-radius: 8px;
    }

    /* 连线匹配 */
    .match-container {
        flex-direction: column;
        gap: 12px;
        margin: 12px 0;
    }

    .words-container,
    .images-container {
        width: 100%;
        gap: 8px;
    }

    .match-item {
        padding: 10px;
        font-size: 0.95em;
        border-width: 2px;
        border-radius: 8px;
    }

    /* 单元选择 - 手机两列 */
    .level-buttons {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
        padding: 4px;
    }

    .level-card {
        padding: 12px 8px;
        border-radius: 12px;
        border-width: 2px;
    }

    .level-card-title {
        font-size: 1em;
        margin-bottom: 6px;
    }

    .level-card-stats {
        font-size: 0.75em;
        margin-bottom: 6px;
    }

    .level-card-bar {
        height: 6px;
        margin-bottom: 8px;
    }

    .level-history-btn {
        padding: 4px 10px;
        font-size: 0.75em;
    }

    /* 返回按钮 */
    #game-controls {
        margin-top: 12px;
    }

    #back-btn {
        width: 100%;
        padding: 12px;
        font-size: 1em;
        border-radius: 12px;
    }

    /* 反馈提示 */
    .feedback {
        font-size: 1em;
        padding: 12px;
        margin: 10px 0;
        border-radius: 12px;
        border-width: 2px;
    }

    /* 模态框 - 手机全宽 */
    .modal-content {
        margin: 2vh auto;
        padding: 20px 16px;
        width: 95%;
        max-width: 95%;
        border-width: 3px;
        border-radius: 16px;
        max-height: 94vh;
    }

    .modal-content h2 {
        font-size: 1.4em;
        margin-bottom: 12px;
    }

    .modal-content button {
        margin-top: 15px;
        padding: 12px 24px;
        font-size: 1em;
    }

    .ai-settings-content {
        width: 95%;
        max-width: 95%;
    }

    .ai-form-group input,
    .ai-form-group select {
        padding: 10px 12px;
        font-size: 0.95em;
    }

    .ai-settings-actions button {
        padding: 10px;
        font-size: 0.95em;
    }

    /* 学习总览 */
    .overview-container {
        padding: 12px;
        border-radius: 12px;
    }

    .overview-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding-bottom: 10px;
    }

    .overview-header h2 {
        font-size: 1.3em;
    }

    .overview-header-btns {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
    }

    .overview-header button {
        padding: 7px 12px;
        font-size: 0.8em;
        margin: 0;
        border-radius: 15px;
    }

    .overview-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 15px;
    }

    .summary-card {
        padding: 12px 8px;
        border-radius: 10px;
    }

    .summary-number {
        font-size: 1.5em;
    }

    .summary-label {
        font-size: 0.8em;
    }

    .overview-charts {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .chart-card {
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 10px;
    }

    .chart-card h3 {
        font-size: 0.95em;
        margin-bottom: 10px;
    }

    .chart-card-wide {
        grid-column: 1;
    }

    /* 历史表格 */
    .history-table th,
    .history-table td {
        padding: 8px 6px;
        font-size: 0.8em;
    }

    /* 管理面板 */
    .admin-section {
        padding: 12px;
    }

    .admin-section h3 {
        font-size: 1.1em;
    }

    .admin-actions {
        flex-direction: column;
        gap: 8px;
    }

    .admin-input {
        width: 100% !important;
    }

    .admin-actions .btn-primary,
    .admin-actions .btn-secondary {
        width: 100%;
        padding: 10px;
        font-size: 0.9em;
    }

    .admin-table {
        font-size: 0.75em;
        display: block;
        overflow-x: auto;
    }

    .admin-table th,
    .admin-table td {
        padding: 6px 4px;
        white-space: nowrap;
    }

    .btn-small {
        padding: 4px 8px;
        font-size: 0.7em;
    }

    /* 管理员表单 */
    .admin-profile-form {
        padding: 12px;
    }

    .admin-form-row {
        flex-direction: column;
        gap: 4px;
    }

    .admin-form-row input {
        width: 100%;
    }

    /* 学生详情 */
    #student-detail-screen .overview-container {
        padding: 10px;
    }

    .mistake-tags {
        gap: 6px;
    }

    .mistake-tag {
        padding: 4px 10px;
        font-size: 0.8em;
    }

    .score-detail-panel {
        padding: 8px;
        overflow-x: auto;
    }

    .detail-table {
        font-size: 0.8em;
    }

    .detail-table th,
    .detail-table td {
        padding: 5px 6px;
    }

    /* 排行榜 */
    .leaderboard-table {
        font-size: 0.8em;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 6px;
    }

    /* 间隔复习 */
    .spaced-cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .spaced-card {
        padding: 12px;
    }

    /* AI 报告 */
    .ai-report-content {
        width: 95%;
        max-width: 95%;
    }

    .ai-report-body {
        font-size: 0.9em;
        padding: 10px;
    }

    /* AI 推荐 */
    .ai-recommendation-card {
        padding: 12px;
    }
}

/* ========== 多单元选择 & 练习配置 ========== */
.unit-select-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.unit-selectable {
    cursor: pointer;
    position: relative;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    border: 3px solid transparent;
}

.unit-selectable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102,126,234,0.18);
}

.unit-selected {
    border-color: #667eea !important;
    background: linear-gradient(135deg, #eef0ff 0%, #f7f0ff 100%) !important;
    box-shadow: 0 4px 16px rgba(102,126,234,0.22);
}

.unit-check {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 1.2em;
}

.practice-config {
    background: #f8f9ff;
    border-radius: 16px;
    padding: 20px 24px;
    margin-top: 8px;
    border: 1px solid #e0e3f1;
}

.config-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.config-row label {
    font-weight: 600;
    font-size: 1em;
    white-space: nowrap;
}

.config-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.config-btn {
    padding: 7px 18px;
    border-radius: 20px;
    border: 2px solid #e0e3f1;
    background: #fff;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
}

.config-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-color: transparent;
}

.config-btn:hover:not(.active) {
    border-color: #667eea;
    color: #667eea;
}

.config-info {
    font-size: 0.92em;
    color: #999;
}

.btn-start-practice {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.15em;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}

.btn-start-practice:hover:not(:disabled) {
    opacity: 0.92;
    transform: translateY(-1px);
}

.btn-start-practice:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ========== 补全单词题型 ========== */
.fill-image-container {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.fill-question-image {
    max-width: 180px;
    max-height: 160px;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    object-fit: contain;
}

.fill-word-display {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 18px 0;
    flex-wrap: wrap;
}

.fill-word-display span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 48px;
    font-size: 1.5em;
    font-weight: 700;
    border-radius: 8px;
}

.fill-fixed {
    background: #eef0ff;
    color: #333;
}

.fill-blank {
    background: #fff;
    border: 2px dashed #667eea;
    color: #aaa;
    cursor: pointer;
    transition: all 0.15s;
}

.fill-blank.fill-filled {
    border-style: solid;
    color: #667eea;
    background: #f0f0ff;
}

.fill-letter-pool {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.fill-letter-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 2px solid #d0d5e8;
    background: #fff;
    font-size: 1.15em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: lowercase;
}

.fill-letter-btn:hover:not(:disabled) {
    border-color: #667eea;
    background: #f8f8ff;
}

.fill-letter-btn.fill-letter-used {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ========== 多单元选择响应式 ========== */
@media (max-width: 900px) {
    .unit-select-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .unit-select-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .practice-config {
        padding: 14px 12px;
    }

    .config-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .config-btn {
        padding: 6px 14px;
        font-size: 0.88em;
    }

    .btn-start-practice {
        font-size: 1em;
        padding: 12px;
    }

    .fill-word-display span {
        width: 32px;
        height: 40px;
        font-size: 1.2em;
    }

    .fill-letter-btn {
        width: 36px;
        height: 36px;
        font-size: 1em;
    }

    .fill-question-image {
        max-width: 140px;
        max-height: 120px;
    }
}

/* 触摸设备 - 补全字母按钮 */
@media (hover: none) {
    .unit-selectable:hover {
        transform: none;
        box-shadow: none;
    }

    .config-btn:hover:not(.active) {
        border-color: #e0e3f1;
        color: inherit;
    }

    .fill-letter-btn:hover:not(:disabled) {
        border-color: #d0d5e8;
        background: #fff;
    }

    .btn-start-practice:hover:not(:disabled) {
        opacity: 1;
        transform: none;
    }

    .unit-selectable:active {
        transform: scale(0.97);
    }

    .fill-letter-btn:active:not(:disabled) {
        transform: scale(0.93);
    }
}

/* ========== 教师控制台 / 仪表盘 ========== */
.dash-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.dash-card {
    border-radius: 16px;
    padding: 22px 18px;
    text-align: center;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.dash-card-blue { background: linear-gradient(135deg, #667eea, #764ba2); }
.dash-card-purple { background: linear-gradient(135deg, #a18cd1, #fbc2eb); color: #4a3670; }
.dash-card-green { background: linear-gradient(135deg, #43e97b, #38f9d7); color: #1a5c3a; }
.dash-card-orange { background: linear-gradient(135deg, #f9d423, #f83600); }

.dash-card-num {
    font-size: 2.2em;
    font-weight: 800;
    line-height: 1.2;
}

.dash-card-label {
    font-size: 0.95em;
    margin-top: 4px;
    opacity: 0.9;
}

.dash-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.dash-chart-box {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.dash-chart-box h3 {
    margin: 0 0 14px 0;
    font-size: 1.05em;
    color: #333;
}

.dash-chart-box canvas {
    max-height: 260px;
}

.dash-list {
    max-height: 260px;
    overflow-y: auto;
}

.dash-mistake-item {
    display: flex;
    align-items: center;
    padding: 8px 4px;
    border-bottom: 1px solid #f0f0f0;
}

.dash-mistake-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 700;
    margin-right: 10px;
    flex-shrink: 0;
}

.dash-mistake-word {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.dash-mistake-count {
    color: #f5576c;
    font-weight: 600;
    font-size: 0.9em;
}

.dash-table-section {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.dash-table-section h3 {
    margin: 0 0 14px 0;
    font-size: 1.05em;
    color: #333;
}

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

.dash-table {
    width: 100%;
    border-collapse: collapse;
}

.dash-table th,
.dash-table td {
    padding: 10px 14px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.dash-table th {
    background: #f8f9ff;
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.dash-table td {
    font-size: 0.95em;
}

.dash-table tbody tr:hover {
    background: #f8f9ff;
}

/* 仪表盘响应式 */
@media (max-width: 900px) {
    .dash-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .dash-charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .dash-cards {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .dash-card {
        padding: 14px 10px;
    }

    .dash-card-num {
        font-size: 1.6em;
    }

    .dash-card-label {
        font-size: 0.8em;
    }

    .dash-charts-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .dash-chart-box {
        padding: 14px;
    }

    .dash-table th,
    .dash-table td {
        padding: 8px 8px;
        font-size: 0.85em;
    }
}