@charset "UTF-8";
:root {
    /* 默认主题色（竹青），各页面可通过 body[data-theme] 覆盖 */
    --primary: #2d7a2d;
    --primary-light: #f0f8f0;
    --primary-dark: #1f5e1f;
    --bg-color: #fcfaf5; /* 纸白/米黄，古风底色 */
    --card-bg: #ffffff;
    --text-main: #2c2c2c;
    --text-muted: #888888;
    --border-color: #e8e4d8;
    --font-sans: 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
    --font-serif: 'STSong', 'SimSun', 'Source Han Serif SC', 'Noto Serif CJK SC', serif;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* 主题变体 */
body[data-theme="sentence"] { --primary: #5a3018; --primary-light: #fdf5e8; --primary-dark: #3a1808; }
body[data-theme="char"] { --primary: #1a4a7a; --primary-light: #f0f5fa; --primary-dark: #0f2a4a; }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-sans); background: var(--bg-color); color: var(--text-main); line-height: 1.8; font-size: 16px; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; transition: all 0.2s; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }

/* 布局 */
html { overflow-x: hidden; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; width: 100%; box-sizing: border-box; }
.layout { display: grid; grid-template-columns: 1fr 300px; gap: 24px; margin: 24px auto 40px; }
/* Grid 项目防止内容撑宽轨道 */
.main-content, .sidebar { min-width: 0; overflow: hidden; }

/* 头部导航 */
.header { background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-size: 22px; font-weight: 700; color: #ffe066; letter-spacing: 2px; display: flex; align-items: center; }
.logo small { font-size: 13px; color: rgba(255,255,255,0.8); margin-left: 10px; font-weight: normal; letter-spacing: 0; }
.nav { display: flex; gap: 5px; }
.nav a { color: rgba(255,255,255,0.9); padding: 6px 16px; border-radius: 20px; font-size: 15px; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,0.2); color: #fff; text-decoration: none; }
.search-btn { display: none; } /* 移动端搜索按钮 */

/* 搜索栏 */
.search-bar { background: var(--primary-dark); padding: 12px 0; }
.search-box { max-width: 600px; margin: 0 auto; display: flex; background: #fff; border-radius: 24px; overflow: hidden; }
.search-box input { flex: 1; border: none; padding: 10px 20px; font-size: 15px; outline: none; }
.search-box button { background: #ffe066; color: var(--primary-dark); border: none; padding: 0 24px; font-weight: 600; cursor: pointer; font-size: 15px; }

/* 面包屑 */
.breadcrumb { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }

/* 卡片通用 */
.card { background: var(--card-bg); border-radius: 12px; padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); border: 1px solid var(--border-color); }
.card-title { font-size: 18px; font-weight: 700; color: var(--primary); border-bottom: 2px solid var(--primary-light); padding-bottom: 10px; margin-bottom: 16px; display: flex; align-items: center; }

/* 诗词正文区 (Hero) */
.hero { text-align: center; padding: 20px 0 30px; border-bottom: 1px dashed var(--border-color); margin-bottom: 24px; }
.hero-title { font-size: 32px; font-weight: 700; color: var(--text-main); letter-spacing: 4px; margin-bottom: 12px; font-family: var(--font-serif); max-width: 100%; overflow-wrap: anywhere; word-break: break-all; }
.hero-title ruby { font-size: inherit; }
.hero-title rt { font-size: 13px; color: var(--primary); font-weight: normal; letter-spacing: 0; transform: translateY(-2px); }
.hero-meta { font-size: 15px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 12px; }
.hero-meta a { color: var(--primary); font-weight: 600; }
.poem-content { font-family: var(--font-serif); font-size: 24px; line-height: 2.2; color: #1a1a1a; text-align: center; padding: 20px; letter-spacing: 2px; }

/* 注释与赏析 */
.note-block { font-size: 15px; color: #444; line-height: 2; }
.note-item { padding: 6px 0 6px 16px; border-left: 3px solid var(--primary-light); margin: 8px 0; background: #fafafa; }
.note-section { font-weight: 700; color: var(--primary); margin: 16px 0 8px; font-size: 16px; }

/* 列表项 (图文/纯文) */
.list-item { display: flex; padding: 12px 0; border-bottom: 1px dashed var(--border-color); gap: 16px; align-items: flex-start; }
.list-item:last-child { border-bottom: none; padding-bottom: 0; }
.list-title { font-size: 16px; font-weight: 600; color: var(--text-main); margin-bottom: 4px; }
.list-meta { font-size: 13px; color: var(--text-muted); }
.list-desc { font-size: 14px; color: #666; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 侧边栏小卡片 */
.side-card { background: var(--primary-light); border-radius: 8px; padding: 20px; text-align: center; margin-bottom: 20px; }
.side-stat { display: flex; justify-content: space-between; font-size: 14px; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,0.05); }
.side-stat:last-child { border-bottom: none; }
.side-stat span:first-child { color: var(--text-muted); }

/* 标签云 */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 4px 12px; background: var(--primary-light); color: var(--primary); border-radius: 16px; font-size: 13px; border: 1px solid rgba(0,0,0,0.05); }
.tag:hover { background: var(--primary); color: #fff; text-decoration: none; }

/* 汉字/成语特有 */
.char-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.char-box { border: 1px solid var(--border-color); border-radius: 8px; text-align: center; padding: 16px 10px; background: #fff; }
.char-huge { font-size: 40px; color: var(--primary); font-family: var(--font-serif); line-height: 1; margin-bottom: 8px; }
.char-py { font-size: 13px; color: var(--text-muted); }

/* 汉堡菜单按钮 */
.ham-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    flex-shrink: 0;
}

/* 移动端抽屉导航 */
.mob-nav {
    position: fixed;
    top: 0; left: 0;
    transform: translateX(-100%);
    width: 150px; height: 100vh;
    background: var(--primary-dark);
    z-index: 1001;
    transition: transform .25s ease;
    overflow-y: auto;
    box-shadow: 4px 0 16px rgba(0,0,0,.3);
}
.mob-nav.open { transform: translateX(0); }
.mob-nav-hd {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0,0,0,.2);
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.mob-nav-hd span { font-size: 14px; font-weight: 700; color: #ffe066; letter-spacing: 1px; }
.mob-nav-hd button { background: none; border: none; color: rgba(255,255,255,.7); font-size: 18px; cursor: pointer; line-height: 1; padding: 0; }
.mob-nav-hd button:hover { color: #fff; }
.mob-nav-links a {
    display: block;
    padding: 10px 18px;
    color: rgba(255,255,255,.85);
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    text-decoration: none;
    transition: background .15s;
}
.mob-nav-links a:hover { background: rgba(255,255,255,.12); color: #fff; }
.mob-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    backdrop-filter: blur(2px);
}
.mob-overlay.open { display: block; }

/* 移动端适配 */
@media (max-width: 768px) {
    .layout { grid-template-columns: 1fr; margin-top: 16px; }
    .header-inner { padding: 0 15px; }
    .nav { display: none; }
    .search-btn { display: none; }
    .ham-btn { display: block; }
    .search-box { margin: 0 15px; }
    .hero-title { font-size: clamp(16px, 5vw, 26px); letter-spacing: 1px; }
    .poem-content { font-size: 20px !important; padding: 10px; letter-spacing: 1px; }
    .char-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 移动端统计数字缩小 */
@media (max-width: 480px) {
    .stat-num  { font-size: 17px !important; }
    .stat-lbl  { font-size: 10px !important; }
    .stats-inn { gap: 14px !important; padding: 10px 12px !important; }
    /* 小屏诗句缩小 */
    .poem-content { font-size: 17px !important; padding: 8px; }
}
