* { margin: 0; padding: 0; box-sizing: border-box; -webkit-user-select: none; user-select: none;}
body {
    font-family: 'Noto Sans SC', sans-serif; 
    background-color: #fce4ec;
    color: #333;
    position: relative;
    overflow: hidden;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* Internet Explorer/Edge */
    user-select: none; /* Chrome, Opera, and others */
}
#app {
    min-height: 100dvh;
    margin: 0;
    padding: 6px 20px;
    --color-page-body: #fff;
    /* --color-theme: #66bb6a; */
    --color-theme: #4CAF50; 

}
#app.theme-green {
    --color-bg: #F5FAF5;
    --color-page-body: #FAFAF7;
    --color-theme: #538063;
    --color-btn-bg: var(--color-theme);
    --color-btn-bg1: #E0E0E0;
    --color-border: #D5E0D8;
    --color-link: #397D4F;
    --color-link-hover: #1B5E20;
}
.body-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background: var(--color-page-body);
    filter: blur(5px);
}

[v-cloak] {
    display: none !important;
}
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-1 { flex: 1; width: 0; }
.flex-col { display: flex; flex-direction: column; }
.ai-c { align-items: center; }
.jc-sb{ justify-content: space-between; }
.jc-c { justify-content: center; }
.jc-sa { justify-content: space-around; }
.p10{padding:10px;}.p15{padding:15px;}.p20{padding:20px;}
.m10{margin:10px;}.m15{margin:15px;}.m20{margin:20px;}
.mb10{margin-bottom:10px;}.mb15{margin-bottom:15px;}.mb20{margin-bottom:20px;}
.mr10{margin-right:10px;}.mr15{margin-right:15px;}.mr20{margin-right:20px;}
.mx10{margin:0 10px;}.mx15{margin:0 15px;}.mx20{margin:0 20px;}
.my10{margin:10px 0;}.my15{margin:15px 0;}.my20{margin:20px 0;}
.w100{width:100%;}
.h100{height:100%;}

.container {
    background-color: var(--color-page-body);
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
    text-align: center;
    width: 100%;
    /* max-width: 800px; */
    max-width: max(80%, 800px);
    position: relative;
    overflow: hidden;
}

.mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9; /* Ensure it's above other content */
}
.btn-top {
    position: absolute;
    top: 10px;
    z-index: 8;
    width: 30px;
    cursor: pointer;
}
.audio-img {
    right: 10px;
}
.btn-theme {
   left: 10px;
   opacity: .5;
}
.audio-img.off, .click-read.off {
    opacity: .3;
}
.click-read {
    right: 45px;
    font-size: 21px;
}
.go-top {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 2;
    padding: 4px;
}


.container::before, .container::after {
    content: '';
    position: absolute;
    background-color: #ffdab9; /* PeachPuff for cute elements */
    border-radius: 50%;
    opacity: 0.7;
}

.container::before {
    width: 80px;
    height: 80px;
    top: -40px;
    left: -40px;
}

.container::after {
    width: 120px;
    height: 120px;
    bottom: -60px;
    right: -60px;
}


header h1 {
    color: var(--color-theme); 
    font-size: 3em;
    margin-bottom: 30px;
}
header h1:before, header h1:after {
    content: ''; 
    margin: 0 10px;
    background: url(../img/nezha1.webp) no-repeat center center;
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: middle;
    background-size: contain;
    position: relative;
    top: 4px;
}

header p {
    color: #888;
    font-size: 1.2em;
    margin-bottom: 30px;
}


.hanzi-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 20px;
    height: 70dvh;
    overflow-y: auto;
    padding: 10px;
}

.hanzi-item {
    background: var(--color-page-body);
    border: 3px solid #ccc;
    border-color: var(--color-border);
    border-radius: 15px;
    padding: 15px;
    font-size: 3em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    color: var(--color-theme);
}
body .hanzi-item.tested {
    font-size: 1.9em;
    color: #ff6347;
}
.hanzi-item.on {
    background: #ffca87;
}

.hanzi-item.locked {
    background-color: var(--color-bg);
    border-color: var(--color-border);
    cursor: not-allowed;
    padding-left: 0px;
    color: #909090 !important;
}

.hanzi-item.locked::after {
    content: '';
    position: absolute;
    font-size: 1.5em;
    /* color: #696969; */
    width: 24%;
    height: 47%;
    right: 0;
    bottom: -6px;
    background: url(../img/nezha.png) no-repeat center center;
    background-size: auto 90%;
    opacity: .7;
}

.hanzi-item:not(.locked):hover {
    background-color: #ffcccb; 
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.hanzi-item.correct {
    background-color: #90ee90; 
    border-color: #32cd32;
}

.hanzi-item.wrong {
    background-color: #ffb6c1; 
    border-color: #ff0000;
}


#learning-section {
    margin-bottom: 20px;
}

.character-display {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

.nav-button {
    background-color: #ff9a8b;
    color: white;
    border: none;
    padding: 15px 25px;
    font-size: 2em;
    border-radius: 15px;
    cursor: pointer;
    margin: 0 15px;
    transition: background-color 0.3s ease;
}

.nav-button:hover {
    background-color: #ff6f91;
}

.char-card {
    background-color: #e0f2f7; 
    border-radius: 20px;
    padding: 20px 40px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.05);
    min-width: 250px;
}

.big-char {
    font-size: 8em; 
    font-weight: bold;
    color: var(--color-theme); 
    margin-bottom: 10px;
    line-height: 1; 
    cursor: pointer;
}

.pinyin {
    font-size: 2.5em;
    color: var(--color-theme); 
    margin-bottom: 5px;
}

.meaning {
    font-size: 1.5em;
    color: var(--color-theme); 
    margin-bottom: 20px;
}

.play-button {
    background-color: var(--color-btn-bg1);
    color: #666666;
    border: none;
    padding: 12px 25px;
    font-size: 1.2em;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.play-button:hover {
    background-color: #6a1b9a;
}

.instructions {
    font-size: 1.3em;
    color: var(--color-theme);
    margin-top: 30px;
    margin-bottom: 20px;
    cursor: pointer;
}

.game-selection {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.game-button {
    position: relative;
    background-color: var(--color-theme);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.5em;
    border-radius: 15px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    flex-grow: 1;
    max-width: 250px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.game-button.own {
    background-color: #ff9a8b;
}
.game-button.own:after {
        content: '';
    position: absolute;
    bottom: 11px;
    right: 0;
    width: 30px;
    height: 36px;
    background: url('../img/step.webp') no-repeat center center;
    background-size: auto 100%;
}

.game-button:hover {
    background-color: #4CAF50;
    transform: translateY(-3px);
}


#game-section {
    background-color: var(--color-page-body); 
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.05);
}

#game-section h2 {
    color: var(--color-theme);
    font-size: 2.5em;
    margin-bottom: 25px;
}

#game-content {
    background-color: #ffffff;
    border-radius: 15px;
    padding: 25px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

#game-content .question-text {
    font-size: 3em;
    font-weight: bold;
    color: var(--color-theme);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}
#game-content .question-text span {
    font-size: 0.7em;
    animation: scale 1s infinite alternate;
}

#game-content .options-grid {
    /* display: grid; */
    /* grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); */
    gap: 15px;
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    max-width: 600px;
}

.option-button {
    flex: 1;
    background-color: var(--color-theme);
    color: white;
    border: none;
    padding: 15px 10px;
    font-size: 2.3em;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    word-break: break-word;
}

.option-button:hover {
    background-color: var(--color-theme);
    transform: translateY(-2px);
}

.option-button.correct {
    background-color: #4CAF50; 
}

.option-button.wrong {
    background-color: #FF5252;
}

.game-feedback {
    min-height: 1.8em;
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: bold;
}

#feedback-icon {
    margin-right: 10px;
}
#feedback-text {
    color: #555;
}
#feedback-text b {
    color: #4CAF50;
}

.game-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.action-button {
    background-color: #FFAB40; 
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.2em;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.action-button span {
    position: relative;
    top: -2px;
}

.action-button:hover {
    background-color: #FF8F00;
}

#stroke-ani {
    border: 1px solid #FFAB40;
    position: relative;
}
#stroke-write {
    border: 1px solid var(--color-theme);
    position: relative;
}
#stroke-write:before, #stroke-ani:before{ content: ''; position: absolute; z-index: 0; top: 50%; left: 0; width: 100%; height: 0; border-top: 1px dashed #999;}
#stroke-write:after, #stroke-ani:after{ content: ''; position: absolute; z-index: 0; top: 0; left: 50%; width: 0px; height: 100%; border-left: 1px dashed #999;}
.draw-box {
    margin: 0 auto;
    position: relative;
    border: 2px solid #FF5252;
    border-color: var(--color-theme);
    margin-right: 3vw;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.draw-box img {
    display: block;
    /* max-width: 18vw; */
    /* width: 18vw; */
    height: 32vw;
    max-height: 390px;
}
.draw-box span {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #000;
    transition: all .3s;
}
.draw-box span.slide-up { top: 0; left: 0; height: var(--p-not); }
.draw-box span.slide-down { bottom: 0; left: 0; height: var(--p-not); }
.draw-box span.slide-left { left: 0; top: 0; width: var(--p-not); }
.draw-box span.slide-right { right: 0; top: 0; width: var(--p-not); }
.draw-box span.fade { top: 0; left: 0; background-color: #000; opacity: var(--d-not); }
.draw-box span.scale { top: 0; left: 0; background-color: #000; transform: scale(var(--d-not));}
.draw-box span.circle { top: 0; left: 0; border-radius: 50%; background-color: #000; opacity: var(--d-not); transform: scale(var(--d-not));}
.draw-wrap .option-button {
    padding: 5px 10px;
    margin: 6px 0;
}

/* ================= 第 4 步：田字格默写 ================= */
.write-game { text-align: center; }
#game-content .write-game .question-text { font-size: 1.45em; margin-bottom: 4px; }
.write-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}
.write-yin {
    font-size: 1.6em;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--color-theme);
}
.write-prog {
    font-size: .95em;
    color: #6b8f3f;
    background: #eef7e2;
    padding: 3px 12px;
    border-radius: 999px;
}
.theme-default .write-prog { background: #ffe9ef; color: #d6457a; }
/* 田字格本体（HanziWriter 的 svg 由脚本写入，格子自带虚线十字底） */
.write-grid {
    position: relative;
    display: inline-block;
    margin: 8px auto 4px;
    border: 2px solid var(--color-theme);
    border-radius: 16px;
    background: #fffefb;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .1);
}
.write-grid:before, .write-grid:after {
    content: '';
    position: absolute;
    z-index: 0;
    pointer-events: none;
}
.write-grid:before {
    top: 50%; left: 8px; right: 8px;
    border-top: 1px dashed #e3cd9e;
}
.write-grid:after {
    left: 50%; top: 8px; bottom: 8px;
    border-left: 1px dashed #e3cd9e;
}
.write-grid svg { position: relative; z-index: 1; display: block; }
.write-tip { color: #e07a9c; font-size: .98em; margin: 6px auto 8px; line-height: 1.6; }
.write-tip.muted { color: #b7a99b; }
.write-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.write-actions .option-button { margin: 0; font-size: 1em; }

.hidden {
    display: none !important;
}

footer {
    margin-top: 40px;
    color: #aaa;
    font-size: 0.9em;
}

@keyframes scale {
    0% { transform: scale(0.9); }
    100% { transform: scale(1.1); }
}

@media (min-width: 700px) {
  /* .draw-box img{
    height: 30vw;
    max-height: 390px;
  } */
}
@media (orientation: landscape) {
  .draw-box img{
    height: 23vw;
    max-height: 250px;
  }
}

/* 小于500宽度的样式 */
@media (max-width: 500px) {
    #app {
        padding: 6px 8px;
    }
    .container {
        padding: 15px 10px;
    }
    #game-section {
        padding: 16px 10px;
    }
    .game-button {
        font-size: 1em;
        padding: 10px;
    }
    #game-content {
        padding: 16px 10px;
    }
    .game-feedback {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
    #game-content .question-text {
        font-size: 2em;
    }
    .option-button {
        font-size: 1.5em;
        padding: 10px 6px;
    }
    .action-button {
        font-size: 1em;
        padding: 10px 20px;
    }
    .draw-box img{
        width: 40vw;
        height: 56vw;
        max-height: auto;
    }
    header h1 {
        font-size: 1.8em;
        margin-bottom: 10px;
    }
    #game-section h2 {
        font-size: 2.2em;
        margin-bottom: 10px;
    }
    .hanzi-list {
        grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
        height: 67dvh;
    }
    .big-char {
        font-size: 6em;
    }
    .pinyin {
        font-size: 2em;
    }
    .instructions {
        margin-top: 16px;
    }
}

.theme-default .body-bg {
    background: url('../img/bg.webp') no-repeat center center / cover;
}
.theme-default header h1 {
    color: #ff6f91;
}
.theme-default .btn-theme {
    opacity: 1;
}
.theme-default .hanzi-item {
    background: #ffe4e1;
    border-color: #ff6347;
}
.hanzi-item:not(.locked):hover, .hanzi-item.on {
    background-color: #b9e7c9;
}
.theme-default .hanzi-item.locked {
    background-color: #fce4ec;
    border-color: #fce4ec;
}
.theme-default .hanzi-item.locked::after {
    opacity: 0.6;
}
.theme-default .play-button {
    background: #9c27b0;
    color: #fff;
}
.theme-default #game-section {
    background: #fff9c4;
}
.theme-default .instructions {
    color: #0078d7;
}
.theme-default #game-section h2 {
    color: #FF9800;
}
.theme-default .pinyin {
    color: #FFC107;
}
.theme-default .meaning {
    color: #7B1FA2;
}
.theme-default #game-content .question-text {
    color: #00BCD4;
}
.theme-default .draw-box {
    border-color: #FF5252;
}
.theme-green .action-button {
    background: #8A7967;
}

/* 收藏按钮（学习卡） */
.fav-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 8px 0 4px;
    cursor: pointer;
}
.fav-star {
    font-size: 1.5em;
    filter: grayscale(1);
    opacity: .5;
    transition: all .2s;
}
.fav-star.on {
    filter: none;
    opacity: 1;
}
.fav-tip {
    font-size: .9em;
    color: #a05a6e;
}

/* ================= 每日任务首页（只渲染今日组 + 少量回顾） ================= */
.hanzi-list {
    display: block;
    height: auto;
    max-height: 74dvh;
    overflow-y: auto;
    padding: 4px 6px 20px;
    margin-top: 10px;
}
.sec { text-align: left; }
.sec + .sec { margin-top: 18px; }
.hanzi-item { position: relative; }

.task-panel {
    background: #fffaf3;
    border: 2px solid #ffd9ae;
    border-radius: 18px;
    padding: 12px 14px;
    box-shadow: 0 3px 10px rgba(255, 160, 80, .12);
}
.theme-green .task-panel { background: var(--color-bg); border-color: var(--color-border); }
.task-panel.today-done { background: #f0fbe4; border-color: #a8d87a; }
.theme-green .task-panel.today-done { background: #eff7ea; border-color: #9fd29a; }

.sec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 1.15em;
    font-weight: 700;
    color: #444;
    flex-wrap: wrap;
}
.day-badge {
    background: #ff8fab;
    color: #fff;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: .95em;
    box-shadow: 0 2px 6px rgba(255, 143, 171, .35);
}
.theme-green .day-badge { background: #538063; }
.sec-sub { color: #8a8175; font-size: .95em; margin: 8px 0 2px; line-height: 1.6; }
.sec-head + .sec-sub { margin-top: 6px; }
.sec .muted { color: #b7a99b; font-weight: 400; font-size: .85em; margin-left: 6px; }
.task-state { font-size: .9em; color: #538063; }
.theme-default .task-state { color: #e07a9c; }

.behind-tip {
    margin-top: 8px;
    color: #e08a00;
    background: #fff4d6;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: .95em;
}
.theme-green .behind-tip { background: #f2f7e8; color: #6b8f3f; }

.mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.hanzi-item.passed {
    background: #e8f7ea;
    border-color: #7fbf85;
    color: #2f7d33 !important;
}
.theme-default .hanzi-item.passed { background: #d9f5ea; border-color: #7fd0a4; }
.hanzi-item.passed::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #43b45f;
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .15);
}
.review-grid .hanzi-item {
    font-size: 1.9em;
    height: 64px;
    padding: 6px;
}
.review-panel .sec-sub { margin-bottom: 4px; }
.review-panel .sec-head { color: #7b6f63; }

.start-panel {
    margin-bottom: 14px;
    padding: 14px 16px;
    background: #fff8ee;
    border-radius: 16px;
    border: 2px dashed #ffc98f;
    text-align: center;
}
.start-title { font-size: 1.5em; font-weight: 800; color: #ff6f91; }
.theme-green .start-title { color: var(--color-theme); }
.start-sub { font-size: 1em; color: #8a8175; margin-top: 8px; line-height: 1.6; }

/* 小屏适配 */
@media (max-width: 500px) {
    .hanzi-list { max-height: 68dvh; padding: 2px 2px 14px; }
    .mini-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
    .review-grid { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
    .review-grid .hanzi-item { font-size: 1.5em; height: 52px; }
    .day-badge { font-size: .85em; padding: 3px 10px; }
    .start-title { font-size: 1.25em; }
    .task-panel { padding: 10px; }
}
/* } */