* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 1rem;
    color: #333;
    background: #f5f5f5;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
}

.header {
    text-align: center;
    margin-bottom: 0;
    padding-bottom: 0;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.header .subtitle {
    font-size: 14px;
    color: #999;
}

.search-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.auspicious-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e74c3c;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.auspicious-title {
    font-size: 1rem;
    font-weight: 600;
    color: #e74c3c;
    white-space: nowrap;
}

.auspicious-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auspicious-input-group label {
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
}

.auspicious-input-group input[type="date"],
.auspicious-input-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    background: #fff;
    cursor: pointer;
    min-width: 140px;
}

.auspicious-result {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.auspicious-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.auspicious-header h3 {
    font-size: 1.1rem;
    color: #333;
    margin: 0;
}

.result-count {
    font-size: 0.9rem;
    color: #e74c3c;
    font-weight: 500;
}

.auspicious-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.auspicious-item {
    padding: 1rem;
    background: #fafafa;
    border-radius: 0.25rem;
    border-left: 3px solid #e74c3c;
}

.auspicious-date {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.auspicious-lunar {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.auspicious-events {
    font-size: 0.9rem;
    color: #e74c3c;
    margin-bottom: 0.5rem;
}

.auspicious-clash {
    font-size: 0.85rem;
    color: #999;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
}

.input-group input[type="date"],
.input-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    background: #fff;
    cursor: pointer;
    min-width: 140px;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

.btn-primary, .btn-secondary {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 70px;
    transition: background-color 0.2s ease;
}

.btn-primary {
    background: #3498db;
    color: #fff;
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result {
    gap: 20px;
}

.main-layout {
    display: grid;
    grid-template-columns: 140px 1fr 320px;
    gap: 1rem;
    margin-bottom: 1rem;
}

.left-column {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: left;
}

.bazi-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bazi-item {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px dashed #eee;
    text-align: center;
}

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

.bazi-item .label {
    font-size: 0.9rem;
    color: #666;
    margin-right: 1rem;
    white-space: nowrap;
}

.bazi-item .value {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
}

.center-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.date-section {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
}

.date-section .weekday {
    font-size: 1rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.date-section .date-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.date-section .date-row:last-child {
    margin-bottom: 0;
}

.date-section .date-label {
    font-size: 1.5rem;
    font-weight: 500;
}

.date-section .gregorian-date {
    font-size: 1.5rem;
    font-weight: 700;
}

.date-section .lunar-date {
    font-size: 1.5rem;
    font-weight: 500;
}

.huangdao-section {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.huangdao-info {
    font-size: 14px;
    color: #27ae60;
    font-weight: 500;
}

.huangdao-info.huangdao-lucky {
    color: #e74c3c;
}

.huangdao-info.huangdao-black {
    color: #f39c12;
}

.huangdao-info.heidao-bad {
    color: #95a5a6;
}

.huangdao-info.heidao-worst {
    color: #2c3e50;
}

.peng-section {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.peng-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.peng-content {
    font-size: 13px;
    color: #666;
    line-height: 1.8;
    text-align: center;
}

.gods-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px dashed #eee;
    border-radius: 4px;
}

.gods-label {
    font-size: 13px;
    color: #999;
    text-align: center;
}

.gods-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gods-list span {
    padding: 3px 8px;
    background: #ffeb3b;
    border: 1px solid #ffeb3b;
    border-radius: 3px;
    font-size: 12px;
    color: #d32f2f;
}

.gods-list.bad span {
    background: #000;
    color: #fff;
    border-color: #000;
}

.right-column {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
}

.calendar-section {
    display: flex;
    flex-direction: column;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
}

.calendar-header #calendarMonth {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.calendar-header .calendar-title {
    font-size: 13px;
    color: #999;
}

.calendar-header .nav-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.calendar-header .nav-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    margin-bottom: 8px;
}

.calendar-weekdays span {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 12px;
    color: #999;
}

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

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
    position: relative;
}

.calendar-day:hover {
    background: #f0f0f0;
}

.calendar-day.today {
    background: #3498db;
    color: #fff;
}

.calendar-day.selected {
    background: transparent;
    color: #27ae60;
    font-weight: bold;
}

.calendar-day.selected span:first-child {
    font-size: 16px;
}

.calendar-day.other-month {
    color: #ddd;
}

.calendar-day.empty {
    background: transparent;
    cursor: default;
}

.calendar-day.lunar {
    font-size: 10px;
    margin-top: 2px;
    position: absolute;
    bottom: 2px;
    color: #999;
}

.calendar-day.today .lunar {
    color: rgba(255,255,255,0.8);
}

.calendar-day.selected .lunar {
    color: #27ae60;
}

.yi-ji-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.yi-card, .ji-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
}

.yi-card h3 {
    font-size: 14px;
    font-weight: 500;
    color: #d32f2f;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eee;
    text-align: center;
}

.ji-card h3 {
    font-size: 14px;
    font-weight: 500;
    color: #000;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eee;
    text-align: center;
}

.yi-ji-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.yi-ji-list span {
    padding: 4px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
    color: #d32f2f;
}

.ji-card .yi-ji-list span {
    background: #f8f9fa;
    color: #000;
}

.info-section {
    margin-bottom: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.info-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-size: 13px;
    color: #999;
}

.info-value {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.twohour-section, .directions-section {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.twohour-section h3, .directions-section h3 {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
    text-align: center;
}

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

.twohour-item {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 10px;
}

.twohour-time {
    text-align: left;
    margin-bottom: 8px;
}

.time-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.time-name.luck-good {
    color: #e74c3c;
}

.time-name.luck-bad {
    color: #333;
}

.time-range {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.twohour-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.twohour-row {
    display: flex;
    justify-content: flex-start;
    font-size: 12px;
    gap: 15px;
}

.twohour-row .label {
    color: #999;
}

.twohour-row .value {
    color: #333;
}

.twohour-row.yi .value {
    color: #e74c3c;
}

.twohour-row.ji .value {
    color: #333;
}

.directions-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}

.directions-grid div {
    text-align: center;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
}

.dir-name {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.dir-value {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

footer {
    text-align: center;
    padding: 15px;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: #999;
}

footer p {
    margin-bottom: 5px;
}

footer p:last-child {
    margin-bottom: 0;
}

@media (max-width: 992px) {
    html {
        font-size: 13px;
    }
    
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .left-column {
        order: 2;
    }
    
    .center-column {
        order: 1;
    }
    
    .right-column {
        order: 3;
    }
    
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .twohour-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .directions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .date-section .date-label,
    .date-section .gregorian-date,
    .date-section .lunar-date {
        font-size: 1.25rem;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 12px;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .main-layout {
        gap: 0.75rem;
    }
    
    .search-bar {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .input-group input[type="date"],
    .input-group select {
        min-width: 120px;
        padding: 0.4rem 0.5rem;
    }
    
    .btn-primary, .btn-secondary {
        padding: 0.4rem 0.75rem;
        min-width: 60px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .twohour-grid {
        grid-template-columns: 1fr;
    }
    
    .directions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .date-section {
        padding: 1rem;
    }
    
    .date-section .date-label,
    .date-section .gregorian-date,
    .date-section .lunar-date {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 11px;
    }
    
    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group {
        justify-content: space-between;
    }
    
    .button-group {
        justify-content: center;
    }
    
    .input-group input[type="date"],
    .input-group select {
        min-width: 100px;
        flex: 1;
    }
    
    .directions-grid {
        grid-template-columns: 1fr;
    }
    
    .date-section .date-row {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .bazi-item {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .bazi-item .label {
        margin-right: 0;
    }
}