/* ============================================================
   style.css — Chinese-themed Bazi Analyser Styling
   ============================================================ */

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #FFF8F0;
    color: #2D2D2D;
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

main {
    flex: 1;
}

/* ── Header ──────────────────────────────────────────────── */
.site-header {
    background: linear-gradient(135deg, #8B0000 0%, #5C0000 100%);
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    color: #FFF8F0;
}

.logo-icon {
    font-family: 'Noto Serif SC', serif;
    font-size: 2.2rem;
    font-weight: 700;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border: 2px solid #DAA520;
    border-radius: 4px;
}

.logo-text h1 {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.15em;
}

.logo-text p {
    font-size: 0.75rem;
    opacity: 0.8;
    letter-spacing: 0.1em;
}

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
    background: #3D0000;
    color: #D4B896;
    padding: 1.5rem 0;
    text-align: center;
    margin-top: 3rem;
    font-size: 0.85rem;
}

.site-footer .disclaimer {
    opacity: 0.7;
    margin-top: 0.3rem;
    font-size: 0.75rem;
}

/* ── Form Page ───────────────────────────────────────────── */
.form-page {
    padding: 2rem 0;
    display: flex;
    justify-content: center;
}

.form-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 600px;
    width: 100%;
    border-top: 4px solid #8B0000;
}

.form-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.6rem;
    color: #8B0000;
    text-align: center;
    letter-spacing: 0.2em;
}

.form-subtitle {
    text-align: center;
    color: #888;
    margin-top: 0.3rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-section h3 {
    font-size: 0.95rem;
    color: #5C0000;
    margin-bottom: 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #F0E6D8;
}

.form-section h3 .optional {
    font-weight: 300;
    font-size: 0.8rem;
    color: #999;
}

.form-row {
    display: grid;
    gap: 0.8rem;
}

.form-row.three-col { grid-template-columns: 1fr 1fr 1fr; }
.form-row.two-col { grid-template-columns: 1fr 1fr; }

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.3rem;
}

.form-group input,
.form-group select {
    padding: 0.6rem 0.8rem;
    border: 1px solid #D4C5B0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #FFFDF8;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #8B0000;
    box-shadow: 0 0 0 2px rgba(139,0,0,0.1);
}

.gender-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.gender-option {
    cursor: pointer;
}

.gender-option input[type="radio"] {
    display: none;
}

.gender-label {
    display: inline-block;
    padding: 0.6rem 2rem;
    border: 2px solid #D4C5B0;
    border-radius: 8px;
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.gender-option input[type="radio"]:checked + .gender-label {
    border-color: #8B0000;
    background: #8B0000;
    color: #fff;
}

.gender-label:hover {
    border-color: #8B0000;
}

.submit-btn {
    display: block;
    width: 100%;
    padding: 0.9rem;
    background: linear-gradient(135deg, #8B0000, #A52A2A);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-family: 'Noto Serif SC', serif;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    margin-top: 1.5rem;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139,0,0,0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.error-box {
    background: #FFF0F0;
    border: 1px solid #FFB4B4;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    color: #8B0000;
    font-size: 0.9rem;
}

/* ── Result Page ─────────────────────────────────────────── */
.result-page {
    padding: 2rem 0;
}

.result-header {
    text-align: center;
    margin-bottom: 2rem;
}

.result-header h2 {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.8rem;
    color: #8B0000;
    letter-spacing: 0.3em;
}

.birth-info {
    color: #666;
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

.solar-time-note {
    color: #999;
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

/* ── Sections ────────────────────────────────────────────── */
.section {
    margin-bottom: 2rem;
}

.section-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2rem;
    color: #8B0000;
    text-align: center;
    letter-spacing: 0.3em;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #F0E6D8;
}

/* ── Four Pillars Grid ───────────────────────────────────── */
.pillars-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
}

.pillar-card {
    background: #fff;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border: 1px solid #F0E6D8;
}

.pillar-label {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 0.6rem;
    letter-spacing: 0.1em;
}

.pillar-stem, .pillar-branch {
    padding: 0.6rem 0;
    border-radius: 6px;
    margin-bottom: 0.4rem;
}

.pillar-stem .char, .pillar-branch .char {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.6rem;
    font-weight: 700;
    display: block;
}

.element-tag {
    font-size: 0.7rem;
    opacity: 0.8;
    display: block;
    margin-top: 0.1rem;
}

.tg-tag {
    display: inline-block;
    font-size: 0.65rem;
    background: rgba(0,0,0,0.06);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-top: 0.3rem;
}

.dm-tag {
    background: #8B0000;
    color: #fff;
}

/* ── Element Colors ──────────────────────────────────────── */
.element-木 { color: #2E7D32; }
.element-火 { color: #C62828; }
.element-土 { color: #BF8C00; }
.element-金 { color: #546E7A; }
.element-水 { color: #1565C0; }

.pillar-stem.element-木 { background: #E8F5E9; }
.pillar-stem.element-火 { background: #FFEBEE; }
.pillar-stem.element-土 { background: #FFF8E1; }
.pillar-stem.element-金 { background: #ECEFF1; }
.pillar-stem.element-水 { background: #E3F2FD; }

.pillar-branch.element-木 { background: #F1F8E9; }
.pillar-branch.element-火 { background: #FFF3E0; }
.pillar-branch.element-土 { background: #FFFDE7; }
.pillar-branch.element-金 { background: #F5F5F5; }
.pillar-branch.element-水 { background: #E8EAF6; }

/* ── Day Master & Strength ───────────────────────────────── */
.strength-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    text-align: center;
}

.dm-display {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.dm-char {
    font-family: 'Noto Serif SC', serif;
    font-size: 2.5rem;
    font-weight: 700;
}

.dm-element {
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

.strength-meter {
    max-width: 300px;
    margin: 0 auto;
}

.meter-bar {
    height: 10px;
    background: #F0E6D8;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.meter-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s;
}

.meter-very-weak { width: 15%; background: #1565C0; }
.meter-weak      { width: 35%; background: #43A047; }
.meter-balanced  { width: 50%; background: #DAA520; }
.meter-strong    { width: 70%; background: #E65100; }
.meter-very-strong { width: 90%; background: #C62828; }

.strength-label {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    color: #5C0000;
    font-weight: 600;
}

.strength-details {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.detail-item {
    font-size: 0.8rem;
    background: #FFF8F0;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    color: #666;
}

/* ── Yong Shen ───────────────────────────────────────────── */
.yongshen-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.ys-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
}

.ys-item {
    text-align: center;
    padding: 1rem 1.5rem;
    border-radius: 8px;
}

.ys-item.favorable {
    background: #F1F8E9;
    border: 1px solid #C8E6C9;
}

.ys-item.unfavorable {
    background: #FFF3E0;
    border: 1px solid #FFE0B2;
}

.ys-label {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.3rem;
}

.ys-element {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.8rem;
    font-weight: 700;
}

.ys-category {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.2rem;
}

.ys-reasoning {
    border-top: 1px solid #F0E6D8;
    padding-top: 0.8rem;
}

.reason-item {
    font-size: 0.85rem;
    color: #666;
    padding: 0.2rem 0;
}

.reason-item::before {
    content: ">";
    color: #DAA520;
    margin-right: 0.4rem;
}

/* ── Interactions ────────────────────────────────────────── */
.interactions-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.interaction-group {
    margin-bottom: 1rem;
}

.interaction-group:last-child {
    margin-bottom: 0;
}

.interaction-group h4 {
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    color: #8B0000;
    margin-bottom: 0.4rem;
}

.interaction-item {
    padding: 0.3rem 0;
    font-size: 0.9rem;
}

.interaction-desc {
    color: #333;
}

.interaction-effect {
    color: #888;
    font-size: 0.85rem;
    display: block;
    padding-left: 1rem;
}

/* ── Interpretations Grid ────────────────────────────────── */
.interp-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.interp-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.interp-card h4 {
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    color: #8B0000;
    margin-bottom: 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #F0E6D8;
}

.interp-card p {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: #444;
}

.interp-highlight {
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    color: #5C0000;
    margin-bottom: 0.6rem;
}

/* ── Luck Pillars Timeline ───────────────────────────────── */
.lp-header {
    display: flex;
    justify-content: space-between;
    background: #fff;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.lp-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.lp-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border-left: 4px solid #ccc;
    transition: transform 0.15s;
}

.lp-card:hover {
    transform: translateX(4px);
}

/* Verdict-based border colors */
.lp-card.verdict-大吉 { border-left-color: #DAA520; }
.lp-card.verdict-吉   { border-left-color: #2E8B57; }
.lp-card.verdict-中   { border-left-color: #9E9E9E; }
.lp-card.verdict-凶   { border-left-color: #D2691E; }
.lp-card.verdict-大凶 { border-left-color: #B22222; }

.lp-age {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.3rem;
}

.lp-pillar {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.lp-stem, .lp-branch {
    margin-right: 0.2rem;
}

.lp-verdict {
    margin-bottom: 0.6rem;
}

.verdict-icon {
    font-size: 1rem;
    margin-right: 0.3rem;
}

.verdict-daji  { color: #DAA520; }
.verdict-ji    { color: #2E8B57; }
.verdict-zhong { color: #9E9E9E; }
.verdict-xiong { color: #D2691E; }
.verdict-daxiong { color: #B22222; }

.verdict-text {
    font-size: 0.95rem;
    font-weight: 500;
}

.lp-notes {
    margin-bottom: 0.5rem;
}

.lp-note {
    font-size: 0.82rem;
    color: #666;
    padding: 0.15rem 0;
}

.lp-note::before {
    content: ">";
    color: #DAA520;
    margin-right: 0.3rem;
}

.lp-interactions {
    margin-bottom: 0.5rem;
}

.lp-interaction {
    font-size: 0.82rem;
    color: #8B6914;
    padding: 0.15rem 0;
}

.lp-events {
    background: #FFFDF8;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    margin-top: 0.6rem;
    border: 1px solid #F0E6D8;
}

.events-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.85rem;
    color: #8B0000;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.event-group {
    margin-bottom: 0.5rem;
}

.event-group:last-child {
    margin-bottom: 0;
}

.event-label {
    display: inline-block;
    font-size: 0.72rem;
    background: #8B0000;
    color: #fff;
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
    margin-bottom: 0.2rem;
}

.event-note {
    font-size: 0.82rem;
    color: #555;
    padding: 0.1rem 0 0.1rem 0.5rem;
}

/* ── Annual Year Query ───────────────────────────────────── */
.annual-query {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.annual-form {
    display: flex;
    gap: 0.8rem;
    max-width: 400px;
    margin: 0 auto 1rem;
}

.annual-form input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid #D4C5B0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #FFFDF8;
}

.annual-form input:focus {
    outline: none;
    border-color: #8B0000;
}

.annual-form button {
    padding: 0.6rem 1.5rem;
    background: #8B0000;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-family: 'Noto Serif SC', serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}

.annual-form button:hover {
    background: #A52A2A;
}

.annual-result {
    max-width: 600px;
    margin: 0 auto;
}

.annual-card {
    border-radius: 8px;
    padding: 1rem 1.2rem;
    border-left: 4px solid #ccc;
    background: #FFFDF8;
}

.annual-card.verdict-大吉 { border-left-color: #DAA520; }
.annual-card.verdict-吉   { border-left-color: #2E8B57; }
.annual-card.verdict-中   { border-left-color: #9E9E9E; }
.annual-card.verdict-凶   { border-left-color: #D2691E; }
.annual-card.verdict-大凶 { border-left-color: #B22222; }

.annual-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.annual-year-label {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    font-weight: 600;
}

.annual-pillar {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
}

.annual-lp {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.annual-notes {
    margin-bottom: 0.5rem;
}

.annual-error {
    color: #B22222;
    text-align: center;
    padding: 0.5rem;
}

.annual-loading {
    color: #888;
    text-align: center;
    padding: 0.5rem;
}

/* ── Back Button ─────────────────────────────────────────── */
.back-section {
    text-align: center;
    margin: 2rem 0;
}

.back-btn {
    display: inline-block;
    padding: 0.7rem 2rem;
    background: transparent;
    color: #8B0000;
    border: 2px solid #8B0000;
    border-radius: 8px;
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.2s;
}

.back-btn:hover {
    background: #8B0000;
    color: #fff;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .form-card {
        padding: 1.5rem;
        border-radius: 0;
    }

    .form-row.three-col {
        grid-template-columns: 1fr;
    }

    .form-row.two-col {
        grid-template-columns: 1fr;
    }

    .pillars-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ys-grid {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }

    .ys-item {
        width: 100%;
        max-width: 200px;
    }

    .lp-header {
        flex-direction: column;
        gap: 0.3rem;
    }

    .annual-form {
        flex-direction: column;
    }
}
