/* 儿童学习平台 - 卡通风格 */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #FFF8E7;
    --card-bg: #FFFFFF;
    --primary: #FF6B9D;
    --secondary: #4ECDC4;
    --accent: #FFE66D;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --success: #6BCB77;
    --warning: #FFD93D;
    --shadow: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-hover: 0 12px 32px rgba(0,0,0,0.12);
    --radius: 20px;
}

html, body {
    height: 100%;
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Comic Sans MS", sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 230, 109, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(78, 205, 196, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 90%, rgba(255, 107, 157, 0.1) 0%, transparent 40%);
    color: var(--text);
    min-height: 100vh;
}

/* 顶部导航 */
.navbar {
    background: var(--card-bg);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1001;
    border-radius: 0 0 24px 24px;
}
.navbar .logo {
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(135deg, #FF6B9D, #4ECDC4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
    user-select: none;
}
.navbar .nav-links { display: flex; gap: 18px; align-items: center; }
.navbar .nav-links a {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.2s;
}
.navbar .nav-links a:hover { background: var(--accent); transform: translateY(-2px); }
.navbar .kid-badge {
    background: linear-gradient(135deg, #FF6B9D, #FF8A65);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

/* 大标题 */
.hero {
    text-align: center;
    padding: 40px 20px 20px;
}
.hero h1 {
    font-size: 42px;
    background: linear-gradient(135deg, #FF6B9D, #4ECDC4, #FFE66D);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
    letter-spacing: 2px;
}
.hero p { font-size: 18px; color: var(--text-light); }

/* 年级选择器 */
.grade-picker {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 32px 0;
    flex-wrap: wrap;
}
.grade-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--card-bg);
    background: var(--card-bg);
    font-size: 18px;
    font-weight: bold;
    color: var(--text);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.grade-btn .grade-num { font-size: 26px; }
.grade-btn .grade-label { font-size: 12px; color: var(--text-light); }
.grade-btn:hover { transform: translateY(-6px) scale(1.05); box-shadow: var(--shadow-hover); }
.grade-btn.active {
    background: linear-gradient(135deg, #FF6B9D, #FF8A65);
    color: white;
    border-color: white;
    transform: scale(1.1);
}
.grade-btn.active .grade-label { color: rgba(255,255,255,0.9); }

/* 科目卡片 */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 24px;
}
.subject-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow);
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}
.subject-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: var(--subject-color, var(--primary));
}
.subject-card:hover {
    transform: translateY(-8px) rotate(-1deg);
    box-shadow: var(--shadow-hover);
    border-color: var(--subject-color, var(--primary));
}
.subject-card .icon { font-size: 56px; margin-bottom: 12px; display: block; }
.subject-card .name { font-size: 22px; font-weight: bold; margin-bottom: 6px; }
.subject-card .desc { font-size: 13px; color: var(--text-light); }

/* 关卡列表 */
.level-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 20px;
}
.level-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.25s;
    border-left: 6px solid var(--level-color, var(--secondary));
    position: relative;
}
.level-card:hover { transform: translateX(6px); box-shadow: var(--shadow-hover); }
.level-card .stage-badge {
    display: inline-block;
    background: var(--level-color, var(--secondary));
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 8px;
}
.level-card .title { font-size: 18px; font-weight: bold; margin-bottom: 6px; }
.level-card .desc { font-size: 13px; color: var(--text-light); margin-bottom: 12px; }
.level-card .stars { font-size: 20px; letter-spacing: 2px; }
.level-card .best-score {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--accent);
    color: var(--text);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

/* 答题页面 */
.play-header {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.play-header .title { font-size: 22px; font-weight: bold; }
.play-header .progress-text { font-size: 14px; color: var(--text-light); }

.progress-bar {
    width: 100%;
    height: 12px;
    background: #F0F0F0;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, #4ECDC4, #6BCB77);
    border-radius: 6px;
    transition: width 0.4s ease;
}

.question-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.question-card .q-type {
    display: inline-block;
    background: var(--accent);
    color: var(--text);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 16px;
}
.question-card .q-prompt {
    font-size: 24px;
    font-weight: bold;
    line-height: 1.5;
    margin-bottom: 24px;
}

.option-list { display: grid; gap: 12px; }
.option-btn {
    background: #F8F9FA;
    border: 3px solid #E9ECEF;
    border-radius: 16px;
    padding: 16px 20px;
    font-size: 18px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
}
.option-btn:hover:not(:disabled) {
    border-color: var(--secondary);
    background: #E8F8F5;
    transform: translateX(4px);
}
.option-btn .option-key {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}
.option-btn.selected { border-color: var(--primary); background: #FFF0F5; }
.option-btn.correct { border-color: var(--success); background: #D4EDDA; }
.option-btn.wrong { border-color: #E74C3C; background: #FADBD8; }
.option-btn:disabled { cursor: not-allowed; opacity: 0.85; }

.judge-group { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.judge-btn {
    padding: 24px;
    font-size: 28px;
    border-radius: 16px;
    border: 3px solid #E9ECEF;
    background: #F8F9FA;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.judge-btn:hover:not(:disabled) { transform: scale(1.05); }
.judge-btn.selected { border-color: var(--primary); background: #FFF0F5; }
.judge-btn.correct { border-color: var(--success); background: #D4EDDA; }
.judge-btn.wrong { border-color: #E74C3C; background: #FADBD8; }

.fill-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 22px;
    border: 3px solid #E9ECEF;
    border-radius: 16px;
    font-family: inherit;
    text-align: center;
    letter-spacing: 2px;
}
.fill-input:focus { outline: none; border-color: var(--secondary); }

.explanation {
    background: #FFF9E6;
    border-left: 4px solid var(--warning);
    border-radius: 12px;
    padding: 14px 18px;
    margin-top: 20px;
    font-size: 15px;
    line-height: 1.6;
    display: none;
}
.explanation.show { display: block; animation: slideIn 0.3s; }
.explanation .label { font-weight: bold; margin-right: 6px; }

/* ============ 新题型：多选 / 连线 / 排序 / 跟读 ============ */
.multi-hint {
    background: #E3F2FD;
    border-left: 4px solid #2196F3;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 10px 0 14px;
    font-size: 14px;
    color: #1565C0;
}

/* 多选题 */
.multi-btn { position: relative; }
.multi-btn .multi-check {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: bold;
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.15s;
}
.multi-btn.selected .multi-check { opacity: 1; }
.multi-btn.selected { border-color: var(--primary); background: #FFF0F5; }

/* 连线题 */
.match-wrap {
    display: grid;
    grid-template-columns: 1fr 40px 1fr;
    gap: 12px;
    align-items: stretch;
    margin-top: 12px;
}
.match-col { display: grid; gap: 10px; }
.match-lines { position: relative; }
.match-btn {
    padding: 14px 18px;
    border: 3px solid #E0E0E0;
    border-radius: 14px;
    background: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-family: inherit;
}
.match-btn:hover:not(:disabled):not(.matched) { border-color: var(--secondary); transform: translateY(-2px); }
.match-btn.selected { border-color: var(--primary); background: #FFF0F5; }
.match-btn.matched { border-color: var(--success); background: #F1F8E9; }
.match-btn.correct { border-color: var(--success) !important; background: #D4EDDA !important; }
.match-btn.wrong { border-color: #E74C3C !important; background: #FADBD8 !important; }
.match-btn:disabled { cursor: not-allowed; }
.match-status {
    margin-top: 14px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

/* 排序题 */
.order-list { display: grid; gap: 10px; margin-top: 12px; }
.order-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: white;
    border: 3px solid #E0E0E0;
    border-radius: 14px;
    transition: all 0.2s;
}
.order-item.correct { border-color: var(--success); background: #D4EDDA; }
.order-item.wrong { border-color: #E74C3C; background: #FADBD8; }
.order-num {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}
.order-text { flex: 1; font-size: 16px; font-weight: 500; }
.order-arrows { display: flex; gap: 6px; }
.order-arrows button {
    width: 36px; height: 36px;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}
.order-arrows button:hover:not(:disabled) { border-color: var(--secondary); transform: scale(1.1); }
.order-arrows button:disabled { opacity: 0.3; cursor: not-allowed; }

/* 跟读题 */
.read-text {
    background: linear-gradient(135deg, #FFF5E6, #FFE8F0);
    border: 3px dashed var(--primary);
    border-radius: 16px;
    padding: 24px 28px;
    margin: 16px 0;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    color: var(--text);
    letter-spacing: 2px;
}
.read-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 16px 0;
}
.read-result {
    margin-top: 16px;
    text-align: center;
    font-size: 16px;
    min-height: 30px;
}
.read-said {
    color: var(--text-light);
    margin-bottom: 8px;
    font-style: italic;
}
.read-score { font-size: 22px; font-weight: bold; }
.read-score.good { color: var(--success); }
.read-score.ok { color: #FF9800; }
.read-fail { color: #E74C3C; }
.read-listening { color: var(--primary); animation: pulse 1.2s infinite; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.action-bar {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}
.btn {
    padding: 14px 36px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.25s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.btn:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #FF6B9D, #FF8A65); color: white; }
.btn-secondary { background: linear-gradient(135deg, #4ECDC4, #44A08D); color: white; }
.btn-ghost { background: white; color: var(--text); border: 2px solid #E9ECEF; }

/* 结果页 */
.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 48px 32px;
    text-align: center;
    box-shadow: var(--shadow);
    animation: slideIn 0.4s;
}
.result-card .score-big {
    font-size: 96px;
    font-weight: bold;
    background: linear-gradient(135deg, #FF6B9D, #4ECDC4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin: 20px 0;
}
.result-card .stars-big { font-size: 64px; letter-spacing: 8px; margin: 20px 0; }
.result-card .verdict { font-size: 24px; font-weight: bold; margin-bottom: 8px; }
.result-card .verdict.pass { color: var(--success); }
.result-card .verdict.fail { color: #E74C3C; }
.result-card .cheer { font-size: 16px; color: var(--text-light); }

/* 个人中心 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-card .stat-value { font-size: 36px; font-weight: bold; color: var(--primary); }
.stat-card .stat-label { font-size: 14px; color: var(--text-light); margin-top: 6px; }

.record-table {
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border-collapse: collapse;
}
.record-table th, .record-table td {
    padding: 14px 16px;
    text-align: left;
}
.record-table th {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
    font-weight: bold;
}
.record-table tr:nth-child(even) { background: #F8F9FA; }

/* 昵称弹窗 */
.modal-mask {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.modal-box {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 36px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal-box h2 { margin-bottom: 12px; }
.modal-box p { color: var(--text-light); margin-bottom: 20px; }
.modal-box input {
    width: 100%;
    padding: 14px 20px;
    font-size: 18px;
    border: 3px solid #E9ECEF;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 16px;
    font-family: inherit;
}
.modal-box input:focus { outline: none; border-color: var(--primary); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}
.empty-state .emoji { font-size: 72px; margin-bottom: 16px; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    transition: all 0.2s;
}
.back-link:hover { transform: translateX(-4px); }

/* 响应式 */
@media (max-width: 640px) {
    .hero h1 { font-size: 28px; }
    .grade-btn { width: 64px; height: 64px; }
    .grade-btn .grade-num { font-size: 20px; }
    .question-card { padding: 20px; }
    .question-card .q-prompt { font-size: 20px; }
    .result-card .score-big { font-size: 64px; }
    .result-card .stars-big { font-size: 48px; }
    .judge-group { grid-template-columns: 1fr; }
}

/* 移动端优化（补充） */
@media (max-width: 640px) {
    .navbar { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
    .navbar .logo { font-size: 19px; white-space: nowrap; }
    .navbar .nav-links { gap: 10px; width: 100%; justify-content: space-between; }
    .navbar .nav-links a { font-size: 14px; }
    .navbar .kid-badge { display: none; }
    #voiceToggle { padding: 6px 10px !important; font-size: 13px !important; }
    .container { padding: 14px 12px 28px; }
    .hero { padding: 18px 14px; }
    .hero h1 { font-size: 22px; }
    .hero p { font-size: 14px; }
    .grade-picker { gap: 8px; }
    .grade-btn { width: 52px; height: 52px; }
    .grade-btn .grade-num { font-size: 17px; }
    .grade-btn .grade-label { font-size: 11px; }
    .subject-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
    .subject-card { padding: 14px 10px; }
    .subject-card .icon { font-size: 30px; }
    .subject-card .name { font-size: 15px; }
    .subject-card .desc { font-size: 12px; }
    .question-card { padding: 16px 14px; }
    .question-card .q-prompt { font-size: 17px; }
    .options-grid { grid-template-columns: 1fr !important; }
    .btn-primary, .submit-btn { width: 100%; }
    .modal-card, .result-card { width: calc(100% - 24px) !important; }
}

/* 账号 / 登录 */
.auth-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-tab {
    flex: 1; padding: 10px; border: 2px solid transparent; border-radius: 10px;
    background: var(--card-bg); cursor: pointer; font-size: 15px; font-weight: bold;
}
.auth-tab.active { border-color: var(--primary); color: var(--primary); }
.auth-error { color: #e74c3c; font-size: 13px; min-height: 18px; margin: 6px 0; }
.modal-box .btn-primary { width: 100%; margin-top: 6px; }
.modal-box .btn-ghost { width: 100%; margin-top: 8px; }
.account-box {
    background: var(--card-bg); border-radius: 16px; padding: 16px 18px;
    box-shadow: var(--shadow); margin-bottom: 16px; font-size: 15px;
    display: flex; flex-direction: column; gap: 8px;
}
.account-box.guest { text-align: center; align-items: center; }
.account-tip { color: var(--text-light); font-size: 12.5px; }
.bind-row { display: flex; gap: 8px; align-items: center; }
.bind-row input {
    flex: 1; padding: 10px 12px; border: 2px solid var(--border, #e8e8ef);
    border-radius: 10px; font-size: 14px; min-width: 0;
}
.bind-msg { font-size: 13px; min-height: 16px; }
.bind-msg.ok { color: #2ecc71; }
.bind-msg.err { color: #e74c3c; }
.mini-link { font-size: 12.5px; color: var(--primary); margin-left: 8px; }
.verified { color: #2ecc71; font-size: 13px; }
.unverified { color: #f39c12; font-size: 13px; }
@media (max-width: 640px) {
    .bind-row { flex-wrap: wrap; }
    .bind-row input { flex: 1 1 100%; }
    .bind-row .btn { flex: 1; }
}

/* 设置页表格 */
table.cfg-table, .account-box table { min-width: 480px; }
.account-box input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }

.verify-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.verify-tabs .auth-tab { padding: 8px; font-size: 14px; }
