/* ========== 基础变量 ========== */
:root {
    --purple-primary: #9b59b6;
    --purple-dark: #8e44ad;
    --purple-light: #e1bee7;
    --purple-lighter: #f3e5f5;
    --purple-soft: #ba68c8;
    --yellow: #ffd54f;
    --yellow-light: #fff8e1;
    --green: #81c784;
    --green-light: #e8f5e9;
    --blue: #64b5f6;
    --blue-light: #e3f2fd;
    --red: #e57373;
    --text-dark: #4a148c;
    --text-medium: #6a1b9a;
    --text-light: #9c27b0;
    --bg-gradient: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 50%, #d1c4e9 100%);
    --card-shadow: 0 4px 15px rgba(155, 89, 182, 0.12);
    --card-shadow-hover: 0 8px 25px rgba(155, 89, 182, 0.22);
}

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

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-dark);
    overflow-x: hidden;
}

.page { display: none; min-height: 100vh; animation: fadeIn 0.5s ease; }
.page.active { display: block; }
.hidden { display: none !important; }

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* ========== 通用按钮 ========== */
.btn-primary {
    background: linear-gradient(135deg, var(--purple-primary), var(--purple-dark));
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(155, 89, 182, 0.4); }

.btn-secondary {
    background: white;
    color: var(--purple-primary);
    border: 2px solid var(--purple-primary);
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-secondary:hover { background: var(--purple-lighter); }

.btn-icon {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-icon:hover { background: var(--purple-lighter); }

.btn-complete {
    background: linear-gradient(135deg, #81c784, #66bb6a);
    color: white;
    border: none;
    padding: 16px 36px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(129, 199, 132, 0.4);
    width: 100%;
    margin-top: 20px;
}
.btn-complete:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 6px 22px rgba(129, 199, 132, 0.5); }

/* ========== 欢迎页 ========== */
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    text-align: center;
}
.logo-area { margin-bottom: 40px; }
.butterfly-animation {
    font-size: 80px;
    animation: float 3s ease-in-out infinite;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 8px rgba(155, 89, 182, 0.3));
}
.logo-area h1 {
    font-size: 32px;
    color: var(--text-dark);
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(155, 89, 182, 0.1);
}
.subtitle {
    font-size: 18px;
    color: var(--purple-soft);
    font-style: italic;
}

.identity-selection { width: 100%; max-width: 500px; }
.select-prompt {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-medium);
    margin-bottom: 20px;
}
.role-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}
.role-card {
    background: white;
    border-radius: 20px;
    padding: 30px 25px;
    width: 160px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
    border: 3px solid transparent;
}
.role-card:hover { transform: translateY(-5px); box-shadow: var(--card-shadow-hover); }
.role-card.selected {
    border-color: var(--purple-primary);
    background: var(--purple-lighter);
    transform: scale(1.05);
}
.role-emoji { font-size: 60px; margin-bottom: 10px; }
.role-name { font-size: 20px; font-weight: 700; color: var(--text-dark); margin-bottom: 5px; }
.role-desc { font-size: 14px; color: var(--text-light); }

.avatar-selection {
    margin-top: 35px;
    width: 100%;
    max-width: 500px;
    animation: fadeIn 0.4s ease;
}
.avatar-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin: 20px 0 25px;
}
.avatar-option {
    width: 60px;
    height: 60px;
    font-size: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 3px solid transparent;
}
.avatar-option:hover { transform: scale(1.15); box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3); }
.avatar-option.selected {
    border-color: var(--purple-primary);
    background: var(--purple-lighter);
    transform: scale(1.2);
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
}

/* ========== 主应用布局 ========== */
.app-header {
    background: linear-gradient(135deg, var(--purple-primary), var(--purple-dark));
    color: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.butterfly-icon { font-size: 28px; }
.app-title { font-size: 22px; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    font-size: 32px;
    background: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.user-name { font-weight: 600; font-size: 15px; }

.app-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 15px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-light);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 60px;
}
.nav-btn .nav-icon { font-size: 24px; }
.nav-btn:hover { background: var(--purple-lighter); }
.nav-btn.active {
    background: linear-gradient(135deg, var(--purple-primary), var(--purple-dark));
    color: white;
    box-shadow: 0 3px 10px rgba(155, 89, 182, 0.3);
}

.app-main { max-width: 850px; margin: 0 auto; padding: 20px; }
.content-page { display: none; animation: fadeIn 0.4s ease; }
.content-page.active { display: block; }

.page-title { font-size: 24px; color: var(--text-dark); margin-bottom: 8px; text-align: center; }
.page-subtitle { text-align: center; color: var(--purple-soft); margin-bottom: 25px; }

/* ========== 今日学习 ========== */
.loading-state { text-align: center; padding: 60px 20px; color: var(--purple-soft); font-size: 18px; }
.today-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.date-badge {
    background: white;
    padding: 10px 18px;
    border-radius: 20px;
    font-weight: 700;
    color: var(--purple-dark);
    box-shadow: var(--card-shadow);
    font-size: 15px;
}
.topic-badge {
    background: linear-gradient(135deg, var(--yellow), var(--yellow-light));
    padding: 10px 18px;
    border-radius: 20px;
    font-weight: 700;
    color: #e65100;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
}
.lesson-card {
    background: white;
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--card-shadow);
}
.lesson-title {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 25px;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px dashed var(--purple-light);
}

.dialogue-section h3, .keywords-section h3, .comments-section h3 {
    font-size: 18px;
    color: var(--purple-dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dialogue-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 30px;
}
.dialogue-bubble {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    max-width: 85%;
}
.dialogue-bubble.parent {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
}
.dialogue-bubble.child { align-self: flex-start; }
.bubble-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--purple-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.dialogue-bubble.parent .bubble-avatar { background: #e3f2fd; }
.bubble-content {
    background: var(--purple-lighter);
    padding: 14px 18px;
    border-radius: 18px;
    border-top-left-radius: 4px;
    color: var(--text-dark);
    font-size: 16px;
    line-height: 1.6;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.dialogue-bubble.parent .bubble-content {
    background: #e3f2fd;
    border-top-left-radius: 18px;
    border-top-right-radius: 4px;
}
.bubble-speaker {
    font-size: 12px;
    color: var(--purple-soft);
    margin-bottom: 4px;
    font-weight: 600;
}
.dialogue-bubble.parent .bubble-speaker { color: #1976d2; }

.keywords-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.keyword-card {
    background: linear-gradient(135deg, var(--purple-lighter), white);
    border-radius: 16px;
    padding: 18px;
    border: 2px solid var(--purple-light);
    transition: all 0.3s ease;
}
.keyword-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--purple-primary);
}
.keyword-word { font-size: 20px; font-weight: 700; color: var(--purple-dark); margin-bottom: 6px; }
.keyword-phonetic { font-size: 13px; color: var(--purple-soft); font-style: italic; margin-bottom: 8px; }
.keyword-meaning { font-size: 15px; color: var(--text-medium); background: white; padding: 6px 12px; border-radius: 10px; display: inline-block; }

.completion-message {
    margin-top: 25px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}
.celebration {
    font-size: 22px;
    font-weight: 700;
    color: var(--purple-dark);
    margin-bottom: 20px;
    animation: bounce 1.5s ease infinite;
}
.reward-form {
    background: var(--yellow-light);
    border-radius: 20px;
    padding: 25px;
    border: 2px dashed var(--yellow);
}
.reward-form p { font-size: 16px; color: var(--text-medium); margin-bottom: 15px; font-weight: 600; }
.reward-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--purple-light);
    border-radius: 15px;
    font-size: 15px;
    margin-bottom: 15px;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
}
.reward-form input:focus { border-color: var(--purple-primary); }

/* ========== 留言区域 ========== */
.comments-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px dashed var(--purple-light);
}
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}
.comment-item {
    background: var(--blue-light);
    border-radius: 16px;
    padding: 14px 18px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
}
.comment-item.parent-item { background: var(--green-light); }
.comment-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.comment-body { flex: 1; }
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.comment-author { font-weight: 700; font-size: 14px; color: var(--text-dark); }
.comment-time { font-size: 12px; color: #888; }
.comment-text { font-size: 15px; color: #333; line-height: 1.5; }
.comment-delete {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
}
.comment-delete:hover { color: var(--red); }
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
}

.btn-record {
    background: linear-gradient(135deg, #ff7043, #f4511e);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-record:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(244, 81, 30, 0.3); }
.btn-record.recording {
    background: linear-gradient(135deg, #e53935, #c62828);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(229, 57, 53, 0); }
}

.recording-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #ffebee;
    border-radius: 12px;
    color: #c62828;
    font-weight: 600;
    font-size: 14px;
}
.recording-dot {
    width: 10px;
    height: 10px;
    background: #e53935;
    border-radius: 50%;
    animation: blink 1s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.recording-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f5f5f5;
    padding: 12px 16px;
    border-radius: 12px;
}
.recording-preview audio {
    flex: 1;
    height: 36px;
}

.comment-audio {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.btn-play-audio {
    background: linear-gradient(135deg, var(--purple-primary), var(--purple-dark));
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.btn-play-audio:hover { opacity: 0.9; }

.bubble-speaker {
    font-size: 12px;
    color: var(--purple-soft);
    margin-bottom: 4px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-speak {
    background: rgba(155, 89, 182, 0.15);
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--purple-dark);
}
.btn-speak:hover { background: rgba(155, 89, 182, 0.3); transform: scale(1.1); }
.btn-speak.speaking { background: var(--purple-primary); color: white; animation: pulse-purple 1s infinite; }
@keyframes pulse-purple {
    0%, 100% { box-shadow: 0 0 0 0 rgba(155, 89, 182, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(155, 89, 182, 0); }
}
.comment-form textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--purple-light);
    border-radius: 16px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.3s;
}
.comment-form textarea:focus { border-color: var(--purple-primary); }

/* ========== 按月浏览 ========== */
.months-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}
.month-card {
    background: white;
    border-radius: 20px;
    padding: 22px;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    text-align: center;
}
.month-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--purple-light);
}
.month-icon { font-size: 48px; margin-bottom: 10px; }
.month-name { font-size: 18px; font-weight: 700; color: var(--text-dark); margin-bottom: 6px; }
.month-theme { font-size: 14px; color: var(--text-medium); margin-bottom: 8px; }
.level-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 4px;
}
.level-badge.beginner { background: #c8e6c9; color: #2e7d32; }
.level-badge.elementary { background: #fff9c4; color: #f57f17; }
.level-badge.intermediate { background: #ffe0b2; color: #e65100; }
.level-badge.upper-intermediate { background: #e1bee7; color: #6a1b9a; }
.level-badge.advanced { background: #ffcdd2; color: #c62828; }

.month-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.month-desc { color: var(--text-medium); margin-bottom: 20px; padding-left: 4px; }

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}
.day-card {
    background: white;
    border-radius: 14px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--card-shadow);
    border: 2px solid transparent;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.day-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--purple-light);
}
.day-card.completed { border-color: var(--green); background: var(--green-light); }
.day-card.today { border-color: var(--purple-primary); background: var(--purple-lighter); }
.day-number { font-size: 18px; font-weight: 800; color: var(--text-dark); }
.day-icon { font-size: 22px; }
.day-title {
    font-size: 10px;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

/* ========== 奖励 ========== */
.rewards-header {
    text-align: center;
    margin-bottom: 25px;
    padding: 25px;
    background: linear-gradient(135deg, var(--yellow-light), #fff3e0);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}
.rewards-header h2 { font-size: 24px; color: var(--text-dark); margin-bottom: 8px; }
.rewards-header p { color: var(--purple-soft); font-size: 15px; }
.rewards-list { display: flex; flex-direction: column; gap: 15px; }
.reward-item {
    background: white;
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    border-left: 5px solid var(--purple-primary);
}
.reward-item:hover { transform: translateX(5px); box-shadow: var(--card-shadow-hover); }
.reward-icon { font-size: 36px; flex-shrink: 0; }
.reward-content { flex: 1; }
.reward-title { font-size: 17px; font-weight: 700; color: var(--text-dark); margin-bottom: 5px; }
.reward-date { font-size: 13px; color: var(--text-light); }
.reward-delete {
    background: #ffebee;
    border: none;
    color: #e53935;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.reward-delete:hover { background: #ef9a9a; color: white; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--purple-soft); }
.empty-emoji { font-size: 60px; margin-bottom: 15px; display: block; }

/* ========== 管理 ========== */
.admin-header {
    text-align: center;
    margin-bottom: 25px;
    padding: 25px;
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}
.admin-header h2 { font-size: 24px; color: var(--text-dark); margin-bottom: 8px; }
.admin-header p { color: var(--purple-soft); font-size: 15px; }

.admin-months-list { display: flex; flex-direction: column; gap: 12px; }
.admin-month-item {
    background: white;
    border-radius: 16px;
    padding: 18px 22px;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}
.admin-month-item:hover { transform: translateX(5px); box-shadow: var(--card-shadow-hover); }
.admin-month-info { display: flex; align-items: center; gap: 12px; }
.admin-month-icon { font-size: 28px; }
.admin-month-title { font-weight: 700; color: var(--text-dark); font-size: 16px; }
.admin-month-theme { font-size: 13px; color: var(--text-light); margin-top: 2px; }

.admin-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; flex-wrap: wrap; }
.admin-lessons-table { display: flex; flex-direction: column; gap: 10px; }
.admin-lesson-row {
    background: white;
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.admin-lesson-row:hover { background: var(--purple-lighter); }
.admin-lesson-info { display: flex; align-items: center; gap: 10px; }
.admin-lesson-day { font-weight: 700; color: var(--purple-primary); min-width: 40px; }
.admin-lesson-title { color: var(--text-dark); font-size: 15px; }

.admin-editor {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-top: 20px;
    box-shadow: var(--card-shadow);
    animation: fadeIn 0.4s ease;
}
.admin-editor h3 { margin-bottom: 20px; color: var(--text-dark); font-size: 20px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; color: var(--text-medium); margin-bottom: 8px; font-size: 14px; }
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--purple-light);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--purple-primary); }
.form-group textarea { resize: vertical; min-height: 100px; }
.editor-actions { display: flex; gap: 12px; margin-top: 20px; }

.btn-inline {
    background: var(--purple-lighter);
    color: var(--purple-primary);
    border: 1px solid var(--purple-light);
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
}
.btn-inline:hover { background: var(--purple-light); }

.dialogue-edit-list, .keywords-edit-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dialogue-edit-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #f8f5fa;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--purple-light);
}

.dialogue-edit-row select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 2px solid var(--purple-light);
    font-size: 14px;
    background: white;
    outline: none;
    min-width: 80px;
}

.dialogue-edit-row textarea {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 2px solid var(--purple-light);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: vertical;
    min-height: 50px;
}

.keyword-edit-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 10px;
    background: #f8f5fa;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--purple-light);
    align-items: center;
}

.keyword-edit-row input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 2px solid var(--purple-light);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.delete-row-btn {
    background: #ffebee;
    color: #e53935;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}
.delete-row-btn:hover { background: #ef9a9a; color: white; }

/* ========== 响应式 ========== */
@media (max-width: 600px) {
    .logo-area h1 { font-size: 24px; }
    .app-title { font-size: 18px; }
    .nav-btn { padding: 6px 10px; min-width: 55px; }
    .nav-btn span:last-child { font-size: 11px; }
    .lesson-card { padding: 18px; }
    .lesson-title { font-size: 20px; }
    .keywords-container { grid-template-columns: 1fr; }
    .dialogue-bubble { max-width: 95%; }
    .months-grid { grid-template-columns: 1fr; }
    .days-grid { grid-template-columns: repeat(4, 1fr); }
    .role-card { width: 140px; padding: 20px 15px; }
    .page-title { font-size: 20px; }
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--purple-lighter); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--purple-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple-soft); }

/* ========== 逐句跟读 ========== */
.btn-record-sentence {
    background: rgba(155, 89, 182, 0.1);
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 4px;
    color: var(--purple-dark);
}
.btn-record-sentence:hover {
    background: rgba(155, 89, 182, 0.25);
    transform: scale(1.1);
}
.btn-record-sentence.recording {
    background: #e74c3c;
    color: white;
    animation: pulse-red 1s infinite;
}
@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
}
.btn-record-sentence.playing {
    background: var(--purple-primary);
    color: white;
}

.btn-re-record {
    background: rgba(100, 149, 237, 0.15);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 4px;
    color: #4a6fa5;
    vertical-align: middle;
}
.btn-re-record:hover {
    background: rgba(100, 149, 237, 0.35);
    transform: scale(1.1);
}


/* ========== 登录/注册表单 ========== */
.auth-box {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin: 20px auto;
    max-width: 340px;
    box-shadow: 0 8px 32px rgba(155, 89, 182, 0.12);
    animation: fadeInUp 0.5s ease;
}

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

.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.auth-input-group input {
    padding: 12px 16px;
    border: 2px solid #e8e0f0;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #faf8fc;
}

.auth-input-group input:focus {
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.btn-auth {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 8px;
}

.auth-switch {
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
    color: #888;
}

.auth-switch a {
    color: var(--purple-primary);
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-hint {
    text-align: center;
    font-size: 12px;
    color: #aaa;
    margin-top: 10px;
}

.role-selection {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 12px 0;
}

.role-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 12px;
    border: 2px solid #e8e0f0;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    background: #faf8fc;
}

.role-radio:hover {
    border-color: var(--purple-soft);
}

.role-radio input[type="radio"] {
    display: none;
}

.role-radio:has(input[type="radio"]:checked) {
    border-color: var(--purple-primary);
    background: rgba(155, 89, 182, 0.08);
    color: var(--purple-dark);
    font-weight: 600;
}

.select-prompt-small {
    text-align: center;
    font-size: 14px;
    color: var(--purple-dark);
    margin: 10px 0 6px;
}

.avatar-grid-mini {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-width: 280px;
    margin: 8px auto;
    justify-items: center;
}

.avatar-option-mini {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    background: #f5f0f8;
}

.avatar-option-mini:hover {
    transform: scale(1.15);
    background: rgba(155, 89, 182, 0.1);
}

.avatar-option-mini.selected {
    border-color: var(--purple-primary);
    background: rgba(155, 89, 182, 0.15);
    transform: scale(1.1);
}

.avatar-selection-mini {
    margin: 12px 0;
}


/* ========== 历史上的今天 ========== */
.history-today-card {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border-radius: 16px;
    padding: 16px 20px;
    margin: 12px 0 20px;
    border-left: 4px solid #f0ad4e;
    box-shadow: 0 4px 12px rgba(240, 173, 78, 0.1);
}

.history-today-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-today-card p {
    margin: 0;
    font-size: 14px;
    color: #5d4a1f;
    line-height: 1.6;
}

/* ========== 词汇拼写练习 ========== */
.spelling-section {
    margin: 20px 0;
    padding: 18px;
    background: #f8f5fb;
    border-radius: 16px;
    border: 2px dashed #d8c4e8;
}

.spelling-section h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--purple-dark);
}

.spelling-hint {
    margin: 0 0 14px;
    font-size: 13px;
    color: #888;
}

.spelling-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.spelling-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.spelling-meaning {
    flex: 1;
    min-width: 120px;
    font-size: 14px;
    color: #333;
    background: white;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #eee;
}

.spelling-input {
    width: 160px;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.spelling-input:focus {
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.spelling-input.correct {
    border-color: #2ecc71;
    background: #eafaf1;
}

.spelling-input.incorrect {
    border-color: #e74c3c;
    background: #fdeaea;
}

.spelling-feedback {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.spelling-tip {
    text-align: center;
    font-size: 13px;
    color: var(--purple-primary);
    margin-top: 10px;
}

.btn-complete:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}
