html {
    font-size: 16px;
}

@media (min-width: 768px) {
    html { font-size: 17px; }
}

@media (max-width: 575px) {
    html { font-size: 17px; }
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", sans-serif;
    color: #333;
    background: #f7f5f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

/* Tool cards on home page */
.tool-card {
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid #dee2e6;
}
.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.tool-card .card-title { font-size: 1.25rem; font-weight: 600; }

/* Date navigation */
.date-nav .btn-sm { font-size: 0.9rem; }
.week-chip { min-width: 55px; font-size: 0.85rem; }
@media (max-width: 575px) {
    .week-chip { min-width: 40px; font-size: 0.8rem; padding: 0.25rem 0.4rem; }
}

/* ZeRi header — warm professional palette */
.zeri-header {
    background: linear-gradient(135deg, #3a2e1e, #5c4a2f, #6b5635);
    color: #f5efe6;
    border-radius: 0.5rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 12px rgba(60, 40, 10, 0.15);
}
.zeri-header .gregorian-date { font-size: 2rem; font-weight: 700; color: #fff; }
.zeri-header .lunar-date { font-size: 1.2rem; opacity: 0.95; }
.zeri-header .weekday { font-size: 1rem; opacity: 0.75; }
.zeri-header .header-ganzhi {
    font-size: 1.3rem;
    font-weight: 700;
    color: #e8d5a3;
    letter-spacing: 0.1em;
}
.zeri-header .header-sub { opacity: 0.95; }
.zeri-header .header-badge { font-size: 0.95rem !important; }

@media (max-width: 767px) {
    .zeri-header .gregorian-date { font-size: 1.6rem; }
    .zeri-header .header-ganzhi { font-size: 1.1rem; }
    .zeri-header { padding: 1rem; }
}

/* GanZhi line */
.ganzhi-line {
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    background: #faf6ee;
    border-left: 4px solid #c9a96e;
    padding: 0.7rem 1rem;
    border-radius: 0.25rem;
    word-break: break-all;
}

/* Cards */
.card {
    border: 1px solid #e5dfd4;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* Section titles */
.section-title {
    font-size: 1.05rem;
    font-weight: 600;
    border-bottom: 2px solid #e5dfd4;
    padding-bottom: 0.35rem;
    margin-bottom: 0.7rem;
}

/* Info rows */
.info-row {
    display: flex;
    padding: 0.3rem 0;
    border-bottom: 1px dotted #eee;
}
.info-row:last-child { border-bottom: none; }
.info-label {
    min-width: 5em;
    font-weight: 600;
    color: #555;
    flex-shrink: 0;
}

/* Yi/Ji badges */
.yi-list .badge, .ji-list .badge {
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0.15rem;
    padding: 0.4em 0.65em;
}

/* Special day warnings */
.special-day-banner {
    background: #c0392b;
    color: #fff;
    padding: 0.6rem 1rem;
    font-weight: 700;
    font-size: 1.1rem;
}
.special-day-tag {
    display: inline-block;
    margin-right: 1em;
}
.special-day-tag.severity-high { color: #fff; }
.special-day-tag.severity-medium { color: #fde8e8; }

/* Summary banner */
.summary-banner { font-size: 1.05rem; font-weight: 600; }

/* Tags */
.tag-badge { font-size: 0.85rem; font-weight: 500; }

/* Memorial items */
.memorial-item {
    padding: 0.35rem 0;
    border-bottom: 1px dashed #eee;
}
.memorial-item:last-child { border-bottom: none; }

/* YuXiaJi reference entries */
.yuxiaji-ref {
    padding: 0.45rem 0.6rem;
    margin-bottom: 0.3rem;
    border-radius: 0.25rem;
    font-size: 0.93rem;
    color: #555;
    line-height: 1.5;
    border-left: 3px solid transparent;
}
.yuxiaji-ref.status-ji { border-left-color: #b5645a; }
.yuxiaji-ref.status-xiong { border-left-color: #c9a96e; }
.yuxiaji-ref.status-ping { border-left-color: #8e8e8e; }

.yuxiaji-ref.highlighted {
    background: #faf3e0;
    color: #333;
    font-weight: 600;
    border-left-width: 4px;
}
.yuxiaji-ref.highlighted.status-ji { border-left-color: #c0392b; background: #fdf0ee; }
.yuxiaji-ref.highlighted.status-xiong { border-left-color: #27ae60; background: #eef9f0; }
.yuxiaji-ref.highlighted.status-ping { border-left-color: #6c757d; background: #f5f5f5; }

.yuxiaji-gz {
    font-weight: 700;
    margin-right: 0.4em;
    color: #5c4a2f;
}
.yuxiaji-ref.highlighted .yuxiaji-gz { color: #3a2e1e; }

.yuxiaji-status {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.1em 0.45em;
    border-radius: 0.2rem;
    margin-right: 0.4em;
    vertical-align: baseline;
}
.yuxiaji-status-吉 { background: #ffebee; color: #c62828; }
.yuxiaji-status-凶 { background: #e8f5e9; color: #2e7d32; }
.yuxiaji-status-平 { background: #f5f5f5; color: #616161; }

/* YuXiaJi matched rules */
.yuxiaji-card { border-left: 4px solid #6c757d; background: #fafafa; }
.yuxiaji-card.severity-severe { border-left-color: #27ae60; background: #eef9f0; }
.yuxiaji-card.severity-warning { border-left-color: #e67e22; background: #fdf6ee; }
.yuxiaji-card.severity-caution { border-left-color: #f1c40f; background: #fdfbee; }
.yuxiaji-card.severity-info { border-left-color: #c0392b; background: #fdf0ee; }

/* === MingPan (八字命盘) === */
.mp-table th, .mp-table td {
    vertical-align: middle;
    padding: 0.5rem 0.4rem;
}
.mp-header-row th {
    background: #f7f5f0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #5c4a2f;
    border-bottom: 2px solid #e5dfd4;
}
.mp-label-col {
    text-align: right !important;
    font-weight: 600;
    color: #888;
    font-size: 0.85rem;
    min-width: 3.5em;
    padding-right: 0.6rem !important;
}
.mp-char {
    display: inline-block;
    font-size: 1.6rem;
    font-weight: 700;
    width: 2.2em;
    height: 2.2em;
    line-height: 2.2em;
    border-radius: 0.35rem;
    border: 2px solid #e5dfd4;
}
.mp-gan-row .mp-char { background: #faf6ee; }
.mp-zhi-row .mp-char { background: #f0ece4; }

.mp-shishen-row td { font-size: 0.85rem; }
.mp-hidden-row td { line-height: 1.6; }
.mp-hidden-gan { font-weight: 600; }
.mp-dishi-row td { color: #5c4a2f; font-weight: 500; }
.mp-nayin-row td { font-size: 0.82rem; }
.mp-shensha-row td { vertical-align: top; }
.mp-shensha-tags {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    width: 100%;
}

/* Five Element colors */
.wx-wood { color: #2d8a4e; }
.wx-fire { color: #c0392b; }
.wx-earth { color: #b8860b; }
.wx-metal { color: #7f8c8d; }
.wx-water { color: #2471a3; }

.wx-wood-bg { background-color: #2d8a4e !important; }
.wx-fire-bg { background-color: #c0392b !important; }
.wx-earth-bg { background-color: #b8860b !important; }
.wx-metal-bg { background-color: #95a5a6 !important; }
.wx-water-bg { background-color: #2471a3 !important; }

.mp-wx-label {
    font-weight: 700;
    font-size: 1rem;
    min-width: 1.8em;
    text-align: center;
}

/* 大运 grid */
.mp-dayun-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.mp-dayun-item {
    text-align: center;
    padding: 0.5rem 0.7rem;
    border: 1px solid #e5dfd4;
    border-radius: 0.35rem;
    min-width: 4.5em;
    background: #faf6ee;
}
.mp-dayun-age {
    font-size: 0.8rem;
    color: #888;
}
.mp-dayun-gz {
    font-size: 1.15rem;
    font-weight: 700;
    color: #3a2e1e;
}
.mp-dayun-year {
    font-size: 0.75rem;
}

/* 神煞 tags */
.mp-shensha-tag {
    display: inline-block;
    padding: 0.1em 0.35em;
    margin: 0;
    border-radius: 0.2rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: help;
    white-space: nowrap;
}
.mp-shensha-tag.ss-ji { background: #e8f5e9; color: #2e7d32; }
.mp-shensha-tag.ss-zhong { background: #f5f5f5; color: #555; }
.mp-shensha-tag.ss-xiong { background: #ffebee; color: #c62828; }
.mp-shensha-pos {
    font-size: 0.75rem;
    color: #999;
    margin-left: 0.2em;
}

@media (max-width: 575px) {
    .mp-char { font-size: 1.3rem; width: 2em; height: 2em; line-height: 2em; }
    .mp-dayun-item { min-width: 3.5em; padding: 0.4rem 0.5rem; }
}

/* BurnNote */
.burn-message-box {
    background: #faf6ee;
    border: 1px solid #e5dfd4;
    border-radius: 0.35rem;
    padding: 1rem 1.25rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.95rem;
    line-height: 1.6;
    max-height: 50vh;
    overflow-y: auto;
}

/* Navbar */
.navbar {
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    background: #fff !important;
}
.navbar-brand {
    color: #3a2e1e !important;
    font-size: 1.15rem;
    letter-spacing: 0.05em;
}
.navbar .nav-link {
    color: #555 !important;
    font-weight: 500;
}
.navbar .nav-link.active {
    color: #3a2e1e !important;
    font-weight: 600;
}
.navbar .nav-link:hover {
    color: #5c4a2f !important;
}
