/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    min-height: 100vh;
    color: #1e3a5f;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: #0369a1;
    margin-bottom: 20px;
}

nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    background: white;
    color: #0369a1;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(3, 105, 161, 0.1);
}

.nav-btn:hover {
    background: #0369a1;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(3, 105, 161, 0.2);
}

.nav-btn.active {
    background: #0369a1;
    color: white;
}

/* 页面切换 */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 按钮样式 */
.primary-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.primary-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.secondary-btn {
    padding: 12px 28px;
    border: 2px solid #0ea5e9;
    border-radius: 25px;
    background: white;
    color: #0369a1;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: #f0f9ff;
    transform: translateY(-2px);
}

.danger-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    background: #ef4444;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.danger-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* 首页样式 */
.welcome-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(3, 105, 161, 0.1);
}

.welcome-section h2 {
    font-size: 2rem;
    color: #0369a1;
    margin-bottom: 20px;
}

.progress-overview {
    margin: 30px 0;
    padding: 20px;
    background: #f0f9ff;
    border-radius: 15px;
}

.progress-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #0369a1;
}

/* 后台管理样式 */
.admin-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(3, 105, 161, 0.1);
}

.admin-section h2 {
    color: #0369a1;
    margin-bottom: 25px;
    text-align: center;
}

.add-words-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f0f9ff;
    border-radius: 15px;
}

.add-words-section h3 {
    color: #0369a1;
    margin-bottom: 15px;
}

.input-group {
    margin-bottom: 15px;
}

.input-group textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e0f2fe;
    border-radius: 12px;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.input-group textarea:focus {
    outline: none;
    border-color: #0ea5e9;
}

.single-input {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.single-input input {
    flex: 1;
    min-width: 150px;
    padding: 12px 15px;
    border: 2px solid #e0f2fe;
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.single-input input:focus {
    outline: none;
    border-color: #0ea5e9;
}

.word-list-section {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.section-header h3 {
    color: #0369a1;
}

.word-list {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid #e0f2fe;
    border-radius: 12px;
    padding: 10px;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.word-item:hover {
    background: #f0f9ff;
    transform: translateX(5px);
}

.word-info {
    flex: 1;
}

.word-info .word {
    font-size: 1.2rem;
    font-weight: bold;
    color: #0369a1;
}

.word-info .meaning {
    color: #64748b;
    margin-top: 5px;
}

.word-item .delete-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 15px;
    background: #fee2e2;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.3s ease;
}

.word-item .delete-btn:hover {
    background: #ef4444;
    color: white;
}

.admin-stats-section {
    padding: 20px;
    background: #f0f9ff;
    border-radius: 15px;
}

.admin-stats-section h3 {
    color: #0369a1;
    margin-bottom: 15px;
}

.progress-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.progress-item {
    padding: 15px;
    background: white;
    border-radius: 10px;
    text-align: center;
}

/* 学习页面样式 */
.stage-section {
    text-align: center;
}

.stage-section h2 {
    color: #0369a1;
    margin-bottom: 30px;
}

.stage-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stage-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(3, 105, 161, 0.1);
    border: 3px solid transparent;
}

.stage-card:hover:not(.locked) {
    transform: translateY(-5px);
    border-color: #0ea5e9;
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.2);
}

.stage-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.stage-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.stage-card h3 {
    color: #0369a1;
    margin-bottom: 10px;
}

.stage-card p {
    color: #64748b;
    margin-bottom: 15px;
}

.stage-status {
    display: inline-block;
    padding: 5px 15px;
    background: #e0f2fe;
    border-radius: 15px;
    font-size: 0.85rem;
    color: #0369a1;
}

/* 学习内容样式 */
.stage-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(3, 105, 161, 0.1);
}

.stage-content.hidden {
    display: none;
}

/* 已记住标识 */
.remembered-badge {
    display: inline-block;
    padding: 5px 15px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 10px;
}

.remembered-badge.hidden {
    display: none;
}

.stage-header {
    text-align: center;
    margin-bottom: 30px;
}

.stage-header h2 {
    color: #0369a1;
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e0f2fe;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0ea5e9, #0369a1);
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* 单词卡片样式 */
.word-card {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 20px;
    margin-bottom: 20px;
}

.word-display {
    margin-bottom: 20px;
}

.word-text {
    font-size: 3rem;
    color: #0369a1;
    margin-bottom: 15px;
}

.sound-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    background: #0ea5e9;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sound-btn:hover {
    background: #0369a1;
    transform: scale(1.05);
}

.sound-btn.large {
    padding: 15px 30px;
    font-size: 1.2rem;
}

.word-meaning {
    font-size: 1.5rem;
    color: #64748b;
    margin-bottom: 30px;
}

.word-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 听写样式 */
.dictation-card {
    text-align: center;
    padding: 40px;
}

.dictation-prompt {
    margin-bottom: 30px;
}

.dictation-prompt p {
    font-size: 1.2rem;
    color: #64748b;
    margin-bottom: 20px;
}

#dictation-input {
    width: 100%;
    max-width: 400px;
    padding: 15px 20px;
    border: 3px solid #e0f2fe;
    border-radius: 15px;
    font-size: 1.5rem;
    text-align: center;
    transition: border-color 0.3s ease;
}

#dictation-input:focus {
    outline: none;
    border-color: #0ea5e9;
}

.dictation-feedback {
    margin: 20px 0;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1rem;
}

.dictation-feedback.correct {
    background: #dcfce7;
    color: #16a34a;
}

.dictation-feedback.wrong {
    background: #fee2e2;
    color: #dc2626;
}

.dictation-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.hint-section {
    margin-top: 20px;
    padding: 15px;
    background: #fef3c7;
    border-radius: 10px;
}

.hint-text {
    color: #92400e;
}

/* 游戏样式 */
.game-card {
    text-align: center;
    padding: 30px;
}

.game-question {
    margin-bottom: 30px;
}

.game-question p {
    color: #64748b;
    margin-bottom: 10px;
}

.game-word {
    font-size: 2.5rem;
    color: #0369a1;
}

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

.game-option {
    padding: 20px;
    background: #f0f9ff;
    border: 2px solid #e0f2fe;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.game-option:hover {
    background: #e0f2fe;
    border-color: #0ea5e9;
    transform: translateY(-2px);
}

.game-option.correct {
    background: #dcfce7;
    border-color: #16a34a;
}

.game-option.wrong {
    background: #fee2e2;
    border-color: #ef4444;
}

.game-feedback {
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1rem;
    margin-top: 20px;
}

.score-display {
    font-size: 1.2rem;
    color: #0369a1;
    margin-top: 10px;
}

/* 完成页面 */
.complete-section {
    text-align: center;
    padding: 50px;
}

.complete-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.complete-section h2 {
    font-size: 2.5rem;
    color: #0369a1;
    margin-bottom: 15px;
}

.complete-section p {
    color: #64748b;
    margin-bottom: 30px;
}

.final-stats {
    background: #f0f9ff;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.final-stats p {
    font-size: 1.2rem;
    margin: 10px 0;
}

.back-btn {
    display: block;
    margin: 20px auto 0;
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    background: #e0f2fe;
    color: #0369a1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #bae6fd;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    nav {
        gap: 10px;
    }

    .nav-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .welcome-section,
    .admin-section,
    .stage-content {
        padding: 20px;
    }

    .word-text {
        font-size: 2rem;
    }

    .word-meaning {
        font-size: 1.2rem;
    }

    .game-options {
        grid-template-columns: 1fr;
    }

    .single-input {
        flex-direction: column;
    }

    .single-input input {
        width: 100%;
    }

    .progress-stats {
        gap: 20px;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .stage-card {
        padding: 20px;
    }

    .stage-icon {
        font-size: 2rem;
    }

    .word-actions {
        flex-direction: column;
    }

    .word-actions button {
        width: 100%;
    }

    .dictation-actions {
        flex-direction: column;
    }

    .dictation-actions button {
        width: 100%;
    }
}

/* 滚动条样式 */
.word-list::-webkit-scrollbar {
    width: 8px;
}

.word-list::-webkit-scrollbar-track {
    background: #f0f9ff;
    border-radius: 4px;
}

.word-list::-webkit-scrollbar-thumb {
    background: #bae6fd;
    border-radius: 4px;
}

.word-list::-webkit-scrollbar-thumb:hover {
    background: #7dd3fc;
}

/* 空状态提示 */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

.empty-state p {
    font-size: 1.1rem;
}

/* 单元选择样式 */
.unit-add-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f0f9ff;
    border-radius: 15px;
}

.unit-add-section h3 {
    color: #0369a1;
    margin-bottom: 15px;
}

.unit-selector {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.select-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.select-group label {
    font-weight: 500;
    color: #0369a1;
    min-width: 80px;
}

.select-group select {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #e0f2fe;
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.select-group select:focus {
    outline: none;
    border-color: #0ea5e9;
}

.unit-preview {
    padding: 15px;
    background: white;
    border-radius: 10px;
    border: 2px solid #e0f2fe;
}

.preview-text {
    color: #64748b;
    font-size: 0.95rem;
}

.preview-text.error {
    color: #ef4444;
}

.preview-info {
    text-align: left;
}

.unit-title {
    font-size: 1.1rem;
    color: #0369a1;
    margin-bottom: 8px;
}

.word-count {
    color: #64748b;
    margin-bottom: 8px;
}

.word-preview {
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.5;
}

#add-unit-btn {
    align-self: flex-start;
    margin-top: 5px;
}

/* 分组导航样式 */
.group-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 10px;
    background: white;
    border-radius: 10px;
    border: 2px solid #e0f2fe;
}

#group-indicator {
    font-size: 1rem;
    color: #0369a1;
    font-weight: 500;
    min-width: 120px;
    text-align: center;
}

#prev-group-btn,
#next-group-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

#prev-group-btn:disabled,
#next-group-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
