/* ==========================================================================
   重走长征路 · 基础样式与设计令牌
   视觉主题：明亮教材插画——米白纸底 + 深蓝灰字 + 明快朱红 + 天蓝草绿
   ========================================================================== */
:root {
    /* 纸与字 */
    --paper: #fdf8f0;
    --paper-2: #f5eee1;
    --paper-3: #e6dac6;
    --ink: #26313d;
    --ink-2: #4b5a68;
    --ink-3: #8695a3;
    --ink-4: #adbac6;

    /* 朱红（旗帜、印章、标题重音） */
    --red: #d93a2b;
    --red-2: #ef5a42;
    --red-3: #b52a1d;
    --red-soft: rgba(217, 58, 43, .1);

    /* 天蓝 / 草绿 / 暖阳金 */
    --sky: #6fb9e3;
    --sky-2: #a8d8f0;
    --sky-soft: rgba(111, 185, 227, .14);
    --grass: #7cb069;
    --grass-2: #a8d096;
    --sun: #eda93c;
    --sun-2: #f7c862;
    --sun-soft: rgba(237, 169, 60, .16);

    /* 兼容旧变量名（部分样式仍引用） */
    --frost: #6fb9e3;
    --frost-2: #a8d8f0;
    --army: #7cb069;
    --army-2: #a8d096;
    --gold: var(--sun);
    --gold-2: var(--sun-2);
    --night: #f4efe4;
    --night-2: #ece4d4;

    --line: rgba(38, 49, 61, .12);
    --line-2: rgba(38, 49, 61, .06);
    --shadow: 0 6px 20px rgba(74, 92, 112, .12);
    --shadow-lg: 0 16px 40px rgba(74, 92, 112, .2);

    --r-s: 10px;
    --r: 16px;
    --r-l: 24px;

    --serif: "STKaiti", "KaiTi", "楷体", "Songti SC", "SimSun", "Noto Serif SC", serif;
    --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --num: "DIN Alternate", "Bahnschrift", "Impact", var(--sans);

    --ease: cubic-bezier(.22, .9, .3, 1);
    --deck-h: 100dvh;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
    font-family: var(--sans);
    color: var(--ink);
    background: var(--paper);
    font-size: 16px;
    line-height: 1.7;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* 滚动条（桌面端） */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(27, 32, 39, .18); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

.hide { display: none !important; }
.serif { font-family: var(--serif); }
.muted { color: var(--ink-3); }
.ic { width: 22px; height: 22px; flex-shrink: 0; display: block; }

/* --------------------------------------------------------------------------
   纸面 / 玻璃 / 暗色三种容器
   -------------------------------------------------------------------------- */
.paper {
    background: linear-gradient(180deg, #fffdf8, #f7f1e5);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow);
}
.glass {
    background: rgba(255, 253, 248, .72);
    backdrop-filter: blur(16px) saturate(1.25);
    -webkit-backdrop-filter: blur(16px) saturate(1.25);
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: var(--r);
    box-shadow: var(--shadow);
}
/* 注：.glass-dark / .btn-dark / .chip-dark 的类名是旧暗色主题的遗留，现在一律
   渲染成明亮主题的白色卡片；改名会牵动各页 markup，所以保留类名、只改样式。 */
.glass-dark {
    background: rgba(255, 255, 255, .93);
    backdrop-filter: blur(12px) saturate(1.1);
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
    border: 1px solid rgba(38, 49, 61, .08);
    border-radius: var(--r);
    color: var(--ink);
    box-shadow: 0 6px 22px rgba(74, 92, 112, .12);
}
.card { padding: 18px; }

/* --------------------------------------------------------------------------
   按钮
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 11px 20px; border-radius: 999px; font-weight: 600; font-size: 15px;
    white-space: nowrap; flex-shrink: 0; line-height: 1.2;
    transition: transform .18s var(--ease), box-shadow .2s, background .2s, opacity .2s, border-color .2s;
}
.btn:active { transform: scale(.96); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn-primary { background: linear-gradient(135deg, var(--red-2), var(--red)); color: #fff; box-shadow: 0 8px 20px rgba(217, 58, 43, .32); }
.btn-primary:hover { box-shadow: 0 12px 28px rgba(217, 58, 43, .44); }
.btn-gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #46330c; box-shadow: 0 8px 20px rgba(237, 169, 60, .34); }
.btn-ghost { background: rgba(255, 253, 248, .78); border: 1.5px solid var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: #fff; border-color: var(--paper-3); }
.btn-dark { background: rgba(255, 255, 255, .93); border: 1.5px solid var(--line); color: var(--ink-2); box-shadow: 0 3px 12px rgba(74, 92, 112, .1); }
.btn-dark:hover { background: #fff; border-color: var(--paper-3); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 28px; font-size: 17px; }
.btn-sm { padding: 7px 14px; font-size: 13.5px; }

.icon-btn {
    width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
    color: var(--ink-2); transition: background .2s, color .2s; flex-shrink: 0;
}
.icon-btn:hover { background: rgba(27, 32, 39, .07); }
.icon-btn.on { color: var(--red); background: var(--red-soft); }
.icon-btn-ph { width: 40px; height: 40px; display: inline-block; flex-shrink: 0; }

/* --------------------------------------------------------------------------
   标签 / 印章 / 星级
   -------------------------------------------------------------------------- */
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 13px; border-radius: 999px; font-size: 13px; font-weight: 500;
    background: rgba(255, 253, 248, .8); border: 1px solid var(--line); color: var(--ink-2);
    transition: background .2s, color .2s, border-color .2s, transform .15s;
}
button.chip:active { transform: scale(.95); }
.chip.on { background: var(--red); border-color: var(--red); color: #fff; }
.chip.gold.on { background: var(--gold); border-color: var(--gold); color: #46330c; }
.chip-dark { background: rgba(255, 255, 255, .92); border-color: var(--line); color: var(--ink-2); }
.chip-dark.on { background: var(--red); border-color: var(--red); color: #fff; }

.seal {
    display: inline-grid; place-items: center; padding: 4px 7px;
    background: var(--red); color: #fff6ef; font-family: var(--serif);
    border-radius: 5px; line-height: 1.15; letter-spacing: 1px;
    box-shadow: inset 0 0 0 2px rgba(255, 240, 220, .35);
}
.stars { display: inline-flex; gap: 2px; }
.stars .ic { width: 17px; height: 17px; color: var(--paper-3); fill: var(--paper-3); }
.stars .ic.on { color: var(--gold); fill: var(--gold); }

/* --------------------------------------------------------------------------
   表单
   -------------------------------------------------------------------------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.input, .textarea {
    width: 100%; padding: 12px 14px; border-radius: 12px;
    border: 1.5px solid var(--paper-3); background: #fffdf8; font-size: 16px;
    transition: border-color .2s, box-shadow .2s;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(237, 169, 60, .15); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.7; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.5; }

/* --------------------------------------------------------------------------
   动效
   -------------------------------------------------------------------------- */
.page-anim { animation: pageIn .5s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.86) } 60% { transform: scale(1.04) } 100% { opacity: 1; transform: scale(1) } }
@keyframes floatY { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
@keyframes flagWave { 0%, 100% { transform: rotate(-1.2deg) } 50% { transform: rotate(1.2deg) } }
@keyframes glowPulse { 0%, 100% { opacity: .5 } 50% { opacity: 1 } }
@keyframes spinSlow { to { transform: rotate(360deg) } }

/* --------------------------------------------------------------------------
   toast
   -------------------------------------------------------------------------- */
#toast {
    position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom));
    transform: translateX(-50%); z-index: 9000;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    pointer-events: none; width: min(90vw, 420px);
}
.toast-item {
    max-width: 100%; padding: 10px 18px; border-radius: 999px;
    background: rgba(17, 23, 33, .88); color: #f6f1e6; font-size: 14px;
    box-shadow: var(--shadow-lg); animation: popIn .28s var(--ease) both;
    backdrop-filter: blur(8px); text-align: center;
}
.toast-item.out { animation: fadeIn .3s reverse both; }

/* --------------------------------------------------------------------------
   弹窗
   -------------------------------------------------------------------------- */
.modal-mask {
    position: fixed; inset: 0; z-index: 9500; display: grid; place-items: center;
    padding: 20px; background: rgba(12, 16, 22, .58); backdrop-filter: blur(4px);
    animation: fadeIn .22s both;
}
.modal-mask.out { animation: fadeIn .25s reverse both; }
.modal {
    width: min(100%, 480px); max-height: min(86dvh, 720px); overflow-y: auto;
    padding: 22px; animation: popIn .32s var(--ease) both;
}
.modal-title { font-family: var(--serif); font-size: 21px; margin-bottom: 12px; color: var(--red-3); }
.modal-body { color: var(--ink-2); font-size: 15px; }
.modal-body h4 { font-family: var(--serif); font-size: 17px; margin: 12px 0 4px; color: var(--ink); }
.modal-body p { margin: 6px 0; }
.modal-body ul, .modal-body ol { margin: 6px 0 6px 20px; }
.modal-body li { margin: 3px 0; }
.modal-body b { color: var(--red-3); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* 撒花 */
.confetti {
    position: fixed; top: -12px; z-index: 9600; width: 8px; height: 14px;
    pointer-events: none; border-radius: 2px;
    animation: confettiFall 2.6s linear forwards;
}
@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0); opacity: 1 }
    100% { transform: translateY(102vh) rotate(660deg); opacity: .1 }
}

/* 屏幕阅读器专用 */
.sr {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    html { scroll-behavior: auto; }
}
