/* ===== 基础组件 ===== */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: var(--paper);
    border-radius: 999px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, background .15s, border-color .15s;
    white-space: nowrap;
}
.button:hover { opacity: .88; color: var(--paper); }
.button-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.button-ghost:hover { border-color: var(--ink); color: var(--ink); }
.button-small { padding: 6px 13px; font-size: 13px; }

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px 0;
}
.panel-head h2 { font-size: 1.15rem; }
.more-link { color: var(--accent); font-size: 13.5px; white-space: nowrap; }

/* ===== 首页 ===== */
.daily-card { margin-bottom: 30px; overflow: hidden; }

.daily-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 18px 22px 22px;
}
.daily-inner:hover .daily-glyph { color: var(--accent); }

.daily-glyph {
    font-family: var(--font-serif);
    font-size: 82px;
    line-height: 1;
    color: var(--ink);
    transition: color .15s;
    flex: 0 0 auto;
}

.daily-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.daily-pinyin { color: var(--accent); font-size: 15px; letter-spacing: .08em; }
.daily-def { color: var(--ink-soft); font-size: 15px; }
.daily-meta { color: var(--muted); font-size: 12.5px; }

.section-block { margin-bottom: 34px; }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.section-head h2 {
    font-size: 1.28rem;
    position: relative;
    padding-left: 13px;
}
.section-head h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: .22em;
    bottom: .22em;
    width: 4px;
    border-radius: 3px;
    background: var(--accent);
}

.entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 10px;
}

.entry-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 13px 14px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    min-width: 0;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.entry-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    color: inherit;
}

.entry-card-title {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.entry-card-pinyin {
    color: var(--accent);
    font-size: 12.5px;
    letter-spacing: .02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entry-card-snippet {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-state {
    padding: 46px 20px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.empty-hint { font-size: 14px; }
.empty-hint a { color: var(--accent); }

/* ===== 侧栏 ===== */
.side-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    box-shadow: var(--shadow-sm);
}
.side-card h2 {
    font-family: var(--font-sans);
    font-size: 13px;
    letter-spacing: .1em;
    color: var(--muted);
    margin-bottom: 12px;
    font-weight: 600;
}
.side-text { color: var(--muted); font-size: 13.5px; }

.letter-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.letter-grid a {
    display: grid;
    place-items: center;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    font-size: 13px;
    color: var(--ink-soft);
    background: var(--surface-2);
    transition: border-color .12s, color .12s;
}
.letter-grid a:hover, .letter-grid a.is-current {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.quick-links a {
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-soft);
    font-size: 13px;
}
.quick-links a:hover { border-color: var(--accent); color: var(--accent); }

.recent-list { display: flex; flex-wrap: wrap; gap: 7px; }
.recent-list a {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--ink-soft);
}
.recent-list a:hover { border-color: var(--accent); color: var(--accent); }
.side-empty { color: var(--muted); font-size: 13px; margin: 0; }

/* ===== 列表页 ===== */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.page-header p { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 14px;
}
.filter-form input[type="search"],
.filter-form select {
    border: 1px solid var(--line);
    background: var(--paper);
    border-radius: var(--radius-xs);
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    min-height: 38px;
}
.filter-form input[type="search"] { flex: 1 1 200px; min-width: 0; }
.filter-form input:focus, .filter-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.filter-form .button { min-height: 38px; }

.index-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.index-label { color: var(--muted); font-size: 12.5px; margin-right: 4px; letter-spacing: .05em; }
.letter-chip {
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--radius-xs);
    font-size: 13px;
    color: var(--ink-soft);
}
.letter-chip:hover { background: var(--surface-2); color: var(--accent); }
.letter-chip.is-active { background: var(--accent); color: #fff; }

/* ===== 面包屑 ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 18px;
}
.breadcrumb a:hover { color: var(--accent); }
.crumb-sep { color: var(--line-strong); }

/* ===== 详情页 ===== */
.entry-head {
    display: flex;
    align-items: flex-start;
    gap: 26px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 26px;
}

.char-head { align-items: center; }

.glyph-box {
    width: 132px;
    height: 132px;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    font-family: var(--font-serif);
    font-size: 82px;
    line-height: 1;
    flex: 0 0 auto;
}
.glyph-small { width: 86px; height: 86px; font-size: 48px; }

.entry-title { min-width: 0; }
.entry-title h1 {
    font-size: clamp(2rem, 5vw, 2.9rem);
    overflow-wrap: anywhere;
}
.pinyin {
    color: var(--accent);
    font-size: 17px;
    letter-spacing: .1em;
    margin: 6px 0 0;
}
.zhuyin { color: var(--muted); font-size: 13px; margin: 2px 0 0; }

.phonetic-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 4px; }
.phonetic { color: var(--ink-soft); font-size: 14px; }
.phonetic em {
    font-style: normal;
    color: var(--muted);
    font-size: 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 4px;
    margin-right: 5px;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.chip-row-large { margin: 4px 0 24px; }

.chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 12.5px;
    line-height: 1.6;
}
.chip-link:hover { border-color: var(--accent); color: var(--accent); }

.entry-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.prose-block { margin-bottom: 26px; }
.prose-block h2 {
    font-size: 1.25rem;
    margin-bottom: 10px;
    padding-left: 12px;
    position: relative;
}
.prose-block h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: .24em;
    bottom: .24em;
    width: 4px;
    border-radius: 3px;
    background: var(--jade);
}
.prose {
    color: var(--ink-soft);
    font-size: 16px;
    line-height: 1.95;
    overflow-wrap: anywhere;
}

.definition-list { margin: 0; padding-left: 1.35em; color: var(--ink-soft); }
.definition-list li { margin-bottom: 8px; }
.pos-badge {
    display: inline-block;
    min-width: 34px;
    margin-right: 8px;
    color: var(--accent);
    font-size: 13px;
    font-style: italic;
}

.example-list { list-style: none; padding: 0; margin: 0; }
.example-list li {
    padding: 12px 0;
    border-bottom: 1px dashed var(--line);
}
.example-list li:last-child { border-bottom: 0; }
.example-en { color: var(--ink); margin: 0; }
.example-zh { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

.exchange-list { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 20px; }
.exchange-list div { display: flex; gap: 10px; }
.exchange-list dt { color: var(--muted); font-size: 13px; flex: 0 0 88px; }
.exchange-list dd { margin: 0; color: var(--ink-soft); font-size: 14px; }

.fact-list { margin: 0; }
.fact-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 13.5px;
}
.fact-list div:last-child { border-bottom: 0; }
.fact-list dt { color: var(--muted); }
.fact-list dd { margin: 0; color: var(--ink-soft); text-align: right; overflow-wrap: anywhere; }

.char-links { display: flex; flex-wrap: wrap; gap: 10px; }
.char-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 64px;
    padding: 10px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}
.char-link:hover { border-color: var(--accent); color: inherit; }
.char-link-glyph { font-family: var(--font-serif); font-size: 30px; line-height: 1.1; }
.char-link-pinyin { color: var(--accent); font-size: 11.5px; }

.inline-char {
    display: flex;
    gap: 18px;
    align-items: center;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 24px;
}
.inline-char p { margin: 2px 0; }
.inline-char a { color: var(--accent); font-size: 14px; }

.jl-chain {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 24px;
}
.jl-node {
    padding: 5px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
    font-size: 14px;
}
.jl-node:hover { border-color: var(--accent); color: var(--accent); }
.jl-arrow { color: var(--line-strong); font-size: 13px; }

/* ===== 搜索 ===== */
.search-page-head { padding: 34px 0 6px; }
.search-page-head h1 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 16px; }
.page-search {
    position: relative;
    display: flex;
    gap: 6px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 6px 6px 6px 14px;
    max-width: 720px;
}
.page-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.page-search .search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    padding: 8px 0;
    font-size: 16px;
}
.page-search .search-select {
    border: 0;
    background: transparent;
    color: var(--muted);
    outline: none;
    font-size: 13px;
    max-width: 80px;
}

.search-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 4px; }
.search-tab {
    padding: 5px 13px;
    border-radius: 999px;
    font-size: 13.5px;
    color: var(--ink-soft);
    border: 1px solid transparent;
}
.search-tab:hover { background: var(--surface-2); }
.search-tab.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.result-count { color: var(--muted); font-size: 13.5px; margin: 18px 0 10px; }

.result-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.result-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 16px 4px;
    border-bottom: 1px solid var(--line);
}
.result-item:hover { color: inherit; background: var(--surface-2); }
.result-module {
    flex: 0 0 auto;
    font-size: 11.5px;
    color: var(--jade);
    border: 1px solid var(--jade);
    border-radius: 4px;
    padding: 1px 5px;
    margin-top: 4px;
}
.result-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result-title { font-family: var(--font-serif); font-size: 19px; font-weight: 600; }
.result-pinyin { color: var(--accent); font-size: 12.5px; }
.result-snippet { color: var(--muted); font-size: 13.5px; line-height: 1.6; }

/* ===== 分页 ===== */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 30px 0 10px;
}
.page-link {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 13.5px;
}
.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-link.is-current { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.page-gap { display: inline-grid; place-items: center; min-width: 24px; color: var(--muted); }

/* ===== 错误页 ===== */
.error-page {
    text-align: center;
    padding: 76px 0 90px;
}
.error-code {
    font-family: var(--font-serif);
    font-size: 86px;
    line-height: 1;
    color: var(--accent);
    margin: 0 0 6px;
    opacity: .9;
}
.error-page h1 { font-size: 1.8rem; margin-bottom: 10px; }
.error-page p { color: var(--muted); }
.error-page .page-search { margin: 24px auto; }
.error-links { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* ===== 内容页 ===== */
.prose-page { padding: 20px 0 40px; }
.prose-page h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 14px; }
.prose-page h2 { font-size: 1.3rem; margin: 28px 0 10px; }
.prose-page p, .prose-page li { color: var(--ink-soft); line-height: 1.95; }
.prose-page a { color: var(--accent); }

/* ===== 搜索建议 ===== */
.suggest-panel {
    position: absolute;
    z-index: 80;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    padding: 6px;
}
.suggest-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
}
.suggest-item:hover, .suggest-item.is-active { background: var(--surface-2); }
.suggest-title { font-family: var(--font-serif); font-size: 16px; font-weight: 600; }
.suggest-pinyin { color: var(--accent); font-size: 12px; }
.suggest-label { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.suggest-empty { padding: 12px; color: var(--muted); font-size: 13px; }

/* ===== 字号调节 ===== */
body.font-large .prose { font-size: 19px; }
body.font-large .entry-card-snippet { font-size: 13.5px; }

/* ===== 打印 ===== */
@media print {
    .site-header, .site-footer, .entry-side, .entry-actions, .pagination, .search-form { display: none !important; }
    body { background: #fff; color: #000; }
    .page-layout, .home-layout { display: block; }
    .container { max-width: none; padding: 0; }
}

@media (max-width: 900px) {
    .entry-head { flex-direction: column; gap: 16px; }
    .glyph-box { width: 104px; height: 104px; font-size: 62px; }
    .entry-side { position: static; }
    .entry-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
}

@media (max-width: 640px) {
    .entry-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
    .entry-card { padding: 11px 12px; }
    .entry-card-title { font-size: 18px; }
    .daily-glyph { font-size: 64px; }
    .daily-inner { gap: 16px; padding: 14px 16px 18px; }
    .panel-head { padding: 14px 16px 0; }
    .side-card { padding: 15px 15px 13px; }
    .letter-grid { grid-template-columns: repeat(6, 1fr); }
    .result-item { gap: 10px; }
    .error-code { font-size: 64px; }
}