/* ==========================================================
   云松学堂 · 主题与设计系统 theme.css
   多套适老化皮肤 + 统一组件 + 字号无级缩放
   ========================================================== */

/* ---------- 主题变量 ---------- */
:root {
    /* 默认：松韵雅致 */
    --bg: #FBF7EC;
    --bg-soft: #FFFDF7;
    --surface: #FFFFFF;
    --surface-2: #F4EFE2;
    --primary: #2E7D32;
    --primary-dark: #1B5E20;
    --primary-soft: #E6F2E7;
    --accent: #C9A227;
    --accent-soft: #FBF3D6;
    --text: #22301F;
    --text-muted: #5C6B58;
    --border: #E5DEC9;
    --border-strong: #D3C9AC;
    --shadow-sm: 0 4px 12px rgba(46, 125, 50, .08);
    --shadow: 0 10px 30px rgba(46, 125, 50, .12);
    --shadow-lg: 0 20px 50px rgba(27, 94, 32, .18);
    --grad: linear-gradient(135deg, #2E7D32 0%, #14532D 100%);
    --grad-soft: linear-gradient(135deg, #EAF6EA 0%, #FFFDF7 100%);
    --radius: 20px;
    --radius-sm: 12px;
}

/* 暖阳福寿：红金喜庆风 */
[data-theme="festive"] {
    --bg: #FFF7F2;
    --bg-soft: #FFFCF8;
    --surface: #FFFFFF;
    --surface-2: #FBEEE6;
    --primary: #B71C1C;
    --primary-dark: #7F1010;
    --primary-soft: #FBEAE8;
    --accent: #E8A33D;
    --accent-soft: #FCF0DC;
    --text: #311A16;
    --text-muted: #7A5F58;
    --border: #F1DCD2;
    --border-strong: #E3C1B2;
    --shadow-sm: 0 4px 12px rgba(183, 28, 28, .08);
    --shadow: 0 10px 30px rgba(183, 28, 28, .13);
    --shadow-lg: 0 20px 50px rgba(127, 16, 16, .18);
    --grad: linear-gradient(135deg, #C62828 0%, #8E1414 100%);
    --grad-soft: linear-gradient(135deg, #FBEAE8 0%, #FFFCF8 100%);
}

/* 水墨清雅：淡墨徽派风 */
[data-theme="ink"] {
    --bg: #EEF1F4;
    --bg-soft: #F7F9FB;
    --surface: #FFFFFF;
    --surface-2: #E7EBEF;
    --primary: #37474F;
    --primary-dark: #222E35;
    --primary-soft: #E4E9ED;
    --accent: #4A8B7B;
    --accent-soft: #E2EFEB;
    --text: #1E2A30;
    --text-muted: #5B6B74;
    --border: #DCE2E7;
    --border-strong: #C3CCD3;
    --shadow-sm: 0 4px 12px rgba(55, 71, 79, .08);
    --shadow: 0 10px 30px rgba(55, 71, 79, .13);
    --shadow-lg: 0 20px 50px rgba(34, 46, 53, .18);
    --grad: linear-gradient(135deg, #455A64 0%, #22303A 100%);
    --grad-soft: linear-gradient(135deg, #E4E9ED 0%, #F7F9FB 100%);
}

/* 湖天澄碧：明朗湖蓝风 */
[data-theme="azure"] {
    --bg: #F1F7FD;
    --bg-soft: #F8FBFF;
    --surface: #FFFFFF;
    --surface-2: #E3EFFA;
    --primary: #0277BD;
    --primary-dark: #01579B;
    --primary-soft: #E1F0FB;
    --accent: #F9A825;
    --accent-soft: #FEF5DC;
    --text: #16283A;
    --text-muted: #4F6B85;
    --border: #D3E5F5;
    --border-strong: #B2D3EE;
    --shadow-sm: 0 4px 12px rgba(2, 119, 189, .09);
    --shadow: 0 10px 30px rgba(2, 119, 189, .14);
    --shadow-lg: 0 20px 50px rgba(1, 87, 155, .18);
    --grad: linear-gradient(135deg, #039BE5 0%, #01497B 100%);
    --grad-soft: linear-gradient(135deg, #E1F0FB 0%, #F8FBFF 100%);
}

/* 夜览护眼：深色高对比 */
[data-theme="night"] {
    --bg: #101623;
    --bg-soft: #141C2B;
    --surface: #182031;
    --surface-2: #1F2839;
    --primary: #66BB6A;
    --primary-dark: #3E8E43;
    --primary-soft: #1C2C24;
    --accent: #FFC65C;
    --accent-soft: #2C2A1C;
    --text: #E9EEF6;
    --text-muted: #9FB0C4;
    --border: #2C3749;
    --border-strong: #3B4A61;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, .35);
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
    --grad: linear-gradient(135deg, #2E7D52 0%, #16351F 100%);
    --grad-soft: linear-gradient(135deg, #1C2C24 0%, #141C2B 100%);
}

/* ---------- 基础排版（适老化：大字号、宽行距） ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: calc(16px * var(--fs, 1.25)); scroll-behavior: smooth; }

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "SimHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    transition: background-color .35s ease, color .35s ease;
}

a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }

.wrap { width: min(1240px, 92vw); margin: 0 auto; }

/* ---------- 通用组件 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5em;
    padding: .7em 1.6em; border: none; border-radius: 999px; cursor: pointer;
    font-size: 1rem; font-weight: 600; letter-spacing: .02em;
    background: var(--grad); color: #fff; box-shadow: var(--shadow);
    transition: transform .22s ease, box-shadow .22s ease, filter .22s ease;
}
.btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); filter: brightness(1.06); }
.btn:active { transform: translateY(-1px); }
.btn-lg { padding: .95em 2.2em; font-size: 1.15rem; }
.btn-ghost {
    background: transparent; color: var(--primary);
    border: 2px solid var(--primary); box-shadow: none;
}
.btn-ghost:hover { background: var(--primary-soft); }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--primary-dark)); }
[data-theme="night"] .btn-ghost { color: var(--primary); border-color: var(--primary); }

.tag {
    display: inline-block; padding: .25em .85em; border-radius: 999px;
    background: var(--primary-soft); color: var(--primary);
    font-size: .82rem; font-weight: 600; white-space: nowrap;
}
.tag-gold { background: var(--accent-soft); color: var(--accent); }

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--border-strong); }

.sec-title { text-align: center; margin-bottom: 2.4rem; }
.sec-title h2 {
    font-size: 2.1rem; font-weight: 800; color: var(--primary);
    letter-spacing: .04em; position: relative; display: inline-block; padding-bottom: .6rem;
}
.sec-title h2::after {
    content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
    width: 84px; height: 5px; border-radius: 4px; background: var(--accent);
}
.sec-title p { color: var(--text-muted); font-size: 1.05rem; margin-top: .8rem; }

/* ---------- 顶栏 ---------- */
.topbar { background: var(--grad); color: #fff; position: relative; overflow: hidden; }
.topbar::after {
    content: ""; position: absolute; inset: 0; opacity: .16; pointer-events: none;
    background-image: radial-gradient(circle at 18% 30%, #fff 0 2px, transparent 3px),
                      radial-gradient(circle at 72% 62%, #fff 0 3px, transparent 4px),
                      radial-gradient(circle at 46% 82%, #fff 0 2px, transparent 3px);
    background-size: 220px 220px, 320px 320px, 260px 260px;
}
.nav-inner {
    display: flex; align-items: center; gap: 1.2rem;
    padding: 1rem 0; position: relative; z-index: 2;
}
.brand { display: flex; align-items: center; gap: .7rem; font-size: 1.5rem; font-weight: 800; color: #fff; }
.brand-mark {
    width: 2.6rem; height: 2.6rem; border-radius: 14px; font-size: 1.3rem;
    display: grid; place-items: center; background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .35); backdrop-filter: blur(4px);
}
.nav-links { display: flex; gap: .3rem; margin-left: auto; flex-wrap: wrap; }
.nav-links a {
    color: rgba(255, 255, 255, .92); padding: .55em 1.05em; border-radius: 999px;
    font-size: 1rem; font-weight: 600; transition: background .2s ease, color .2s ease;
}
.nav-links a:hover, .nav-links a.on { background: rgba(255, 255, 255, .22); color: #fff; }
.nav-toggle { display: none; background: rgba(255,255,255,.18); border: none; color: #fff; font-size: 1.4rem; padding: .3em .7em; border-radius: 10px; cursor: pointer; }

/* ---------- 首屏 ---------- */
.hero { position: relative; padding: 4.2rem 0 5.4rem; color: #fff; overflow: hidden; }
.hero-bg {
    position: absolute; inset: 0; background: var(--grad);
    clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
}
.hero-bg::after {
    content: ""; position: absolute; inset: 0; opacity: .5;
    background: radial-gradient(900px 380px at 82% 12%, rgba(255,255,255,.20), transparent 62%),
                radial-gradient(700px 320px at 8% 90%, rgba(0,0,0,.16), transparent 60%);
}
.hero-inner { position: relative; z-index: 2; display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; }
.hero h1 { font-size: 3.1rem; line-height: 1.28; font-weight: 900; letter-spacing: .02em; margin-bottom: 1rem; }
.hero h1 em { font-style: normal; color: var(--accent); -webkit-text-stroke: 0; }
.hero .lead { font-size: 1.2rem; color: rgba(255,255,255,.94); max-width: 34em; margin-bottom: 1.8rem; }
.hero-cta { display: flex; gap: .9rem; flex-wrap: wrap; margin-bottom: 2.2rem; }
.hero .btn-ghost { border-color: rgba(255,255,255,.85); color: #fff; }
.hero .btn-ghost:hover { background: rgba(255,255,255,.16); }
.hero-stats { display: flex; gap: 2.2rem; flex-wrap: wrap; }
.hero-stats div span { display: block; font-size: 1.9rem; font-weight: 800; color: var(--accent); }
.hero-stats div small { color: rgba(255,255,255,.9); font-size: .95rem; }

.hero-art {
    position: relative; border-radius: var(--radius); padding: 1.6rem;
    background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28);
    backdrop-filter: blur(8px); box-shadow: var(--shadow-lg);
}
.hero-art h3 { font-size: 1.25rem; margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }
.hero-art ul { list-style: none; display: grid; gap: .7rem; }
.hero-art li {
    background: rgba(255, 255, 255, .16); border-radius: var(--radius-sm);
    padding: .7rem .9rem; display: flex; justify-content: space-between; gap: .8rem;
    font-size: .98rem; align-items: center;
}
.hero-art li b { color: var(--accent); font-weight: 800; }

/* ---------- 分区容器 ---------- */
section.block { padding: 4rem 0; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.3rem; }

.feature { padding: 1.7rem; }
.feature .ico {
    width: 3.2rem; height: 3.2rem; border-radius: 16px; display: grid; place-items: center;
    font-size: 1.6rem; background: var(--grad-soft); border: 1px solid var(--border-strong); margin-bottom: 1rem;
}
.feature h3 { font-size: 1.25rem; margin-bottom: .5rem; color: var(--primary); }
.feature p { color: var(--text-muted); font-size: .98rem; }

/* ---------- 课程卡片 ---------- */
.course { overflow: hidden; display: flex; flex-direction: column; }
.course-cover {
    height: 9.5rem; display: grid; place-items: center; font-size: 3rem; color: #fff;
    background: var(--grad); position: relative;
}
[data-theme="festive"] .course-cover { background: linear-gradient(135deg, #C62828, #F9A825); }
[data-theme="azure"] .course-cover { background: linear-gradient(135deg, #039BE5, #0277BD); }
.course-cover::after {
    content: ""; position: absolute; inset: auto 0 0 0; height: 2.4rem;
    background: var(--surface); border-radius: 60% 60% 0 0 / 100% 100% 0 0;
}
.course-body { padding: 1.4rem 1.5rem 1.6rem; display: flex; flex-direction: column; gap: .7rem; flex: 1; }
.course-body h3 { font-size: 1.3rem; color: var(--text); }
.course-body p { color: var(--text-muted); font-size: .98rem; flex: 1; }
.course-meta { display: flex; flex-wrap: wrap; gap: .5rem; }
.course-foot { display: flex; align-items: center; justify-content: space-between; padding-top: .8rem; border-top: 1px dashed var(--border); }
.course-foot .price { color: var(--accent); font-weight: 800; font-size: 1.05rem; }

/* ---------- 学分银行 ---------- */
.credit-panel {
    border-radius: 28px; padding: 2.6rem; color: #fff; position: relative; overflow: hidden;
    background: var(--grad); box-shadow: var(--shadow-lg);
}
.credit-panel::before {
    content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
    border-radius: 50%; background: rgba(255, 255, 255, .10);
}
.credit-panel::after {
    content: ""; position: absolute; right: 60px; bottom: -90px; width: 200px; height: 200px;
    border-radius: 50%; background: rgba(0, 0, 0, .10);
}
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.2rem; position: relative; z-index: 2; margin-top: 1.6rem; }
.step {
    background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .25);
    border-radius: var(--radius); padding: 1.3rem; backdrop-filter: blur(6px);
}
.step b { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%;
    background: var(--accent); color: #2c2c00; font-size: 1.05rem; margin-bottom: .6rem; }
.step h4 { font-size: 1.1rem; margin-bottom: .35rem; }
.step p { font-size: .95rem; color: rgba(255, 255, 255, .88); }

/* ---------- AI 对话 ---------- */
.ai-wrap { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.chat-box {
    border: 2px solid var(--border); border-radius: var(--radius); background: var(--bg-soft);
    padding: 1.2rem; min-height: 20rem; max-height: 30rem; overflow-y: auto; display: flex;
    flex-direction: column; gap: .9rem;
}
.bubble { max-width: 78%; padding: .85rem 1.1rem; border-radius: 18px; font-size: 1rem; line-height: 1.8; }
.bubble.user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 6px; }
.bubble.bot { align-self: flex-start; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.bubble.typing { color: var(--text-muted); }
.quick-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip {
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
    padding: .45em 1em; border-radius: 999px; cursor: pointer; font-size: .92rem;
}
.chip:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.chat-input { display: flex; gap: .7rem; }
.chat-input input {
    flex: 1; padding: .85em 1.1em; font-size: 1.05rem; font-family: inherit; color: var(--text);
    background: var(--surface); border: 2px solid var(--border-strong); border-radius: 999px; outline: none;
}
.chat-input input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }

/* ---------- 页脚 ---------- */
.footer { background: var(--grad); color: rgba(255,255,255,.94); padding: 2.6rem 0 1.6rem; margin-top: 2rem; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.6rem; }
.footer h4 { font-size: 1.1rem; margin-bottom: .7rem; color: #fff; }
.footer li { list-style: none; color: rgba(255,255,255,.85); font-size: .96rem; padding: .18rem 0; }
.footer .copy { text-align: center; margin-top: 1.8rem; padding-top: 1.2rem; border-top: 1px solid rgba(255,255,255,.22); font-size: .92rem; color: rgba(255,255,255,.8); }

/* ---------- 适老化悬浮工具栏 ---------- */
.a11y-bar {
    position: fixed; right: 18px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; gap: 10px;
}
.a11y-btn {
    width: 3.1rem; height: 3.1rem; border-radius: 50%; border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--primary); font-size: 1.15rem; font-weight: 800;
    cursor: pointer; box-shadow: var(--shadow); display: grid; place-items: center;
    transition: transform .2s ease, background .2s ease;
}
.a11y-btn:hover { transform: scale(1.07); background: var(--primary-soft); }

/* 皮肤选择面板 */
.skin-panel {
    position: fixed; right: 18px; bottom: 96px; z-index: 95; width: 268px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 1.1rem; transform-origin: bottom right;
    transition: opacity .22s ease, transform .22s ease;
}
.skin-panel[hidden] { display: none; }
.skin-panel h5 { font-size: 1rem; color: var(--primary); margin-bottom: .7rem; }
.skin-opt {
    display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; border-radius: var(--radius-sm);
    cursor: pointer; border: 1px solid transparent; font-size: .98rem;
}
.skin-opt:hover { background: var(--surface-2); }
.skin-opt.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.skin-dot { width: 1.35rem; height: 1.35rem; border-radius: 8px; border: 1px solid rgba(0,0,0,.12); flex: none; }
.skin-divider { height: 1px; background: var(--border); margin: .8rem 0; }
.font-row { display: flex; gap: .5rem; align-items: center; }
.font-row button {
    flex: 1; padding: .5em 0; border-radius: 10px; border: 1px solid var(--border-strong);
    background: var(--surface-2); color: var(--text); font-weight: 700; cursor: pointer; font-size: .95rem;
}
.font-row button:hover { background: var(--primary-soft); color: var(--primary); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2.3rem; }
    .hero-bg { clip-path: polygon(0 0, 100% 0, 100% 94%, 0 100%); }
    .nav-toggle { display: block; margin-left: auto; }
    .nav-links {
        display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column;
        background: var(--primary-dark); padding: .6rem .4rem; gap: .2rem;
    }
    .nav-links.open { display: flex; }
    .nav-inner { flex-wrap: wrap; }
}
@media (max-width: 560px) {
    .hero-stats { gap: 1.2rem; }
    .credit-panel { padding: 1.6rem; }
    .bubble { max-width: 92%; }
}
