/**
 * 乾坤门老黄历 - 中国古风样式表
 * 版本：V2.0
 * 创建时间：2025-11-08
 * 设计主题：传统中式 + 现代响应式
 */

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== 全局样式 ==================== */
body {
    font-family: "Microsoft YaHei", "SimSun", "STSong", serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    padding: 20px;
    color: #2c3e50;
    position: relative;
    overflow-x: hidden;
}

/* 祥云背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ==================== 页面头部 ==================== */
.header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.header-decoration {
    position: relative;
    display: inline-block;
    padding: 30px 60px;
}

/* 印章风格边框 */
.header-decoration::before,
.header-decoration::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    border: 3px solid #D4A373;
}

.header-decoration::before {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.header-decoration::after {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

.header h1 {
    font-size: 3em;
    background: linear-gradient(135deg, #C8161D 0%, #D4A373 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    letter-spacing: 8px;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.header h1::before {
    content: '🏮';
    position: absolute;
    left: -50px;
    animation: swing 3s ease-in-out infinite;
}

.header h1::after {
    content: '🏮';
    position: absolute;
    right: -50px;
    animation: swing 3s ease-in-out infinite;
    animation-delay: 1.5s;
}

@keyframes swing {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

.header-subtitle {
    color: #F5E6D3;
    font-size: 1.2em;
    margin-bottom: 8px;
    letter-spacing: 3px;
}

.header-note {
    color: rgba(245, 230, 211, 0.7);
    font-size: 0.95em;
    letter-spacing: 2px;
}

/* ==================== 主布局 ==================== */
.main-wrapper {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 25px;
    margin-bottom: 25px;
}

/* ==================== 中式卡片通用样式 ==================== */
.chinese-card {
    background: linear-gradient(135deg, #F5E6D3 0%, #fff 100%);
    border-radius: 12px;
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.8);
    position: relative;
    overflow: hidden;
}

/* 卡片边框装饰 */
.chinese-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #C8161D 20%, 
        #D4A373 50%, 
        #C8161D 80%, 
        transparent 100%);
}

/* ==================== 日历容器 ==================== */
.calendar-wrapper {
    background: linear-gradient(135deg, #F5E6D3 0%, #fff 100%);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
}

.calendar-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #C8161D 20%, 
        #D4A373 50%, 
        #C8161D 80%, 
        transparent 100%);
}

/* 日历头部 */
.calendar-header {
    background: linear-gradient(135deg, #C8161D 0%, #8B0000 100%);
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
}

/* 祥云装饰 */
.calendar-header::after {
    content: '☁️';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3em;
    opacity: 0.1;
}

.month-selector {
    display: flex;
    align-items: center;
    gap: 20px;
}

.month-selector button {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.month-selector button:hover {
    background: rgba(255,255,255,0.25);
    border-color: #D4A373;
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.month-selector button:active {
    transform: scale(0.95);
}

.current-date {
    color: white;
    font-size: 1.8em;
    font-weight: bold;
    letter-spacing: 3px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.date-picker {
    display: flex;
    gap: 10px;
    align-items: center;
}

.date-picker input[type="date"] {
    padding: 12px 15px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.9);
    font-size: 16px;
    color: #2c3e50;
    transition: all 0.3s ease;
}

.date-picker input[type="date"]:focus {
    outline: none;
    border-color: #D4A373;
    box-shadow: 0 0 0 3px rgba(212, 163, 115, 0.2);
}

.date-picker button {
    background: white;
    color: #C8161D;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.date-picker button:hover {
    background: #D4A373;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

/* ==================== 日历网格 ==================== */
.calendar-grid {
    padding: 25px;
    background: linear-gradient(to bottom, #F5E6D3 0%, #fff 100%);
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.weekday {
    text-align: center;
    font-weight: bold;
    color: #2c3e50;
    padding: 12px;
    font-size: 1.1em;
    background: linear-gradient(135deg, #fff 0%, #F5E6D3 100%);
    border-radius: 8px;
    border: 2px solid #D4A373;
}

.weekday.weekend {
    color: #C8161D;
    border-color: #C8161D;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.day {
    aspect-ratio: 1;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.day:hover {
    background: linear-gradient(135deg, #fff 0%, #F5E6D3 100%);
    border-color: #C8161D;
    transform: scale(1.08);
    z-index: 10;
    box-shadow: 0 8px 16px rgba(200, 22, 29, 0.2);
}

.day.weekend {
    background: #fff5f5;
}

.day.today {
    background: linear-gradient(135deg, #C8161D 0%, #8B0000 100%);
    color: white;
    font-weight: bold;
    border-color: #D4A373;
    box-shadow: 0 8px 24px rgba(200, 22, 29, 0.4);
}

.day.selected {
    background: linear-gradient(135deg, #D4A373 0%, #C8A876 100%);
    color: white;
    border-color: #C8161D;
    box-shadow: 0 8px 24px rgba(212, 163, 115, 0.4);
}

.day.other-month {
    opacity: 0.25;
    pointer-events: none;
}

.day-number {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 4px;
}

.day-lunar {
    font-size: 0.8em;
    color: #666;
    margin-top: 2px;
}

.day.today .day-lunar,
.day.selected .day-lunar {
    color: rgba(255,255,255,0.9);
}

/* 节日标记 */
.holiday-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #C8161D;
    color: white;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 0.7em;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 节气标记 */
.solar-term-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: #2BAE85;
    color: white;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 0.7em;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-card {
    background: linear-gradient(135deg, #F5E6D3 0%, #fff 100%);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.sidebar-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #C8161D 20%, 
        #D4A373 50%, 
        #C8161D 80%, 
        transparent 100%);
}

.sidebar-card h3 {
    color: #C8161D;
    margin-bottom: 18px;
    font-size: 1.2em;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0e6d8;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 2px;
}

/* 信息项 */
.quick-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick-info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed #e0d5c7;
    transition: all 0.3s ease;
}

.quick-info-item:hover {
    padding-left: 8px;
    background: rgba(200, 22, 29, 0.05);
}

.quick-info-item:last-child {
    border-bottom: none;
}

.quick-info-label {
    color: #666;
    font-size: 0.95em;
}

.quick-info-value {
    font-weight: bold;
    color: #2c3e50;
}

/* 神煞卡片特殊样式 */
.shensha-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.shensha-item {
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #D4A373;
    transition: all 0.3s ease;
    cursor: pointer;
}

.shensha-item:hover {
    border-left-color: #C8161D;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateX(4px);
}

.shensha-name {
    font-weight: bold;
    color: #C8161D;
    margin-bottom: 6px;
    font-size: 1.05em;
}

.shensha-type {
    display: inline-block;
    background: #D4A373;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-right: 6px;
}

.shensha-description {
    color: #666;
    font-size: 0.9em;
    line-height: 1.6;
    margin-top: 8px;
    display: none; /* 默认隐藏，点击展开 */
}

.shensha-item.expanded .shensha-description {
    display: block;
}

/* 搜索框 */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.search-box input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e0d5c7;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #D4A373;
    box-shadow: 0 0 0 3px rgba(212, 163, 115, 0.1);
}

.search-box button {
    background: linear-gradient(135deg, #C8161D 0%, #8B0000 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: linear-gradient(135deg, #D4A373 0%, #C8A876 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* 节日列表 */
.holiday-list {
    max-height: 350px;
    overflow-y: auto;
    padding-right: 5px;
}

.holiday-item {
    padding: 12px;
    border-bottom: 1px solid #f0e6d8;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.holiday-item:hover {
    background: linear-gradient(135deg, rgba(200, 22, 29, 0.05) 0%, rgba(212, 163, 115, 0.05) 100%);
    padding-left: 16px;
    border-left: 3px solid #C8161D;
}

.holiday-date {
    font-size: 0.9em;
    color: #666;
}

.holiday-name {
    font-weight: bold;
    color: #2c3e50;
    margin-top: 5px;
}

/* ==================== 详细信息面板 ==================== */
.info-panel {
    background: linear-gradient(135deg, #F5E6D3 0%, #fff 100%);
    border-radius: 12px;
    padding: 35px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin-top: 25px;
    position: relative;
}

.info-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #C8161D 20%, 
        #D4A373 50%, 
        #C8161D 80%, 
        transparent 100%);
}

.info-panel h2 {
    color: #C8161D;
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.8em;
    letter-spacing: 4px;
    position: relative;
    padding-bottom: 15px;
}

.info-panel h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #D4A373, transparent);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.info-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #f0e6d8;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.info-card:hover {
    border-color: #D4A373;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-4px);
}

.info-card h3 {
    color: #C8161D;
    margin-bottom: 20px;
    font-size: 1.15em;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0e6d8;
    letter-spacing: 2px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed #e0d5c7;
    align-items: flex-start;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: #666;
    font-size: 0.95em;
    min-width: 100px;
}

.info-value {
    font-weight: 500;
    color: #2c3e50;
    text-align: right;
    flex: 1;
    word-break: break-word;
}

/* 十二时辰列表 */
.hour-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.hour-item {
    background: linear-gradient(135deg, #fff 0%, #F5E6D3 100%);
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #D4A373;
    text-align: center;
    transition: all 0.3s ease;
}

.hour-item:hover {
    border-color: #C8161D;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(200, 22, 29, 0.2);
}

.hour-name {
    font-weight: bold;
    color: #C8161D;
    margin-bottom: 6px;
    font-size: 1.05em;
}

.hour-time {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
}

.hour-ganzhi {
    font-size: 1.1em;
    font-weight: bold;
    color: #2c3e50;
}

/* ==================== 加载和错误状态 ==================== */
.loading {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 1.05em;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f0e6d8;
    border-top-color: #C8161D;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 12px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error {
    text-align: center;
    padding: 20px;
    color: #C8161D;
    background: rgba(200, 22, 29, 0.1);
    border-radius: 8px;
    margin: 20px 0;
    border: 2px solid rgba(200, 22, 29, 0.3);
}

/* 缓存指示器 */
.cache-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(212, 163, 115, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85em;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    display: none;
}

.cache-indicator.show {
    display: block;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==================== 滚动条样式 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f0e6d8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #C8161D 0%, #D4A373 100%);
    border-radius: 4px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #8B0000 0%, #C8A876 100%);
}

/* ==================== 响应式设计 ==================== */

/* 平板设备 */
@media (max-width: 1023px) {
    .main-wrapper {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
    
    .header h1 {
        font-size: 2.5em;
        letter-spacing: 4px;
    }
    
    .info-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* 手机设备 */
@media (max-width: 767px) {
    body {
        padding: 10px;
    }
    
    .container {
        max-width: 100%;
    }
    
    /* 头部调整 */
    .header {
        margin-bottom: 20px;
    }
    
    .header-decoration {
        padding: 20px 30px;
    }
    
    .header-decoration::before,
    .header-decoration::after {
        width: 50px;
        height: 50px;
        border-width: 2px;
    }
    
    .header h1 {
        font-size: 1.8em;
        letter-spacing: 2px;
    }
    
    .header h1::before,
    .header h1::after {
        display: none;
    }
    
    .header-subtitle {
        font-size: 1em;
        letter-spacing: 2px;
    }
    
    .header-note {
        font-size: 0.85em;
    }
    
    /* 日历头部 */
    .calendar-header {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
    }
    
    .calendar-header::after {
        display: none;
    }
    
    .month-selector {
        width: 100%;
        justify-content: space-between;
    }
    
    .month-selector button {
        padding: 10px 14px;
        font-size: 16px;
    }
    
    .current-date {
        font-size: 1.4em;
        letter-spacing: 2px;
    }
    
    .date-picker {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .date-picker input[type="date"] {
        flex: 1;
        min-width: 150px;
        padding: 10px;
        font-size: 14px;
    }
    
    .date-picker button {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    /* 日历网格 */
    .calendar-grid {
        padding: 15px 10px;
    }
    
    .weekdays {
        gap: 5px;
    }
    
    .weekday {
        padding: 8px 4px;
        font-size: 0.9em;
        border-width: 1px;
    }
    
    .days {
        gap: 5px;
    }
    
    .day {
        padding: 6px;
        border-width: 1px;
        min-height: 60px;
    }
    
    .day-number {
        font-size: 1.1em;
    }
    
    .day-lunar {
        font-size: 0.7em;
    }
    
    .holiday-badge,
    .solar-term-badge {
        padding: 2px 4px;
        font-size: 0.6em;
        border-radius: 4px;
    }
    
    /* 侧边栏 */
    .sidebar {
        grid-template-columns: 1fr;
    }
    
    .sidebar-card {
        padding: 20px;
    }
    
    .sidebar-card h3 {
        font-size: 1.1em;
    }
    
    .shensha-list,
    .holiday-list {
        max-height: 300px;
    }
    
    /* 信息面板 */
    .info-panel {
        padding: 20px 15px;
    }
    
    .info-panel h2 {
        font-size: 1.4em;
        letter-spacing: 2px;
        margin-bottom: 20px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .info-card {
        padding: 18px;
    }
    
    .info-card h3 {
        font-size: 1.05em;
    }
    
    .info-item {
        flex-direction: column;
        gap: 6px;
        padding: 8px 0;
    }
    
    .info-label {
        min-width: auto;
    }
    
    .info-value {
        text-align: left;
    }
    
    /* 时辰列表 */
    .hour-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .hour-item {
        padding: 10px;
    }
    
    /* 搜索框 */
    .search-box {
        flex-wrap: wrap;
    }
    
    .search-box input {
        min-width: 70px;
    }
    
    /* 缓存指示器 */
    .cache-indicator {
        bottom: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 0.8em;
    }
}

/* 超小屏幕 */
@media (max-width: 375px) {
    .header h1 {
        font-size: 1.5em;
    }
    
    .current-date {
        font-size: 1.2em;
    }
    
    .day {
        min-height: 50px;
        padding: 4px;
    }
    
    .day-number {
        font-size: 1em;
    }
    
    .day-lunar {
        font-size: 0.65em;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    body {
        background: white;
    }
    
    .date-picker,
    .search-box,
    .cache-indicator {
        display: none;
    }
    
    .info-panel {
        page-break-before: always;
    }
}

/* ==================== 辅助类 ==================== */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 協紀卡（2026-10-29 批 W）：淺底黑字，整區塊統一 */
.xieji-card {
    background: #FAF7F0;
    color: #1A1A1A;
    grid-column: 1 / -1;
}
.xieji-card h3 {
    color: #1A1A1A;
}
.xieji-card .xj-sub {
    color: #1A1A1A;
    margin: -8px 0 10px;
    font-size: 0.95em;
}
.xieji-card .xj-row {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed #e0d5c7;
    align-items: flex-start;
}
.xieji-card .xj-row:last-child {
    border-bottom: none;
}
.xieji-card .xj-label {
    color: #1A1A1A;
    min-width: 4.5em;
    flex-shrink: 0;
}
.xieji-card .xj-value {
    color: #1A1A1A;
    flex: 1;
    line-height: 1.8;
    word-break: break-word;
}
@media (max-width: 600px) {
    .xieji-card .xj-row { flex-direction: column; gap: 2px; }
}

/* 乙版：神煞分「協紀｜通書」兩欄（2026-10-29），淺底黑字同一區塊 */
.xieji-card .xj-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 10px;
}
.xieji-card .xj-col {
    border: 1px solid #e0d5c7;
    border-radius: 8px;
    padding: 6px 10px;
}
.xieji-card .xj-col-title {
    color: #1A1A1A;
    font-weight: 600;
    padding: 4px 0;
    border-bottom: 1px solid #e0d5c7;
}
.xieji-card .xj-yiji-title {
    margin-top: 6px;
}
@media (max-width: 600px) {
    .xieji-card .xj-cols { gap: 8px; }
    .xieji-card .xj-col { padding: 4px 6px; }
}

/* ==================== 版面優化階段一（預覽 .ui-v2，2026-10-29） ==================== */
.ui-v2 .weekdays, .ui-v2 .days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.ui-v2 .day { min-width: 0; overflow: hidden; }
.ui-v2 .calendar-wrapper .info-panel { margin: 0; border-radius: 0; box-shadow: none; padding: 16px; }
.ui-v2 .info-panel h2 { font-size: 1.2em; margin-bottom: 12px; }
.ui-v2 .info-panel h2::after { display: none; }
.ui-v2 .info-grid { gap: 14px; }
.ui-v2 .info-card { padding: 14px; }
.ui-v2 .xieji-card { font-size: 16px; padding: 16px; }
.ui-v2 .xieji-card h3 { font-size: 1.2em; margin-bottom: 8px; }
.ui-v2 .xieji-card .xj-sub { margin: 0 0 10px; font-size: 15px; }
.ui-v2 .xieji-card .xj-label { font-weight: 600; }
.ui-v2 .xieji-card .xj-row { flex-direction: column; gap: 4px; padding: 8px 0; }
.ui-v2 .xieji-card .xj-value { line-height: 1.5; }
.ui-v2 .xj-chip {
    display: inline-block; white-space: nowrap;
    padding: 2px 9px; margin: 3px 6px 3px 0;
    border: 1px solid #d9cbb6; border-radius: 14px;
    background: #fff; color: #1A1A1A; font-size: 15px; line-height: 1.6;
}
.ui-v2 .xj-none { color: #1A1A1A; }
.ui-v2 .xj-tip { padding: 2px 0; line-height: 1.6; }
.ui-v2 .xieji-card .xj-cols { gap: 10px; }
.ui-v2 .xieji-card .xj-col { padding: 6px 8px; background: #FFFDF8; }
@media (max-width: 767px) {
    .ui-v2 .calendar-wrapper .info-panel { padding: 10px 8px; }
    .ui-v2 .info-card { padding: 12px; }
    .ui-v2 .xieji-card { padding: 12px 10px; }
    .ui-v2 .xj-chip { font-size: 14px; padding: 1px 7px; margin: 2px 4px 2px 0; }
}
.ui-v2 .day { aspect-ratio: auto; min-height: 56px; }  /* 正方形＋最小高度會把格寬撐出畫面 */
@media (max-width: 767px) {   /* 手機：節日／節氣標籤改放在農曆下方，不蓋住日期數字 */
    .ui-v2 .holiday-badge, .ui-v2 .solar-term-badge {
        position: static; margin-top: 2px; padding: 0 3px;
        font-size: 10px; line-height: 1.4; box-shadow: none; white-space: nowrap;
    }
    .ui-v2 .day { padding: 4px 2px; justify-content: flex-start; }
}

/* 今日資訊橫列（預覽 ui-v2，2026-10-29） */
.ui-v2 .today-strip { margin: 0 0 16px; padding: 12px 16px; }
.ui-v2 .today-strip h3 { margin-bottom: 8px; }
.ui-v2 .today-strip .quick-info { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0; }
.ui-v2 .today-strip .quick-info-item {
    flex-direction: column; align-items: center; justify-content: center; text-align: center;
    border-bottom: none; border-right: 1px solid #e0d5c7; padding: 6px 4px; gap: 4px;
}
.ui-v2 .today-strip .quick-info-item:last-child { border-right: none; }
.ui-v2 .today-strip .quick-info-item:hover { padding-left: 4px; }
.ui-v2 .today-strip .quick-info-label { font-size: 13px; color: #1A1A1A; }
.ui-v2 .today-strip .quick-info-value { font-size: 15px; color: #1A1A1A; }
@media (max-width: 1100px) {
    .ui-v2 .today-strip .quick-info { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .ui-v2 .today-strip .quick-info-item { border-bottom: 1px solid #e0d5c7; }
    .ui-v2 .today-strip .quick-info-item:nth-child(6n) { border-right: none; }
}
@media (max-width: 767px) {
    .ui-v2 .today-strip { padding: 10px 8px; margin-bottom: 10px; }
    .ui-v2 .today-strip .quick-info { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .ui-v2 .today-strip .quick-info-item:nth-child(6n) { border-right: 1px solid #e0d5c7; }
    .ui-v2 .today-strip .quick-info-item:nth-child(4n) { border-right: none; }
    .ui-v2 .today-strip .quick-info-value { font-size: 14px; }
}
@media (min-width: 1101px) {   /* 公曆欄較寬，日期不折行 */
    .ui-v2 .today-strip .quick-info { grid-template-columns: 1.7fr repeat(11, minmax(0, 1fr)); }
    .ui-v2 .today-strip .quick-info-item:first-child .quick-info-value { white-space: nowrap; }
}

/* 詳情面板放進月曆卡下方（2026-10-30 正式版）：與月曆同卡，去掉獨立卡片的外框陰影 */
.calendar-wrapper .info-panel {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 24px;
    border-top: 1px solid #e0d5c7;
}
.calendar-wrapper .info-panel::before { display: none; }
@media (max-width: 767px) {
    .calendar-wrapper .info-panel { padding: 14px 10px; }
}

/* 詳情面板整合版（2026-10-30）：協紀卡上方日期＋四柱納音＋其他曆法；右欄兩卡疊放；十二時辰滿版置底 */
.xieji-card .day-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0d5c7;
}
.xieji-card .dh-solar { font-size: 1.15em; font-weight: 700; }
.xieji-card .dh-lunar { margin-top: 4px; }
.xieji-card .dh-fest { color: #C8161D; font-weight: 600; }
.xieji-card .dh-pillars { display: flex; gap: 10px; }
.xieji-card .dh-pillar {
    min-width: 84px;
    text-align: center;
    border: 1px solid #e0d5c7;
    border-radius: 8px;
    padding: 6px 10px;
    background: #FFFDF8;
}
.xieji-card .dh-pname { font-size: 0.85em; }
.xieji-card .dh-gz { font-size: 1.35em; font-weight: 700; color: #C8161D; letter-spacing: 2px; }
.xieji-card .dh-ny, .xieji-card .dh-ex { font-size: 0.85em; }
.xieji-card .dh-cal {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    font-size: 0.85em;
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid #e0d5c7;
}
.xieji-card .day-head + .xj-sub { margin-top: 10px; }
.info-stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.info-card.hour-card { grid-column: 1 / -1; }
@media (max-width: 767px) {
    .xieji-card .dh-pillars { width: 100%; justify-content: space-between; gap: 6px; }
    .xieji-card .dh-pillar { flex: 1; min-width: 0; padding: 6px 4px; }
    .info-stack { gap: 15px; }
}

/* 全版萬年曆（2026-10-30）：側欄取消，月曆滿版；標題旁農曆；格子農曆月日；近30天節日置底；其他曆法標題上色 */
.main-wrapper { grid-template-columns: 1fr; }
.month-title { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.current-lunar { color: #FFE9C9; font-size: 0.95em; letter-spacing: 1px; white-space: nowrap; }
@media (min-width: 1024px) {   /* 滿版後正方形格子太高 */
    .day { aspect-ratio: auto; min-height: 92px; }
    .day-lunar { font-size: 0.9em; }
    .hour-card .hour-list { grid-template-columns: repeat(6, minmax(0, 1fr)); }   /* 十二時辰兩排各六 */
}
.day-lunar .lm { margin-right: 1px; }
.xieji-card .dh-extra { margin-top: 4px; font-size: 0.9em; }
.xieji-card .dh-cal b { font-weight: 700; margin-right: 4px; }
.xieji-card .cal-fo { color: #B8860B; }
.xieji-card .cal-dao { color: #2E7D32; }
.xieji-card .cal-yi { color: #00838F; }
.xieji-card .cal-ju { color: #1565C0; }
.holiday-section { padding: 0 24px 24px; }
.holiday-section h3 {
    color: #C8161D;
    font-size: 1.15em;
    letter-spacing: 2px;
    padding: 16px 0 10px;
    margin-bottom: 10px;
    border-bottom: 2px solid #f0e6d8;
}
.holiday-section .holiday-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 6px 12px;
}
.holiday-section .holiday-item { background: #fff; border: 1px solid #f0e6d8; }
@media (max-width: 767px) {
    .day-lunar .lm { display: none; }
    .holiday-section { padding: 0 10px 14px; }
    .holiday-section .holiday-list { grid-template-columns: 1fr 1fr; }
}

/* 三欄合一表（2026-10-30）：神位方向｜天神・節氣・星宿｜其他資訊，星宿歌訣跨三欄置底 */
.info-card.three-col-card { grid-column: 1 / -1; }
.three-col-card .tc-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 28px; }
.three-col-card .tc-col { min-width: 0; }
.three-col-card .tc-col + .tc-col { border-left: 1px solid #f0e6d8; padding-left: 28px; }
.three-col-card .info-label { min-width: 86px; }
.three-col-card .tc-song {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid #f0e6d8;
    line-height: 1.7;
    color: #2c3e50;
}
.three-col-card .tc-song b { color: #C8161D; margin-right: 10px; }
@media (max-width: 1023px) {
    .three-col-card .tc-cols { grid-template-columns: 1fr; }
    .three-col-card .tc-col + .tc-col { border-left: none; padding-left: 0; margin-top: 14px; }
}

/* 標題欄粗體上色（2026-10-30，老師看過底色塊後改為不要底色）：吉／宜綠、凶／忌紅、其餘深棕 */
.xieji-card .xj-row { align-items: baseline; }
.xieji-card .xj-label {
    color: #5A3A1A;
    font-weight: 700;
    min-width: 5em;
}
.xieji-card .xj-label b { font-weight: 700; }
.xieji-card .xj-label.lb-good { color: #1E7B4F; }
.xieji-card .xj-label.lb-bad { color: #B71C1C; }
.three-col-card .info-item { align-items: baseline; }
.three-col-card .info-label {
    color: #5A3A1A;
    font-weight: 700;
    min-width: 0;
    flex: 0 0 auto;
    margin-right: 10px;
    align-self: flex-start;
}
@media (max-width: 600px) {
    .xieji-card .xj-label { text-align: left; align-self: flex-start; }
}

/* 手機／平板月曆只剩六格（2026-10-30 客訴）：正方形＋最小高度把每格撐到 60px，七格超出畫面、週六被切掉 → 七欄平分寬度、取消正方形 */
@media (max-width: 1023px) {
    .weekdays, .days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .day { aspect-ratio: auto; min-width: 0; overflow: hidden; }
}
@media (max-width: 767px) {   /* 窄格裡節日／節氣小標改放農曆下方，不蓋住日期數字 */
    .day { padding: 4px 2px; min-height: 56px; justify-content: flex-start; }
    .holiday-badge, .solar-term-badge {
        position: static; margin-top: 2px; padding: 0 3px;
        font-size: 10px; line-height: 1.4; box-shadow: none; white-space: nowrap;
    }
}

/* ==================== 多語系（2026-10-31） ==================== */
.lang-bar { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin: 0 0 6px; position: relative; z-index: 2; }
.lang-bar .lang-globe { font-size: 16px; line-height: 1; }
.lang-bar select {
    font-size: 16px; padding: 5px 28px 5px 10px; border-radius: 8px; border: 1px solid rgba(245,230,211,0.5);
    background: #FFF8EE; color: #1A1A1A; max-width: 70vw; cursor: pointer;
}
.lang-bar noscript a { color: #F5E6D3; margin-left: 6px; font-size: 14px; }
html.i18n-foreign body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Thai", "Leelawadee UI", Tahoma, Arial, "Microsoft YaHei", sans-serif; }
html.i18n-foreign .holiday-badge, html.i18n-foreign .solar-term-badge {
    max-width: calc(50% - 6px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html.i18n-foreign .header h1, html.i18n-foreign .header-subtitle, html.i18n-foreign .header-note { letter-spacing: normal; }
html.i18n-foreign .current-lunar { white-space: normal; text-align: center; letter-spacing: normal; }
html.i18n-foreign .xieji-card .xj-label { min-width: 6.5em; }
html.i18n-foreign .info-value, html.i18n-foreign .xj-value, html.i18n-foreign .holiday-name, html.i18n-foreign .dh-ex, html.i18n-foreign .dh-ny { overflow-wrap: anywhere; }
html.i18n-foreign .hour-name { white-space: normal; }
@media (max-width: 767px) {
    .lang-bar { margin-bottom: 4px; }
    .lang-bar select { font-size: 16px; padding: 4px 24px 4px 8px; }
    html.i18n-foreign .holiday-badge, html.i18n-foreign .solar-term-badge { max-width: 100%; }
    html.i18n-foreign .header h1 { font-size: 1.6em; }
}
html.i18n-foreign h2, html.i18n-foreign h3, html.i18n-foreign .current-date, html.i18n-foreign .xj-col-title { letter-spacing: normal; }

/* 2026-10-31：手機版外語節日／節氣標籤會被截成「Hari…」，改成小圓點（紅＝節日、綠＝節氣），點日期看全名（老師裁「可以」） */
@media (max-width: 767px) {
    html.i18n-foreign .holiday-badge, html.i18n-foreign .solar-term-badge {
        font-size: 0; width: 8px; height: 8px; max-width: 8px; padding: 0; margin: 3px auto 0;
        border-radius: 50%; display: inline-block; overflow: hidden;
    }
}
