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

body {
    font-family: 'Microsoft YaHei', 'Arial', sans-serif;
    background: #93C6DB;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1em;
    opacity: 0.95;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

.card h2 {
    color: #E87A5D;
    margin-bottom: 20px;
    border-bottom: 2px solid #E87A5D;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #E87A5D;
    box-shadow: 0 0 0 3px rgba(232, 122, 93, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 18px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.gender-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.gender-option {
    flex: 1;
    display: flex;
    align-items: center;
}

.gender-option input[type="radio"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

.gender-option label {
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

.form-group.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 25px;
}

button {
    padding: 14px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-calculate {
    background: linear-gradient(135deg, #F4A261 0%, #E87A5D 100%);
    color: white;
    grid-column: 1 / -1;
}

.btn-calculate:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(232, 122, 93, 0.4);
}

.btn-calculate:active {
    transform: scale(0.98);
}

.btn-export {
    background: #F4A261;
    color: white;
}

.btn-export:hover {
    background: #E87A5D;
    transform: scale(1.02);
}

.btn-clear {
    background: #f44336;
    color: white;
}

.btn-clear:hover {
    background: #da190b;
    transform: scale(1.02);
}

.error {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #c62828;
    display: none;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

.error.show {
    display: block;
}

/* Results Section */
.result {
    display: none;
    margin-top: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 12px;
}

.result.show {
    display: block;
}

.result h2 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

/* Pillars Display */
.pillars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.pillar {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pillar-title {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
}

.pillar-value {
    font-size: 24px;
    font-weight: bold;
    color: #E87A5D;
}

.pillar.hidden {
    display: none;
}

.pillars.three-columns {
    grid-template-columns: repeat(3, 1fr);
}

/* Info Display */
.info {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

.info-label {
    color: #666;
}

.info-value {
    color: #333;
    font-weight: bold;
}

/* Sections */
.section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 25px;
}

.section h3 {
    color: #E87A5D;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-bottom: 2px solid #E87A5D;
    padding-bottom: 10px;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.section h4 {
    color: #D96846;
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.section h4:first-child {
    margin-top: 0;
}

/* Pillar Table */
.pillar-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.pillar-table th,
.pillar-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.pillar-table th {
    background: linear-gradient(135deg, #E87A5D 0%, #D96846 100%);
    color: white;
    font-weight: 600;
}

.pillar-table tr:nth-child(even) {
    background: #f9f9f9;
}

.pillar-table tr:hover {
    background: #f0f0f0;
}

.ganzhi-cell {
    font-size: 1.3em;
    font-weight: bold;
    color: #E87A5D;
}

.deity-cell {
    color: #D96846;
    font-weight: 600;
}

.stage-cell {
    color: #ff9800;
    font-weight: 500;
}

/* Info Table */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.info-table th,
.info-table td {
    padding: 10px;
    text-align: left;
    border: 1px solid #e0e0e0;
}

.info-table th {
    background: #f5f5f5;
    font-weight: 600;
    width: 40%;
    color: #333;
}

.info-table td {
    color: #666;
}

/* Elements Chart */
.elements-chart {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.element-box {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.element-box:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.element-name {
    font-size: 0.9em;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.element-score {
    font-size: 1.4em;
    font-weight: bold;
    color: white;
    padding: 8px;
    border-radius: 6px;
}

.element-wood { background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%); }
.element-fire { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); }
.element-earth { background: linear-gradient(135deg, #f39c12 0%, #d68910 100%); }
.element-metal { background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%); }
.element-water { background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); }

/* Relationships List */
.relationships {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.relationship-item {
    background: #f9f9f9;
    padding: 10px;
    border-left: 4px solid #E87A5D;
    border-radius: 4px;
    font-size: 0.95em;
}

.relationship-item strong {
    color: #E87A5D;
}

/* Description Text */
.description {
    background: #f0f7ff;
    padding: 12px;
    border-left: 4px solid #E87A5D;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 0.95em;
    line-height: 1.6;
    color: #444;
}

/* Dayun (Big Luck) Table */
.dayun-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.dayun-table th,
.dayun-table td {
    padding: 10px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.dayun-table th {
    background: linear-gradient(135deg, #E87A5D 0%, #D96846 100%);
    color: white;
    font-weight: 600;
}

.dayun-table tr:nth-child(even) {
    background: #f9f9f9;
}

.dayun-age {
    color: #E87A5D;
    font-weight: 600;
}

.dayun-ganzhi {
    color: #D96846;
    font-weight: bold;
    font-size: 1.1em;
}

/* Time Uncertainty */
.time-uncertainty {
    background: #fff3cd;
    padding: 12px;
    border-left: 4px solid #ff9800;
    border-radius: 4px;
    margin-bottom: 15px;
    color: #856404;
    font-size: 0.95em;
}

/* Utility Classes */
.full-width {
    grid-column: 1 / -1;
}

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

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

.text-center {
    text-align: center;
}

.text-muted {
    color: #999;
    font-size: 0.9em;
}

/* Loading state */
.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading.show {
    display: block;
}

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

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
.footer {
    background: rgba(0, 0, 0, 0.1);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.95em;
}

.footer p {
    margin: 0;
}

.footer a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Print styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .btn-group,
    .btn-export,
    .btn-clear {
        display: none;
    }

    .card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .section {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .footer {
        display: none;
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .results-grid {
        grid-template-columns: 1fr;
    }

    .relationships {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .elements-chart {
        grid-template-columns: repeat(3, 1fr);
    }

    .btn-group {
        grid-template-columns: 1fr;
    }

    .pillar-table,
    .info-table,
    .dayun-table {
        font-size: 0.9em;
    }

    .ganzhi-cell {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .card,
    .section {
        padding: 15px;
    }

    .header h1 {
        font-size: 1.4em;
    }

    .elements-chart {
        grid-template-columns: repeat(2, 1fr);
    }

    .pillar-table th,
    .pillar-table td {
        padding: 8px;
        font-size: 0.85em;
    }
}
