
:root {
    --primary: #468C37;
    --primary-light: #49964D;
    --secondary: #ADD5A2;
    --bg: #f0f5f2;
    --card-bg: #f8faf8;
    --text: #3D6036;
    --text-black: #000;
    --text-light: #446A37;
    --border: #D4DDE1;
    --input-bg: #ffffff;
    --input-border: #e8eceb;
    --input-focus-shadow: rgba(74, 124, 89, 0.12);
    --shadow: rgba(70, 140, 55, 0.08);
    --text-main: #3D6036;
    --text-sub: #5a7a52;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: "Microsoft JhengHei", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    min-height: 100vh;
}
.mt-3 {
    margin-top: 1.5rem!important;
}
.mb-3 {
    margin-bottom: 1.5rem!important;;
}
u {
    color: #f44236!important;
}
.text-center {
    text-align: center!important;
}
.text-primary {
    color: var(--primary)!important;
}

/*新增*/
.page-subtitle {
    background-color: #6BB392;
    color: #fff;
    font-weight: 300;
    align-items: center !important;
    display: flex;
    text-align: center;
    justify-content: center !important;
    font-size: 2rem;
    border-radius: 8px;
}
.high-school {
    background-color: #206864;
}
.intro-text {
    max-width: 1440px;
    margin: 0 auto;
    padding: 30px;
    padding-bottom: 0px;
}

/* ===== 首页 ===== */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--card-bg);
    padding: 50px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.header::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.03) 10px, rgba(255,255,255,0.03) 20px);
    pointer-events: none;
}
.header h1 {
    font-size: 2.8em;
    font-weight: 300;
    letter-spacing: 12px;
    margin-bottom: 12px;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.3);
    position: relative;
}
.header p {
    font-size: 1.15em;
    opacity: 0.9;
    letter-spacing: 3px;
    position: relative;
}
.search-wrap {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: #fff;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.search-wrap input {
    width: 100%;
    max-width: 600px;
    padding: 16px 24px;
    border: 2px solid var(--input-border);
    border-radius: 60px;
    font-size: 16px;
    background: var(--input-bg);
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    color: var(--text-main);
    font-family: inherit;
}
.search-wrap input::placeholder {
    color: var(--text-sub);
    opacity: 0.6;
}
.search-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--input-focus-shadow);
}
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    padding: 30px;
    max-width: 1440px;
    margin: 0 auto;
}
.article-card {
    background: #fff;
    border-radius: 8px;
    padding: 28px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: block;
}
.article-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.35s;
    transform-origin: top;
}
.article-card:hover {
    box-shadow: 0 12px 30px rgba(70,140,55,0.12);
}
.article-card:hover::before { transform: scaleY(1); }
.card-title {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}
.card-meta {
    color: var(--text-light);
    font-size: 0.9em;
    margin-bottom: 14px;
}
.card-meta span { margin-right: 12px; }
.card-preview {
    color: #777;
    font-size: 0.95em;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-footer {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #EFF0F1;
    color: var(--primary);
    border-radius: 2px;
    font-size: 0.8em;
    font-weight: 500;
}
.card-arrow {
    color: var(--secondary);
    font-size: 1.2em;
    transition: transform 0.3s;
}
.article-card:hover .card-arrow {
    transform: translateX(4px);
    color: var(--primary);
}

/* ===== 详情页 ===== */
.detail-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 35px 30px 120px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow: hidden;
}
.detail-header::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.03) 10px, rgba(255,255,255,0.03) 20px);
    pointer-events: none;
}
.back-btn {
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px 18px;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    font-size: 0.9em;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    text-decoration: none;
    font-family: inherit;
    cursor: pointer;
    z-index: 10;
}
.back-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.7);
}
.detail-title {
    font-size: 2.2em;
    color: #fff;
    margin-bottom: 10px;
    font-weight: 300;
    position: relative;
}
.detail-meta {
    color: rgba(255,255,255,0.75);
    font-size: 1.05em;
    position: relative;
}
.detail-content {
    padding: 0 30px 30px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}
.article-content {
    margin-top: -99px;
    position: relative;
    width: 100%;
}
.section {
    background: #fff;
    border-radius: 5px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 30px 50px 0 rgba(1,1,1,0.15);
}
.section-title {
    font-size: 1.25em;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #BFD1B2;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}
.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--secondary);
    border-radius: 2px;
}

/* 原文拼音样式 - 词组高亮 */
.original-text {
    font-size: 1.75em;
    text-align: left;
    line-height: 1.75;
    color: var(--text-black);
}
.char-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 0 1px;
}
.pinyin {
    font-size: 0.5714em;
    color: #aaa;
    height: 25px;
    line-height: 25px;
    font-family: 'Noto Sans SC', sans-serif;
    letter-spacing: 0;
}
.hanzi {
    font-size: 1em;
    padding: 2px 1px;
    border-radius: 4px;
    transition: all 0.2s;
    font-family: "楷体";
    min-width: 54px;
    min-height: 53px;
    background-image: url(../images/tian.png);
    background-repeat: no-repeat;
    background-size: cover;
    text-align: center;
}

/* 词组整体包裹 */
/* 词组只保留语义和 tooltip 定位 */
.word-group {
    display: inline;
    cursor: help;
    position: relative;
}

/* 每个字组独立承载下划线和 hover 背景 */
.word-group > .char-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 0 1px;
    border-bottom: 2px dotted var(--secondary);
    border-radius: 4px;
    transition: all 0.2s;
}

/* 词组 hover：每个字组同步高亮，视觉上连成一片 */
.word-group:hover > .char-group {
    background: #eef5ec;
}

.word-group:hover > .char-group .hanzi {
    color: var(--primary);
}

/* 纯CSS Tooltip */
.tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);

    /* 关键修改：让宽度由内容决定，不再受父级 narrow width 限制 */
    width: max-content;           /* 或 fit-content */
    max-width: 500px;             /* 上限生效 */
    min-width: 220px;             /* 下限保留 */

    /* 确保超长内容到达 500px 时能正确换行，而不是溢出 */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;

    background: var(--text-black);
    color: var(--card-bg);
    padding: 10px 14px;
    border-radius: 3px;
    font-size: 0.85em;
    line-height: 1.5;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    pointer-events: none;
    text-align: left;
}
.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: var(--text-black) transparent transparent;
}
.word-group:hover .tooltip {
    display: block;
}
.tooltip-word {
    font-weight: 300;
    display: block;
    color: var(--secondary);
    font-size: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.175);
    padding-bottom: 3px;
    margin-bottom: 6px;
}
.tooltip-meaning {
    font-size: 1rem;
    line-height: 1.5;
}

.sentence {
    margin-bottom: 3rem;
    display: block;
}

.translation-text {
    line-height: 2.2;
    margin-bottom: 1.5rem;
    color: #555;
    font-size: 1.08em;
}
.translation-text p {
    margin-bottom: 12px;
    text-indent: 2em;
}
.notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.note-item {
    background: var(--card-bg);
    padding: 14px 16px;
    border-radius: 5px;
    border: 1px solid #EAEEF1;
    transition: all 0.2s;
}
.note-item:hover {
    border-color: var(--secondary);
    box-shadow: 0 2px 8px rgba(70,140,55,0.06);
}
.note-word {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
    font-size: 1.05em;
}
.note-meaning {
    color: #666;
    font-size: 0.92em;
    line-height: 1.5;
}
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #999;
    grid-column: 1 / -1;
}

footer {
    margin-top: 72px;
    text-align: center;
    color: var(--text-sub);
    font-size: 14px;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    letter-spacing: 1px;
    transition: color 0.45s ease, border-color 0.45s ease;
}

footer a {
    color: var(--text-sub);
}

.hide-card {
    display: none!important;
}

.empty-tip {
    text-align: center;
    padding: 60px 20px 0px;
    color: var(--text-sub);
    font-size: 16px;
    display: none;
    transition: background 0.45s ease, color 0.45s ease, border-color 0.45s ease;
}

.empty-tip strong {
    color: var(--primary);
    transition: color 0.45s ease;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .header h1 { font-size: 2em; letter-spacing: 6px; }
    .article-grid { grid-template-columns: 1fr; padding: 20px; }

    .detail-header { padding: 25px 15px 100px; }
    .back-btn { 
        position: static; 
        transform: none; 
        margin-bottom: 15px; 
        display: inline-flex;
        background: rgba(255,255,255,0.15);
    }
    .detail-title { font-size: 1.6em; }
    .detail-content { padding: 0 15px 20px; }
    .article-content { margin-top: -80px; }
    .section { padding: 20px; }

    .original-text { font-size: 1.25em; }
    .pinyin { height: 16px; line-height: 16px; }
    .hanzi { min-width: 39px; min-height: 39px; }
    .tooltip { max-width: 260px; min-width: 160px; font-size: 0.8em; padding: 8px 10px; }
    .notes-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .header h1 { font-size: 1.6em; letter-spacing: 4px; }
    .header p { font-size: 1em; }
    .search-wrap { padding: 15px; }
    .search-wrap input { padding: 12px 18px; font-size: 15px; }
    .article-card { padding: 20px; }
    .hanzi { min-width: 35px; min-height: 35px;}
    .card-title { font-size: 1.3em; }
    .original-text { font-size: 1.15em; }
}
