/* ===== CSS变量定义 ===== */
:root {
    /* 传统中国色彩系统 */
    --color-celadon: #7FB069;
    /* 青瓷蓝 */
    --color-paper: #F7E7CE;
    /* 宣纸黄 */
    --color-cinnabar: #D64545;
    /* 朱砂红 */
    --color-ink: #2C3E50;
    /* 墨黑 */

    /* 扩展色彩 */
    --color-light-celadon: #A8D084;
    --color-dark-celadon: #5A8C4A;
    --color-light-paper: #FDF2E6;
    --color-light-ink: #566573;
    --color-success: #4CAF50;
    --color-warning: #FF9800;
    --color-error: #F44336;

    /* 字体系统 */
    --font-family-fun: 'Noto Sans SC', 'Source Han Sans SC', 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    --font-family-base: 'Noto Sans SC', 'Source Han Sans SC', 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;

    /* 间距系统 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* 阴影 */
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.2);

    /* 3D效果 */
    --shadow-3d: 0 6px 0 var(--color-dark-celadon);
    --shadow-3d-pressed: 0 2px 0 var(--color-dark-celadon);
}

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

body {
    font-family: var(--font-family-base);
    background: linear-gradient(135deg, var(--color-light-paper) 0%, var(--color-paper) 100%);
    color: var(--color-ink);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== 头部样式 ===== */
header {
    background: linear-gradient(135deg, var(--color-celadon) 0%, var(--color-light-celadon) 50%, #8BC34A 100%);
    padding: var(--spacing-lg) 0;
    box-shadow: 0 8px 32px rgba(127, 176, 105, 0.25), 0 4px 16px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0 0 40px 40px;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: header-shine 6s ease-in-out infinite;
}

@keyframes header-shine {

    0%,
    100% {
        transform: rotate(45deg) translateX(-100%);
    }

    50% {
        transform: rotate(45deg) translateX(100%);
    }
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--spacing-md);
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo-icon-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #fffbe6 0%, #fff8dc 50%, #e6f9f2 100%);
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.15), 0 3px 0 #e6d4a3, inset 0 2px 4px rgba(255, 255, 255, 0.3);
    margin-right: 8px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.logo-icon-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(45deg);
    animation: logo-shine 4s ease-in-out infinite;
}

@keyframes logo-shine {

    0%,
    100% {
        transform: rotate(45deg) translateX(-100%);
    }

    50% {
        transform: rotate(45deg) translateX(100%);
    }
}

.logo-icon-bg:hover {
    box-shadow: 0 10px 30px rgba(44, 62, 80, 0.2), 0 5px 0 #e6d4a3, inset 0 3px 6px rgba(255, 255, 255, 0.4);
    transform: scale(1.1) rotate(-10deg) translateY(-2px);
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 2px #e6d4a3);
    transition: transform 0.2s;
}

.logo-text {
    font-family: var(--font-family-fun);
    font-size: 2.3rem;
    font-weight: bold;
    color: white;
    letter-spacing: 2px;
    text-shadow: 0 3px 12px rgba(44, 62, 80, 0.15), 0 1px 4px rgba(0, 0, 0, 0.1);
    margin-left: 4px;
    position: relative;
    z-index: 1;
}

.header-nav {
    display: flex;
    gap: var(--spacing-sm);
}

.nav-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: var(--color-celadon);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    padding: 0.6em 1.2em;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    min-height: 52px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transform-origin: center;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
    opacity: 0;
}

.nav-btn:hover::before {
    opacity: 1;
    animation: nav-shine 0.6s ease;
}

@keyframes nav-shine {
    0% {
        transform: rotate(45deg) translateX(-100%);
    }

    100% {
        transform: rotate(45deg) translateX(100%);
    }
}

.nav-btn .nav-btn-icon {
    font-size: 1.7rem;
    display: block;
    line-height: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
    transform-origin: center;
}

.nav-btn:hover .nav-btn-icon {
    transform: scale(1.2) rotate(10deg);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    animation: icon-bounce 0.6s ease;
}

@keyframes icon-bounce {
    0% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.3) rotate(15deg);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }

    75% {
        transform: scale(1.25) rotate(12deg);
    }

    100% {
        transform: scale(1.2) rotate(10deg);
    }
}

.nav-btn-home .nav-btn-icon {
    color: var(--color-celadon);
}

.nav-btn-progress .nav-btn-icon {
    color: var(--color-cinnabar);
}

.nav-btn-danger {
    color: var(--color-cinnabar);
    border: 2px solid var(--color-cinnabar);
    background: #fff;
}

.nav-btn-danger .nav-btn-icon {
    color: var(--color-cinnabar);
}

.nav-btn:hover {
    transform: scale(1.08) translateY(-4px) rotate(2deg);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.4), 0 4px 16px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #ffffff 0%, #f0f8ff 100%);
    border-color: rgba(127, 176, 105, 0.3);
    animation: nav-btn-hover 0.3s ease;
}

@keyframes nav-btn-hover {
    0% {
        transform: scale(1) translateY(0) rotate(0deg);
    }

    50% {
        transform: scale(1.12) translateY(-6px) rotate(3deg);
    }

    100% {
        transform: scale(1.08) translateY(-4px) rotate(2deg);
    }
}

.nav-btn:active {
    transform: scale(0.95) translateY(2px) rotate(-1deg);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2), 0 1px 4px rgba(0, 0, 0, 0.1);
    animation: nav-btn-click 0.2s ease;
}

@keyframes nav-btn-click {
    0% {
        transform: scale(1.08) translateY(-4px) rotate(2deg);
    }

    50% {
        transform: scale(0.92) translateY(4px) rotate(-2deg);
    }

    100% {
        transform: scale(0.95) translateY(2px) rotate(-1deg);
    }
}

.nav-btn-danger:hover,
.nav-btn-danger:focus {
    background: var(--color-cinnabar);
    color: #fff;
    border-color: var(--color-cinnabar);
}

.nav-btn-danger:hover .nav-btn-icon,
.nav-btn-danger:focus .nav-btn-icon {
    color: #fff;
}

/* ===== 特定按钮的独特动画效果 ===== */

/* 主页按钮 - 房子摇摆动画 */
#home-btn:hover .nav-btn-icon {
    animation: home-sway 0.6s ease;
}

@keyframes home-sway {

    0%,
    100% {
        transform: scale(1.2) rotate(0deg);
    }

    25% {
        transform: scale(1.3) rotate(-8deg);
    }

    75% {
        transform: scale(1.3) rotate(8deg);
    }
}

/* 进度按钮 - 图表跳动动画 */
#progress-btn:hover .nav-btn-icon {
    animation: chart-bounce 0.8s ease;
}

@keyframes chart-bounce {
    0% {
        transform: scale(1.2) translateY(0);
    }

    20% {
        transform: scale(1.4) translateY(-8px);
    }

    40% {
        transform: scale(1.1) translateY(4px);
    }

    60% {
        transform: scale(1.3) translateY(-4px);
    }

    80% {
        transform: scale(1.15) translateY(2px);
    }

    100% {
        transform: scale(1.2) translateY(0);
    }
}

/* 清除数据按钮 - 垃圾桶摇摆动画 */
#clear-data-btn:hover .nav-btn-icon {
    animation: trash-shake 0.5s ease;
}

@keyframes trash-shake {

    0%,
    100% {
        transform: scale(1.2) rotate(0deg);
    }

    10% {
        transform: scale(1.3) rotate(-10deg);
    }

    20% {
        transform: scale(1.25) rotate(8deg);
    }

    30% {
        transform: scale(1.35) rotate(-6deg);
    }

    40% {
        transform: scale(1.2) rotate(4deg);
    }

    50% {
        transform: scale(1.3) rotate(-2deg);
    }

    60% {
        transform: scale(1.25) rotate(2deg);
    }

    70% {
        transform: scale(1.3) rotate(-1deg);
    }

    80% {
        transform: scale(1.25) rotate(1deg);
    }

    90% {
        transform: scale(1.3) rotate(0deg);
    }
}

/* 搜索按钮 - 放大镜旋转动画 */
#search-btn:hover .nav-btn-icon {
    animation: search-spin 0.7s ease;
}

@keyframes search-spin {
    0% {
        transform: scale(1.2) rotate(0deg);
    }

    25% {
        transform: scale(1.4) rotate(90deg);
    }

    50% {
        transform: scale(1.1) rotate(180deg);
    }

    75% {
        transform: scale(1.3) rotate(270deg);
    }

    100% {
        transform: scale(1.2) rotate(360deg);
    }
}

/* 帮助按钮 - 问号弹跳动画 */
#help-btn:hover .nav-btn-icon {
    animation: help-bounce 0.6s ease;
}

@keyframes help-bounce {

    0%,
    100% {
        transform: scale(1.2) translateY(0) rotate(0deg);
    }

    20% {
        transform: scale(1.4) translateY(-6px) rotate(5deg);
    }

    40% {
        transform: scale(1.1) translateY(3px) rotate(-3deg);
    }

    60% {
        transform: scale(1.3) translateY(-3px) rotate(2deg);
    }

    80% {
        transform: scale(1.15) translateY(1px) rotate(-1deg);
    }
}

/* ===== 按钮点击时的特殊效果 ===== */
.nav-btn:active .nav-btn-icon {
    transform: scale(0.9) rotate(-5deg);
    filter: brightness(1.2);
}

/* 危险按钮的特殊点击效果 */
.nav-btn-danger:active .nav-btn-icon {
    transform: scale(0.9) rotate(-10deg);
    filter: brightness(1.3) drop-shadow(0 0 8px rgba(214, 69, 69, 0.5));
}

/* ===== 按钮组合动画效果 ===== */
.header-nav:hover .nav-btn:not(:hover) {
    transform: scale(0.95);
    opacity: 0.8;
}

.header-nav .nav-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 按钮加载状态动画 ===== */
.nav-btn.loading .nav-btn-icon {
    animation: loading-spin 1s linear infinite;
}

@keyframes loading-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ===== 主容器样式 ===== */
#app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-md);
    min-height: calc(100vh - 80px);
    position: relative;
    overflow: visible;
}

/* 主页背景装饰 */
#theme-selection-view {
    position: relative;
    overflow: hidden;
}

#theme-selection-view::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(127, 176, 105, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    animation: float-decoration 6s ease-in-out infinite;
}

#theme-selection-view::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -15%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(214, 69, 69, 0.03) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    animation: float-decoration 8s ease-in-out infinite reverse;
}

@keyframes float-decoration {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

/* ===== 视图切换 ===== */
.view {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.view.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ===== 页面头部 ===== */
.view-header {
    text-align: center;
    margin-bottom: var(--spacing-xxl);
}

.page-title {
    font-family: var(--font-family-fun);
    font-size: 2.8rem;
    color: var(--color-celadon);
    margin-bottom: var(--spacing-md);
    text-shadow: 0 2px 4px rgba(127, 176, 105, 0.2);
    background: linear-gradient(135deg, var(--color-celadon) 0%, var(--color-light-celadon) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--color-celadon) 0%, var(--color-light-celadon) 100%);
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(127, 176, 105, 0.3);
}

.page-subtitle {
    font-size: 1.2rem;
    color: var(--color-light-ink);
    font-weight: 500;
    margin-top: var(--spacing-md);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ===== 返回按钮 ===== */
.back-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 1.08rem;
    font-family: var(--font-family-fun);
    font-weight: bold;
    padding: 8px 18px 8px 10px;
    background: var(--color-light-paper);
    border: 2px solid var(--color-celadon);
    border-radius: 18px;
    color: var(--color-celadon);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(127, 176, 105, 0.10);
    margin-right: 18px;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.back-btn:hover {
    background: var(--color-celadon);
    color: #fff;
    box-shadow: 0 6px 24px rgba(127, 176, 105, 0.18);
}

.back-btn:active {
    background: var(--color-dark-celadon);
    color: #fff;
}

.back-btn-text {
    font-weight: bold;
    font-size: 1.08rem;
    letter-spacing: 1px;
}

.view-header,
.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-header,
.detail-header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding-top: 0.5em;
    padding-bottom: 0.5em;
}

.view-header .back-btn,
.detail-header .back-btn {
    position: absolute;
    left: 0.5em;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    z-index: 1;
}

.view-header>h1,
.view-header>.page-title,
.detail-header>h1,
.detail-header>.page-title {
    flex: none;
    text-align: center;
    margin: 0 0 0.2em 0;
    align-self: center;
}

.view-header>p,
.detail-header>p {
    flex: none;
    text-align: center;
    margin: 0;
    align-self: center;
}

.view-header>.page-title,
.detail-header>.page-title {
    margin-bottom: 0.2em;
}

/* ===== 主题网格 ===== */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg);
    overflow: visible;
}

.theme-card {
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    border-radius: 20px;
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    border-bottom: 6px solid var(--color-celadon);
    border: 3px solid transparent;
    transition: all 0.4s cubic-bezier(.5, 1.8, .5, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.theme-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(127, 176, 105, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.theme-card:hover::before {
    opacity: 1;
    animation: shimmer 0.6s ease;
}

.theme-card:hover {
    transform: scale(1.07) translateY(-6px);
    box-shadow: var(--shadow-heavy), 0 0 0 6px rgba(127, 176, 105, 0.12);
    border: 3px solid var(--color-celadon);
    animation: theme-bounce 0.4s;
}

@keyframes theme-bounce {
    0% {
        transform: scale(1) translateY(0);
    }

    40% {
        transform: scale(1.12) translateY(-10px);
    }

    60% {
        transform: scale(0.98) translateY(2px);
    }

    100% {
        transform: scale(1.07) translateY(-6px);
    }
}

.theme-icon {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-md);
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
}

.theme-card:hover .theme-icon {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 6px 12px rgba(127, 176, 105, 0.3));
}

.theme-name {
    font-family: var(--font-family-fun);
    font-size: 1.4rem;
    color: var(--color-ink);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.theme-card:hover .theme-name {
    color: var(--color-celadon);
    transform: translateY(-2px);
}

.theme-progress {
    font-size: 1rem;
    color: var(--color-light-ink);
    font-weight: 500;
    padding: 8px 16px;
    background: rgba(127, 176, 105, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(127, 176, 105, 0.2);
    transition: all 0.3s ease;
}

.theme-card:hover .theme-progress {
    background: rgba(127, 176, 105, 0.2);
    color: var(--color-celadon);
    transform: translateY(-2px);
}

/* ===== 汉字网格 ===== */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.character-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 150px;
    padding: var(--spacing-md);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-light);
    border-bottom: 4px solid var(--color-celadon);
    cursor: pointer;
    transition: all 0.3s ease;
}

/* 已学习汉字的样式 */
.character-card.learned {
    background: linear-gradient(135deg, #f0f9f0 0%, #e8f5e8 100%);
    border-bottom: 4px solid var(--color-success);
    border: 2px solid var(--color-success);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.15);
}

.character-card.learned::before {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--color-success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.character-card.learned .character-text {
    color: var(--color-success);
}

.character-card.learned .character-pinyin {
    color: var(--color-success);
    font-weight: bold;
}

/* 未学习汉字的提示样式 */
.character-card:not(.learned)::after {
    content: '待学习';
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 152, 0, 0.1);
    color: var(--color-warning);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.character-tianzige {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px auto;
}

.tianzige-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    z-index: 1;
}

.character-text {
    font-size: 2rem;
    font-weight: bold;
    color: #2C3E50;
    text-align: center;
    line-height: 1;
    margin-top: 8px;
    pointer-events: none;
}

.character-pinyin {
    font-size: 0.9rem;
    color: #d64545;
    margin-bottom: 6px;
    font-weight: bold;
    text-align: center;
    line-height: 1;
}

/* ===== 汉字详情页 ===== */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
}

.character-nav {
    display: flex;
    gap: var(--spacing-sm);
}

.nav-char-btn {
    background: var(--color-light-paper);
    border: 2.5px solid var(--color-celadon);
    border-radius: 18px;
    padding: 0.7em 1.6em;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(.5, 1.8, .5, 1);
    display: flex;
    align-items: center;
    gap: 0.7em;
    font-size: 1.15rem;
    font-family: var(--font-family-fun);
    font-weight: bold;
    color: var(--color-ink);
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.06);
    position: relative;
    outline: none;
}

.nav-char-btn span {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    width: 1.7em;
    height: 1.7em;
    background: var(--color-celadon);
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(127, 176, 105, 0.10);
    margin: 0 0.1em;
    transition: background 0.18s, transform 0.18s;
}

.nav-char-btn:hover {
    transform: scale(1.09) translateY(-2px);
    border-color: var(--color-dark-celadon);
    box-shadow: 0 6px 24px rgba(127, 176, 105, 0.18);
    background: #e6f9f2;
}

.nav-char-btn:active {
    transform: scale(0.96) translateY(2px);
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.10);
}

.nav-char-btn:hover span {
    animation: nav-icon-shake 0.5s;
    background: var(--color-dark-celadon);
}

@keyframes nav-icon-shake {
    0% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-4px);
    }

    40% {
        transform: translateX(4px);
    }

    60% {
        transform: translateX(-2px);
    }

    80% {
        transform: translateX(2px);
    }

    100% {
        transform: translateX(0);
    }
}

.nav-char-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    border-style: dashed;
}

.detail-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xxl);
    align-items: start;
}

/* ===== 汉字显示区域 ===== */
.character-main {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.hanzi-display {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto var(--spacing-lg);
    border: 3px solid var(--color-celadon);
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
}

/* 确保桌面端大屏幕显示 */
@media (min-width: 1025px) {
    .hanzi-display {
        width: 600px !important;
        height: 600px !important;
    }
}

.hanzi-tianzige-bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

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

#hanzi-writer-inner {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.character-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.character-meta {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
    order: 1;
}

.character-title {
    font-family: var(--font-family-fun);
    font-size: 2rem;
    color: var(--color-celadon);
    margin-bottom: var(--spacing-sm);
    order: 2;
}

.pinyin {
    font-size: 1.2rem;
    color: var(--color-cinnabar);
    font-weight: bold;
}

.strokes {
    font-size: 1rem;
    color: var(--color-light-ink);
}

/* ===== 操作按钮 ===== */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-3d);
    transition: all 0.2s ease;
    font-weight: bold;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.action-btn:active {
    transform: translateY(4px);
    box-shadow: var(--shadow-3d-pressed);
}

.action-btn.primary {
    background: var(--color-celadon);
    color: white;
    box-shadow: 0 6px 0 var(--color-dark-celadon);
}

.action-btn.primary .nav-btn-icon {
    color: #fff;
}

.action-btn.secondary {
    background: var(--color-paper);
    color: var(--color-ink);
    box-shadow: 0 6px 0 #E6D4A3;
}

.action-btn.accent {
    background: var(--color-cinnabar);
    color: white;
    box-shadow: 0 6px 0 #B73E3E;
}

/* ===== 信息区域 ===== */
.info-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-light);
    border-left: 4px solid var(--color-celadon);
}

.info-section h3 {
    font-family: var(--font-family-fun);
    color: var(--color-celadon);
    margin-bottom: var(--spacing-md);
    font-size: 1.1rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 变成4列横排 */
    gap: var(--spacing-md);
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm);
    background: var(--color-light-paper);
    border-radius: var(--radius-sm);
}

.info-label {
    font-weight: bold;
    color: var(--color-ink);
}

.info-value {
    color: var(--color-cinnabar);
    font-weight: bold;
}

.definition-text {
    line-height: 1.8;
    color: var(--color-ink);
    font-size: 1rem;
}

/* ===== 组词容器 ===== */
.words-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.word-item {
    background: var(--color-light-paper);
    border: 2px solid var(--color-celadon);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.word-item:hover {
    background: var(--color-celadon);
    color: white;
}

.word-pinyin {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 2px;
    order: 1;
}

.word-text {
    font-weight: bold;
    order: 2;
}

/* ===== 相关汉字 ===== */
.related-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.related-item {
    background: var(--color-paper);
    border: 2px solid var(--color-celadon);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.related-item:hover {
    background: var(--color-celadon);
    color: white;
    transform: translateY(-2px);
}

/* ===== 进度页样式 ===== */
.progress-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xxl);
    align-items: start;
    margin-bottom: var(--spacing-xl);
}

.main-progress {
    background: linear-gradient(135deg, #ffffff 0%, #f8fffe 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-medium);
    border: 2px solid rgba(127, 176, 105, 0.1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.main-progress::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(127, 176, 105, 0.05), transparent);
    transform: rotate(45deg);
    animation: progress-shimmer 3s ease-in-out infinite;
}

@keyframes progress-shimmer {

    0%,
    100% {
        transform: rotate(45deg) translateX(-100%);
    }

    50% {
        transform: rotate(45deg) translateX(100%);
    }
}

.progress-circle {
    position: relative;
    margin-bottom: var(--spacing-lg);
    z-index: 1;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    stroke: #e0e0e0;
    stroke-width: 10;
    fill: none;
}

.progress-ring-fill {
    stroke: #4CAF50;
    stroke-width: 10;
    fill: none;
    stroke-linecap: round;
    stroke-dasharray: 314;
    stroke-dashoffset: 314;
    transition: stroke-dashoffset 0.5s;
}

.progress-text {
    color: #388E3C;
    font-weight: bold;
    font-size: 2em;
}

.progress-text-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 8px;
    gap: 2px;
}

.progress-text {
    color: #388E3C;
    font-weight: bold;
    font-size: 2em;
    line-height: 1.1;
    letter-spacing: 1px;
}

.progress-label {
    display: block;
    font-size: 1rem;
    color: #2C3E50;
    font-weight: 500;
    margin-top: 2px;
    letter-spacing: 0.5px;
}

.progress-total-count {
    color: #666;
    font-size: 1.08em;
    margin-top: 2px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

#progress-percentage {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-celadon);
    display: block;
}

.progress-label {
    font-size: 0.9rem;
    color: var(--color-light-ink);
}

.achievement-badge {
    background: linear-gradient(135deg, var(--color-cinnabar) 0%, #E57373 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
}

.achievement-badge::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: achievement-shine 4s ease-in-out infinite;
}

@keyframes achievement-shine {

    0%,
    100% {
        transform: rotate(45deg) translateX(-100%);
    }

    50% {
        transform: rotate(45deg) translateX(100%);
    }
}

#achievement-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: var(--spacing-sm);
    z-index: 1;
    position: relative;
}

#achievement-text {
    font-family: var(--font-family-fun);
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 1;
    position: relative;
}

/* 打卡信息区域优化 */
.clockin-info {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f9f0 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-light);
    border: 2px solid rgba(127, 176, 105, 0.2);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.clockin-info span {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-celadon);
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.clockin-info span:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(4px);
}

/* ===== 主题进度列表 ===== */
.theme-progress-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    background: linear-gradient(135deg, #ffffff 0%, #f8fffe 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-medium);
    border: 2px solid rgba(127, 176, 105, 0.1);
    position: relative;
    overflow: hidden;
}

.theme-progress-list::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(127, 176, 105, 0.03), transparent);
    transform: rotate(45deg);
    animation: list-shimmer 4s ease-in-out infinite;
}

@keyframes list-shimmer {

    0%,
    100% {
        transform: rotate(45deg) translateX(-100%);
    }

    50% {
        transform: rotate(45deg) translateX(100%);
    }
}

.theme-progress-item {
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-light);
    border-left: 4px solid var(--color-celadon);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
    overflow: hidden;
}

.theme-progress-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(127, 176, 105, 0.1), transparent);
    transition: left 0.5s ease;
}

.theme-progress-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    border-left-color: var(--color-dark-celadon);
}

.theme-progress-item:hover::before {
    left: 100%;
}

.theme-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    position: relative;
    z-index: 1;
}

.theme-progress-name {
    font-family: var(--font-family-fun);
    font-size: 1.2rem;
    color: var(--color-ink);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.theme-progress-name::before {
    content: '';
    font-size: 1.1rem;
}

.theme-progress-stats {
    font-size: 0.9rem;
    color: var(--color-light-ink);
    background: rgba(127, 176, 105, 0.1);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.theme-progress-bar {
    width: 100%;
    height: 12px;
    background: var(--color-light-paper);
    border-radius: 6px;
    overflow: hidden;
}

.theme-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-celadon) 0%, var(--color-light-celadon) 100%);
    border-radius: 6px;
    transition: width 1s ease;
}

/* ===== 自定义确认弹窗 ===== */
.custom-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-confirm-overlay.show {
    opacity: 1;
    visibility: visible;
}

.custom-confirm-box {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-heavy);
    max-width: 400px;
    width: 90%;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.custom-confirm-overlay.show .custom-confirm-box {
    transform: scale(1);
}

.confirm-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.confirm-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--spacing-sm);
}

.confirm-title {
    font-family: var(--font-family-fun);
    color: var(--color-ink);
}

.confirm-message {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    color: var(--color-light-ink);
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: var(--spacing-md);
}

.confirm-btn {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-3d);
}

.confirm-btn:active {
    transform: translateY(4px);
    box-shadow: var(--shadow-3d-pressed);
}

.confirm-btn.cancel {
    background: var(--color-light-paper);
    color: var(--color-ink);
    box-shadow: 0 6px 0 #E6D4A3;
}

.confirm-btn.confirm {
    background: var(--color-cinnabar);
    color: white;
    box-shadow: 0 6px 0 #B73E3E;
}

/* ===== 熊猫助教 ===== */
.panda-container {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 500;
}

.panda-speech {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: var(--spacing-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    max-width: 250px;
}

.panda-speech.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.speech-content {
    background: white;
    border: 3px solid var(--color-celadon);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-medium);
    position: relative;
}

.speech-content p {
    margin: 0;
    color: var(--color-ink);
    font-size: 0.9rem;
    line-height: 1.4;
}

.speech-arrow {
    position: absolute;
    bottom: -10px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--color-celadon);
}

.panda-avatar {
    background: white;
    border-radius: 50%;
    padding: var(--spacing-sm);
    box-shadow: var(--shadow-medium);
    border: 3px solid var(--color-celadon);
    position: relative;
}

/* ===== 熊猫眨眼和挥手动画 ===== */
.panda-avatar {
    position: relative;
}

.panda-eyelid {
    transform-origin: center center;
    animation: panda-blink 4s infinite;
}

.panda-eyelid:nth-of-type(1) {
    animation-delay: 0s;
}

.panda-eyelid:nth-of-type(2) {
    animation-delay: 0.1s;
}

@keyframes panda-blink {

    0%,
    92%,
    100% {
        transform: scaleY(0.1) translateY(0);
        opacity: 0;
    }

    94%,
    97% {
        transform: scaleY(2) translateY(0);
        opacity: 0.85;
    }
}

#panda-hand {
    transform-origin: 60px 190px;
    animation: panda-wave 2.5s infinite ease-in-out;
}

@keyframes panda-wave {

    0%,
    100% {
        transform: rotate(-10deg);
    }

    10% {
        transform: rotate(-25deg);
    }

    20% {
        transform: rotate(-10deg);
    }

    30% {
        transform: rotate(-25deg);
    }

    40%,
    100% {
        transform: rotate(-10deg);
    }
}

/* ===== 熊猫跳跃、摇头、说话动画 ===== */
.panda-jump .panda-avatar {
    animation: panda-jump 1s cubic-bezier(.5, 1.8, .5, 1) 2;
}

@keyframes panda-jump {

    0%,
    100% {
        transform: translateY(0);
    }

    20% {
        transform: translateY(-35px);
    }

    40% {
        transform: translateY(0);
    }

    60% {
        transform: translateY(-20px);
    }

    80% {
        transform: translateY(0);
    }
}

.panda-shake #panda-head {
    animation: panda-shake 0.6s linear 2;
}

@keyframes panda-shake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    20% {
        transform: rotate(-25deg);
    }

    40% {
        transform: rotate(25deg);
    }

    60% {
        transform: rotate(-18deg);
    }

    80% {
        transform: rotate(18deg);
    }
}

.panda-talk #panda-mouth {
    animation: panda-mouth-talk 0.5s steps(2, end) infinite;
    transform-origin: 120px 170px;
}

@keyframes panda-mouth-talk {
    0% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(2);
    }

    100% {
        transform: scaleY(1);
    }
}

/* ===== 动画效果 ===== */
@keyframes shimmer {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

@keyframes bounce {

    0%,
    20%,
    53%,
    80%,
    100% {
        transform: translateY(0);
    }

    40%,
    43% {
        transform: translateY(-10px);
    }

    70% {
        transform: translateY(-5px);
    }

    90% {
        transform: translateY(-2px);
    }
}

.bounce {
    animation: bounce 1s ease;
}

/* ===== 笔顺分解样式 ===== */
.stroke-breakdown {
    display: flex;
    gap: 16px;
    margin: 20px 0 10px 0;
    justify-content: flex-start;
    align-items: flex-start;
    flex-wrap: wrap;
}

.stroke-box {
    position: relative;
    width: 56px;
    height: 72px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
    border: 2px solid var(--color-celadon);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transition: box-shadow 0.2s;
    padding-top: 4px;
    padding-bottom: 4px;
}

.stroke-box:hover {
    box-shadow: 0 4px 16px rgba(44, 62, 80, 0.18);
}

.stroke-number {
    position: static;
    margin-top: 4px;
    background: #7FC8F8;
    color: #fff;
    font-size: 0.9rem;
    font-weight: bold;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    z-index: 2;
}

.stroke-svg {
    width: 48px;
    height: 48px;
    display: block;
}

/* ===== 响应式设计 ===== */

/* 平板端优化 (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .theme-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: var(--spacing-lg);
    }

    .character-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: var(--spacing-md);
    }

    .detail-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .hanzi-display {
        width: 350px;
        height: 350px;
    }

    .progress-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
}

/* 移动端优化 (最大768px) */
@media (max-width: 768px) {

    /* 头部优化 */
    header {
        border-radius: 0 0 18px 18px;
        padding: var(--spacing-md) 0;
    }

    .header-content {
        padding: 0 var(--spacing-sm);
        flex-wrap: nowrap;
        gap: var(--spacing-xs);
    }

    .logo {
        flex: 1;
        min-width: 100px;
    }

    .logo-icon-bg {
        width: 38px;
        height: 38px;
    }

    .logo-icon {
        font-size: 1.3rem;
    }

    .logo-text {
        font-size: 1.2rem;
        letter-spacing: 0.5px;
    }

    .header-nav {
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 4px;
    }

    .nav-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 0.3em 0.6em;
        font-size: 0.9rem;
        border-radius: 12px;
    }

    .nav-btn .nav-btn-icon {
        font-size: 1.3rem;
    }

    /* 主容器优化 */
    #app-container {
        padding: var(--spacing-lg) var(--spacing-sm);
        min-height: calc(100vh - 100px);
    }

    /* 页面标题优化 */
    .page-title {
        font-size: 2.2rem;
        margin-bottom: var(--spacing-md);
    }

    .page-subtitle {
        font-size: 1.1rem;
    }

    /* 视图头部优化 */
    .view-header,
    .detail-header {
        margin-bottom: var(--spacing-lg);
        padding: 0 var(--spacing-sm);
    }

    .view-header .back-btn,
    .detail-header .back-btn {
        position: static;
        transform: none;
        margin-bottom: var(--spacing-sm);
        align-self: flex-start;
    }



    /* 主题网格优化 */
    .theme-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        padding: var(--spacing-md);
        margin-top: var(--spacing-lg);
    }

    .theme-card {
        padding: var(--spacing-xl);
        margin: 0 auto;
        max-width: 400px;
        width: 100%;
        border-radius: 16px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    }

    .theme-icon {
        font-size: 3.2rem;
        margin-bottom: var(--spacing-lg);
    }

    .theme-name {
        font-size: 1.3rem;
        margin-bottom: var(--spacing-md);
    }

    .theme-progress {
        font-size: 1rem;
        padding: 8px 16px;
    }

    /* 汉字网格优化 */
    .character-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: var(--spacing-md);
        padding: 0 var(--spacing-sm);
    }

    .character-card {
        height: 120px;
        padding: var(--spacing-md);
        border-radius: var(--radius-md);
    }

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

    .character-pinyin {
        font-size: 0.9rem;
    }

    /* 汉字详情页优化 */
    .detail-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .detail-header {
        flex-direction: column;
        gap: var(--spacing-lg);
        align-items: center;
        text-align: center;
    }

    .character-nav {
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .nav-char-btn {
        padding: 0.6em 1.2em;
        font-size: 1rem;
    }

    /* 汉字显示区域优化 */
    .hanzi-display {
        width: 280px;
        height: 280px;
        margin: 0 auto var(--spacing-md);
    }
    
    /* 确保HanziWriter在移动端正确居中 */
    #hanzi-writer-inner {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #hanzi-writer-inner svg {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
    }
    
    /* 移动端田字格优化 */
    .character-tianzige {
        width: 90px;
        height: 90px;
    }
    
    .character-text {
        font-size: 1.8rem;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        z-index: 2;
    }

    .character-main {
        margin-bottom: var(--spacing-lg);
    }

    .character-meta {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .character-title {
        font-size: 1.6rem;
    }

    /* 操作按钮优化 */
    .action-buttons {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        margin-top: var(--spacing-lg);
    }

    .action-btn {
        padding: var(--spacing-lg);
        font-size: 1.1rem;
        min-height: 56px;
        border-radius: var(--radius-md);
    }

    /* 信息区域优化 */
    .info-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .info-item {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-xs);
        padding: var(--spacing-md);
    }

    /* 进度页面优化 */
    .progress-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .main-progress {
        padding: var(--spacing-xl) var(--spacing-lg);
    }

    /* 熊猫助教优化 */
    .panda-container {
        bottom: var(--spacing-md);
        right: var(--spacing-md);
        transform: scale(0.9);
    }

    .panda-speech {
        max-width: 220px;
        font-size: 0.9rem;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    /* 组词和相关汉字优化 */
    .words-container,
    .related-container {
        justify-content: center;
    }

    .word-item,
    .related-item {
        min-width: 80px;
        text-align: center;
    }
}

/* 小屏手机优化 (最大480px) */
@media (max-width: 480px) {

    /* 头部进一步优化 */
    header {
        padding: var(--spacing-sm) 0;
    }

    .header-content {
        flex-direction: row;
        gap: var(--spacing-xs);
        padding: 0 var(--spacing-xs);
    }

    .logo {
        flex: 1;
        min-width: 80px;
    }

    .header-nav {
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 2px;
    }

    .nav-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 0.3em 0.6em;
        font-size: 0.9rem;
        border-radius: 12px;
    }

    .nav-btn .nav-btn-icon {
        font-size: 1.1rem;
    }

    .logo-icon-bg {
        width: 36px;
        height: 36px;
    }

    .logo-icon {
        font-size: 1.2rem;
    }

    .logo-text {
        font-size: 1.1rem;
        letter-spacing: 1px;
    }
    
    /* 在小屏手机上隐藏logo文字，只保留图标 */
    .logo-text {
        display: none;
    }
    
    /* 调整logo布局，让图标居中 */
    .logo {
        justify-content: center;
        min-width: auto;
    }
    
    .logo-icon-bg {
        margin-right: 0;
    }

    /* 主容器优化 */
    #app-container {
        padding: var(--spacing-md) var(--spacing-xs);
        min-height: calc(100vh - 120px);
    }

    /* 页面标题优化 */
    .page-title {
        font-size: 1.8rem;
        margin-bottom: var(--spacing-sm);
    }

    .page-subtitle {
        font-size: 1rem;
    }

    /* 主题卡片进一步优化 */
    .theme-card {
        padding: var(--spacing-lg);
        margin: 0;
        max-width: none;
        border-radius: 12px;
    }

    .theme-icon {
        font-size: 2.8rem;
        margin-bottom: var(--spacing-md);
    }

    .theme-name {
        font-size: 1.1rem;
        margin-bottom: var(--spacing-sm);
    }

    .theme-progress {
        font-size: 0.9rem;
        padding: 6px 12px;
    }

    /* 汉字网格进一步优化 */
    .character-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: var(--spacing-sm);
        padding: 0 var(--spacing-xs);
    }

    .character-card {
        height: 100px;
        padding: var(--spacing-sm);
    }

    .character-text {
        font-size: 1.6rem;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        z-index: 2;
    }

    .character-pinyin {
        font-size: 0.8rem;
    }

    /* 小屏手机田字格优化 */
    .character-tianzige {
        width: 75px;
        height: 75px;
    }

    /* 汉字详情页进一步优化 */
    .detail-header {
        gap: var(--spacing-md);
        padding: 0 var(--spacing-xs);
    }

    .nav-char-btn {
        padding: 0.5em 1em;
        font-size: 0.9rem;
    }

    .nav-char-btn span {
        font-size: 1.2em;
        width: 1.5em;
        height: 1.5em;
    }

    .hanzi-display {
        width: 160px;
        height: 160px;
    }

    .character-title {
        font-size: 1.4rem;
    }

    .character-meta {
        gap: var(--spacing-md);
    }

    /* 操作按钮进一步优化 */
    .action-btn {
        padding: var(--spacing-md);
        font-size: 1rem;
        min-height: 48px;
        border-radius: var(--radius-sm);
    }

    /* 信息区域进一步优化 */
    .info-section {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }

    .info-section h3 {
        font-size: 1rem;
        margin-bottom: var(--spacing-sm);
    }

    .info-item {
        padding: var(--spacing-sm);
        gap: var(--spacing-xs);
    }

    /* 进度页面进一步优化 */
    .main-progress {
        padding: var(--spacing-lg);
    }

    .progress-circle {
        margin-bottom: var(--spacing-md);
    }

    /* 熊猫助教进一步优化 */
    .panda-container {
        bottom: var(--spacing-sm);
        right: var(--spacing-sm);
        transform: scale(0.8);
    }

    .panda-speech {
        max-width: 180px;
        font-size: 0.8rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    /* 弹窗优化 */
    .custom-confirm-box {
        padding: var(--spacing-lg);
        margin: var(--spacing-md);
        max-width: calc(100vw - 32px);
    }

    /* 组词和相关汉字进一步优化 */
    .word-item,
    .related-item {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.9rem;
        min-width: 60px;
    }

    .word-pinyin {
        font-size: 0.7rem;
    }

    /* 返回按钮优化 */
    .back-btn {
        padding: 6px 12px 6px 8px;
        font-size: 0.9rem;
        border-radius: 14px;
    }

    .back-btn-text {
        font-size: 0.9rem;
    }
}

/* ===== 打印样式 ===== */
@media print {

    .header-nav,
    .panda-container,
    .custom-confirm-overlay {
        display: none !important;
    }

    body {
        background: white;
    }

    .view {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ===== 主题卡片点击动画 ===== */
.theme-card:active {
    transform: scale(0.96) translateY(2px);
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.10);
    border-color: var(--color-celadon);
}

/* 波纹动画 */
.theme-card:active::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 120%;
    height: 120%;
    background: rgba(127, 176, 105, 0.18);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    animation: ripple 0.4s;
    pointer-events: none;
    z-index: 2;
}

@keyframes ripple {
    0% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(0.7);
    }

    80% {
        opacity: 0.2;
        transform: translate(-50%, -50%) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

/* ===== 汉字卡片动画 ===== */
.character-card {
    transition: all 0.25s cubic-bezier(.5, 1.8, .5, 1);
    border: 2px solid transparent;
}

.character-card:hover {
    transform: scale(1.08) translateY(-4px);
    box-shadow: var(--shadow-medium);
    border: 2px solid var(--color-celadon);
    z-index: 2;
    animation: char-bounce 0.35s;
}

.character-card:active {
    transform: scale(0.96) translateY(2px);
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.10);
    border-color: var(--color-celadon);
}

@keyframes char-bounce {
    0% {
        transform: scale(1) translateY(0);
    }

    40% {
        transform: scale(1.12) translateY(-8px);
    }

    60% {
        transform: scale(0.98) translateY(2px);
    }

    100% {
        transform: scale(1.08) translateY(-4px);
    }
}

.character-pinyin,
.character-text {
    transition: transform 0.18s cubic-bezier(.5, 1.8, .5, 1);
}

.character-card:hover .character-pinyin,
.character-card:hover .character-text {
    transform: scale(1.12);
}

/* ===== 操作按钮动画 ===== */
.action-btn {
    transition: all 0.18s cubic-bezier(.5, 1.8, .5, 1), box-shadow 0.18s;
    position: relative;
    overflow: hidden;
}

.action-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.action-btn:active {
    transform: scale(0.96) translateY(2px);
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.10);
}

.action-btn:active::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 120%;
    height: 120%;
    background: rgba(214, 69, 69, 0.12);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    animation: ripple 0.4s;
    pointer-events: none;
    z-index: 2;
}

/* ===== 弹窗、气泡、详情页动画 ===== */
.custom-confirm-overlay,
.panda-speech,
.view {
    transition: opacity 0.35s cubic-bezier(.5, 1.8, .5, 1), transform 0.35s cubic-bezier(.5, 1.8, .5, 1);
}

.custom-confirm-overlay.show,
.panda-speech.show,
.view.active {
    animation: fadeInScale 0.4s cubic-bezier(.5, 1.8, .5, 1);
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ===== 成就徽章动画 ===== */
.achievement-badge {
    animation: badge-bounce 1s cubic-bezier(.5, 1.8, .5, 1);
    box-shadow: 0 0 24px 4px #FFD70044, 0 4px 16px rgba(44, 62, 80, 0.15);
}

@keyframes badge-bounce {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
        opacity: 1;
    }

    80% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1);
    }
}

.badge-animate {
    animation: badge-rotate 1.2s cubic-bezier(.5, 1.8, .5, 1), badge-glow 1.2s cubic-bezier(.5, 1.8, .5, 1);
    box-shadow: 0 0 32px 8px #FFD70088, 0 4px 16px rgba(44, 62, 80, 0.18);
}

@keyframes badge-rotate {
    0% {
        transform: scale(0.7) rotate(0deg);
    }

    40% {
        transform: scale(1.2) rotate(180deg);
    }

    70% {
        transform: scale(1.1) rotate(340deg);
    }

    100% {
        transform: scale(1) rotate(360deg);
    }
}

@keyframes badge-glow {
    0% {
        box-shadow: 0 0 0 0 #FFD70000;
    }

    40% {
        box-shadow: 0 0 32px 8px #FFD70088;
    }

    100% {
        box-shadow: 0 0 0 0 #FFD70000;
    }
}

/* 烟花动画容器 */
.firework-container {
    position: fixed;
    left: 50%;
    top: 30%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2000;
}

/* ===== 进度条动画 ===== */
.theme-progress-fill,
.progress-ring-fill {
    transition: width 1s cubic-bezier(.5, 1.8, .5, 1), stroke-dashoffset 1s cubic-bezier(.5, 1.8, .5, 1);
}

/* 移除.nav-char-btn相关样式，避免干扰 */
.nav-btn,
.nav-btn-home,
.nav-btn-progress,
.nav-btn-danger {
    all: unset;
}

.header-nav .action-btn.primary,
.header-nav .action-btn.accent {
    border-radius: 18px;
    min-width: 48px;
    min-height: 48px;
    font-size: 1.2rem;
    font-family: var(--font-family-fun);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    box-shadow: var(--shadow-light);
    padding: 0.5em 1.1em;
    transition: all 0.18s cubic-bezier(.5, 1.8, .5, 1);
}

.header-nav .action-btn.primary .nav-btn-icon,
.header-nav .action-btn.accent .nav-btn-icon {
    color: #fff;
    font-size: 1.7rem;
    display: block;
    line-height: 1;
    transition: transform 0.18s;
}

.header-nav .action-btn.primary:hover,
.header-nav .action-btn.accent:hover {
    transform: scale(1.12) translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.header-nav .action-btn.primary:active,
.header-nav .action-btn.accent:active {
    transform: scale(0.96) translateY(2px);
    box-shadow: var(--shadow-3d-pressed);
}

/* 新的标题和打卡信息布局 */
.header-with-clockin {
    position: relative;
    margin-bottom: var(--spacing-xl);
}

.title-section {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

/* 进度页面的打卡信息区域 */
.progress-clockin-info {
    background: linear-gradient(135deg, #f0f9f0 0%, #e8f5e8 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-light);
    border: 2px solid rgba(127, 176, 105, 0.2);
    margin-bottom: var(--spacing-lg);
    position: relative;
    overflow: hidden;
}

.home-clockin-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: clockin-shine 6s infinite;
}

@keyframes clockin-shine {
    0% {
        left: -100%;
    }

    50% {
        left: 100%;
    }

    100% {
        left: 100%;
    }
}

.home-clockin-info span {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    text-align: right;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: flex-end;
}

.home-clockin-info span:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateX(-2px);
}

#home-clockin-status {
    font-weight: bold;
    font-size: 1rem;
    color: var(--color-success);
    text-shadow: 0 1px 2px rgba(76, 175, 80, 0.2);
}

#home-clockin-status::before {
    content: '📅';
    margin-right: 6px;
    font-size: 1.1rem;
}

#home-clockin-streak {
    color: var(--color-celadon);
    font-weight: bold;
    font-size: 0.95rem;
}

#home-clockin-streak::before {
    content: '🔥';
    margin-right: 6px;
    font-size: 1rem;
}

#home-clockin-maxstreak {
    color: #f39c12;
    font-size: 0.9rem;
    font-weight: 600;
}

#home-clockin-maxstreak::before {
    content: '🏆';
    margin-right: 6px;
    font-size: 1rem;
}

/* 优化的帮助弹窗样式 */
#help-modal-overlay .custom-confirm-box {
    max-width: 480px;
    min-width: 360px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(127, 176, 105, 0.2);
}

#help-modal-content {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

.help-content {
    font-family: var(--font-family-fun);
    line-height: 1.6;
}

.help-header {
    text-align: center;
    padding: 24px 20px 16px;
    background: linear-gradient(135deg, #f8fdf8 0%, #f0f9f0 100%);
    border-radius: 14px 14px 0 0;
    border-bottom: 2px solid rgba(127, 176, 105, 0.1);
}

.help-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

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

.help-title h3 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--color-celadon);
    font-weight: 600;
}

.help-subtitle {
    font-size: 0.95rem;
    color: #666;
    font-style: italic;
}

.help-section {
    padding: 20px;
    border-bottom: 1px solid rgba(127, 176, 105, 0.1);
}

.help-section:last-of-type {
    border-bottom: none;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.section-icon {
    font-size: 1.3rem;
}

.section-title h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-celadon);
    font-weight: 600;
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.help-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(127, 176, 105, 0.05);
    border-radius: 10px;
    border-left: 3px solid var(--color-celadon);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--color-celadon);
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content strong {
    display: block;
    color: var(--color-celadon);
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.step-content p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(127, 176, 105, 0.05);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.feature-item:hover {
    background: rgba(127, 176, 105, 0.1);
    transform: translateY(-1px);
}

.feature-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.feature-text strong {
    display: block;
    color: var(--color-celadon);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.feature-text p {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
}

.privacy-note {
    padding: 16px;
    background: linear-gradient(135deg, #fff9e6 0%, #fef7e0 100%);
    border-radius: 10px;
    border: 1px solid #f0d000;
}

.privacy-note p {
    margin: 0;
    font-size: 0.9rem;
    color: #8b6914;
    text-align: center;
}

.help-footer {
    padding: 20px;
    text-align: center;
    background: linear-gradient(135deg, #f8fdf8 0%, #f0f9f0 100%);
    border-radius: 0 0 14px 14px;
}

.encouragement {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.party-icon {
    font-size: 1.2rem;
}

.encouragement p {
    margin: 0;
    font-size: 1rem;
    color: var(--color-celadon);
    font-weight: 500;
}

/* 弹窗动画效果 */
#help-modal-overlay {
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

#help-modal-overlay.show .custom-confirm-box {
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 步骤动画 */
.help-step {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.help-step:nth-child(1) {
    animation-delay: 0.1s;
}

.help-step:nth-child(2) {
    animation-delay: 0.2s;
}

.help-step:nth-child(3) {
    animation-delay: 0.3s;
}

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

/* 功能卡片动画 */
.feature-item {
    animation: fadeInScale 0.5s ease forwards;
    opacity: 0;
    transform: scale(0.8);
}

.feature-item:nth-child(1) {
    animation-delay: 0.2s;
}

.feature-item:nth-child(2) {
    animation-delay: 0.3s;
}

.feature-item:nth-child(3) {
    animation-delay: 0.4s;
}

.feature-item:nth-child(4) {
    animation-delay: 0.5s;
}

@keyframes fadeInScale {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 关闭按钮优化 */
#help-modal-close {
    background: linear-gradient(135deg, var(--color-celadon) 0%, #6ba54a 100%);
    border: none;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(127, 176, 105, 0.3);
}

#help-modal-close:hover {
    background: linear-gradient(135deg, #6ba54a 0%, var(--color-celadon) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127, 176, 105, 0.4);
}

#help-modal-close:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(127, 176, 105, 0.3);
}

/* 隐私提示优化 */
.privacy-note {
    position: relative;
    overflow: hidden;
}

.privacy-note::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* 鼓励消息动画 */
.encouragement {
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-5px);
    }

    60% {
        transform: translateY(-3px);
    }
}

/* 图标旋转效果 */
.help-icon,
.section-icon,
.feature-icon {
    transition: transform 0.3s ease;
}

.help-section:hover .section-icon,
.feature-item:hover .feature-icon {
    transform: scale(1.1) rotate(5deg);
}

/* 搜索弹窗样式 */
.search-modal-box {
    max-width: 600px;
    min-width: 400px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(127, 176, 105, 0.2);
    padding: 0;
    overflow: hidden;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f8fdf8 0%, #f0f9f0 100%);
    border-bottom: 2px solid rgba(127, 176, 105, 0.1);
}

.search-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.3rem;
    color: var(--color-celadon);
    font-weight: 600;
    font-family: var(--font-family-fun);
}

.search-icon {
    font-size: 1.4rem;
}

.search-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
}

.search-close-btn:hover {
    background: rgba(127, 176, 105, 0.1);
    color: var(--color-celadon);
    transform: scale(1.1);
}

.search-input-container {
    padding: 20px 24px 16px;
    background: white;
}

#search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(127, 176, 105, 0.3);
    border-radius: 12px;
    font-size: 1rem;
    font-family: var(--font-family-fun);
    outline: none;
    transition: all 0.3s ease;
    background: rgba(127, 176, 105, 0.05);
}

#search-input:focus {
    border-color: var(--color-celadon);
    box-shadow: 0 0 0 3px rgba(127, 176, 105, 0.1);
    background: white;
}

.search-suggestions {
    margin-top: 8px;
    text-align: center;
}

.suggestion-tip {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 0 24px 20px;
    background: white;
}

.search-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.6;
}

.search-empty p {
    font-size: 1.1rem;
    margin-bottom: 24px;
    color: var(--color-light-ink);
}

.search-tips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    max-width: 300px;
    margin: 0 auto;
}

.tip-item {
    font-size: 0.9rem;
    color: #888;
    padding: 6px 12px;
    background: rgba(127, 176, 105, 0.05);
    border-radius: 8px;
    border-left: 3px solid rgba(127, 176, 105, 0.3);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: rgba(127, 176, 105, 0.05);
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-result-item:hover {
    background: rgba(127, 176, 105, 0.1);
    border-color: var(--color-celadon);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(127, 176, 105, 0.2);
}

.search-result-char {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-celadon);
    min-width: 50px;
    text-align: center;
}

.search-result-info {
    flex: 1;
}

.search-result-pinyin {
    font-size: 1rem;
    color: var(--color-cinnabar);
    font-weight: bold;
    margin-bottom: 4px;
}

.search-result-meaning {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

.search-result-theme {
    font-size: 0.8rem;
    color: var(--color-celadon);
    background: rgba(127, 176, 105, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    white-space: nowrap;
}

.search-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.search-no-results .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.search-no-results p {
    font-size: 1rem;
    margin-bottom: 16px;
}

.search-retry-tip {
    font-size: 0.9rem;
    color: #888;
    font-style: italic;
}

/* 搜索动画效果 */
#search-modal-overlay.show .search-modal-box {
    animation: searchModalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes searchModalSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.search-result-item {
    animation: searchResultFadeIn 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

.search-result-item:nth-child(1) {
    animation-delay: 0.1s;
}

.search-result-item:nth-child(2) {
    animation-delay: 0.15s;
}

.search-result-item:nth-child(3) {
    animation-delay: 0.2s;
}

.search-result-item:nth-child(4) {
    animation-delay: 0.25s;
}

.search-result-item:nth-child(5) {
    animation-delay: 0.3s;
}

@keyframes searchResultFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {

    /* 移除悬停效果，优化触摸体验 */
    .theme-card:hover,
    .character-card:hover,
    .nav-btn:hover,
    .action-btn:hover {
        transform: none;
    }

    /* 增大触摸目标 */
    .nav-btn {
        min-width: 48px;
        min-height: 48px;
        padding: 0.5em 1em;
    }

    .action-btn {
        min-height: 48px;
        padding: var(--spacing-md) var(--spacing-lg);
    }

    .character-card {
        min-height: 120px;
    }

    /* 优化触摸反馈 */
    .theme-card:active,
    .character-card:active,
    .nav-btn:active,
    .action-btn:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* 搜索功能移动端优化 */
@media (max-width: 768px) {
    .search-modal-overlay {
        padding: var(--spacing-sm);
    }

    .search-modal-box {
        max-width: 100%;
        min-width: auto;
        margin: 0;
        max-height: 90vh;
        border-radius: var(--radius-md);
    }

    .search-header {
        padding: var(--spacing-lg);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .search-title {
        font-size: 1.2rem;
    }

    .search-input-container {
        padding: var(--spacing-lg);
    }

    .search-input {
        font-size: 16px;
        /* 防止iOS缩放 */
        padding: var(--spacing-md);
        border-radius: var(--radius-sm);
    }

    .search-results {
        padding: 0 var(--spacing-lg) var(--spacing-lg);
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .search-result-item {
        padding: var(--spacing-md);
        border-radius: var(--radius-sm);
        margin-bottom: var(--spacing-sm);
        min-height: 60px;
        display: flex;
        align-items: center;
        gap: var(--spacing-md);
    }

    .search-result-char {
        font-size: 1.8rem;
        min-width: 50px;
        text-align: center;
    }

    .search-result-info {
        flex: 1;
        text-align: left;
    }

    .search-result-pinyin {
        font-size: 1rem;
        font-weight: bold;
    }

    .search-result-meaning {
        font-size: 0.9rem;
        margin: 2px 0;
    }

    .search-result-theme {
        font-size: 0.8rem;
        opacity: 0.7;
    }

    .search-tips {
        padding: var(--spacing-md);
        background: rgba(127, 176, 105, 0.05);
        border-radius: var(--radius-sm);
        margin-top: var(--spacing-md);
    }

    .tip-item {
        padding: var(--spacing-xs) 0;
        font-size: 0.9rem;
    }
}

/* 帮助弹窗移动端优化 */
@media (max-width: 768px) {
    #help-modal-overlay .custom-confirm-box {
        max-width: 95vw;
        min-width: auto;
        margin: var(--spacing-md);
        max-height: 85vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #help-modal-content {
        font-size: 0.9rem;
        line-height: 1.6;
        padding: var(--spacing-md);
    }

    #help-modal-content b {
        font-size: 1rem;
        display: block;
        margin: var(--spacing-md) 0 var(--spacing-sm) 0;
    }

    .help-section {
        margin-bottom: var(--spacing-lg);
    }
}

/* 进度页面移动端优化 */
@media (max-width: 768px) {
    .theme-progress-list {
        gap: var(--spacing-sm);
    }

    .theme-progress-item {
        padding: var(--spacing-md);
        border-radius: var(--radius-sm);
        display: flex;
        align-items: center;
        gap: var(--spacing-md);
    }

    .theme-progress-icon {
        font-size: 1.5rem;
        min-width: 40px;
        text-align: center;
    }

    .theme-progress-info {
        flex: 1;
    }

    .theme-progress-name {
        font-size: 1rem;
        font-weight: bold;
        margin-bottom: 2px;
    }

    .theme-progress-stats {
        font-size: 0.8rem;
        opacity: 0.7;
    }

    .theme-progress-bar {
        height: 6px;
        border-radius: 3px;
        margin-top: var(--spacing-xs);
    }
}

/* 描红练习移动端优化 */
@media (max-width: 768px) {
    .practice-modal-overlay {
        padding: var(--spacing-sm);
    }

    .practice-modal-box {
        max-width: 100%;
        min-width: auto;
        margin: 0;
        max-height: 90vh;
    }

    .practice-canvas-container {
        padding: var(--spacing-md);
    }

    .practice-canvas {
        max-width: 100%;
        height: auto;
        border-radius: var(--radius-sm);
    }

    .practice-controls {
        padding: var(--spacing-md);
        display: flex;
        justify-content: space-around;
        gap: var(--spacing-sm);
    }

    .practice-btn {
        flex: 1;
        min-height: 44px;
        font-size: 0.9rem;
        border-radius: var(--radius-sm);
    }
}

/* 小屏手机搜索优化 */
@media (max-width: 480px) {
    .search-modal-box {
        max-height: 95vh;
    }

    .search-header {
        padding: var(--spacing-md);
    }

    .search-title {
        font-size: 1.1rem;
    }

    .search-input-container {
        padding: var(--spacing-md);
    }

    .search-results {
        padding: 0 var(--spacing-md) var(--spacing-md);
        max-height: 60vh;
    }

    .search-result-item {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-xs);
        padding: var(--spacing-sm);
        min-height: auto;
    }

    .search-result-char {
        font-size: 1.5rem;
        min-width: auto;
    }

    .search-result-info {
        text-align: center;
    }

    .search-result-pinyin {
        font-size: 0.9rem;
    }

    .search-result-meaning {
        font-size: 0.8rem;
    }

    .search-result-theme {
        font-size: 0.7rem;
        margin-top: var(--spacing-xs);
        padding: 2px 6px;
        background: rgba(127, 176, 105, 0.1);
        border-radius: 10px;
        display: inline-block;
    }

    .tip-item {
        font-size: 0.8rem;
        padding: var(--spacing-xs) 0;
    }
}

.step-number {
    align-self: center;
}

/* 启动页样式 */
#app-loader {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--color-light-paper) 0%, var(--color-paper) 100%), url('data:image/svg+xml;utf8,<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="120" height="120" fill="%23fdf2e6"/><path d="M0 60 Q30 65 60 60 T120 60" stroke="%23f7e7ce" stroke-width="2" fill="none"/><circle cx="30" cy="90" r="2" fill="%23f7e7ce"/><circle cx="90" cy="30" r="1.5" fill="%23f7e7ce"/></svg>');
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 5s cubic-bezier(.5, 1.8, .5, 1);
}

#app-loader.hide {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    animation: fadeInScale 0.8s;
}

/* 熊猫动画包裹层：上下浮动 */
.loader-panda-anim {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: panda-float 2.8s ease-in-out infinite;
}

@keyframes panda-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-16px);
    }
}

.loader-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 2.1rem;
    font-family: var(--font-family-fun);
    color: var(--color-celadon);
    font-weight: bold;
    letter-spacing: 2px;
}

.loader-logo .logo-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 2px 2px #e6d4a3);
}

.loader-panda {
    margin: 0 0 8px 0;
    position: relative;
    z-index: 2;
}

/* 熊猫眨眼动画 */
.panda-svg .panda-eyelid {
    transform-origin: center center;
    animation: panda-blink-loader 4s infinite;
}

@keyframes panda-blink-loader {

    0%,
    92%,
    100% {
        transform: scaleY(0.1) translateY(0);
        opacity: 0;
    }

    94%,
    97% {
        transform: scaleY(2) translateY(0);
        opacity: 0.85;
    }
}

/* 熊猫地面阴影 */
.panda-shadow {
    width: 60px;
    height: 14px;
    background: radial-gradient(ellipse at center, #d6c7b1 60%, #f7e7ce 100%);
    opacity: 0.45;
    border-radius: 50%;
    margin: -8px auto 8px auto;
    z-index: 1;
}

.loader-animation {
    display: flex;
    gap: 8px;
    margin: 8px 0 0 0;
}

.loader-animation .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7FB069 0%, #A8D084 100%);
    opacity: 0.8;
    animation: loader-bounce 1.2s infinite both;
}

.loader-animation .dot:nth-child(2) {
    animation-delay: 0.2s;
    background: linear-gradient(135deg, #D64545 0%, #F7E7CE 100%);
}

.loader-animation .dot:nth-child(3) {
    animation-delay: 0.4s;
    background: linear-gradient(135deg, #2C3E50 0%, #7FB069 100%);
}

@keyframes loader-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.loader-welcome {
    font-size: 2.1rem;
    font-family: var(--font-family-fun);
    font-weight: 900;
    margin-top: 32px;
    letter-spacing: 1.5px;
    color: var(--color-celadon);
    text-align: center;
    background: none;
}

.loader-subtitle {
    font-size: 1.05rem;
    color: #7FB069;
    margin-top: 2px;
    font-family: var(--font-family-fun);
    letter-spacing: 0.5px;
    opacity: 0.85;
    text-align: center;
}

/* 启动页立体卡片 */
.loader-card {
    background: #fffbe6cc;
    border-radius: 32px;
    box-shadow: 0 8px 32px rgba(127, 176, 105, 0.18), 0 2px 0 #e6d4a3;
    padding: 36px 36px 32px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 320px;
    max-width: 95vw;
    margin: 0 auto;
    position: relative;
}

/* 熊猫卡片渐变背景 */
.panda-card-bg {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #f7e7ce 60%, #a8d084 100%);
    border-radius: 32px;
    z-index: 0;
    box-shadow: 0 4px 24px #7fb06922;
    opacity: 0.55;
    filter: blur(2px);
}

.loader-logo {
    margin-bottom: 8px;
    z-index: 2;
}

.loader-panda-anim {
    margin-bottom: 0px;
    margin-top: 0px;
    z-index: 2;
}

.loader-panda {
    margin-bottom: 0px;
    margin-top: 0px;
    z-index: 2;
}

/* 熊猫欢迎气泡 */
.panda-speech-bubble {
    margin-top: 6px;
    margin-bottom: 2px;
    background: linear-gradient(90deg, #fffbe6 60%, #f7e7ce 100%);
    color: #7FB069;
    font-family: var(--font-family-fun);
    font-size: 1.08rem;
    font-weight: bold;
    border-radius: 18px;
    box-shadow: 0 2px 8px #e6d4a344;
    padding: 6px 18px 6px 16px;
    display: inline-block;
    position: relative;
    z-index: 2;
}

.panda-speech-bubble::after {
    content: '';
    position: absolute;
    left: 32px;
    top: 100%;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #fffbe6;
    filter: drop-shadow(0 2px 2px #e6d4a3);
}

.loader-welcome {
    margin-top: 32px;
}

.loader-subtitle {
    margin-top: 8px;
}

@media (max-width: 480px) {
    .loader-card {
        padding: 18px 4vw 18px 4vw;
        min-width: 0;
        border-radius: 18px;
    }

    .panda-card-bg {
        width: 80px;
        height: 80px;
        border-radius: 18px;
    }
}

#app-loader .loader-logo .logo-text {
    color: var(--color-celadon) !important;
    font-weight: bold;
    text-shadow: none;
}

/* ==
=== 横屏模式优化 ===== */
@media (max-width: 768px) and (orientation: landscape) {

    /* 头部在横屏时更紧凑 */
    header {
        padding: var(--spacing-sm) 0;
    }

    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0 var(--spacing-md);
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .nav-btn {
        min-width: 36px;
        min-height: 36px;
        padding: 0.3em 0.6em;
    }

    /* 主容器在横屏时调整 */
    #app-container {
        padding: var(--spacing-md) var(--spacing-sm);
        min-height: calc(100vh - 80px);
    }

    /* 主题网格在横屏时使用多列 */
    .theme-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: var(--spacing-md);
    }

    .theme-card {
        padding: var(--spacing-md);
    }

    .theme-icon {
        font-size: 2.5rem;
        margin-bottom: var(--spacing-sm);
    }

    .theme-name {
        font-size: 1.1rem;
    }

    /* 汉字网格在横屏时更紧凑 */
    .character-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: var(--spacing-sm);
    }

    .character-card {
        height: 100px;
        padding: var(--spacing-sm);
    }

    .character-text {
        font-size: 1.8rem;
    }

    /* 汉字详情页在横屏时使用两列布局 */
    .detail-content {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-lg);
    }

    .hanzi-display {
        width: 180px;
        height: 180px;
    }

    /* 熊猫助教在横屏时位置调整 */
    .panda-container {
        bottom: var(--spacing-sm);
        right: var(--spacing-sm);
        transform: scale(0.7);
    }
}

/* ===== 超小屏幕优化 (320px以下) ===== */
@media (max-width: 320px) {
    .header-content {
        padding: 0 var(--spacing-xs);
    }

    .logo-text {
        display: none; /* 超小屏也隐藏logo文字 */
    }
    
    /* 调整logo布局 */
    .logo {
        justify-content: center;
        min-width: auto;
    }

    .nav-btn {
        min-width: 36px;
        min-height: 36px;
        padding: 0.2em 0.4em;
        font-size: 0.8rem;
    }

    .nav-btn .nav-btn-icon {
        font-size: 1rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .theme-card {
        padding: var(--spacing-md);
    }

    .theme-icon {
        font-size: 2.5rem;
    }

    .theme-name {
        font-size: 1rem;
    }

    .character-grid {
        grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
        gap: var(--spacing-xs);
    }

    .character-card {
        height: 90px;
        padding: var(--spacing-xs);
    }

    .character-text {
        font-size: 1.4rem;
    }

    .character-pinyin {
        font-size: 0.7rem;
    }

    .hanzi-display {
        width: 140px;
        height: 140px;
    }
}

/* ===== 高分辨率屏幕优化 ===== */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .character-text,
    .theme-icon,
    .logo-icon {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .nav-btn,
    .action-btn,
    .theme-card,
    .character-card {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* ===== 深色模式支持 ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --color-paper: #2C3E50;
        --color-light-paper: #34495E;
        --color-ink: #ECF0F1;
        --color-light-ink: #BDC3C7;
    }

    body {
        background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
        color: var(--color-ink);
    }

    .theme-card,
    .character-card,
    .info-section,
    .main-progress {
        background: rgba(52, 73, 94, 0.8);
        color: var(--color-ink);
        border-color: rgba(127, 176, 105, 0.3);
    }

    .hanzi-display {
        background: rgba(44, 62, 80, 0.9);
        border-color: var(--color-celadon);
    }
}

/* ===== 减少动画偏好支持 ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .theme-card:hover,
    .character-card:hover,
    .nav-btn:hover {
        transform: none;
    }
}

/* ===== 打印样式优化 ===== */
@media print {

    header,
    .header-nav,
    .panda-container,
    .custom-confirm-overlay,
    .search-modal-overlay,
    .nav-btn,
    .action-btn {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.4;
    }

    .view {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
        page-break-inside: avoid;
    }

    .theme-card,
    .character-card {
        border: 1px solid #ccc;
        box-shadow: none;
        background: white;
        page-break-inside: avoid;
        margin-bottom: 10pt;
    }

    .page-title {
        font-size: 18pt;
        color: black !important;
        text-shadow: none;
        background: none !important;
        -webkit-text-fill-color: black !important;
    }

    .hanzi-display {
        border: 2px solid #333;
        background: white;
    }
}

/* ===== 无障碍访问优化 ===== */
@media (prefers-contrast: high) {
    :root {
        --color-celadon: #2E7D32;
        --color-cinnabar: #C62828;
        --color-ink: #000000;
        --color-light-ink: #424242;
    }

    .theme-card,
    .character-card,
    .nav-btn {
        border-width: 3px;
        box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
    }

    .character-text,
    .theme-name,
    .page-title {
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    }
}

/* ===== 焦点可见性优化 ===== */
.nav-btn:focus-visible,
.action-btn:focus-visible,
.theme-card:focus-visible,
.character-card:focus-visible,
.back-btn:focus-visible {
    outline: 3px solid var(--color-celadon);
    outline-offset: 2px;
}

/* ===== 触摸设备滚动优化 ===== */
.search-results,
.theme-grid,
.character-grid,
#help-modal-content {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* ===== iOS Safari 特殊优化 ===== */
@supports (-webkit-touch-callout: none) {

    /* iOS Safari 特有样式 */
    .nav-btn,
    .action-btn,
    .theme-card,
    .character-card {
        -webkit-tap-highlight-color: rgba(127, 176, 105, 0.2);
    }

    /* 防止iOS缩放 */
    input,
    textarea,
    select {
        font-size: 16px !important;
    }

    /* 优化iOS滚动性能 */
    body {
        -webkit-overflow-scrolling: touch;
    }

    /* 防止iOS双击缩放 */
    * {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    /* 允许文本选择的元素 */
    .character-pinyin,
    .character-definition,
    .word-item {
        -webkit-user-select: text;
        user-select: text;
    }

    /* iOS安全区域适配 */
    header {
        padding-top: max(var(--spacing-lg), env(safe-area-inset-top));
    }

    #app-container {
        padding-left: max(var(--spacing-md), env(safe-area-inset-left));
        padding-right: max(var(--spacing-md), env(safe-area-inset-right));
        padding-bottom: max(var(--spacing-xl), env(safe-area-inset-bottom));
    }
}

/* ===== Android Chrome 特殊优化 ===== */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .001dpcm) {

    /* Android Chrome 特有样式 */
    .theme-card,
    .character-card {
        will-change: transform;
    }

    .nav-btn:active,
    .action-btn:active {
        background-color: rgba(127, 176, 105, 0.1);
    }
}

/* ===== 性能优化 ===== */
.theme-card,
.character-card,
.nav-btn,
.action-btn {
    contain: layout style paint;
}

.theme-grid,
.character-grid {
    contain: layout;
}

/* ===== 最终的移动端优化总结 ===== */
@media (max-width: 768px) {

    /* 确保所有交互元素都有足够的触摸目标大小 */
    button,
    .nav-btn,
    .action-btn,
    .theme-card,
    .character-card,
    .back-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* 优化文字可读性 */
    body {
        font-size: 16px;
        line-height: 1.5;
    }

    /* 确保内容不会被遮挡 */
    .view {
        padding-bottom: 80px;
        /* 为熊猫助教留出空间 */
    }

    /* 优化滚动体验 */
    html {
        scroll-padding-top: 100px;
        /* 为固定头部留出空间 */
    }
}

@keyframes shadow-pulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 0.45;
    }

    50% {
        transform: translateX(-50%) scale(1.1);
        opacity: 0.3;
    }
}

/* =====
 顶部导航栏打卡状态指示器 ===== */


@keyframes checkin-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

@keyframes streak-glow {
    0% {
        box-shadow: 0 0 8px rgba(255, 107, 53, 0.6);
    }

    100% {
        box-shadow: 0 0 12px rgba(255, 107, 53, 0.9), 0 0 16px rgba(255, 107, 53, 0.4);
    }
}

/* 进度按钮的相对定位 */
#progress-btn {
    position: relative;
}

/* 移动端打卡指示器优化 */
@media (max-width: 768px) {
    .checkin-indicator {
        width: 10px;
        height: 10px;
        top: -1px;
        right: -1px;
    }
}/* =
==== 移动端田字格和汉字显示修复 ===== */

/* 移动端汉字显示区域进一步优化 */
@media (max-width: 768px) {
    /* 确保HanziWriter在移动端正确居中和缩放 */
    .hanzi-display {
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }
    
    #hanzi-writer-inner {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #hanzi-writer-inner svg {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
    
    #hanzi-writer-inner svg {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }
    
    /* 田字格背景在移动端的调整 */
    .hanzi-tianzige-bg {
        width: 100%;
        height: 100%;
        left: 0%;
        top: 0%;
    }
    
    /* 汉字卡片中的田字格优化 */
    .character-tianzige {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .hanzi-display .character-tianzige .character-text {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: auto;
        height: auto;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2;
    }
    
    .tianzige-svg {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        z-index: 1;
    }
}

/* 小屏手机进一步优化 */
@media (max-width: 480px) {
    .hanzi-display {
        width: 160px;
        height: 160px;
    }
    
    #hanzi-writer-inner {
        width: 100%;
        height: 100%;
    }
    
    .hanzi-tianzige-bg {
        width: 100%;
        height: 100%;
        left: 0%;
        top: 0%;
    }
    
    .character-tianzige {
        width: 75px;
        height: 75px;
    }
    
    .character-text {
        font-size: 1.4rem;
    }
}

/* 超小屏优化 */
@media (max-width: 320px) {
    .hanzi-display {
        width: 140px;
        height: 140px;
    }
    
    .character-tianzige {
        width: 65px;
        height: 65px;
    }
    
    .character-text {
        font-size: 1.2rem;
    }
}

/* 横屏模式下的田字格优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .hanzi-display {
        width: 180px;
        height: 180px;
    }
    
    .character-tianzige {
        width: 80px;
        height: 80px;
    }
    
    .character-text {
        font-size: 1.6rem;
    }
}

/* 确保描红练习在移动端正确显示 */
@media (max-width: 768px) {
    .practice-canvas-container {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: var(--spacing-md);
    }
    
    .practice-canvas {
        max-width: 90vw;
        max-height: 50vh;
        width: auto;
        height: auto;
        border-radius: var(--radius-sm);
    }
    
    /* 描红练习的汉字居中 */
    .practice-canvas svg {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain;
    }
}

/* 修复HanziWriter在不同设备上的显示问题 */
.hanzi-writer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hanzi-writer-container svg {
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

/* 确保田字格线条在高分辨率屏幕上清晰显示 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .tianzige-svg line,
    .hanzi-tianzige-svg line {
        stroke-width: 0.5;
        shape-rendering: crispEdges;
    }
    
    .hanzi-writer-container svg {
        shape-rendering: geometricPrecision;
    }
}

/* 确保汉字显示容器尺寸正确 */
.hanzi-display {
    width: 300px !important;
    height: 300px !important;
}