/*
 * style.css - 儿童练字App 视觉设计样式表
 * 温暖童趣色彩、圆角柔和质感、动感反馈与打印专用排版
 */

:root {
    --primary: #ff6b6b;
    --primary-hover: #ee5253;
    --secondary: #48dbfb;
    --accent: #feca57;
    --success: #1dd1a1;
    --dark: #222f3e;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --bg-main: #fbf9f5;
    --bg-card: #ffffff;
    --border-color: #f1ebd8;
    --grid-red: #e17055;
    --shadow-soft: 0 8px 24px rgba(149, 157, 165, 0.12);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.05);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none; /* 禁用移动端长按呼出放大镜与上下文气泡菜单 (防误触) */
    -webkit-user-select: none;   /* Safari, Chrome, iOS WebKit */
    -khtml-user-select: none;
    -moz-user-select: none;      /* Firefox */
    -ms-user-select: none;       /* IE/Edge */
    user-select: none;           /* 全局禁止文本选区，防止儿童手写或点击时误触产生蓝色高亮选框 */
}

html, body {
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden; /* 保证单页面显示所有内容，严禁页面出现纵向滚动条 */
    overscroll-behavior: none; /* 禁用移动端边缘横向滑动翻页与下拉刷新，配合 history 返回层级 */
    display: flex;
    flex-direction: column;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.4;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: none; /* 防止页面边缘过度下拉弹性晃动干扰书写 */
}

/* 仅在需要输入汉字的文本框保留文本编辑与选区能力 */
input[type="text"], input[type="search"], textarea, [contenteditable="true"] {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 禁止图片、SVG与画板被拖拽出半透明虚影 */
img, svg, canvas {
    -webkit-user-drag: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* 顶部导航栏 */
.app-header {
    background: #ffffff;
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    position: relative;
    z-index: 100;
    flex-shrink: 0;
}

.header-inner {
    max-width: 1480px;
    margin: 0 auto;
    padding: 4px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap; /* 严禁换行增加高度 */
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 24px;
    animation: bounce 2s infinite ease-in-out;
}

.logo-title {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #ff6b6b, #f368e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.logo-subtitle {
    font-size: 12px;
    color: #475569; /* 加深提高对比度 */
    font-weight: 600;
    margin-left: 4px;
    white-space: nowrap;
}

/* 搜索与输入自选汉字 (宽度充裕不截断提示) */
.search-box {
    display: flex;
    align-items: center;
    background: #f1f2f6;
    border-radius: 30px;
    padding: 3px 4px 3px 12px;
    border: 1.5px solid transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
    min-width: 180px;
    width: 210px;
    box-sizing: border-box;
}

.search-box:focus-within {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15);
}

.search-box input {
    border: none;
    background: transparent;
    font-size: 14.5px;
    font-weight: 600;
    outline: none;
    flex: 1;
    min-width: 70px;
    color: var(--text-main);
}

.search-box button {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 13.5px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.15s;
}

.search-box button:hover {
    background: var(--primary-hover);
    transform: scale(1.03);
}

.settings-trigger-btn {
    background: #f1f2f6;
    border: 1.5px solid #dcdde1;
    border-radius: 18px;
    height: 36px;
    min-height: 36px;
    padding: 0 12px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.settings-trigger-btn:hover {
    background: #e4e7eb;
    border-color: #b2bec3;
    transform: translateY(-1px);
}

.settings-trigger-btn:active {
    transform: scale(0.96);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.star-badge, .completed-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #fff9e6;
    border: 1.5px solid #ffeaa7;
    color: #d35400;
    padding: 3px 10px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

.completed-badge {
    background: #e8f8f5;
    border-color: #a3e4d7;
    color: #16a085;
}

.sound-toggle-btn {
    background: #f8f9fa;
    border: 1.5px solid #e9ecef;
    border-radius: 16px;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.sound-toggle-btn:hover {
    background: #e9ecef;
}

.sound-toggle-btn.muted {
    color: #95a5a6;
    background: #f1f2f6;
}

.ipad-connect-btn {
    background: linear-gradient(135deg, #0984e3, #74b9ff);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(9, 132, 227, 0.25);
    transition: all 0.2s ease;
}

.ipad-connect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(9, 132, 227, 0.35);
}

.print-sheet-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
    transition: all 0.2s ease;
}

.print-sheet-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

.print-sheet-btn:active {
    transform: scale(0.96);
}

.fullscreen-toggle-btn {
    background: #f1f2f6;
    border: 1.5px solid #dcdde1;
    border-radius: 16px;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.fullscreen-toggle-btn:hover {
    background: #e4e7eb;
    border-color: #ced6e0;
}

.fullscreen-toggle-btn.active {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
}

.clear-data-btn {
    background: #fff5f5;
    border: 1.5px solid #ffccd2;
    color: #e84118;
    border-radius: 16px;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.clear-data-btn:hover {
    background: #ffe3e3;
    border-color: #e84118;
    transform: translateY(-1px);
}

/* 幸运扭蛋机与贴纸乐园入口按键 */
.gashapon-trigger-btn {
    background: linear-gradient(135deg, #ff9f43, #ee5253);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(238, 82, 83, 0.28);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.gashapon-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(238, 82, 83, 0.4);
}

.gashapon-trigger-btn:active {
    transform: scale(0.96);
}

.gashapon-bubble-badge {
    background: #ff4757;
    color: #ffffff;
    border: 1.5px solid #ffffff;
    border-radius: 10px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 900;
    line-height: 14px;
    min-width: 14px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: bounce 1.8s infinite ease-in-out;
}

.sticker-book-trigger-btn {
    background: linear-gradient(135deg, #a55eea, #8854d0);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(136, 84, 208, 0.28);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sticker-book-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(136, 84, 208, 0.4);
}

.sticker-book-trigger-btn:active {
    transform: scale(0.96);
}

/* 移动端手机小屏提示条 */
.mobile-hint-banner {
    background: linear-gradient(90deg, #fff3cd, #ffeaa7);
    border-bottom: 1px solid #feca57;
    color: #8c5300;
    font-size: 12px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    position: relative;
    z-index: 90;
    flex-shrink: 0;
}

.mobile-hint-banner strong {
    color: #d35400;
}

.banner-actions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.mobile-hint-banner button {
    background: #e67e22;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.mobile-hint-banner button:hover {
    background: #d35400;
}

.mobile-hint-banner .btn-close-banner {
    background: rgba(211, 84, 0, 0.14);
    color: #8c5300;
    padding: 2px 7px;
    font-size: 12px;
    border-radius: 50%;
    line-height: 1.2;
}

.mobile-hint-banner .btn-close-banner:hover {
    background: rgba(211, 84, 0, 0.25);
}

/* 分类与汉字选单条 - 汉字选择行除外（允许横向滑动选字） */
.char-selector-section {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 4px 16px 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    flex-shrink: 0;
}

.category-bar {
    max-width: 1480px;
    margin: 0 auto;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.category-bar::-webkit-scrollbar {
    display: none;
}

.cat-tab-btn {
    background: #f5f6fa;
    border: 1px solid #dcdde1;
    border-radius: 14px;
    padding: 3px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.cat-tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cat-tab-btn.active {
    background: linear-gradient(135deg, #ff7675, #fab1a0);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(255, 118, 117, 0.3);
}

/* 汉字卡片横向滚动平铺行（带右侧渐隐提示可滑动） */
.char-list-grid {
    max-width: 1480px;
    margin: 4px auto 0;
    display: flex;
    gap: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 36px), transparent 100%);
    mask-image: linear-gradient(to right, black calc(100% - 36px), transparent 100%);
}

.char-list-grid::-webkit-scrollbar {
    display: none;
}

.char-card-btn {
    flex: 0 0 auto;
    width: 52px;
    min-width: 52px;
    height: 58px;
    background: #ffffff;
    border: 1.5px solid #ecf0f1;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.char-card-btn:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.char-card-btn.active {
    border-color: var(--primary);
    background: #fff5f5;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.28);
}

.char-card-btn .char-py {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 700;
    line-height: 1;
}

.char-card-btn .char-hz {
    font-size: 25px;
    font-family: "KaiTi", "STKaiti", serif;
    font-weight: bold;
    color: var(--text-main);
    line-height: 1;
    margin-top: 2px;
}

.char-card-btn.completed .char-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #ffd32a, #ff9f1a);
    color: #ffffff;
    border: 1.5px solid #ffffff;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(255, 159, 26, 0.45);
    line-height: 1;
}

/* 主内容布局：1:1 对称黄金两栏 (左右等宽、紧凑聚拢，彻底消除左侧与右侧的冗余空白) */
.main-container {
    flex: 1;
    min-height: 0; /* 允许 flex 项目响应高度缩减 */
    max-width: 1180px; /* 精确约束整体内容宽度，居中聚拢，杜绝任何一侧出现大片空白死角 */
    width: 100%;
    margin: 0 auto;
    padding: 6px 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: stretch;
    overflow: hidden; /* 保证容器绝对无滚动条 */
}

.panel-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    border: 1.5px solid var(--border-color);
    padding: 10px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}

/* ========================================================
   左侧：综合大本营 (看图识字 + 笔顺大课堂)
   ======================================================== */
.panel-left-studio {
    gap: 10px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* 🎨 上半部分：看图识字与语言认知卡 */
.cognition-hero-card {
    background: #ffffff;
    border: 1.5px solid #fae3d9;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    padding: 6px 12px;
    display: flex;
    gap: 10px;
    flex: 0 0 228px;
    height: 228px;
    min-height: 0;
    box-sizing: border-box;
    transition: all 0.2s ease;
    overflow: hidden;
}

/* 大幅插画卡 (纯净全幅展示) */
.ill-art-box {
    width: 155px;
    flex-shrink: 0;
    background: linear-gradient(145deg, #fffcf5 0%, #fff4e6 50%, #ffe9d9 100%);
    border: 1.5px solid #fed385;
    border-radius: var(--radius-sm);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 8px rgba(254, 202, 87, 0.2);
}

.ill-art-box:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(254, 202, 87, 0.35);
    border-color: #f39c12;
}

.ill-art-box:active, .ill-art-box.pop-anim {
    transform: scale(0.96);
}

.ill-art-wrap {
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 2px;
}

.ill-large-img {
    width: 100%;
    height: 100%;
    max-width: 236px;
    max-height: 236px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: block;
    background: #ffffff;
}

.ill-art-box:hover .ill-large-img {
    transform: scale(1.04);
}

.ill-fallback-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 190px;
    height: 190px;
    background: linear-gradient(135deg, #ffffff, #fff8f0);
    border: 2.5px solid #fed385;
    border-radius: 18px;
    box-shadow: 0 4px 14px rgba(254, 202, 87, 0.25);
    user-select: none;
    transition: transform 0.2s;
}

.ill-fallback-card .fallback-char {
    font-size: 92px;
    font-family: "KaiTi", "STKaiti", serif;
    font-weight: 900;
    color: #e17055;
    line-height: 1;
}

.ill-fallback-card .fallback-pinyin {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 6px;
}

.ill-large-art {
    font-size: 80px; /* 大幅展示插画 */
    line-height: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
    animation: gentleBob 3s ease-in-out infinite alternate;
}

@keyframes gentleBob {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-3px) scale(1.03); }
}

/* 右半：汉字详情、例句与组词 (字体加大加粗，更适合少儿阅读) */
.cognition-details-box {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 4px;
}

.cognition-char-header {
    background: #fdfaf6;
    border: 1.5px solid #fae3d9;
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cognition-char-header:hover {
    background: #fff8f0;
    border-color: #f39c12;
    box-shadow: 0 3px 10px rgba(243, 156, 18, 0.15);
    transform: translateY(-1px);
}

.cognition-char-header:active, .cognition-char-header.pop-anim {
    transform: scale(0.97);
}

.cognition-char-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cognition-pinyin-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cognition-pinyin {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    font-family: "Segoe UI", -apple-system, sans-serif;
    line-height: 1.1;
}

.cognition-char-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cognition-char {
    font-size: 52px;
    font-family: "KaiTi", "STKaiti", serif;
    font-weight: bold;
    color: var(--dark);
    line-height: 1;
}

.hero-en-badge {
    font-size: 14.5px;
    font-weight: 800;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #4834d4;
    background: #eef2ff;
    border: 1.5px solid #c7d2fe;
    border-radius: 8px;
    padding: 2px 9px;
    cursor: pointer;
    line-height: 1.2;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    user-select: none;
    box-shadow: 0 1px 3px rgba(72, 52, 212, 0.1);
}

.hero-en-badge:hover {
    background: #4834d4;
    color: #ffffff;
    border-color: #4834d4;
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 3px 8px rgba(72, 52, 212, 0.3);
}

.hero-en-badge:active, .hero-en-badge.pop-anim {
    transform: scale(0.95);
}

.char-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-speak {
    background: #ffbe76;
    border: none;
    border-radius: 20px;
    height: 38px;
    min-height: 38px;
    padding: 0 10px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255, 190, 118, 0.45);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #8c5300;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s;
}

.btn-speak:hover {
    transform: scale(1.06);
    background: #fed385;
}

.btn-speak:active {
    transform: scale(0.96);
}

.btn-speak-icon {
    font-size: 16px;
    line-height: 1;
}

.btn-speak-text {
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.cognition-meta-badges {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.meta-pill {
    background: #ffffff;
    border: 1px solid #fae3d9;
    border-radius: 8px;
    padding: 2px 6px;
    white-space: nowrap;
    font-size: 12px;
}

.meta-pill strong {
    color: var(--text-main);
    font-weight: 800;
}

/* 经典例句 */
.cognition-sentence-section {
    background: #fdfaf6;
    border: 1px solid #fae3d9;
    border-radius: 6px;
    padding: 5px 9px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
}

.cognition-sentence-section .cognition-section-title {
    font-size: 13px;
    font-weight: 800;
    color: #e17055;
}

.cognition-sentence-text {
    font-size: 16px;
    color: var(--text-main);
    line-height: 1.4;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
    padding: 2px 4px;
}

.cognition-sentence-text:hover {
    background: #fff8e7;
    color: #d35400;
}

.cognition-sentence-text:active, .cognition-sentence-text.pop-anim {
    transform: scale(0.98);
}

/* 常用组词 */
.cognition-words-section {
    background: #fdfaf6;
    border: 1px solid #fae3d9;
    border-radius: 6px;
    padding: 5px 9px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
}

.cognition-words-section .cognition-section-title {
    font-size: 13px;
    font-weight: 800;
    color: #0984e3;
}

.cognition-words-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.word-tag {
    background: #e3f2fd;
    color: #0984e3;
    padding: 4px 11px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(9, 132, 227, 0.12);
    user-select: none;
}

.word-tag:hover {
    transform: translateY(-2px) scale(1.06);
    background: #d0e7ff;
    box-shadow: 0 3px 8px rgba(9, 132, 227, 0.2);
    border-color: #0984e3;
}

.word-tag:active, .word-tag.pop-anim {
    transform: scale(0.94);
}

/* ========================================================
   下半部分：笔顺小课堂 (大幅演示与互动闯关 - 纵向流式排版，按键与设置始终置顶与置底)
   ======================================================== */
.guide-studio-card {
    flex: 1;
    min-height: 0;
    background: #ffffff;
    border: 1.5px solid #fae3d9;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    padding: 8px 12px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    box-sizing: border-box;
    overflow: hidden;
}

/* 顶部标题与速度栏 */
.guide-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1.5px dashed #f1f2f6;
    padding-bottom: 4px;
    flex-shrink: 0;
}

.guide-title-box {
    display: flex;
    align-items: center;
    gap: 6px;
}

.guide-icon {
    font-size: 18px;
    line-height: 1;
}

.guide-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--dark);
    margin: 0;
    white-space: nowrap;
}

.speed-control-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.speed-label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
}

.speed-segmented-ctrl {
    display: inline-flex;
    background: #f1f2f6;
    border-radius: 16px;
    padding: 2px;
    gap: 2px;
}

.guide-header-ctrls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.guide-frame-size-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.guide-frame-size-group .control-label-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.frame-size-seg-btn {
    border: none;
    background: transparent;
    border-radius: 14px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.frame-size-seg-btn:hover {
    color: var(--primary);
}

.frame-size-seg-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* 一键快速放大/还原写字框按钮 */
.btn-frame-zoom {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ffd0c7;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 10;
    opacity: 0.85;
}

.btn-frame-zoom:hover {
    opacity: 1;
    transform: scale(1.1);
    background: #ffffff;
    border-color: var(--primary);
}

.speed-seg-btn {
    border: none;
    background: transparent;
    border-radius: 14px;
    padding: 3px 10px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.speed-seg-btn:hover {
    color: var(--primary);
}

.speed-seg-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* 中间：笔顺演示框 (支持小 175px、中 210px、大 265px 自由缩放调节，弹性居中不挤压底部按钮) */
.guide-frame-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 2px 0;
}

.hanzi-writer-frame {
    width: 215px;
    height: 215px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    border: 3px solid var(--grid-red);
    box-shadow: inset 0 0 16px rgba(225, 112, 85, 0.06), 0 4px 14px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
    transition: width 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275), height 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 紧凑字框 (170px) - 适合字词认知为主 */
.frame-size-small .hanzi-writer-frame {
    width: 170px;
    height: 170px;
}
.frame-size-small .cognition-hero-card {
    flex: 1;
}

/* 大号字框 (255px) - 宽幅临摹与跟写闯关 */
.frame-size-large .hanzi-writer-frame {
    width: 255px;
    height: 255px;
}
.frame-size-large .cognition-hero-card {
    flex: 0 0 150px;
    height: 150px;
    padding: 5px 10px;
}
.frame-size-large .cognition-ill-wrap {
    width: 115px;
    height: 140px;
}
.frame-size-large .cognition-sentence-section {
    margin-top: 3px;
    padding: 4px 8px;
}
.frame-size-large .cognition-sentence-text {
    font-size: 12px;
    line-height: 1.3;
}
.frame-size-large .cognition-words-section {
    display: none !important;
}
.frame-size-large .status-pill {
    padding: 3px 8px;
    font-size: 11.5px;
    margin: 2px 0 4px;
}

/* 米字格网格线装饰在 HanziWriter 背后 (与右侧画板统一虚线与色系) */
.writer-grid-lines {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.writer-grid-lines::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    border-top: 1px dashed rgba(225, 112, 85, 0.45);
}

.writer-grid-lines::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    border-left: 1px dashed rgba(225, 112, 85, 0.45);
}

.writer-diag-line-1 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom right, transparent calc(50% - 0.5px), rgba(225, 112, 85, 0.35) 50%, transparent calc(50% + 0.5px));
    pointer-events: none;
}

.writer-diag-line-2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top right, transparent calc(50% - 0.5px), rgba(225, 112, 85, 0.35) 50%, transparent calc(50% + 0.5px));
    pointer-events: none;
}

#hanzi-writer-box {
    position: relative;
    z-index: 10;
    cursor: crosshair;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hw-fallback {
    font-size: 140px;
    font-family: "KaiTi", "STKaiti", serif;
    color: var(--dark);
}

/* 状态提示浮条 (动态小手指示，高对比高可读) */
.status-pill {
    background: #fff8eb;
    border: 1.5px solid #fcdba0;
    border-radius: 16px;
    padding: 5px 12px;
    font-size: 13.5px;
    font-weight: 700;
    color: #b75500;
    line-height: 1.35;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(243, 156, 18, 0.1);
}

.hand-pointer-icon {
    font-size: 16px;
    display: inline-block;
    animation: handPointBounce 1.5s infinite ease-in-out;
}

@keyframes handPointBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px) scale(1.15); }
}

/* 核心操作按键组 (大按键并排置底，色彩高饱和高对比) */
.writer-action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    flex-shrink: 0;
    padding-bottom: 2px;
}

.btn-ctrl {
    flex: 1;
    height: 44px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 16px;
    border: none;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-ctrl:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.15);
}

.btn-ctrl:active {
    transform: scale(0.97);
}

.btn-play-anim {
    background: linear-gradient(135deg, #0984e3, #0652dd);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(9, 132, 227, 0.35);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.btn-start-quiz {
    background: linear-gradient(135deg, #ff4757, #c0392b);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(255, 71, 87, 0.35);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.btn-start-quiz.pulse {
    animation: pulseBtn 1s infinite alternate;
}

@keyframes pulseBtn {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 118, 117, 0.5); }
    100% { transform: scale(1.03); box-shadow: 0 0 0 10px rgba(255, 118, 117, 0); }
}

/* 右侧手写画板面板 - 紧凑包裹，消除大面积空白 */
.panel-right {
    gap: 6px;
    justify-content: space-between;
    padding: 10px 12px;
}

.canvas-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    border-bottom: 1.5px dashed #f1f2f6;
    padding-bottom: 4px;
    flex-shrink: 0;
}

.canvas-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.canvas-panel-header h2 {
    font-size: 16px;
    font-weight: 800;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    margin: 0;
}

.canvas-size-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.canvas-size-group .control-label-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.canvas-size-seg-btn {
    border: none;
    background: transparent;
    border-radius: 12px;
    padding: 3px 7px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.canvas-size-seg-btn:hover {
    color: var(--primary);
}

.canvas-size-seg-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.grid-selector {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.grid-type-btn {
    background: #f1f2f6;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 3px 7px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.grid-type-btn.active {
    background: #ffeaa7;
    color: #d35400;
    border-color: #fdcb6e;
}

.canvas-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    background: #fdfaf6;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid #fae3d9;
    flex-shrink: 0;
}

/* 画板工具栏第 1 层：常用笔型选择与大号描红开关 */
.canvas-toolbar-tier1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0;
    flex-shrink: 0;
}

.brush-selector {
    display: flex;
    gap: 3px;
}

.brush-btn {
    background: #ffffff;
    border: 1.5px solid #dcdde1;
    border-radius: 14px;
    height: 38px;
    min-height: 38px;
    padding: 0 7px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--text-main);
}

.brush-btn:hover {
    background: #f1f2f6;
    border-color: #ced6e0;
    transform: translateY(-1px);
}

.brush-btn.active {
    background: linear-gradient(135deg, #2d3436, #000000);
    color: #ffffff;
    border-color: #2d3436;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

/* 描红 Toggle Switch 大号开关 (整块可点，触控极佳) */
.trace-toggle-switch-wrap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    height: 38px;
    min-height: 38px;
    padding: 0 6px;
    border-radius: 18px;
    background: #fdfaf6;
    border: 1.5px solid #fae3d9;
    transition: all 0.2s ease;
}

.trace-toggle-switch-wrap:hover {
    background: #fff8f0;
    border-color: #f39c12;
}

.trace-toggle-label-text {
    font-size: 12.5px;
    font-weight: 700;
    color: #2d3436;
    white-space: nowrap;
}

.toggle-switch {
    position: relative;
    width: 38px;
    height: 22px;
    background: #dcdde1;
    border-radius: 11px;
    transition: background 0.25s ease;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toggle-switch input:checked + .toggle-slider {
    transform: translateX(16px);
}

.trace-toggle-switch-wrap:has(input:checked) .toggle-switch {
    background: #10ac84;
}

/* 辅控操作区 (描红开关 + 防误触按钮) */
.canvas-aux-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* 手写笔防误触切换按钮 */
.btn-stylus-guard {
    background: #ffffff;
    border: 1.5px solid #dcdde1;
    border-radius: 18px;
    height: 38px;
    min-height: 38px;
    padding: 0 7px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--text-main);
    user-select: none;
}

.btn-stylus-guard:hover {
    background: #f8fafc;
    border-color: #0984e3;
    transform: translateY(-1px);
}

.btn-stylus-guard:active {
    transform: scale(0.96);
}

.guard-icon {
    font-size: 15px;
    line-height: 1;
}

.guard-text {
    font-size: 13px;
    font-weight: 800;
}

.guard-badge {
    background: #2ed573;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    line-height: 1;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.btn-stylus-guard.mode-pen_only {
    border-color: #0984e3;
    background: #f0f7ff;
}

.btn-stylus-guard.mode-pen_only .guard-badge {
    background: #0984e3;
}

.btn-stylus-guard.mode-off {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.btn-stylus-guard.mode-off .guard-badge {
    background: #94a3b8;
}

/* 画板工具栏第 2 层：调色盘、粗细分段与浓度 */
.canvas-toolbar-tier2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0 2px;
    flex-shrink: 0;
}

.color-palette {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-pill {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    flex-shrink: 0;
}

.color-pill:hover {
    transform: scale(1.15);
}

.color-pill.active {
    transform: scale(1.2);
    box-shadow: 0 0 0 3px #ff6b6b, 0 4px 10px rgba(0, 0, 0, 0.25);
}

.brush-size-control-group, .trace-opacity-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.size-segmented-ctrl {
    display: inline-flex;
    background: #f1f2f6;
    border-radius: 14px;
    padding: 2px;
    gap: 2px;
}

.size-seg-btn {
    border: none;
    background: transparent;
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.size-seg-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.enhanced-slider {
    width: 100px;
    accent-color: var(--primary);
    cursor: pointer;
    height: 6px;
}

.brush-size-control-group .enhanced-slider {
    display: none; /* 平板与桌面优先显示大号[细][中][粗]易点按按钮 */
}

#trace-opacity-slider {
    width: 70px;
}

/* 双层画板核心区域 - 最大化撑满容器，四周保留极简 4px 边距，孩子写字超宽广 */
.canvas-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    padding: 2px;
    margin: 2px 0;
    width: 100%;
    box-sizing: border-box;
    position: relative; /* 为手腕防触垫等提供相对定位基准 */
}

.canvas-box {
    position: relative;
    aspect-ratio: 1 / 1;
    min-width: 165px;
    min-height: 165px;
    flex-shrink: 0;
    background: #ffffff;
    border-radius: 16px;
    border: 3px solid var(--grid-red);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: crosshair;
    margin: auto;
    overflow: hidden;
    box-sizing: border-box;
}

#gridCanvas, #drawCanvas,
#examGridCanvas, #examDrawCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 14px;
}

#gridCanvas, #examGridCanvas {
    z-index: 1;
}

#drawCanvas, #examDrawCanvas {
    z-index: 2;
}

/* 右侧写字格右上角一键放大/全幅按钮 & 右下角无级拖拽缩放手柄 */
.btn-canvas-zoom {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid #ffd0c7;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #e17055;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 15;
    opacity: 0.88;
}

.btn-canvas-zoom:hover, .btn-canvas-zoom.active {
    opacity: 1;
    transform: scale(1.08);
    background: #fff5f5;
    border-color: var(--primary);
    color: var(--primary);
}

.canvas-resize-handle {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 26px;
    height: 26px;
    border-radius: 8px 0 12px 0;
    background: rgba(225, 112, 85, 0.14);
    border-top: 1.5px dashed rgba(225, 112, 85, 0.55);
    border-left: 1.5px dashed rgba(225, 112, 85, 0.55);
    color: #d63031;
    font-size: 13px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: nwse-resize;
    z-index: 15;
    user-select: none;
    touch-action: none;
    transition: all 0.15s ease;
}

.canvas-resize-handle:hover {
    background: rgba(225, 112, 85, 0.28);
    transform: scale(1.08);
}

.canvas-size-indicator {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(34, 47, 62, 0.88);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    z-index: 16;
    pointer-events: none;
    white-space: nowrap;
}

/* 运笔期间隐藏/忽略画板四角辅助按钮，杜绝笔尖误碰 */
body.writing-active .btn-canvas-zoom,
body.writing-active .canvas-resize-handle {
    pointer-events: none !important;
    opacity: 0.25;
}

/* 全幅专注写字模式 (canvas-size-xlarge)：仅在宽屏/平板分栏下展开右侧画板，不影响手机单栏标签页 */
@media (min-width: 601px) {
    .main-container.canvas-size-xlarge {
        max-width: 1360px;
        grid-template-columns: 350px 1fr;
    }

    .main-container.canvas-size-xlarge .cognition-hero-card {
        height: 176px;
        flex: 0 0 176px;
        padding: 5px 8px;
        gap: 6px;
    }

    .main-container.canvas-size-xlarge .ill-art-box {
        width: 86px;
        padding: 4px;
    }

    .main-container.canvas-size-xlarge .ill-large-img {
        max-width: 76px;
        max-height: 76px;
    }

    .main-container.canvas-size-xlarge .cognition-char-header {
        padding: 3px 6px;
        gap: 4px;
    }

    .main-container.canvas-size-xlarge .cognition-pinyin {
        font-size: 20px;
    }

    .main-container.canvas-size-xlarge .cognition-char {
        font-size: 36px;
    }

    .main-container.canvas-size-xlarge .hero-en-badge {
        font-size: 12px;
        padding: 1px 6px;
    }

    .main-container.canvas-size-xlarge .btn-speak {
        height: 32px;
        min-height: 32px;
        padding: 0 8px;
        font-size: 12px;
    }

    .main-container.canvas-size-xlarge .cognition-meta-badges {
        display: none;
    }

    .main-container.canvas-size-xlarge .cognition-words-section {
        display: none;
    }

    .main-container.canvas-size-xlarge .guide-header-row {
        gap: 4px;
    }

    .main-container.canvas-size-xlarge .guide-title {
        font-size: 14.5px;
        white-space: nowrap;
    }

    .main-container.canvas-size-xlarge .guide-frame-size-group {
        display: none;
    }

    .main-container.canvas-size-xlarge .hanzi-writer-frame {
        width: 175px;
        height: 175px;
    }

    .main-container.canvas-size-xlarge .writer-action-buttons .btn-ctrl {
        padding: 0 8px;
        font-size: 13px;
        height: 38px;
        min-height: 38px;
    }

    .main-container.canvas-size-xlarge .panel-right {
        padding: 6px 12px;
        gap: 4px;
    }
}

.canvas-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0 env(safe-area-inset-bottom, 4px);
    flex-shrink: 0;
}

.action-btn-group {
    display: flex;
    gap: 6px;
}

.btn-tool {
    background: #f1f2f6;
    border: 1.5px solid #dcdde1;
    border-radius: 20px;
    height: 40px;
    min-height: 40px;
    padding: 0 11px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.btn-tool:hover {
    background: #e4e7eb;
    border-color: #ced6e0;
    transform: translateY(-1px);
}

.btn-submit-stamp {
    background: linear-gradient(135deg, #1dd1a1, #10ac84);
    color: #fff;
    border: none;
    border-radius: 22px;
    height: 42px;
    min-height: 42px;
    padding: 0 16px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(29, 209, 161, 0.38);
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-submit-stamp:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(29, 209, 161, 0.48);
}

.export-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-top: 1px dashed #f1f2f6;
    padding-top: 3px;
    flex-shrink: 0;
}

.btn-link-action {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    transition: color 0.15s;
}

.btn-link-action:hover {
    color: var(--primary);
}

/* ========================================================
   运笔期间全局防误触机制 (Writing Active Lockout)
   当孩子落笔书写时，外部操作栏与工具按钮立即进入保护态，防止手腕/手掌误触
   ======================================================== */
body.writing-active .canvas-action-bar,
body.writing-active .canvas-toolbar-tier1,
body.writing-active .canvas-toolbar-tier2,
body.writing-active .category-bar,
body.writing-active .char-list-grid {
    pointer-events: none !important;
}

body.writing-active .canvas-box {
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.4), 0 6px 20px rgba(0, 0, 0, 0.08);
}

/* 按钮防误触手腕垫状态 */
.btn-wrist-guard.active {
    background: #e0f2fe;
    border-color: #38bdf8;
    color: #0369a1;
}

/* 可展开式手腕防误触虚拟垫板 (Wrist Guard / Palm Shield) */
.wrist-guard-bar {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    background: rgba(255, 251, 240, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px dashed #fcdba0;
    border-radius: 14px;
    padding: 12px 16px;
    min-height: 52px;
    box-sizing: border-box;
    z-index: 20;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
    touch-action: none; /* 彻底拦截所有触控，防止手掌触控穿透 */
    user-select: none;
    -webkit-user-select: none;
    animation: slideUpGuard 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUpGuard {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.wrist-guard-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.wrist-guard-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.wrist-guard-text {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-close-wrist {
    background: #e2e8f0;
    border: none;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 12.5px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-close-wrist:hover {
    background: #cbd5e1;
    color: #0f172a;
}

/* 全局轻量浮动 Toast 消息提示 */
.app-toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-24px);
    background: rgba(30, 41, 59, 0.94);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    padding: 10px 22px;
    font-size: 14.5px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 90vw;
    text-align: center;
}

.app-toast-container.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 440px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transform: scale(0.85);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-icon-badge {
    font-size: 64px;
    margin-bottom: 12px;
    animation: bounce 1.5s infinite;
}

.modal-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.modal-rewards-box {
    background: #fff9e6;
    border: 2px dashed #feca57;
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 24px;
}

.reward-stat-item .stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.reward-stat-item .stat-val {
    font-size: 20px;
    font-weight: 800;
    color: #e67e22;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.btn-modal {
    flex: 1;
    padding: 12px 18px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform 0.15s;
}

.btn-modal.secondary {
    background: #f1f2f6;
    color: var(--text-main);
}

.btn-modal.primary {
    background: linear-gradient(135deg, #ff6b6b, #ee5253);
    color: #fff;
    box-shadow: 0 4px 14px rgba(238, 82, 83, 0.35);
}

.btn-modal:hover {
    transform: scale(1.03);
}

/* 动效 */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes pulseAnim {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 118, 117, 0.6); }
    70% { transform: scale(1.04); box-shadow: 0 0 0 10px rgba(255, 118, 117, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 118, 117, 0); }
}

.pop-anim {
    animation: quickPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes quickPop {
    0% { transform: scale(1); }
    50% { transform: scale(0.92); }
    100% { transform: scale(1); }
}

/* 针对较小屏幕高度（如 < 680px）的弹性微调，确保绝对不发生滚动 */
@media (max-height: 680px) {
    .char-card-btn {
        width: 48px;
        min-width: 48px;
        height: 52px;
    }
    .char-card-btn .char-hz {
        font-size: 22px;
    }
    .main-container {
        padding: 4px 8px 4px;
        gap: 8px;
    }
    .panel-card {
        padding: 6px 8px;
        gap: 6px;
    }
    .cognition-hero-card {
        padding: 6px;
    }
    .ill-art-box {
        width: 190px;
    }
    .ill-large-img {
        max-width: 165px;
        max-height: 165px;
    }
    .ill-fallback-card {
        width: 140px;
        height: 140px;
    }
    .ill-fallback-card .fallback-char {
        font-size: 68px;
    }
    .ill-large-art {
        font-size: 60px;
    }
    .cognition-char {
        font-size: 46px;
    }
    .hanzi-writer-frame {
        width: 145px;
        height: 145px;
    }
}

/* 针对 iPad / 折叠屏 / 中屏自适应 (宽 < 1100px) */
@media (max-width: 1100px) {
    .logo-subtitle {
        display: none; /* 平板/中屏隐藏副标，顶栏轻松单行展示 */
    }
    .search-box {
        min-width: 135px;
        width: 150px;
    }
    .search-box input {
        width: 72px;
    }
    .header-actions {
        gap: 4px;
    }
    .gashapon-trigger-btn, .sticker-book-trigger-btn, .fullscreen-toggle-btn, .settings-trigger-btn {
        padding: 4px 9px;
        font-size: 12.5px;
    }
    .main-container {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 4px 8px;
    }
    .main-container.canvas-size-xlarge {
        grid-template-columns: 310px 1fr;
    }
    .cognition-hero-card {
        height: auto;
        flex: 0 0 auto;
        padding: 6px 8px;
        gap: 8px;
    }
    .cognition-details-box {
        gap: 3px;
    }
    .cognition-char-header {
        padding: 3px 8px;
    }
    .cognition-pinyin {
        font-size: 19px;
    }
    .cognition-char {
        font-size: 40px;
    }
    .btn-speak {
        height: 32px;
        min-height: 32px;
        padding: 0 8px;
        font-size: 12px;
    }
    .btn-speak-text {
        font-size: 12px;
    }
    .meta-pill {
        font-size: 11px;
        padding: 1px 5px;
    }
    .cognition-sentence-section,
    .cognition-words-section {
        padding: 3px 7px;
        gap: 2px;
    }
    .cognition-sentence-section .cognition-section-title,
    .cognition-words-section .cognition-section-title {
        font-size: 11.5px;
    }
    .cognition-sentence-text {
        font-size: 13.5px;
        line-height: 1.35;
    }
    .word-tag {
        font-size: 13px;
        padding: 2px 8px;
    }
    .guide-studio-card {
        flex: 1;
        padding: 5px 10px 6px;
        gap: 4px;
    }
    .guide-title {
        font-size: 14.5px;
        white-space: nowrap;
    }
    .guide-frame-size-group .control-label-text,
    .speed-control-group .speed-label,
    .canvas-size-group .control-label-text {
        display: none; /* 中屏与折叠屏隐藏冗余前缀文字，消除换行与重叠 */
    }
    .guide-header-ctrls {
        gap: 5px;
    }
    .frame-size-seg-btn,
    .speed-seg-btn {
        padding: 2px 6px;
        font-size: 11.5px;
    }
    .canvas-panel-header {
        flex-wrap: wrap;
        gap: 4px;
    }
    .canvas-panel-header h2 {
        font-size: 14.5px;
    }
    .canvas-size-seg-btn,
    .grid-type-btn {
        padding: 2px 6px;
        font-size: 11.5px;
    }
    .hanzi-writer-frame {
        width: 175px;
        height: 175px;
    }
    .frame-size-small .hanzi-writer-frame {
        width: 145px;
        height: 145px;
    }
    .frame-size-large .hanzi-writer-frame {
        width: 215px;
        height: 215px;
    }
    .ill-art-box {
        width: 112px;
    }
    .ill-large-img {
        max-width: 102px;
        max-height: 102px;
    }
    .ill-fallback-card {
        width: 102px;
        height: 102px;
    }
    .ill-fallback-card .fallback-char {
        font-size: 54px;
    }
    .ill-large-art {
        font-size: 52px;
    }
}

/* ========================================================
   移动端专属组件默认样式 (桌面/iPad端完全隐藏)
   ======================================================== */
.mobile-mode-tabs {
    display: none;
}

.mobile-studio-footer-action {
    display: none;
}

.mobile-canvas-ref-banner {
    display: none;
}

/* ========================================================
   针对手机等窄屏设备（宽 <= 600px）深度优化与自适应
   平板(768px+)不进入此分支，避免将iPad误判为手机
   ======================================================== */
@media (max-width: 600px) {
    /* 1. 顶部模式切换标签栏 (识字与笔顺 vs 书法画板) */
    .mobile-mode-tabs {
        display: flex;
        background: #f1f2f6;
        border-radius: 20px;
        padding: 3px;
        margin: 4px 10px 2px;
        gap: 4px;
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .mobile-tab-btn {
        flex: 1;
        border: none;
        background: transparent;
        padding: 7px 12px;
        border-radius: 16px;
        font-size: 13.5px;
        font-weight: 700;
        color: var(--text-muted);
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
    }

    .mobile-tab-btn.active {
        background: #ffffff;
        color: var(--primary);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    /* 主容器：在手机端根据当前激活标签智能显隐面板，杜绝挤压变扁与超长滚动 */
    .main-container {
        display: block;
        flex: 1;
        min-height: 0;
        padding: 4px 8px 8px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .main-container::-webkit-scrollbar {
        display: none;
    }

    .main-container.mobile-tab-studio .panel-right {
        display: none !important;
    }

    .main-container.mobile-tab-canvas .panel-left-studio {
        display: none !important;
    }

    .main-container.mobile-tab-studio .panel-left-studio,
    .main-container.mobile-tab-canvas .panel-right {
        display: flex !important;
        width: 100%;
        height: auto !important;
        min-height: 0;
        overflow: visible !important;
    }

    /* 2. 顶栏导航自适应 (两行排版，永不截断) */
    .header-inner {
        padding: 6px 10px;
        gap: 6px;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }

    .logo-area {
        flex: 0 0 auto;
        gap: 6px;
    }

    .logo-icon {
        font-size: 20px;
    }

    .logo-title {
        font-size: 17px;
    }

    .logo-subtitle {
        display: none;
    }

    .search-box {
        flex: 0 1 auto;
        margin-left: auto;
        padding: 2px 3px 2px 8px;
    }

    .search-box input {
        width: 72px;
        font-size: 12px;
    }

    .search-box button {
        padding: 3px 8px;
        font-size: 12px;
        border-radius: 12px;
    }

    .header-actions {
        flex: 1 0 100%; /* 独占整整一行，平滑横向滑动 */
        display: flex;
        align-items: center;
        gap: 5px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding: 2px 0 4px;
        width: 100%;
    }

    .header-actions::-webkit-scrollbar {
        display: none;
    }

    .header-actions > * {
        flex-shrink: 0;
    }

    .star-badge,
    .completed-badge,
    .gashapon-trigger-btn,
    .sticker-book-trigger-btn,
    .sound-toggle-btn,
    .fullscreen-toggle-btn,
    .settings-trigger-btn,
    .clear-data-btn,
    .print-sheet-btn,
    .ipad-connect-btn {
        padding: 3px 8px;
        font-size: 11.5px;
        height: 28px;
        min-height: 28px;
        border-radius: 14px;
        white-space: nowrap;
    }

    /* 3. 分类与汉字选单条 */
    .char-selector-section {
        padding: 3px 10px 5px;
    }

    .cat-tab-btn {
        padding: 2px 10px;
        font-size: 12px;
        border-radius: 12px;
    }

    .char-card-btn {
        width: 44px;
        height: 48px;
        border-radius: 6px;
    }

    .char-card-btn .char-hz {
        font-size: 20px;
    }

    .char-card-btn .char-py {
        font-size: 10px;
    }

    /* 4. 看图识字认知卡：彻底修复文本被压缩成单列竖条严重变形的问题 */
    .panel-left-studio {
        padding: 8px;
        gap: 8px;
        height: auto;
        min-height: 0;
    }

    .cognition-hero-card {
        height: auto !important;
        min-height: 0;
        padding: 8px 10px;
        gap: 10px;
        flex-direction: row;
        align-items: stretch;
    }

    .ill-art-box {
        width: 92px !important;
        min-width: 92px !important;
        max-width: 92px !important;
        height: auto;
        padding: 4px;
        border-radius: 12px;
        align-self: stretch;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .ill-art-wrap {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .ill-large-img {
        max-width: 84px !important;
        max-height: 92px !important;
        width: 100%;
        height: auto;
        object-fit: contain;
    }

    .ill-fallback-card {
        width: 84px !important;
        height: 84px !important;
        border-radius: 12px;
    }

    .ill-fallback-card .fallback-char {
        font-size: 44px !important;
    }

    .ill-fallback-card .fallback-pinyin {
        font-size: 13px !important;
        margin-top: 2px;
    }

    .ill-large-art {
        font-size: 52px !important;
    }

    .cognition-details-box {
        flex: 1;
        min-width: 0;
        gap: 4px;
        justify-content: space-between;
    }

    .cognition-char-header {
        padding: 3px 8px;
        margin-bottom: 2px;
    }

    .cognition-pinyin {
        font-size: 14px;
        line-height: 1.1;
    }

    .cognition-char {
        font-size: 32px;
        line-height: 1;
    }

    .hero-en-badge {
        font-size: 11px;
        padding: 1px 6px;
    }

    .char-header-right {
        gap: 5px;
    }

    .btn-speak {
        width: 30px;
        height: 30px;
        min-height: 30px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }

    .btn-speak-icon {
        font-size: 14px;
    }

    .btn-speak-text {
        display: none;
    }

    .cognition-meta-badges {
        gap: 4px;
    }

    .meta-pill {
        font-size: 10px;
        padding: 1px 4px;
    }

    .cognition-sentence-section {
        padding: 3px 6px;
        margin-bottom: 2px;
    }

    .cognition-section-title {
        font-size: 10.5px;
        margin-bottom: 2px;
    }

    .cognition-sentence-text {
        font-size: 12.5px;
        line-height: 1.4;
        word-break: break-all;
    }

    .cognition-words-section {
        margin-top: 0;
    }

    .cognition-words-list {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .word-pill {
        font-size: 11.5px;
        padding: 2px 6px;
    }

    /* 5. 笔顺小课堂 */
    .guide-studio-card {
        padding: 8px 10px;
        gap: 6px;
        height: auto !important;
        overflow: visible !important;
        flex: none;
    }

    .guide-header-row {
        margin-bottom: 2px;
        gap: 4px;
    }

    .guide-title {
        font-size: 14px;
        white-space: nowrap;
    }

    .guide-frame-size-group .control-label-text,
    .speed-control-group .speed-label {
        display: none;
    }

    .frame-size-seg-btn,
    .speed-seg-btn {
        padding: 2px 6px;
        font-size: 11px;
    }

    .speed-control-group {
        font-size: 12px;
    }

    .speed-select {
        font-size: 12px;
        padding: 2px 4px;
    }

    .hanzi-writer-frame {
        width: 146px;
        height: 146px;
        flex-shrink: 0;
    }

    .frame-size-small .hanzi-writer-frame {
        width: 124px;
        height: 124px;
    }

    .frame-size-large .hanzi-writer-frame {
        width: 180px;
        height: 180px;
    }

    .status-pill {
        font-size: 11.5px;
        padding: 4px 8px;
    }

    .writer-action-buttons {
        gap: 8px;
    }

    .btn-ctrl {
        padding: 7px 12px;
        font-size: 13px;
        border-radius: 18px;
    }

    /* 手机端一键切换到画板按钮 */
    .mobile-studio-footer-action {
        display: block;
        margin-top: 6px;
    }

    .btn-mobile-switch {
        width: 100%;
        background: linear-gradient(135deg, #ff7675, #ff6b6b);
        color: #fff;
        border: none;
        border-radius: 18px;
        padding: 9px 16px;
        font-size: 14px;
        font-weight: 800;
        cursor: pointer;
        box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
        transition: transform 0.15s;
    }

    .btn-mobile-switch:active {
        transform: scale(0.97);
    }

    /* 6. 小小书法家画板面板 */
    .panel-right {
        padding: 8px;
        gap: 6px;
        height: auto;
        min-height: 0;
    }

    /* 手机端画板顶部当前字提醒条 */
    .mobile-canvas-ref-banner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: linear-gradient(135deg, #fffcf5, #fff5eb);
        border: 1.5px solid #fed385;
        border-radius: 14px;
        padding: 4px 10px;
        margin-bottom: 4px;
    }

    .ref-char-info {
        display: flex;
        align-items: baseline;
        gap: 5px;
        cursor: pointer;
    }

    .ref-label {
        font-size: 11.5px;
        color: var(--text-muted);
        font-weight: 600;
    }

    .ref-char-text {
        font-size: 22px;
        font-weight: 800;
        font-family: "KaiTi", "STKaiti", serif;
        color: var(--dark);
        line-height: 1;
    }

    .ref-py-text {
        font-size: 13px;
        font-weight: 700;
        color: var(--primary);
    }

    .ref-sub-pill {
        font-size: 10.5px;
        background: #fff;
        border: 1px solid #ffd8a8;
        color: #d35400;
        padding: 1px 5px;
        border-radius: 10px;
        font-weight: 600;
    }

    .btn-ref-speak {
        background: none;
        border: none;
        font-size: 14px;
        cursor: pointer;
        padding: 0 2px;
    }

    .btn-mobile-switch-back {
        background: #ffffff;
        border: 1.5px solid #e17055;
        color: #d63031;
        border-radius: 14px;
        padding: 3px 9px;
        font-size: 11.5px;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.2s;
    }

    .btn-mobile-switch-back:active {
        transform: scale(0.96);
    }

    .canvas-panel-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 3px;
        padding-bottom: 2px;
    }

    .canvas-panel-header h2 {
        font-size: 13px;
        white-space: nowrap;
    }

    .canvas-size-seg-btn {
        padding: 2px 5px;
        font-size: 11px;
    }

    .canvas-size-group .control-label-text,
    .canvas-size-seg-btn[data-canvas-size="xlarge"] {
        display: none;
    }

    .grid-selector {
        display: flex;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 3px;
        padding-bottom: 1px;
    }

    .grid-selector::-webkit-scrollbar {
        display: none;
    }

    .grid-type-btn {
        flex-shrink: 0;
        padding: 2px 5px;
        font-size: 11px;
    }

    .canvas-toolbar-tier1 {
        flex-wrap: nowrap;
        gap: 3px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .canvas-toolbar-tier1::-webkit-scrollbar {
        display: none;
    }

    .brush-selector {
        flex: 1 1 auto;
        display: flex;
        justify-content: space-between;
        gap: 2px;
    }

    .brush-btn {
        flex: 1 0 auto;
        height: 30px;
        min-height: 30px;
        padding: 0 3px;
        font-size: 11px;
        justify-content: center;
        border-radius: 10px;
    }

    .trace-toggle-switch-wrap,
    .btn-stylus-guard {
        height: 30px;
        min-height: 30px;
        padding: 0 5px;
        font-size: 11px;
        gap: 3px;
    }

    .trace-toggle-label-text {
        font-size: 11px;
    }

    .toggle-switch {
        width: 30px;
        height: 18px;
    }

    .toggle-slider {
        width: 14px;
        height: 14px;
    }

    .toggle-switch input:checked + .toggle-slider {
        transform: translateX(12px);
    }

    .guard-icon {
        display: none;
    }

    .guard-text {
        font-size: 11px;
    }

    .guard-badge {
        font-size: 10px;
        padding: 1px 4px;
    }

    .canvas-toolbar-tier2 {
        flex-wrap: nowrap;
        gap: 4px;
    }

    .color-palette {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .color-pill {
        width: 20px;
        height: 20px;
    }

    .brush-size-control-group,
    .trace-opacity-group {
        gap: 3px;
    }

    .control-label {
        font-size: 11px;
    }

    .size-seg-btn {
        padding: 2px 5px;
        font-size: 11px;
    }

    #trace-opacity-slider {
        width: 42px;
    }

    .slider-group {
        display: flex;
        align-items: center;
        gap: 3px;
        font-size: 11px;
    }

    .slider-group input[type="range"] {
        width: 50px;
    }

    .trace-control-bar {
        font-size: 11px;
        padding: 0 2px;
    }

    .trace-toggle-label {
        font-size: 11.5px;
    }

    .canvas-wrapper {
        padding: 4px 2px;
        margin: 2px 0;
        width: 100%;
        min-height: 200px;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .canvas-box {
        max-width: 100%;
        min-width: 165px;
        min-height: 165px;
        aspect-ratio: 1 / 1;
        margin: 0 auto;
        flex-shrink: 0;
    }

    .canvas-action-bar {
        gap: 4px;
        padding-top: 2px;
        flex-wrap: wrap;
    }

    .action-btn-group {
        gap: 4px;
    }

    .btn-tool {
        padding: 5px 8px;
        font-size: 11.5px;
        height: 34px;
        min-height: 34px;
    }

    .btn-submit-stamp {
        padding: 5px 10px;
        font-size: 12px;
        height: 34px;
        min-height: 34px;
    }

    /* 手机端奖励弹窗与乐园自适应 */
    .stickers-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        max-height: 280px !important;
    }

    .sticker-playground-canvas {
        height: 190px !important;
    }

    .gashapon-modal-card {
        padding: 18px 14px !important;
    }

    .sticker-book-modal-card {
        padding: 16px 12px !important;
    }
}

/* 智能评测报告弹窗专用样式 */
.eval-modal-card {
    max-width: 540px !important;
    padding: 26px 24px !important;
    text-align: left !important;
}

.eval-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px dashed #f1f2f6;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.eval-header-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eval-header-icon {
    font-size: 24px;
}

.eval-modal-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--dark);
}

.eval-char-badge {
    background: #fff5f5;
    border: 1.5px solid #ff7675;
    color: #d63031;
    font-size: 14px;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: 12px;
}

.eval-hero-box {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fffbf0;
    border: 2px solid #ffeaa7;
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.eval-score-circle {
    flex: 0 0 auto;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff7675, #fab1a0);
    box-shadow: 0 6px 16px rgba(255, 118, 117, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    border: 3px solid #ffffff;
}

.score-number {
    font-size: 34px;
    font-weight: 900;
    line-height: 1;
    font-family: "Segoe UI", sans-serif;
}

.score-unit {
    font-size: 11px;
    font-weight: 700;
    margin-top: 1px;
}

.eval-hero-info {
    flex: 1;
}

.eval-grade-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.eval-grade-tag {
    font-size: 17px;
    font-weight: 800;
    color: #d35400;
    margin-bottom: 0;
}

/* 听名师语音朗读点评按钮 */
.btn-eval-speak {
    background: #ffffff;
    border: 1.5px solid #fed7aa;
    border-radius: 18px;
    padding: 3px 10px;
    font-size: 12.5px;
    font-weight: 700;
    color: #ea580c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(234, 88, 12, 0.12);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    -webkit-user-select: none;
}

.btn-eval-speak:hover {
    background: #fff7ed;
    border-color: #f97316;
    transform: translateY(-1px);
}

.btn-eval-speak:active {
    transform: scale(0.95);
}

.btn-eval-speak.speaking {
    background: #ea580c;
    border-color: #ea580c;
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.25);
    animation: speakPulse 1.2s infinite ease-in-out;
}

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

.eval-speak-icon {
    font-size: 14px;
    line-height: 1;
}

.eval-speak-text {
    font-size: 12px;
}

.eval-stars-row {
    font-size: 18px;
    margin-bottom: 6px;
}

.eval-comment-text {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* 指标进度条 */
.eval-metrics-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.eval-metric-item {
    background: #fdfaf6;
    border: 1px solid #fae3d9;
    border-radius: 10px;
    padding: 8px 12px;
}

.metric-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.metric-bar-track {
    height: 8px;
    background: #eef2f7;
    border-radius: 4px;
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stroke-fill {
    background: linear-gradient(90deg, #ff7675, #fab1a0);
}

.structure-fill {
    background: linear-gradient(90deg, #0984e3, #74b9ff);
}

.shape-fill {
    background: linear-gradient(90deg, #1dd1a1, #10ac84);
}

/* 诊断建议框 (简明提炼，文字简介) */
.eval-diagnosis-box {
    background: #f9fbfd;
    border: 1px solid #e1effa;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 18px;
}

.diagnosis-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.diagnosis-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #0984e3;
    margin-bottom: 0;
}

.diagnosis-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    margin: 0;
}

.diagnosis-list li {
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.4;
    padding: 3px 6px;
    border-radius: 6px;
    transition: background 0.2s;
}

.diagnosis-list li.eval-warning-item {
    background: #fff8eb;
    border-left: 3.5px solid #f39c12;
    color: #b7791f;
    font-weight: 600;
}

.diagnosis-list li.eval-severe-item {
    background: #fff0f0;
    border-left: 3.5px solid #e74c3c;
    color: #c0392b;
    font-weight: 700;
}

/* 操作按钮 */
.eval-actions-bar {
    display: flex;
    gap: 10px;
}

.btn-eval {
    flex: 1;
    padding: 10px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-eval.secondary {
    background: #f1f2f6;
    color: var(--text-main);
}

.btn-eval.secondary:hover {
    background: #dfe4ea;
}

.btn-eval.primary {
    background: linear-gradient(135deg, #ff6b6b, #ee5253);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(238, 82, 83, 0.3);
}

.btn-eval.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(238, 82, 83, 0.4);
}

/* 打印字帖排版 (Printable Worksheet Styles) */
#printable-area {
    display: none;
}

@media print {
    body * {
        visibility: hidden;
    }
    #printable-area, #printable-area * {
        visibility: visible;
    }
    #printable-area {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: #fff;
        padding: 20px 30px;
        box-sizing: border-box;
    }

    .print-sheet {
        max-width: 800px;
        margin: 0 auto;
        font-family: "KaiTi", "STKaiti", serif;
        color: #000;
    }

    .print-header {
        text-align: center;
        border-bottom: 2px solid #000;
        padding-bottom: 12px;
        margin-bottom: 16px;
    }

    .print-header h2 {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .print-meta {
        display: flex;
        justify-content: space-between;
        font-size: 14px;
    }

    .print-char-intro {
        display: flex;
        align-items: center;
        gap: 20px;
        border: 1px solid #ccc;
        padding: 12px 18px;
        border-radius: 8px;
        margin-bottom: 20px;
    }

    .print-big-box {
        text-align: center;
    }

    .print-big-box .py {
        font-size: 16px;
        font-weight: bold;
    }

    .print-big-box .tianzi {
        width: 80px;
        height: 80px;
        border: 2px solid #e17055;
        font-size: 60px;
        line-height: 76px;
        position: relative;
    }

    .print-info-text p {
        font-size: 14px;
        margin-bottom: 4px;
        line-height: 1.4;
    }

    .print-grid-section h3 {
        font-size: 16px;
        margin: 14px 0 8px;
    }

    .print-row {
        display: flex;
        justify-content: space-between;
        gap: 4px;
        margin-bottom: 8px;
    }

    .print-cell {
        flex: 1;
        max-width: 68px;
        aspect-ratio: 1;
        border: 1.5px solid #e17055;
        position: relative;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .grid-cross-h {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        border-top: 1px dashed rgba(225, 112, 85, 0.4);
    }

    .grid-cross-v {
        position: absolute;
        left: 50%;
        top: 0;
        bottom: 0;
        border-left: 1px dashed rgba(225, 112, 85, 0.4);
    }

    .trace-char {
        font-size: 48px;
        color: rgba(225, 112, 85, 0.35);
        z-index: 2;
    }

    .print-footer {
        margin-top: 30px;
        text-align: center;
        font-size: 13px;
        color: #555;
        border-top: 1px dashed #ccc;
        padding-top: 10px;
    }
}

/* ========================================================
   🎰 墨宝幸运扭蛋机与 📖 贴纸乐园弹窗样式
   ======================================================== */

.gashapon-modal-card {
    max-width: 440px !important;
    padding: 24px 22px !important;
    text-align: center !important;
    position: relative;
    border-radius: 26px !important;
    border: 2px solid #fed385;
}

.sticker-book-modal-card {
    max-width: 680px !important;
    width: 95% !important;
    padding: 22px 20px !important;
    text-align: center !important;
    position: relative;
    border-radius: 26px !important;
    border: 2px solid #e0c3fc;
}

.btn-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: #f1f2f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    color: #747d8c;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    z-index: 10;
}

.btn-modal-close:hover {
    background: #ff4757;
    color: #ffffff;
    transform: scale(1.1);
}

.modal-header-simple {
    margin-bottom: 16px;
}

.gashapon-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 4px;
}

.gashapon-header-icon {
    font-size: 26px;
}

.gashapon-title-row .modal-title {
    margin-bottom: 0;
    font-size: 22px;
    font-weight: 800;
}

.egg-display-box {
    background: linear-gradient(135deg, #fffcf5, #fff5eb);
    border: 3px dashed #fed385;
    border-radius: 20px;
    padding: 20px 14px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.egg-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.egg-shell {
    font-size: 68px;
    line-height: 1;
    animation: bounce 2s infinite ease-in-out;
}

.egg-preview-hint {
    font-size: 14px;
    color: #8c5300;
    font-weight: 600;
    max-width: 280px;
    line-height: 1.45;
}

.egg-rolling {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.egg-animated {
    font-size: 72px;
    line-height: 1;
    animation: spinEgg 0.7s infinite linear;
}

@keyframes spinEgg {
    0% { transform: rotate(0deg) scale(1.05); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1.05); }
}

.rolling-text {
    font-size: 16px;
    font-weight: 800;
    color: #e17055;
    animation: pulse 1s infinite alternate;
}

.prize-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.prize-badge {
    background: #fff3cd;
    color: #b7791f;
    border: 1px solid #fefcbf;
    font-size: 13px;
    font-weight: 800;
    padding: 3px 12px;
    border-radius: 14px;
    margin-bottom: 6px;
}

.prize-emoji {
    font-size: 72px;
    line-height: 1.1;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.15));
    margin-bottom: 4px;
    animation: gentleBob 2s infinite ease-in-out alternate;
}

.prize-name {
    font-size: 22px;
    font-weight: 900;
    color: var(--dark);
    font-family: "KaiTi", "STKaiti", serif;
}

.prize-title {
    font-size: 14px;
    color: #e17055;
    font-weight: 800;
    margin-top: 2px;
}

.draw-action-btn {
    width: 100%;
    background: linear-gradient(135deg, #ff7675, #ee5253);
    color: #ffffff;
    border: none;
    font-size: 17px;
    font-weight: 800;
    padding: 13px 20px;
    border-radius: 24px;
    box-shadow: 0 5px 0 #c23616, 0 8px 16px rgba(238, 82, 83, 0.35);
    cursor: pointer;
    transition: all 0.15s ease;
}

.draw-action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 7px 0 #c23616, 0 10px 20px rgba(238, 82, 83, 0.45);
}

.draw-action-btn:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #c23616;
}

.draw-action-btn:disabled {
    background: #dcdde1;
    box-shadow: none;
    cursor: not-allowed;
    color: #7f8c8d;
}

.gashapon-footer-tip {
    font-size: 12px;
    color: #747d8c;
    margin-top: 12px;
}

/* 贴纸乐园 Tab 标签 */
.sticker-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 14px;
}

.sticker-tab-btn {
    background: #f1f2f6;
    border: 1.5px solid #dcdde1;
    border-radius: 20px;
    padding: 8px 24px;
    font-size: 14.5px;
    font-weight: 800;
    color: #4b6584;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 135px;
}

.sticker-tab-btn:hover {
    background: #f7f1fc;
    border-color: #a55eea;
    color: #8854d0;
    transform: translateY(-1px);
}

.sticker-tab-btn.active {
    background: linear-gradient(135deg, #a55eea, #8854d0);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(136, 84, 208, 0.35);
    transform: none;
}

.sticker-tab-panel {
    display: none;
}

.sticker-tab-panel.active {
    display: block;
}

/* Tab 1: 荣誉图鉴 */
.stickers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
}

.sticker-grid-item {
    background: #ffffff;
    border: 2px solid #ecf0f1;
    border-radius: 16px;
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sticker-grid-item.unlocked {
    background: #ffffff;
    border-color: #feca57;
    box-shadow: 0 3px 8px rgba(254, 202, 87, 0.2);
}

.sticker-grid-item.unlocked:hover {
    transform: scale(1.06);
    border-color: #ff9f43;
    box-shadow: 0 6px 14px rgba(254, 202, 87, 0.35);
}

.sticker-grid-item.locked {
    opacity: 0.55;
    background: #f8f9fa;
    cursor: default;
}

.sticker-icon {
    font-size: 38px;
    line-height: 1;
    margin-bottom: 4px;
}

.sticker-lbl {
    font-size: 13.5px;
    font-weight: 800;
    color: #2d3436;
    font-family: "KaiTi", "STKaiti", serif;
    white-space: nowrap;
}

.sticker-tag {
    font-size: 11px;
    color: #8854d0;
    font-weight: 700;
    margin-top: 2px;
}

.sticker-grid-item.wobble {
    animation: wobbleAnim 0.5s ease;
}

@keyframes wobbleAnim {
    0%, 100% { transform: scale(1.06) rotate(0); }
    25% { transform: scale(1.12) rotate(-8deg); }
    75% { transform: scale(1.12) rotate(8deg); }
}

/* Tab 2: 宣纸创意乐园画布 */
.sticker-playground-canvas {
    width: 100%;
    height: 250px;
    border-radius: 20px;
    background: linear-gradient(to bottom, #fffdfa 0%, #f7f1e5 100%);
    position: relative;
    overflow: hidden;
    border: 3px solid #fed385;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.04);
    margin-bottom: 10px;
    touch-action: none;
}

.placed-playground-sticker {
    position: absolute;
    font-size: 48px;
    line-height: 1;
    cursor: grab;
    user-select: none;
    touch-action: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.16));
    transition: transform 0.1s;
}

.placed-playground-sticker:active {
    cursor: grabbing;
}

.placed-playground-sticker.jumping {
    animation: jumpSticker 0.6s ease;
}

@keyframes jumpSticker {
    0% { transform: translateY(0); }
    50% { transform: translateY(-28px) scale(1.2); }
    100% { transform: translateY(0); }
}

.playground-control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.sub-explain {
    font-size: 12px;
    color: #747d8c;
    text-align: left;
    flex: 1;
}

.btn-clear-playground {
    background: #f1f2f6;
    border: 1px solid #dcdde1;
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
    color: #57606f;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-clear-playground:hover {
    background: #ffeaa7;
    border-color: #fdcb6e;
    color: #d35400;
}

.playground-stickers-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px;
    scrollbar-width: none;
}

.playground-stickers-bar::-webkit-scrollbar {
    display: none;
}

.playground-chip {
    background: #ffffff;
    border: 2px solid #ecf0f1;
    border-radius: 18px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 700;
    color: #2d3436;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}

.playground-chip:hover {
    border-color: #ff7675;
    background: #fff5f5;
    transform: translateY(-2px);
}

.btn-eval.reward-gashapon-action {
    background: linear-gradient(135deg, #ff9f43, #ee5253);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(238, 82, 83, 0.35);
    animation: pulse 1.8s infinite;
}

/* ========================================================
   ⚙️ 家长区与系统设置弹窗 (Parent Zone Modal)
   分组卡片式布局：固定标题栏 + 内部滚动内容区，宽屏双栏 / 手机底部抽屉
   ======================================================== */
.settings-modal-card {
    max-width: 520px;
    width: 94%;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-align: left;
    background: #f6f7fb;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    position: relative;
    box-sizing: border-box;
}

/* 顶部固定标题栏 */
.settings-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 14px 12px 18px;
    background: #ffffff;
    border-bottom: 1px solid #edf0f5;
}

.settings-header-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.settings-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    background: linear-gradient(135deg, #fff1eb, #ffe0d3);
    flex-shrink: 0;
}

.settings-header-text {
    min-width: 0;
}

.settings-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--dark);
    margin: 0;
    line-height: 1.25;
}

.settings-subtitle {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #f1f2f6;
    color: #747d8c;
    font-size: 22px;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.settings-close-btn:hover {
    background: #ff4757;
    color: #ffffff;
    transform: scale(1.08);
}

/* 可滚动内容区 */
.settings-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* 学习成就概览条 */
.settings-stats-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    flex-shrink: 0;
}

.settings-stat-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 14px;
    border: 1.5px solid transparent;
    font: inherit;
    color: inherit;
    text-align: left;
    min-width: 0;
    box-sizing: border-box;
}

button.settings-stat-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button.settings-stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

button.settings-stat-card:active {
    transform: scale(0.97);
}

/* 可点击概览卡右侧小箭头提示 (触屏设备无 hover 也能看出可点) */
.settings-stat-card.is-link::after {
    content: '›';
    margin-left: auto;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    color: rgba(30, 41, 59, 0.28);
    flex-shrink: 0;
}

.settings-stat-card.stat-stars {
    background: #fff9e6;
    border-color: #ffeaa7;
}

.settings-stat-card.stat-chars {
    background: #e8f8f5;
    border-color: #a3e4d7;
}

.settings-stat-card.stat-stickers {
    background: #f6efff;
    border-color: #e0c3fc;
}

.settings-stat-emoji {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.settings-stat-texts {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.settings-stat-num {
    font-size: 18px;
    font-weight: 900;
    line-height: 1.15;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    white-space: nowrap;
}

.stat-stars .settings-stat-num {
    color: #d35400;
}

.stat-chars .settings-stat-num {
    color: #16a085;
}

.stat-stickers .settings-stat-num {
    color: #8854d0;
}

.settings-stat-label {
    font-size: 11.5px;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
}

/* 分组列表 */
.settings-sections {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.settings-group-title {
    font-size: 12px;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 0.5px;
    margin: 0 0 0 6px;
}

.settings-group-card {
    background: #ffffff;
    border: 1px solid #e8ecf2;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.settings-group-card.danger {
    background: #fffafa;
    border-color: #fed7d7;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    min-height: 58px;
    box-sizing: border-box;
    transition: background 0.15s ease, opacity 0.2s ease;
}

.settings-row + .settings-row {
    border-top: 1px solid #f1f4f8;
}

.settings-row-toggle {
    cursor: pointer;
}

.settings-row-toggle:hover {
    background: #fafbfd;
}

.settings-row.is-disabled {
    opacity: 0.5;
}

.settings-row-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    background: #f1f5f9;
}

.settings-row-icon.tone-amber { background: #fff4dc; }
.settings-row-icon.tone-green { background: #e3f9ef; }
.settings-row-icon.tone-blue { background: #e3f0ff; }
.settings-row-icon.tone-purple { background: #f1e8ff; }
.settings-row-icon.tone-slate { background: #eef1f5; }
.settings-row-icon.tone-rose { background: #ffe9ee; }
.settings-row-icon.tone-red { background: #ffe3e3; }

.settings-row-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.settings-row-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
}

.settings-row-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.35;
    margin-top: 2px;
}

.text-danger {
    color: #e53e3e !important;
}

/* 右侧操作按钮 */
.btn-settings-action {
    min-width: 64px;
    padding: 7px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    border: 1.5px solid #dbe2ea;
    background: #ffffff;
    color: #334155;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.btn-settings-action:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.btn-settings-action.active {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
}

.btn-settings-action.primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: 1.5px solid transparent;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-settings-action.primary:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-settings-action.danger {
    background: #e53e3e;
    color: #ffffff;
    border: 1.5px solid transparent;
    box-shadow: 0 2px 8px rgba(229, 62, 62, 0.25);
}

.btn-settings-action.danger:hover {
    background: #c53030;
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.35);
}

.btn-settings-action.is-done,
.btn-settings-action.is-done:hover {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
    box-shadow: none;
    transform: none;
}

.btn-settings-action:disabled {
    cursor: default;
}

/* iOS 风格大号开关 (整行可点) */
.settings-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.settings-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.settings-switch-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 14px;
    transition: background 0.22s ease;
}

.settings-switch-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.24s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.settings-switch input:checked + .settings-switch-slider {
    background: #10b981;
}

.settings-switch input:checked + .settings-switch-slider::before {
    transform: translateX(20px);
}

.settings-switch input:focus-visible + .settings-switch-slider {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35);
}

/* 分段选择器 (防误触模式) */
.settings-seg {
    display: inline-flex;
    background: #f1f2f6;
    border-radius: 12px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}

.settings-seg-btn {
    border: none;
    background: transparent;
    border-radius: 9px;
    padding: 5px 10px;
    font-size: 12.5px;
    font-weight: 700;
    font-family: inherit;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.settings-seg-btn:hover {
    color: #0984e3;
}

.settings-seg-btn.active {
    background: #ffffff;
    color: #0984e3;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* 底部运行状态与版本信息 */
.settings-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding-top: 2px;
    flex-shrink: 0;
}

.settings-status-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.settings-chip {
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 3px 10px;
    white-space: nowrap;
}

.settings-chip.ok {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.settings-footer-text {
    font-size: 11.5px;
    color: #94a3b8;
    text-align: center;
    line-height: 1.4;
}

/* 宽屏 (iPad 横屏 / 折叠屏展开 / 电脑)：双栏排布，一屏看全无需滚动 */
@media (min-width: 860px) {
    .settings-modal-card {
        max-width: 820px;
    }
    .settings-sections {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* 手机竖屏：底部抽屉式面板，单手可达，内容区独立滚动 */
@media (max-width: 600px) {
    #settings-modal {
        align-items: flex-end;
    }
    #settings-modal .settings-modal-card {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: 22px 22px 0 0;
        transform: translateY(48px);
        transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    }
    #settings-modal.visible .settings-modal-card {
        transform: translateY(0);
    }
    .settings-header {
        position: relative;
        padding: 18px 12px 10px 14px;
    }
    .settings-header::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: #d6dbe3;
    }
    .settings-header-icon {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
    .settings-title {
        font-size: 17px;
    }
    .settings-body {
        padding: 12px 12px calc(14px + env(safe-area-inset-bottom, 0px));
        gap: 12px;
    }
    .settings-stat-card {
        padding: 8px;
        gap: 6px;
    }
    .settings-stat-emoji {
        font-size: 18px;
    }
    .settings-stat-num {
        font-size: 16px;
    }
    .settings-stat-label {
        font-size: 11px;
    }
    .settings-row {
        padding: 9px 10px;
        gap: 10px;
        min-height: 54px;
    }
    .settings-row-icon {
        width: 32px;
        height: 32px;
        font-size: 17px;
    }
    .settings-row-title {
        font-size: 14px;
    }
    .settings-row-desc {
        font-size: 11.5px;
    }
    .btn-settings-action {
        min-width: 56px;
        padding: 6px 12px;
        font-size: 12.5px;
    }
    .settings-seg-btn {
        padding: 5px 8px;
        font-size: 12px;
    }
}

/* 超窄屏 (<= 370px)：防误触分段按钮换行到文字下方 */
@media (max-width: 370px) {
    .settings-row-wrap {
        flex-wrap: wrap;
    }
    .settings-row-wrap .settings-seg {
        margin-left: 42px;
    }
}

/* ========================================================
   📱 iPad 竖屏自适应 (@media orientation: portrait)
   上方字卡与笔顺横向紧凑并排，下方书法画板全宽超大展示
   ======================================================== */
@media (orientation: portrait) and (min-width: 601px) {
    .main-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        gap: 8px;
        overflow: hidden;
    }

    .panel-left-studio {
        flex-direction: row;
        gap: 8px;
        height: 310px;
        max-height: 315px;
    }

    .cognition-hero-card {
        flex: 1.1;
        min-width: 0;
        height: 100%;
        padding: 6px 8px;
        gap: 6px;
    }

    .cognition-hero-card .ill-art-box {
        width: 100px;
        flex-shrink: 0;
        padding: 4px;
    }

    .cognition-hero-card .ill-large-img {
        max-width: 90px;
        max-height: 95px;
    }

    .cognition-hero-card .ill-fallback-card {
        width: 90px;
        height: 90px;
    }

    .cognition-hero-card .cognition-char {
        font-size: 38px;
    }

    .cognition-hero-card .cognition-char-header {
        padding: 2px 6px;
        gap: 4px;
    }

    .cognition-hero-card .btn-speak {
        padding: 0 8px;
        font-size: 12px;
        height: 32px;
        min-height: 32px;
    }

    .cognition-hero-card .cognition-meta-badges {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .cognition-hero-card .meta-pill {
        font-size: 10.5px;
        padding: 1px 4px;
        white-space: nowrap;
    }

    .guide-studio-card {
        flex: 1;
        min-width: 0;
        height: 100%;
        padding: 6px 8px;
        gap: 4px;
        display: flex;
        flex-direction: column;
    }

    .guide-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
        margin-bottom: 2px;
    }

    .guide-title-box {
        display: flex;
        align-items: center;
        gap: 4px;
        white-space: nowrap;
    }

    .guide-title {
        font-size: 13.5px;
        white-space: nowrap;
    }

    .guide-icon {
        font-size: 15px;
    }

    .guide-header-ctrls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 4px;
    }

    .guide-frame-size-group,
    .speed-control-group {
        display: flex;
        align-items: center;
        gap: 3px;
    }

    .guide-frame-size-group .control-label-text,
    .speed-control-group .speed-label {
        font-size: 10.5px;
    }

    .frame-size-seg-btn,
    .speed-seg-btn {
        padding: 1px 4px;
        font-size: 10.5px;
    }

    .hanzi-writer-frame {
        width: 152px;
        height: 152px;
    }

    .frame-size-small .hanzi-writer-frame {
        width: 128px;
        height: 128px;
    }

    .frame-size-large .hanzi-writer-frame {
        width: 170px;
        height: 170px;
    }

    .writer-action-buttons {
        gap: 6px;
        margin-top: auto;
    }

    .writer-action-buttons .btn-ctrl {
        padding: 6px 8px;
        font-size: 12px;
        min-height: 34px;
        border-radius: 12px;
    }

    .panel-right {
        flex: 1;
        min-height: 0;
    }

    .main-container.canvas-size-xlarge .panel-left-studio {
        height: 235px;
        max-height: 240px;
    }
}

/* 针对折叠屏展开态 (700px~980px) 与 iPad 竖屏深度优化：顶栏高星星数不裁切、工具栏不溢出、紧凑高度适配 */
@media (max-width: 980px) and (min-width: 601px) {
    .header-inner {
        padding: 4px 8px;
        gap: 4px;
    }
    .logo-icon {
        font-size: 18px;
    }
    .logo-title {
        font-size: 15.5px;
    }
    .search-box {
        min-width: 108px;
        width: 118px;
        padding: 2px 3px 2px 7px;
    }
    .search-box input {
        font-size: 12px;
        min-width: 44px;
        width: 54px;
    }
    .search-box button {
        padding: 2px 7px;
        font-size: 11.5px;
    }
    .header-actions {
        gap: 4px;
        flex: 0 1 auto;
        min-width: 0;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .header-actions::-webkit-scrollbar {
        display: none;
    }
    .star-badge,
    .completed-badge,
    .gashapon-trigger-btn,
    .sticker-book-trigger-btn,
    .sound-toggle-btn,
    .fullscreen-toggle-btn,
    .settings-trigger-btn {
        padding: 2px 6px;
        font-size: 11.5px;
        height: 29px;
        min-height: 29px;
        flex-shrink: 0;
    }
    .canvas-toolbar-tier1 {
        gap: 4px;
    }
    .brush-btn {
        height: 32px;
        min-height: 32px;
        padding: 0 5px;
        font-size: 11.5px;
    }
    .trace-toggle-switch-wrap {
        height: 32px;
        min-height: 32px;
        padding: 0 5px;
    }
    .trace-toggle-label-text {
        font-size: 11.5px;
    }
    .btn-stylus-guard {
        height: 32px;
        min-height: 32px;
        padding: 0 5px;
        font-size: 11.5px;
    }
    .guard-text {
        font-size: 11.5px;
    }
    .canvas-toolbar-tier2 {
        gap: 5px;
    }
    .color-palette {
        gap: 4px;
    }
    .color-pill {
        width: 22px;
        height: 22px;
    }
    .control-label {
        font-size: 11px;
    }
    .size-seg-btn {
        padding: 2px 5px;
        font-size: 11px;
    }
    #trace-opacity-slider {
        width: 48px;
    }
    .btn-tool {
        padding: 5px 8px;
        font-size: 12px;
        height: 34px;
        min-height: 34px;
    }
    .btn-submit-stamp {
        padding: 5px 10px;
        font-size: 12.5px;
        height: 34px;
        min-height: 34px;
    }
}

/* 针对折叠屏横屏或高度紧凑视口 (height <= 750px 且 width >= 601px) 保证笔顺方框 1:1 正方形与底部按钮零挤压 */
@media (max-height: 750px) and (min-width: 601px) {
    .char-selector-section {
        padding: 2px 12px 4px;
    }
    .char-card-btn {
        width: 46px;
        min-width: 46px;
        height: 50px;
    }
    .char-card-btn .char-hz {
        font-size: 22px;
    }
    .cognition-hero-card {
        padding: 4px 8px;
        gap: 6px;
    }
    .cognition-char {
        font-size: 34px;
    }
    .cognition-pinyin {
        font-size: 16px;
    }
    .cognition-sentence-text {
        font-size: 12.5px;
        line-height: 1.3;
    }
    .word-tag {
        font-size: 12px;
        padding: 1px 7px;
    }
    .ill-art-box {
        width: 98px;
    }
    .ill-large-img {
        max-width: 90px;
        max-height: 90px;
    }
    .hanzi-writer-frame {
        width: 152px;
        height: 152px;
    }
    .frame-size-small .hanzi-writer-frame {
        width: 128px;
        height: 128px;
    }
    .frame-size-large .hanzi-writer-frame {
        width: 182px;
        height: 182px;
    }
    .status-pill {
        padding: 3px 8px;
        font-size: 12px;
    }
    .writer-action-buttons .btn-ctrl {
        height: 36px;
        min-height: 36px;
        font-size: 13.5px;
    }
}

/* ==================== 顶部主模式 Tab (🎮 闯关乐园 | ✍️ 趣味练字) ==================== */
.app-primary-tabs {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 999px;
    padding: 3px;
    gap: 3px;
    flex-shrink: 0;
}

.primary-tab-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 800;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
}

.primary-tab-btn:not(.active),
.primary-tab-btn:not(.active) > span {
    color: #475569;
}

.primary-tab-btn:not(.active):hover,
.primary-tab-btn:not(.active):hover > span {
    color: #0f172a;
}

.primary-tab-btn.active,
.primary-tab-btn.active:hover,
.primary-tab-btn.active > span {
    background: transparent;
    color: #ffffff;
}

.primary-tab-btn.active,
.primary-tab-btn.active:hover {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5253 100%);
    box-shadow: 0 3px 10px rgba(238, 82, 83, 0.3);
}

.primary-tab-btn[data-app-tab="exam"].active,
.primary-tab-btn[data-app-tab="exam"].active:hover {
    background: linear-gradient(135deg, #f97316 0%, #ec4899 55%, #8b5cf6 100%);
    box-shadow: 0 3px 12px rgba(236, 72, 153, 0.32);
}

/* 闯关乐园默认隐藏；body.app-mode-exam（默认首页）时显示，并隐藏练字区 */
.exam-view-container {
    display: none;
}

body.app-mode-exam .exam-view-container {
    display: flex;
}

body.app-mode-exam .char-selector-section,
body.app-mode-exam #mobile-mode-tabs,
body.app-mode-exam #main-container,
body.app-mode-exam #header-search-box {
    display: none !important;
}

@media (max-width: 1400px) {
    .logo-subtitle {
        display: none;
    }
    .header-inner {
        gap: 6px;
        padding: 4px 10px;
    }
    .primary-tab-btn {
        padding: 5px 10px;
        font-size: 12.5px;
    }
    .search-box {
        min-width: 136px;
        width: 148px;
        padding: 2px 3px 2px 10px;
    }
    .search-box input {
        font-size: 13px;
        min-width: 56px;
    }
    .search-box button {
        padding: 3px 9px;
        font-size: 12.5px;
    }
    .header-actions {
        gap: 5px;
    }
    .star-badge,
    .completed-badge,
    .gashapon-trigger-btn,
    .sticker-book-trigger-btn,
    .sound-toggle-btn,
    .fullscreen-toggle-btn,
    .settings-trigger-btn {
        padding: 4px 9px;
        font-size: 12.5px;
    }
}

/* iPad 横竖屏顶栏自适应 (721px ~ 1180px)：确保所有核心入口一排完整显示、绝不溢出裁切 */
@media (max-width: 1180px) and (min-width: 721px) {
    .header-inner {
        padding: 4px 10px;
        gap: 5px;
    }
    .logo-icon {
        font-size: 18px;
    }
    .logo-title {
        font-size: 16px;
    }
    .app-primary-tabs {
        padding: 2px;
        gap: 2px;
    }
    .primary-tab-btn {
        padding: 4px 9px;
        font-size: 12px;
        gap: 3px;
    }
    .search-box {
        min-width: 102px;
        width: 112px;
        padding: 2px 3px 2px 8px;
    }
    .search-box input {
        font-size: 12px;
        min-width: 44px;
        width: 52px;
    }
    .search-box button {
        padding: 2px 7px;
        font-size: 11.5px;
    }
    .header-actions {
        gap: 4px;
        flex: 0 1 auto;
        min-width: 0;
    }
    .star-badge,
    .completed-badge,
    .gashapon-trigger-btn,
    .sticker-book-trigger-btn,
    .sound-toggle-btn,
    .fullscreen-toggle-btn,
    .settings-trigger-btn {
        padding: 3px 7px;
        font-size: 11.5px;
        height: 30px;
        min-height: 30px;
        flex-shrink: 0;
    }
}

/* iPad 竖屏紧凑顶栏 (721px ~ 960px，含 iPad Mini 768px / Air 820px / Pro 11" 834px)：全屏开关归入设置，确保设置与声音按钮 100% 可见 */
@media (max-width: 960px) and (min-width: 721px) {
    .header-inner {
        padding: 4px 6px;
        gap: 3px;
    }
    .logo-icon {
        display: none;
    }
    .logo-title {
        font-size: 14px;
    }
    .app-primary-tabs {
        padding: 2px;
        gap: 2px;
    }
    .primary-tab-btn {
        padding: 4px 6px;
        font-size: 11px;
        gap: 2px;
    }
    .search-box {
        min-width: 80px;
        width: 86px;
        padding: 2px 2px 2px 6px;
    }
    .search-box input {
        font-size: 11px;
        min-width: 34px;
        width: 38px;
    }
    .search-box button {
        padding: 2px 5px;
        font-size: 10.5px;
    }
    .header-actions {
        gap: 3px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .header-actions::-webkit-scrollbar {
        display: none;
    }
    .fullscreen-toggle-btn {
        display: none;
    }
    .star-badge,
    .completed-badge,
    .gashapon-trigger-btn,
    .sticker-book-trigger-btn,
    .sound-toggle-btn,
    .settings-trigger-btn {
        padding: 2px 5px;
        font-size: 10.5px;
        height: 28px;
        min-height: 28px;
    }
}

/* ==================== 🎮 汉字闯关乐园 (Game Park) ==================== */
.exam-view-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px 14px 12px;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    box-sizing: border-box;
}

/* 游戏主题色 */
.theme-orange { --g-main: #f97316; --g-deep: #c2410c; --g-soft: #fff7ed; --g-line: #fed7aa; --g-grad: linear-gradient(135deg, #fdba74 0%, #f97316 100%); }
.theme-pink { --g-main: #ec4899; --g-deep: #be185d; --g-soft: #fdf2f8; --g-line: #fbcfe8; --g-grad: linear-gradient(135deg, #f9a8d4 0%, #ec4899 100%); }
.theme-blue { --g-main: #3b82f6; --g-deep: #1d4ed8; --g-soft: #eff6ff; --g-line: #bfdbfe; --g-grad: linear-gradient(135deg, #93c5fd 0%, #3b82f6 100%); }
.theme-purple { --g-main: #8b5cf6; --g-deep: #6d28d9; --g-soft: #f5f3ff; --g-line: #ddd6fe; --g-grad: linear-gradient(135deg, #c4b5fd 0%, #8b5cf6 100%); }
.theme-amber { --g-main: #f59e0b; --g-deep: #b45309; --g-soft: #fffbeb; --g-line: #fde68a; --g-grad: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%); }
.theme-teal { --g-main: #14b8a6; --g-deep: #0f766e; --g-soft: #f0fdfa; --g-line: #99f6e4; --g-grad: linear-gradient(135deg, #5eead4 0%, #14b8a6 100%); }
.theme-indigo { --g-main: #6366f1; --g-deep: #4338ca; --g-soft: #eef2ff; --g-line: #c7d2fe; --g-grad: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%); }
.theme-green { --g-main: #22c55e; --g-deep: #15803d; --g-soft: #f0fdf4; --g-line: #bbf7d0; --g-grad: linear-gradient(135deg, #86efac 0%, #22c55e 100%); }

.game-hub[hidden],
.game-stage[hidden],
#btn-ls-sound-on[hidden],
#btn-sk-next[hidden],
.pw-pinyin-tag[hidden],
.game-combo-pill[hidden] {
    display: none !important;
}

/* ---------- ① 游戏大厅 ---------- */
.game-hub {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding: 2px 2px 10px;
    scrollbar-width: none;
}

.game-hub::-webkit-scrollbar {
    display: none;
}

.game-hub-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-radius: 22px;
    background: linear-gradient(120deg, #fff7ed 0%, #fdf2f8 48%, #eff6ff 100%);
    border: 2px solid #fde68a;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    flex-shrink: 0;
}

.game-hub-hero-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.game-hub-mascot {
    font-size: 46px;
    line-height: 1;
    animation: gpFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.12));
}

.game-hub-title {
    margin: 0;
    font-size: 24px;
    font-weight: 900;
    background: linear-gradient(135deg, #f97316, #ec4899 55%, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.game-hub-subtitle {
    margin: 2px 0 0;
    font-size: 13.5px;
    font-weight: 600;
    color: #64748b;
}

.game-hub-hero-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.game-hub-today {
    background: #fffbeb;
    border: 1.5px solid #fcd34d;
    color: #b45309;
    font-weight: 900;
    font-size: 13.5px;
    padding: 6px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.btn-hub-action {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-hub-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1);
}

.btn-hub-action.random {
    background: linear-gradient(135deg, #a78bfa, #ec4899);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.game-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.game-card {
    position: relative;
    display: flex;
    flex-direction: column;
    text-align: left;
    padding: 0;
    background: #ffffff;
    border: 2px solid var(--g-line);
    border-radius: 22px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    animation: gpCardIn 0.45s ease both;
    animation-delay: calc(var(--n, 0) * 50ms);
    font-family: inherit;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
}

.game-card:active {
    transform: scale(0.97);
}

.game-card-art {
    position: relative;
    height: 108px;
    background: var(--g-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.game-card-art::before,
.game-card-art::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
}

.game-card-art::before {
    width: 90px;
    height: 90px;
    top: -30px;
    left: -24px;
}

.game-card-art::after {
    width: 60px;
    height: 60px;
    bottom: -22px;
    right: 16px;
}

.game-card-emoji {
    position: relative;
    z-index: 1;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    font-size: 58px;
    line-height: 1;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.18));
    transition: transform 0.25s ease;
}

.game-card:hover .game-card-emoji {
    transform: scale(1.12) rotate(-6deg);
}

.game-card-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 14px 4px;
}

.game-card-title {
    font-size: 17px;
    font-weight: 900;
    color: #1e293b;
}

.game-card-desc {
    font-size: 12.5px;
    font-weight: 600;
    color: #64748b;
}

.game-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 14px 12px;
    margin-top: auto;
}

.game-card-stars {
    font-size: 12.5px;
    font-weight: 800;
    color: #b45309;
    background: #fffbeb;
    border-radius: 999px;
    padding: 3px 9px;
}

.game-card-play {
    font-size: 12.5px;
    font-weight: 900;
    color: #ffffff;
    background: var(--g-main);
    border-radius: 999px;
    padding: 5px 12px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

/* ---------- ② 游戏舞台 ---------- */
.game-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #ffffff;
    border: 2px solid var(--g-line);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
}

.btn-game-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 38px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    font-size: 16px;
    font-weight: 800;
    color: #334155;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.btn-game-back:hover {
    transform: translateX(-2px);
}

.btn-game-back-text {
    font-size: 13.5px;
}

.game-title-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 5px 12px;
    border-radius: 14px;
    background: var(--g-soft);
}

.game-title-icon {
    font-size: 22px;
    line-height: 1;
}

.game-title-text {
    font-size: 16px;
    font-weight: 900;
    color: var(--g-deep);
    white-space: nowrap;
}

.game-mascot {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-mascot-face {
    font-size: 30px;
    line-height: 1;
    flex-shrink: 0;
}

.game-mascot-face.bounce {
    animation: gpBounce 0.5s ease;
}

.game-mascot-bubble {
    position: relative;
    min-width: 0;
    padding: 7px 12px;
    border-radius: 14px;
    background: var(--g-soft);
    border: 1.5px solid var(--g-line);
    color: #334155;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.game-mascot-bubble::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 50%;
    width: 12px;
    height: 12px;
    background: var(--g-soft);
    border-left: 1.5px solid var(--g-line);
    border-bottom: 1.5px solid var(--g-line);
    transform: translateY(-50%) rotate(45deg);
}

.game-mascot-bubble.pop {
    animation: gpBubblePop 0.35s ease;
}

.game-topbar-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.game-combo-pill {
    background: linear-gradient(135deg, #fb923c, #ef4444);
    color: #ffffff;
    font-weight: 900;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 999px;
    white-space: nowrap;
    animation: gpPulse 1.2s ease infinite;
}

.game-stars-pill {
    background: #fffbeb;
    border: 1.5px solid #fcd34d;
    color: #b45309;
    font-weight: 900;
    font-size: 14px;
    padding: 5px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.game-stars-pill.bump {
    animation: gpBump 0.5s ease;
}

.game-panels {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
}

.game-panel {
    display: none;
    height: 100%;
    min-height: 0;
}

.game-panel.active {
    display: flex;
    flex-direction: column;
    animation: gpFadeIn 0.3s ease;
}

.gp-card {
    background: #ffffff;
    border: 2px solid var(--g-line, #e2e8f0);
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    padding: 14px;
    min-height: 0;
    box-sizing: border-box;
}

.gp-img-frame,
.pw-img-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 40%, #ffffff 0%, var(--g-soft) 100%);
    border: 2.5px dashed var(--g-line);
    border-radius: 18px;
    overflow: hidden;
}

.gp-img-frame img,
.pw-img-frame img {
    max-width: 88%;
    max-height: 88%;
    object-fit: contain;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.1));
}

.btn-hint {
    border: 1.5px solid #e2e8f0;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13.5px;
    font-weight: 800;
    cursor: pointer;
    background: #ffffff;
    color: #334155;
    white-space: nowrap;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-hint:hover {
    transform: translateY(-1px);
}

.btn-hint.tone-amber { background: #fffbeb; border-color: #fcd34d; color: #b45309; }
.btn-hint.tone-blue { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.btn-hint.tone-red { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }

.btn-hint.active {
    box-shadow: inset 0 0 0 2px currentColor;
}

.btn-game-primary {
    height: 44px;
    padding: 0 20px;
    border: none;
    border-radius: 999px;
    background: var(--g-grad, linear-gradient(135deg, #34d399, #10b981));
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.16);
    transition: transform 0.15s ease;
}

.btn-game-primary:hover {
    transform: translateY(-1px) scale(1.02);
}

.btn-game-primary.pulse,
.btn-tool.pulse {
    animation: gpPulse 1.2s ease infinite;
}

.gp-float-reward {
    position: fixed;
    z-index: 9999;
    transform: translate(-50%, 0);
    font-size: 22px;
    font-weight: 900;
    color: #f59e0b;
    text-shadow: 0 2px 0 #ffffff, 0 0 10px rgba(245, 158, 11, 0.45);
    pointer-events: none;
    white-space: nowrap;
    animation: gpFloatUp 1.1s ease-out forwards;
}

.gp-pop-in {
    animation: gpPopIn 0.45s cubic-bezier(0.2, 1.4, 0.5, 1);
}

/* ---------- 游戏 1：✍️ 看图写字 ---------- */
.pw-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.pw-prompt-card,
.pw-write-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.pw-img-frame {
    flex: 1;
    min-height: 150px;
}

.pw-stamp {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 900;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

.pw-stamp.show {
    display: flex;
    animation: gpStamp 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.pw-stamp.correct {
    background: #ecfdf5;
    border: 3px solid #10b981;
    color: #059669;
}

.pw-stamp.wrong {
    background: #fef2f2;
    border: 3px solid #ef4444;
    color: #dc2626;
}

.pw-pinyin-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 12px;
    border-radius: 12px;
    background: #1d4ed8;
    color: #ffffff;
    font-size: 20px;
    font-weight: 900;
    box-shadow: 0 4px 10px rgba(29, 78, 216, 0.3);
}

.pw-word-clue {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    border: 1.5px solid #fed7aa;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    z-index: 2;
    white-space: nowrap;
}

.pw-word-clue[hidden] {
    display: none;
}

.pw-clue-known {
    font-family: "KaiTi", "STKaiti", serif;
    font-size: 20px;
    font-weight: 900;
    color: #334155;
    line-height: 1;
}

.pw-clue-blank,
.pw-clue-ans {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border-radius: 7px;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
}

.pw-clue-blank {
    border: 2px dashed #f97316;
    background: #fff7ed;
    color: #ea580c;
}

.pw-clue-ans {
    border: 2px solid #10b981;
    background: #ecfdf5;
    color: #059669;
    font-family: "KaiTi", "STKaiti", serif;
    font-size: 18px;
}

.pw-hint-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.pw-feedback {
    display: flex;
    align-items: center;
    min-height: 64px;
    padding: 10px 12px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    color: #475569;
    font-size: 13.5px;
    line-height: 1.5;
    flex-shrink: 0;
}

.pw-feedback.is-correct {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}

.pw-feedback.is-wrong {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #9f1239;
}

.pw-fb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
}

.pw-fb-char {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 12px;
    background: #ffffff;
    border: 2.5px solid #10b981;
    color: #047857;
    font-family: "KaiTi", "STKaiti", serif;
    font-size: 38px;
    font-weight: 900;
    flex-shrink: 0;
}

.pw-fb-char.wrong {
    border-color: #f43f5e;
    color: #e11d48;
}

.pw-fb-text {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pw-fb-text strong {
    font-size: 14.5px;
}

.pw-fb-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pw-write-card .exam-canvas-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    width: 100%;
}

.pw-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.pw-tools {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ---------- 游戏 2：🎈 气球选字 ---------- */
.bl-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.5fr);
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.bl-prompt-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.bl-img-frame {
    flex: 1;
    width: 100%;
    min-height: 160px;
}

.bl-sky {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: center;
    justify-items: center;
    gap: 8px;
    padding: 18px 12px 24px;
    overflow: hidden;
    background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 55%, #f0f9ff 100%);
    border-color: #bae6fd;
}

.bl-cloud {
    position: absolute;
    left: -20%;
    font-size: 44px;
    opacity: 0.85;
    pointer-events: none;
    animation: gpCloud 20s linear infinite;
}

.bl-cloud.c1 { top: 6%; }
.bl-cloud.c2 { top: 42%; font-size: 34px; animation-duration: 28s; animation-delay: -9s; }
.bl-cloud.c3 { top: 76%; font-size: 38px; animation-duration: 24s; animation-delay: -16s; }

.balloon {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    animation: gpBalloonFloat 3.2s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * -0.8s);
}

.balloon-body {
    width: 104px;
    height: 128px;
    border-radius: 50% 50% 48% 48% / 56% 56% 44% 44%;
    background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.75) 0 8%, rgba(255, 255, 255, 0) 22%), var(--b-color);
    box-shadow: inset -10px -14px 22px rgba(0, 0, 0, 0.16), 0 10px 18px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.balloon-char {
    font-family: "KaiTi", "STKaiti", serif;
    font-size: 52px;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.28);
}

.balloon-tie {
    width: 0;
    height: 0;
    margin-top: -3px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 11px solid var(--b-color);
    filter: brightness(0.9);
}

.balloon-string {
    width: 2px;
    height: 46px;
    background: linear-gradient(#94a3b8, rgba(148, 163, 184, 0));
}

.balloon:hover .balloon-body {
    transform: scale(1.06);
}

.bc-red { --b-color: #f87171; }
.bc-orange { --b-color: #fb923c; }
.bc-yellow { --b-color: #facc15; }
.bc-green { --b-color: #4ade80; }
.bc-blue { --b-color: #60a5fa; }
.bc-purple { --b-color: #a78bfa; }
.bc-pink { --b-color: #f472b6; }
.bc-teal { --b-color: #2dd4bf; }

.bc-yellow .balloon-char,
.bc-green .balloon-char {
    color: #713f12;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.balloon.wrong {
    animation: gpShake 0.45s ease;
    opacity: 0.4;
    filter: grayscale(0.7);
    cursor: default;
}

.balloon.wrong .balloon-body {
    transform: scale(0.86);
}

.balloon.popped {
    animation: gpPopBalloon 0.45s ease forwards;
}

.balloon.fly-away {
    animation: gpFlyAway 1.3s ease-in forwards;
}

/* ---------- 游戏 3：👂 听音找字 ---------- */
.ls-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr);
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.ls-speaker-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: radial-gradient(circle at 50% 35%, #eff6ff 0%, #dbeafe 100%);
}

.ls-speaker-btn {
    position: relative;
    width: 150px;
    height: 150px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.ls-speaker-btn:hover {
    transform: scale(1.04);
}

.ls-speaker-icon {
    position: relative;
    z-index: 2;
    font-size: 64px;
    line-height: 1;
}

.ls-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid rgba(96, 165, 250, 0.6);
    opacity: 0;
}

.ls-speaker-btn.playing .ls-ring {
    animation: gpRing 1.4s ease-out infinite;
}

.ls-speaker-btn.playing .ls-ring.r2 {
    animation-delay: 0.5s;
}

.ls-speaker-tip {
    font-size: 15px;
    font-weight: 800;
    color: #1d4ed8;
}

.ls-options,
.wd-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-content: center;
}

.ls-card,
.wd-piece {
    position: relative;
    min-height: 130px;
    border-radius: 22px;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: inherit;
    transition: transform 0.15s ease;
}

.ls-card {
    border: 3px solid #bfdbfe;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.1);
}

.ls-card:hover,
.wd-piece:hover {
    transform: translateY(-3px);
}

.ls-card-char,
.wd-piece-char {
    font-family: "KaiTi", "STKaiti", serif;
    font-size: 64px;
    font-weight: 900;
    color: #1e293b;
    line-height: 1.05;
}

.ls-card-py {
    min-height: 20px;
    font-size: 16px;
    font-weight: 800;
    color: #2563eb;
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.2s ease;
}

.ls-card.revealed .ls-card-py {
    opacity: 1;
    transform: none;
}

.ls-card.correct,
.wd-piece.correct {
    border-color: #22c55e;
    background: #f0fdf4;
    animation: gpCorrectPop 0.45s ease;
}

.ls-card.correct::after,
.wd-piece.correct::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 12px;
    color: #16a34a;
    font-size: 22px;
    font-weight: 900;
}

.ls-card.wrong,
.wd-piece.wrong {
    border-color: #fca5a5;
    background: #fef2f2;
    opacity: 0.6;
    cursor: default;
    animation: gpShake 0.45s ease;
}

/* ---------- 游戏 4：🧩 组词填空 ---------- */
.wd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.wd-prompt-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.wd-img-frame {
    flex: 1;
    width: 100%;
    min-height: 130px;
}

.wd-img-frame[hidden] {
    display: none !important;
}

#bl-img,
#wd-img,
#wd-word,
#ml-target-img {
    cursor: pointer;
}

.wd-word {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

.wd-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.wd-py {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 1px 10px;
    border-radius: 999px;
    background: #ede9fe;
    border: 1.5px solid #c4b5fd;
    color: #5b21b6;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.3px;
}

.wd-py.is-empty {
    background: transparent;
    border-color: transparent;
    visibility: hidden;
    padding: 1px 4px;
}

.wd-char,
.wd-blank {
    width: 86px;
    height: 86px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "KaiTi", "STKaiti", serif;
    font-size: 58px;
    font-weight: 900;
}

.wd-char {
    background: #f5f3ff;
    border: 3px solid #c4b5fd;
    color: #4c1d95;
}

.wd-blank {
    background: #ffffff;
    border: 3px dashed #a78bfa;
    color: #a78bfa;
    animation: gpBlink 1.4s ease infinite;
}

.wd-blank.filled {
    border-style: solid;
    border-color: #22c55e;
    background: #f0fdf4;
    color: #15803d;
    animation: gpCorrectPop 0.45s ease;
}

.wd-piece {
    border: 3px solid #ddd6fe;
    background: linear-gradient(180deg, #ffffff, #faf5ff);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.12);
}

/* ---------- 游戏 5：🔢 数笔画 ---------- */
.sk-layout {
    display: grid;
    grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.25fr);
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.sk-visual-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.sk-svg-box {
    width: min(100%, 300px);
    aspect-ratio: 1 / 1;
    border: 3px solid #fca5a5;
    border-radius: 18px;
    background: #fffdf9;
    overflow: hidden;
}

.sk-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.sk-anim {
    fill: none;
    stroke: #1e293b;
    stroke-width: 150;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sk-label {
    animation: gpFadeIn 0.3s ease;
}

.sk-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-family: "KaiTi", "STKaiti", serif;
    font-size: 160px;
}

.btn-sk-count {
    width: min(100%, 300px);
    padding: 11px 12px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(245, 158, 11, 0.3);
}

.sk-quiz-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.sk-question {
    padding: 12px;
    border-radius: 16px;
    background: #fffbeb;
    border: 2px solid #fde68a;
    color: #1e293b;
    font-size: 24px;
    font-weight: 900;
    text-align: center;
}

.sk-q-char {
    font-family: "KaiTi", "STKaiti", serif;
    font-size: 34px;
    color: #d97706;
}

.sk-q-blank {
    display: inline-flex;
    justify-content: center;
    min-width: 50px;
    border-bottom: 3px solid #f59e0b;
    color: #f59e0b;
}

.sk-q-blank.filled {
    color: #16a34a;
    border-color: #16a34a;
}

.sk-q-em {
    color: #dc2626;
    font-size: 28px;
}

.sk-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.sk-num {
    aspect-ratio: 1 / 1;
    max-height: 112px;
    border-radius: 50%;
    border: 3px solid #fde68a;
    background: radial-gradient(circle at 35% 30%, #ffffff, #fef3c7);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: transform 0.15s ease;
}

.sk-num:hover,
.sk-type:hover {
    transform: translateY(-2px);
}

.sk-num b {
    font-size: 40px;
    line-height: 1;
    color: #92400e;
}

.sk-num small {
    font-size: 14px;
    font-weight: 800;
    color: #b45309;
}

.sk-type {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px 8px;
    border-radius: 18px;
    border: 3px solid #fde68a;
    background: #ffffff;
    color: #1e293b;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease;
}

.sk-type svg {
    width: 64px;
    height: 64px;
}

.sk-type-name {
    font-size: 15px;
    font-weight: 900;
    color: #92400e;
}

.sk-num.correct,
.sk-type.correct {
    border-color: #22c55e;
    background: #dcfce7;
    color: #15803d;
    animation: gpCorrectPop 0.45s ease;
}

.sk-num.wrong,
.sk-type.wrong {
    border-color: #fca5a5;
    opacity: 0.45;
    cursor: default;
    animation: gpShake 0.45s ease;
}

.sk-summary {
    font-size: 14.5px;
    font-weight: 800;
    color: #334155;
}

.sk-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.sk-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.sk-chip b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-size: 11px;
}

.sk-chip.hl {
    border-color: #ef4444;
    background: #fef2f2;
    color: #dc2626;
}

.sk-chip.hl b {
    background: #ef4444;
}

.sk-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* ---------- 游戏 6：🔗 反义词连线 ---------- */
.ant-card,
.mm-wrap,
.ml-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    min-height: 0;
}

.ant-toolbar,
.mm-toolbar,
.ml-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.ant-status,
.mm-status {
    flex: 1;
    min-width: 200px;
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 800;
}

.ant-status {
    background: #f0fdfa;
    border: 1.5px solid #99f6e4;
    color: #0f766e;
}

.mm-status {
    background: #eef2ff;
    border: 1.5px solid #c7d2fe;
    color: #4338ca;
}

.ant-status.all-done,
.mm-status.all-done {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}

.exam-ant-board {
    position: relative;
    flex: 1;
    min-height: 340px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    padding: 14px clamp(14px, 6vw, 90px);
    border-radius: 18px;
    border: 2px dashed #99f6e4;
    background: radial-gradient(circle at 50% 50%, #ffffff 0%, #f0fdfa 100%);
}

.exam-ant-col {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 10px;
}

.exam-ant-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.ant-word-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 122px;
    height: 58px;
    padding: 0 12px;
    border-radius: 16px;
    border: 3px solid #cbd5e1;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
    font-family: inherit;
    transition: transform 0.15s ease, background 0.15s ease;
}

.ant-word-card:hover {
    transform: scale(1.04);
}

.ant-char-text {
    font-family: "KaiTi", "STKaiti", serif;
    font-size: 34px;
    font-weight: 900;
    color: #1e293b;
}

.ant-emoji {
    min-width: 24px;
    font-size: 22px;
    text-align: center;
}

.ant-dot {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 0 0 3px #ffffff, 0 0 0 5px #cbd5e1;
}

.ant-word-card.selected {
    border-color: #14b8a6;
    background: #ccfbf1;
    transform: scale(1.06);
}

.ant-word-card.selected .ant-dot {
    background: #14b8a6;
}

.ant-word-card.matched {
    border-color: #22c55e;
    background: #f0fdf4;
}

.ant-word-card.matched .ant-dot {
    background: #22c55e;
}

.ant-word-card.wrong {
    border-color: #f87171;
    background: #fef2f2;
    animation: gpShake 0.45s ease;
}

/* ---------- 游戏 7：🃏 翻牌配对 ---------- */
.mm-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(96px, 1fr);
    gap: 12px;
    perspective: 1000px;
}

.mm-card {
    position: relative;
    min-height: 96px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.mm-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.45s cubic-bezier(0.4, 1.4, 0.6, 1);
}

.mm-card.flipped .mm-inner,
.mm-card.matched .mm-inner {
    transform: rotateY(180deg);
}

.mm-face {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1);
}

.mm-back {
    border: 3px solid #c7d2fe;
    background-image: radial-gradient(rgba(255, 255, 255, 0.2) 2px, transparent 2px), linear-gradient(135deg, #818cf8, #6366f1);
    background-size: 16px 16px, auto;
}

.mm-back-emoji {
    font-size: 40px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.mm-front {
    transform: rotateY(180deg);
    background: #ffffff;
    border: 3px solid #c7d2fe;
}

.mm-front img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.mm-char {
    font-family: "KaiTi", "STKaiti", serif;
    font-size: 56px;
    font-weight: 900;
    color: #312e81;
}

.mm-card.matched .mm-front {
    border-color: #22c55e;
    background: #f0fdf4;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25);
}

.mm-card.matched {
    animation: gpCorrectPop 0.5s ease;
    cursor: default;
}

/* ---------- 游戏 8：🔨 汉字打地鼠 ---------- */
.ml-wrap {
    background: linear-gradient(180deg, #f7fee7 0%, #d9f99d 100%);
    border-color: #bef264;
}

.ml-target-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 18px;
    background: #ffffff;
    border: 2px solid #bbf7d0;
    box-shadow: 0 4px 10px rgba(21, 128, 61, 0.1);
}

.ml-target-label {
    font-size: 15px;
    font-weight: 900;
    color: #15803d;
    white-space: nowrap;
}

.ml-target-img {
    width: 76px;
    height: 76px;
    padding: 4px;
    object-fit: contain;
    border-radius: 14px;
    background: #f0fdf4;
    border: 2px dashed #86efac;
}

.ml-field {
    flex: 1;
    min-height: 300px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
    padding: 6px 4px 2px;
}

.ml-hole {
    position: relative;
    min-height: 140px;
    cursor: pointer;
    touch-action: manipulation;
}

.ml-pit {
    position: absolute;
    left: 50%;
    bottom: 6%;
    width: 80%;
    max-width: 190px;
    height: 30%;
    max-height: 70px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 40%, #2b1d12 0%, #4a3423 55%, #6b4c35 100%);
    box-shadow: inset 0 10px 16px rgba(0, 0, 0, 0.5);
}

.ml-clip {
    position: absolute;
    left: 50%;
    bottom: 21%;
    width: 80%;
    max-width: 190px;
    height: 79%;
    transform: translateX(-50%);
    overflow: hidden;
}

.ml-mole {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 72%;
    height: 92%;
    max-height: 150px;
    transform: translate(-50%, 108%);
    transition: transform 0.22s cubic-bezier(0.3, 1.5, 0.6, 1);
}

.ml-hole.up .ml-mole {
    transform: translate(-50%, 0);
}

.ml-body {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 48% 48% 16% 16% / 55% 55% 12% 12%;
    background: radial-gradient(circle at 40% 28%, #c58f5d 0%, #a16207 58%, #854d0e 100%);
    box-shadow: inset -8px -10px 16px rgba(0, 0, 0, 0.2);
}

.ml-ear {
    position: absolute;
    top: 3%;
    width: 18%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: #92400e;
}

.ml-ear.l { left: 6%; }
.ml-ear.r { right: 6%; }

.ml-eye {
    position: absolute;
    top: 20%;
    z-index: 2;
    width: 10%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: #1f2937;
    box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.7);
}

.ml-eye.l { left: 30%; }
.ml-eye.r { right: 30%; }

.ml-nose {
    position: absolute;
    top: 31%;
    left: 50%;
    z-index: 2;
    width: 15%;
    aspect-ratio: 1.4 / 1;
    border-radius: 50%;
    background: #f472b6;
    transform: translateX(-50%);
}

.ml-sign {
    position: absolute;
    left: 50%;
    bottom: 6%;
    z-index: 3;
    min-width: 66%;
    padding: 1px 6px;
    transform: translateX(-50%);
    border-radius: 12px;
    background: #ffffff;
    border: 3px solid #f59e0b;
    color: #1e293b;
    font-family: "KaiTi", "STKaiti", serif;
    font-size: clamp(28px, 3.6vw, 44px);
    font-weight: 900;
    line-height: 1.15;
    text-align: center;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.ml-lip {
    position: absolute;
    left: 50%;
    bottom: 6%;
    width: 84%;
    max-width: 200px;
    height: 16%;
    max-height: 36px;
    transform: translateX(-50%);
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
    background: linear-gradient(180deg, #84cc16 0%, #65a30d 100%);
    z-index: 4;
    pointer-events: none;
}

.ml-hole.hit .ml-eye {
    background: transparent;
    box-shadow: none;
}

.ml-hole.hit .ml-eye::before {
    content: '✕';
    position: absolute;
    inset: -60%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 900;
    color: #1f2937;
}

.ml-hole.hit .ml-mole::after {
    content: '💥';
    position: absolute;
    top: -6%;
    left: 50%;
    z-index: 5;
    font-size: 40px;
    transform: translateX(-50%);
    animation: gpFadeIn 0.2s ease;
}

.ml-hole.hit .ml-sign {
    border-color: #22c55e;
    background: #dcfce7;
}

.ml-hole.miss .ml-sign {
    border-color: #ef4444;
    background: #fee2e2;
}

.ml-hole.miss .ml-mole {
    animation: gpWobble 0.4s ease;
}

/* ---------- 动效 ---------- */
@keyframes gpFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes gpFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes gpCardIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes gpBounce { 0% { scale: 1; } 40% { scale: 1.25; } 70% { scale: 0.92; } 100% { scale: 1; } }
@keyframes gpBubblePop { 0% { opacity: 0.3; scale: 0.95; } 100% { opacity: 1; scale: 1; } }
@keyframes gpPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.45); } 50% { box-shadow: 0 0 0 8px rgba(249, 115, 22, 0); } }
@keyframes gpBump { 0% { scale: 1; } 35% { scale: 1.28; } 100% { scale: 1; } }
@keyframes gpStamp { 0% { scale: 2.2; opacity: 0; } 100% { scale: 1; opacity: 1; } }
@keyframes gpShake { 0%, 100% { translate: 0 0; } 20% { translate: -7px 0; } 40% { translate: 7px 0; } 60% { translate: -5px 0; } 80% { translate: 5px 0; } }
@keyframes gpWobble { 0%, 100% { rotate: 0deg; } 25% { rotate: -9deg; } 75% { rotate: 9deg; } }
@keyframes gpCorrectPop { 0% { scale: 1; } 40% { scale: 1.08; } 100% { scale: 1; } }
@keyframes gpPopIn { 0% { scale: 0.7; opacity: 0.2; } 100% { scale: 1; opacity: 1; } }
@keyframes gpBalloonFloat { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-14px) rotate(2deg); } }
@keyframes gpPopBalloon { 0% { transform: scale(1); opacity: 1; } 40% { transform: scale(1.28); opacity: 0.9; } 100% { transform: scale(0.1); opacity: 0; } }
@keyframes gpFlyAway { to { transform: translateY(-160%); opacity: 0; } }
@keyframes gpCloud { from { left: -20%; } to { left: 110%; } }
@keyframes gpRing { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes gpBlink { 0%, 100% { border-color: #a78bfa; } 50% { border-color: #ede9fe; } }
@keyframes gpFloatUp {
    0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
    100% { opacity: 0; transform: translate(-50%, -64px) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .balloon:not(.popped):not(.fly-away),
    .bl-cloud,
    .game-hub-mascot,
    .game-combo-pill,
    .wd-blank {
        animation: none !important;
    }
}

/* ---------- 大屏 / 平板：大厅卡片撑满屏幕、选项更大更醒目（含 iPad 横屏 Safari 地址栏下 ~660px 高度） ---------- */
@media (min-width: 601px) and (min-height: 600px) {
    .game-card-grid {
        flex: 1;
        grid-auto-rows: minmax(0, 1fr);
    }
    .game-card-art {
        flex: 1;
        height: auto;
        min-height: 68px;
    }
}

@media (min-width: 821px) and (orientation: landscape) and (min-height: 640px) {
    .game-card-emoji {
        font-size: 62px;
    }
    .ls-options,
    .wd-options {
        grid-auto-rows: minmax(140px, 200px);
    }
    .ls-card-char,
    .wd-piece-char {
        font-size: 74px;
    }
}

@media (min-width: 1101px) and (orientation: landscape) {
    .balloon-body {
        width: 120px;
        height: 148px;
    }
    .balloon-char {
        font-size: 60px;
    }
}

/* ---------- 中屏 / iPad 横屏 ---------- */
@media (max-width: 1100px) {
    .game-card-grid {
        gap: 10px;
    }
    .game-card-emoji {
        font-size: 48px;
    }
    .game-mascot-bubble {
        font-size: 13px;
    }
    .balloon-body {
        width: 92px;
        height: 114px;
    }
    .balloon-char {
        font-size: 46px;
    }
}

/* ---------- iPad 竖屏专属自适应（768px ~ 1024px，覆盖 Mini / Air / Pro 11" / Pro 12.9"）：上下分栏撑满全屏，零底部留白 ---------- */
@media (min-width: 601px) and (orientation: portrait) and (max-width: 1050px) {
    .game-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
    .game-card-emoji {
        font-size: 52px;
    }
    .game-panel.active {
        height: 100%;
        min-height: 0;
    }
    .pw-layout,
    .bl-layout,
    .ls-layout,
    .wd-layout,
    .sk-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        height: 100%;
        min-height: 0;
    }
    /* 游戏 1 看图写字：上方图片与提示左右并排，下方米字格自适应撑满 */
    .pw-prompt-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 10px 18px;
        padding: 12px 18px;
    }
    .pw-img-frame {
        flex: none;
        width: clamp(148px, 20vw, 190px);
        height: clamp(148px, 20vw, 190px);
        min-height: 0;
    }
    .pw-hint-row {
        justify-content: flex-start;
    }
    .pw-feedback {
        grid-column: 2;
        min-height: 0;
        padding: 8px 12px;
    }
    .pw-feedback:not(.is-correct):not(.is-wrong) {
        display: flex;
    }
    .pw-write-card .exam-canvas-wrapper {
        flex: 1 1 auto;
        height: auto;
        min-height: 240px;
    }
    /* 游戏 2 气球选字：上方居中清晰大图，下方蓝天撑满剩余空间 */
    .bl-img-frame {
        flex: none;
        width: min(100%, 300px);
        height: clamp(160px, 21vh, 240px);
        min-height: 0;
    }
    .bl-sky {
        height: 100%;
        min-height: 0;
    }
    .balloon-body {
        width: 106px;
        height: 132px;
    }
    .balloon-char {
        font-size: 52px;
    }
    /* 游戏 3 听音找字 & 游戏 4 组词填空：下方四选一字卡撑满剩余高度 */
    .ls-speaker-card {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 14px 20px;
        padding: 16px 22px;
    }
    .ls-speaker-btn {
        width: 112px;
        height: 112px;
    }
    .ls-speaker-icon {
        font-size: 50px;
    }
    .wd-img-frame {
        flex: none;
        width: min(100%, 260px);
        height: clamp(136px, 18vh, 210px);
        min-height: 0;
    }
    .ls-options,
    .wd-options {
        height: 100%;
        min-height: 0;
        grid-auto-rows: minmax(110px, 1fr);
        align-content: stretch;
    }
    .ls-card-char,
    .wd-piece-char {
        font-size: 68px;
    }
    /* 游戏 5 数笔画：上方汉字格与演示按钮左右紧凑并排，下方答题区宽敞清晰 */
    .sk-visual-card {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        gap: 16px 24px;
        padding: 14px 20px;
    }
    .sk-svg-box {
        width: clamp(176px, 22vh, 230px);
    }
    .btn-sk-count {
        width: auto;
        min-width: 190px;
        padding: 0 22px;
    }
    .sk-quiz-card {
        justify-content: center;
    }
    /* 游戏 6/7/8 反义词 / 翻牌 / 打地鼠：棋盘撑满全卡 */
    .exam-ant-board,
    .mm-grid,
    .ml-field {
        flex: 1;
        min-height: 0;
    }
    .mm-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-auto-rows: minmax(0, 1fr);
    }
    .mm-card {
        aspect-ratio: auto;
        min-height: 0;
    }
}

/* ---------- 折叠屏窄态 / 手机（<= 720px）：单栏流式堆叠布局 ---------- */
@media (max-width: 720px) {
    .game-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .game-panel {
        height: auto;
    }
    .game-panel.active {
        min-height: 100%;
    }
    .pw-layout,
    .bl-layout,
    .ls-layout,
    .wd-layout,
    .sk-layout {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
    }
    .pw-img-frame,
    .bl-img-frame,
    .wd-img-frame {
        flex: none;
        height: clamp(120px, 20vh, 180px);
        min-height: 0;
    }
    /* 熊猫老师气泡已给出提示，堆叠布局下隐藏空闲提示框，让写字格与“写好了”按钮一屏可见 */
    .pw-feedback:not(.is-correct):not(.is-wrong) {
        display: none;
    }
    .pw-write-card .exam-canvas-wrapper {
        flex: none;
        height: min(86vw, 50vh, 460px);
        min-height: 220px;
    }
    .ls-speaker-card {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px 16px;
        padding: 12px;
    }
    .ls-speaker-btn {
        width: 104px;
        height: 104px;
    }
    .ls-speaker-icon {
        font-size: 46px;
    }
    .sk-visual-card {
        padding: 12px;
    }
    .sk-svg-box,
    .btn-sk-count {
        width: min(100%, 250px);
    }
    .exam-ant-board,
    .mm-grid,
    .ml-field {
        flex: none;
    }
    .mm-grid {
        grid-auto-rows: auto;
    }
    .mm-card {
        aspect-ratio: 1 / 1.08;
        min-height: 0;
    }
}

/* ---------- 手机竖屏 ---------- */
@media (max-width: 720px) {
    .search-box {
        min-width: 0;
        width: 148px;
    }

    .app-primary-tabs {
        order: 2;
        flex: 1 0 100%;
        display: flex;
        padding: 3px;
        gap: 4px;
    }

    .primary-tab-btn {
        flex: 1;
        justify-content: center;
        padding: 6px 10px;
        font-size: 13px;
    }

    .header-actions {
        order: 3;
    }

    /* 闯关乐园模式下搜索框隐藏，主 Tab 与 Logo 同排，节省纵向空间 */
    body.app-mode-exam .app-primary-tabs {
        order: 0;
        flex: 1 1 auto;
        max-width: 240px;
        margin-left: auto;
    }

    body.app-mode-exam .primary-tab-btn {
        padding: 5px 8px;
        font-size: 12.5px;
    }

    body.app-mode-exam #mobile-hint-banner {
        display: none !important;
    }

    .exam-view-container {
        padding: 6px 8px 8px;
        gap: 8px;
    }

    .game-hub-hero {
        padding: 10px 12px;
        gap: 8px;
    }

    .game-hub-mascot {
        font-size: 34px;
    }

    .game-hub-title {
        font-size: 19px;
    }

    .game-hub-subtitle {
        font-size: 12px;
    }

    .game-hub-hero-right {
        width: 100%;
    }

    .game-hub-today,
    .btn-hub-action {
        font-size: 12px;
        padding: 5px 10px;
    }

    .game-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .game-card-art {
        height: 72px;
    }

    .game-card-emoji {
        font-size: 40px;
    }

    .game-card-body {
        padding: 8px 10px 2px;
    }

    .game-card-title {
        font-size: 15px;
    }

    .game-card-desc {
        font-size: 11.5px;
    }

    .game-card-foot {
        padding: 6px 10px 10px;
    }

    .game-card-stars,
    .game-card-play {
        font-size: 11.5px;
    }

    .game-topbar {
        flex-wrap: wrap;
        gap: 6px 8px;
        padding: 6px 8px;
        border-radius: 16px;
    }

    .btn-game-back {
        height: 34px;
        padding: 0 10px;
    }

    .game-title-wrap {
        padding: 4px 10px;
    }

    .game-title-text {
        font-size: 14.5px;
    }

    .game-topbar-stats {
        margin-left: auto;
    }

    .game-mascot {
        order: 5;
        flex: 1 0 100%;
    }

    .game-mascot-face {
        font-size: 24px;
    }

    .game-mascot-bubble {
        font-size: 12.5px;
        padding: 5px 10px;
    }

    .gp-card {
        padding: 10px;
        border-radius: 16px;
    }

    .btn-game-primary {
        height: 40px;
        padding: 0 16px;
        font-size: 14px;
    }

    .btn-hint {
        padding: 6px 11px;
        font-size: 12.5px;
    }

    .pw-feedback {
        font-size: 12.5px;
        min-height: 0;
        padding: 8px 10px;
    }

    .pw-prompt-card,
    .pw-write-card {
        gap: 8px;
    }

    /* 手机：图片与提示按钮左右并排 */
    .pw-prompt-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 8px 12px;
    }

    .pw-img-frame {
        width: clamp(96px, 30vw, 132px);
        height: clamp(96px, 30vw, 132px);
    }

    .pw-word-clue {
        bottom: 4px;
        gap: 3px;
        padding: 2px 8px;
    }

    .pw-clue-known {
        font-size: 15px;
    }

    .pw-clue-blank,
    .pw-clue-ans {
        width: 20px;
        height: 20px;
        font-size: 12.5px;
        border-radius: 5px;
    }

    .pw-hint-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .pw-feedback {
        grid-column: 1 / -1;
    }

    .pw-write-card .exam-canvas-wrapper {
        height: min(86vw, 44vh, 420px);
    }

    .bl-sky {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px 8px;
        padding: 12px 8px 14px;
    }

    .balloon-body {
        width: 84px;
        height: 104px;
    }

    .balloon-char {
        font-size: 42px;
    }

    .balloon-string {
        height: 26px;
    }

    .ls-card,
    .wd-piece {
        min-height: 98px;
        border-radius: 18px;
    }

    .ls-card-char,
    .wd-piece-char {
        font-size: 50px;
    }

    .wd-char,
    .wd-blank {
        width: 70px;
        height: 70px;
        font-size: 46px;
    }

    .sk-question {
        font-size: 19px;
        padding: 10px;
    }

    .sk-q-char {
        font-size: 28px;
    }

    .sk-options {
        gap: 8px;
    }

    .sk-num b {
        font-size: 30px;
    }

    .sk-type {
        padding: 8px 4px 6px;
        border-radius: 14px;
    }

    .sk-type svg {
        width: 44px;
        height: 44px;
    }

    .sk-type-name {
        font-size: 13px;
    }

    .exam-ant-board {
        min-height: 400px;
        padding: 10px 10px;
    }

    .ant-word-card {
        min-width: 92px;
        height: 50px;
        padding: 0 8px;
        gap: 4px;
    }

    .ant-char-text {
        font-size: 28px;
    }

    .ant-emoji {
        min-width: 18px;
        font-size: 17px;
    }

    .mm-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .mm-char {
        font-size: 44px;
    }

    .mm-back-emoji {
        font-size: 30px;
    }

    .ml-target-img {
        width: 58px;
        height: 58px;
    }

    .ml-target-label {
        font-size: 13.5px;
    }

    .ml-field {
        min-height: 280px;
        gap: 6px 10px;
    }

    .ml-hole {
        min-height: 128px;
    }

    .ml-sign {
        font-size: 30px;
    }
}

/* 手机（≤600px）：画板按视口剩余高度自动定尺寸，外框紧贴画板，不留空白 */
@media (max-width: 600px) {
    .pw-write-card .exam-canvas-wrapper {
        height: auto;
        min-height: 0;
    }
}

/* 打印同款课堂试卷 A4 样式 */
@media print {
    .exam-print-sheet h3 {
        font-size: 15px;
        margin: 10px 0 6px;
        color: #111;
    }

    .exam-print-pic-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }

    .exam-print-pic-cell {
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        padding: 4px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .exam-print-img-box {
        width: 68px;
        height: 68px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .exam-print-img-box img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .exam-print-mizi {
        position: relative;
        width: 54px;
        height: 54px;
        border: 1.5px solid #333;
    }

    .exam-print-bottom-cols {
        display: grid;
        grid-template-columns: 1.25fr 1fr;
        gap: 18px;
        margin-top: 8px;
    }

    .exam-print-stk-row {
        font-size: 14px;
        line-height: 2.2;
    }

    .exam-print-line {
        display: inline-block;
        width: 48px;
        border-bottom: 1.5px solid #111;
    }

    .exam-print-ant-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 18px;
        font-weight: bold;
        line-height: 1.9;
        padding: 0 12px;
    }

    .ant-p-gap {
        flex: 1;
    }
}


