* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f5; /* 改为浅灰色 */
    color: #333;
    min-height: 100vh;
    padding: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-height: calc(100vh - 10px); /* 10px = body padding-top + padding-bottom */
    display: flex;
    flex-direction: column;
}

header {
    background: #4a6ee0;
    color: white;
    padding: 5px;
    text-align: center;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
}

.tabs {
    display: flex;
    background: #f0f4ff;
    flex-shrink: 0;
}

.tab {
    flex: 1;
    padding: 5px;
    text-align: center;
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tab.active {
    background: #4a6ee0;
    color: white;
}

.content {
    display: none;
    padding: 30px;
    flex: 1;
    overflow-y: auto;
}

.content.active {
    display: block;
}

/* 学习页面样式 */
.word-card {
    text-align: center;
    margin-bottom: 30px;
}

/* 单词进度信息 */
.word-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1rem;
    color: #718096;
    font-weight: 600;
}

.word {
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: #2d3748;
    line-height: 1.2;
}

.phonetic {
    font-size: 1.5rem;
    color: #718096;
    margin-bottom: 10px;
}

.pos {
    font-size: 1.2rem;
    color: #4a5568;
    margin-bottom: 5px;
}

.meaning {
    font-size: 1rem; /* 调小中文翻译字体 */
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* 控制按钮区域 - 新样式 */
.control-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    gap: 15px;
}

.btn-toggle {
    padding: 12px 20px;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    justify-content: center;
}

.btn-toggle:hover {
    background: #cbd5e0;
}

.btn-audio-small {
    padding: 12px 20px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    justify-content: center;
}

.btn-audio-small:hover {
    background: #0b7dda;
}

/* 例句部分样式 */
.example-section {
    margin-top: 5px;
    padding: 15px;
    background: #f7f9fc;
    border-radius: 10px;
    border-left: 4px solid #4a6ee0;
    transition: all 0.3s ease;
}

.hidden {
    display: none;
}

/* 例句内部的朗读按钮 */
.example-audio {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.example-item {
    display: flex;
    margin-bottom: 10px;
    align-items: flex-start;
}

.example-item:last-child {
    margin-bottom: 0;
}

.example-label {
    font-weight: bold;
    min-width: 50px;
    color: #4a5568;
    font-size: 1rem;
}

.example-sentence,
.example-phonetic,
.example-translation,
.example-structure {
    flex: 1;
    font-size: 1.1rem;
    line-height: 1.4;
    color: #2d3748;
}

.example-phonetic {
    color: #718096;
    font-style: italic;
}

.example-translation {
    color: #4a5568;
}

.example-structure {
    color: #718096;
    font-size: 1rem;
}

/* 导航控制区域 - 电脑端布局 */
.navigation-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    gap: 10px;
}

.btn-nav {
    padding: 12px 15px;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-nav:hover {
    background: #cbd5e0;
}

.btn {
    padding: 5px 5px;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
}

.btn-know {
    background: #4CAF50;
    color: white;
}

.btn-know:hover {
    background: #45a049;
}

.btn-dont-know {
    background: #f44336;
    color: white;
}

.btn-dont-know:hover {
    background: #da190b;
}

.progress-info {
    margin-top: 30px;
    text-align: center;
}

.progress-text {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.progress-bar {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a6ee0, #6a11cb);
    width: 0%;
    transition: width 0.5s ease;
}

/* 测试页面样式 */
.quiz-card {
    text-align: center;
}

.quiz-word {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 30px;
    color: #2d3748;
}

.options {
    display: grid;
    gap: 15px;
    margin-bottom: 5px;
}

.option {
    padding: 3px;
    background: #f7f9fc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s;
}

.option.correct {
    background: #c6f6d5;
    border-color: #48bb78;
}

.option.incorrect {
    background: #fed7d7;
    border-color: #f56565;
}

.feedback {
    min-height: 60px;
    margin: 20px 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.score {
    font-size: 1.2rem;
    margin-top: 5px;
}

/* 进度页面样式 */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: #f7f9fc;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #4a6ee0;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 1rem;
    color: #718096;
}

.word-list {
    max-height: 300px;
    overflow-y: auto;
}

.word-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1.2rem;
}

.word-item:last-child {
    border-bottom: none;
}

.word-name {
    font-weight: bold;
}

.current-word {
    color: #4a6ee0;
    font-weight: bold;
}

.word-status {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    background: #e2e8f0;
}

.word-status.known {
    background: #c6f6d5;
    color: #22543d;
}

/* 响应式调整 - 手机端 */
@media (max-width: 480px) {
    .word {
        font-size: 2.8rem;
    }
    
    .meaning {
        font-size: 1rem; /* 手机端也相应调小 */
    }
    
    .btn {
        padding: 12px;
        font-size: 1.1rem;
    }
    
    .option {
        padding: 15px;
        font-size: 1.2rem;
    }
    
    .example-item {
        flex-direction: column;
    }
    
    .example-label {
        min-width: auto;
        margin-bottom: 5px;
    }
    
    .example-sentence,
    .example-phonetic,
    .example-translation,
    .example-structure {
        font-size: 1rem;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    /* 修改这里：手机端控制按钮也保持水平排列 */
    .control-buttons {
        flex-direction: row; /* 改为row而不是column */
        gap: 10px;
    }
    
    .btn-toggle,
    .btn-audio-small {
        width: auto; /* 改为auto而不是100% */
        flex: 1; /* 保持弹性布局 */
    }
    
    /* 手机端导航按钮布局 - 紧凑设计 */
    .navigation-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 10px;
        margin-top: 20px;
    }
    
    .btn-nav {
        padding: 12px 10px;
        font-size: 0.9rem;
    }
    
    #prevWord {
        grid-column: 1;
        grid-row: 1;
    }
    
    #nextWordNav {
        grid-column: 2;
        grid-row: 1;
    }
    
    #markKnown {
        grid-column: 1;
        grid-row: 2;
    }
    
    #nextWord {
        grid-column: 2;
        grid-row: 2;
    }
    
    /* 手机端例句内部朗读按钮调整 */
    .example-audio .btn-audio-small {
        width: 100%;
    }
}

/* 字母选择器样式 - 与现有设计风格保持一致 */
.alphabet-selector {
    background: #f7f9fc;
    border-radius: 16px;
    padding: 3px;
    margin-bottom: 3px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 2px solid #e2e8f0;
}

.selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.selector-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.3rem;
    font-weight: 600;
}

.letter-stats {
    font-size: 1rem;
    color: #718096;
    background: white;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
}

.alphabet-grid {
    display: grid;
    gap: 8px;
    justify-content: center;
}

/* 桌面端：6列网格 */
@media (min-width: 768px) {
    .alphabet-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* 平板端：4列网格 */
@media (max-width: 767px) and (min-width: 481px) {
    .alphabet-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 手机端：3列网格 */
@media (max-width: 480px) {
    .alphabet-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.letter-btn {
    padding: 14px 8px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.letter-btn:hover {
    border-color: #4a6ee0;
    background-color: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 110, 224, 0.15);
}

.letter-btn.active {
    background: linear-gradient(135deg, #4a6ee0, #6a11cb);
    color: white;
    border-color: #4a6ee0;
    box-shadow: 0 4px 15px rgba(74, 110, 224, 0.3);
}

.letter-btn.completed {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border-color: #4CAF50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.letter-btn:active {
    transform: translateY(0);
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #718096;
    font-size: 1.1rem;
}

/* 手机端字母选择器调整 */
@media (max-width: 480px) {
    .alphabet-selector {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .selector-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .selector-header h3 {
        font-size: 1.2rem;
    }
    
    .letter-stats {
        align-self: stretch;
        text-align: center;
    }
    
    .letter-btn {
        padding: 12px 6px;
        min-height: 50px;
        font-size: 1.1rem;
    }
}

/* 字母选择器折叠/展开功能 */
.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-alphabet {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
}

.toggle-alphabet:hover {
    background: #cbd5e0;
}

.toggle-icon {
    font-weight: bold;
    font-size: 1.1rem;
}

.alphabet-selector.collapsed .alphabet-grid {
    display: none;
}

.alphabet-selector.collapsed .toggle-icon {
    transform: rotate(0deg);
}

.alphabet-selector:not(.collapsed) .toggle-icon {
    transform: rotate(180deg);
}

/* 手机端字母选择器调整 - 只修改手机端 */
@media (max-width: 480px) {
    .alphabet-selector {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    /* 只在手机端修改标题行布局 */
    .selector-header {
        flex-wrap: nowrap; /* 防止换行 */
        gap: 8px;
    }
    
    .selector-header h3 {
        font-size: 1.1rem;
        white-space: nowrap; /* 防止标题换行 */
        flex-shrink: 0; /* 防止标题被压缩 */
    }
    
    .header-controls {
        flex-shrink: 1; /* 允许控制区域适当收缩 */
        min-width: 0; /* 允许flex子项收缩 */
        justify-content: flex-end; /* 右对齐 */
    }
    
    .letter-stats {
        font-size: 0.9rem;
        padding: 6px 10px;
        white-space: nowrap; /* 防止统计信息换行 */
        flex-shrink: 0; /* 防止统计信息被压缩 */
    }
    
    .toggle-alphabet {
        padding: 6px 10px;
        font-size: 0.8rem;
        flex-shrink: 0; /* 防止按钮被压缩 */
    }
    
    /* 在手机上不隐藏按钮文字，也显示图标 */
    .toggle-alphabet .toggle-text {
        display: inline;
    }
    
    .toggle-alphabet .toggle-icon {
        margin: 0;
    }
}

/* 超小屏幕进一步优化 */
@media (max-width: 360px) {
    .selector-header h3 {
        font-size: 1rem;
    }
    
    .letter-stats {
        font-size: 0.8rem;
        padding: 5px 8px;
    }
    
    .toggle-alphabet {
        padding: 5px 8px;
    }
}