/* 현율 만세력 메인 화면 스타일 — index.html 인라인 <style>에서 분리 */
        /* 디자인 시스템 — 리뉴얼가이드 §3 팔레트 */
        :root {
            /* 바탕 */
            --bg-page: #F4F1EA;
            --bg-surface: #FFFDF9;
            --bg-sunken: #F4F0E8;

            /* 글자 */
            --ink: #17191D;
            --ink-soft: #73716B;
            --ink-faint: #9A968D;

            /* 강조 */
            --navy: #182636;
            --navy-soft: #2C3A4B;
            --gold: #A98A54;
            --gold-bg: #F5EBD6;
            --rust: #8E5146;

            /* 선 */
            --line: #E7E2D9;
            --line-strong: #D6CFC2;

            /* 오행 — 가이드가 유일하게 고유색을 허용한 축 */
            --wood: #4F7A56;
            --fire: #B0483E;
            --earth: #C0913F;
            --metal: #7D848A;
            --water: #3F6B93;

            /* 카드 그림자 — 가이드 §16 */
            --shadow-card: 0 8px 30px rgba(43, 36, 25, 0.035);
            --shadow-raise: 0 8px 26px rgba(25, 28, 32, 0.07);

            /* 기존 규칙이 참조하는 별칭. 새 팔레트로 재지정한다. */
            --primary: var(--navy);
            --secondary: var(--gold);
            --bg-primary: var(--bg-surface);
            --bg-secondary: var(--bg-page);
            --bg-card: var(--bg-surface);
            --text-primary: var(--ink);
            --text-secondary: var(--ink-soft);
            --text-muted: var(--ink-faint);
            --shadow-sm: 0 1px 2px rgba(25, 28, 32, 0.03);
            --shadow: var(--shadow-card);
            --shadow-md: var(--shadow-card);
            --shadow-lg: var(--shadow-raise);
        }

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

        body {
            font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
            background: var(--bg-page);
            color: var(--ink);
            line-height: 1.65;
            font-size: 15px;
            min-height: 100vh;
            -webkit-font-smoothing: antialiased;
        }

        .container {
            max-width: 1240px;
            margin: 0 auto;
            padding: 0 28px 80px;
        }

        /* 헤더 */
        .header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 24px;
            padding: 20px 0;
            margin-bottom: 26px;
            border-bottom: 1px solid var(--line);
        }

        .header h1 {
            font-family: 'Noto Serif KR', serif;
            font-size: 18px;
            font-weight: 600;
            letter-spacing: -0.01em;
            color: var(--ink);
        }

        .header p {
            font-size: 13px;
            color: var(--ink-soft);
        }

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

        /* (★중요) 현율 B안 인장 로고의 비율을 작은 헤더에서도 유지한다. */
        .brand-mark {
            display: block;
            width: 36px;
            height: 36px;
            flex: 0 0 36px;
            object-fit: contain;
        }

        .header-nav {
            display: flex;
            gap: 26px;
        }

        .header-nav a {
            font-size: 14px;
            color: var(--ink-soft);
            text-decoration: none;
            padding-bottom: 2px;
            transition: color 180ms ease;
        }

        .header-nav a:hover {
            color: var(--ink);
        }

        .header-nav a.is-current {
            color: var(--ink);
            font-weight: 600;
            border-bottom: 1.5px solid var(--gold);
        }

        .eyebrow {
            display: block;
            color: #92774D;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.14em;
        }

        /* 카드 */
        .card {
            background: var(--bg-surface);
            border: 1px solid var(--line);
            border-radius: 16px;
            padding: 26px;
            margin-bottom: 18px;
            box-shadow: var(--shadow-card);
        }

        /* 섹션 타이틀 */
        .section-title {
            font-size: 21px;
            font-weight: 600;
            letter-spacing: -0.01em;
            color: var(--ink);
            margin-bottom: 18px;
            display: flex;
            align-items: baseline;
            gap: 10px;
        }

        /* 도입부 */
        .intro {
            display: flex;
            align-items: center;
            position: relative;
            min-height: 300px;
            overflow: hidden;
            margin-bottom: 24px;
            padding: 38px 46px;
            border: 1px solid #E6DED0;
            border-radius: 18px;
            background: #F8F4EB url('/static/images/report-landscape.webp') center center / cover no-repeat;
        }

        .intro-copy {
            position: relative;
            z-index: 1;
            max-width: 560px;
        }

        .intro-title {
            font-family: 'Noto Serif KR', 'Pretendard', serif;
            font-size: clamp(29px, 3vw, 39px);
            font-weight: 600;
            line-height: 1.48;
            letter-spacing: -0.045em;
            color: var(--ink);
            margin: 12px 0 14px;
        }

        .intro-title em {
            color: #7D633A;
            font-style: normal;
        }

        .intro-lead {
            max-width: 480px;
            font-size: 14px;
            color: var(--ink-soft);
        }

        .intro-link {
            display: inline-flex;
            align-items: center;
            gap: 22px;
            margin-top: 22px;
            padding: 11px 17px;
            border: 1px solid var(--navy);
            border-radius: 8px;
            background: var(--navy);
            color: #FFFDF8;
            font-size: 13px;
            font-weight: 600;
            text-decoration: none;
        }

        .intro-link:hover { background: var(--navy-soft); }

        .intro-stamp {
            position: absolute;
            right: 54px;
            bottom: 28px;
            display: grid;
            place-items: center;
            width: 52px;
            height: 52px;
            border: 1px solid rgba(151, 115, 58, 0.55);
            border-radius: 50%;
            color: #8D6C38;
            font: 25px 'Noto Serif KR', serif;
            background: rgba(255, 253, 247, 0.65);
        }

        /* (★중요) 입력 컨트롤을 한 줄로 모으되 좁은 폭에서만 단계적으로 접는다. */
        .input-panel {
            scroll-margin-top: 18px;
            padding: 25px 28px 24px;
        }

        .input-aside {
            display: flex;
            align-items: flex-end;
            justify-content: space-between;
            gap: 18px;
            margin-bottom: 20px;
            padding-bottom: 16px;
            border-bottom: 1px solid var(--line);
        }

        .input-aside h3 {
            margin-top: 5px;
            font-family: 'Noto Serif KR', serif;
            font-size: 19px;
            font-weight: 600;
        }

        .input-aside p {
            font-size: 13px;
            color: var(--ink-soft);
            text-align: right;
        }

        .input-fields {
            display: grid;
            grid-template-columns: minmax(130px, 1fr) minmax(165px, 1.15fr) minmax(130px, .8fr) minmax(185px, 1.3fr) minmax(106px, .65fr);
            gap: 14px;
        }

        .form-group {
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        .form-group > .form-control { width: 100%; min-height: 43px; }

        .form-group label,
        .form-group .label-text {
            font-size: 13px;
            color: var(--ink-soft);
            margin-bottom: 6px;
            font-weight: 500;
        }

        /* 분절 토글 — 양력·음력, 남·여 */
        .segmented {
            display: inline-flex;
            align-self: flex-start;
            padding: 3px;
            border: 1px solid var(--line-strong);
            border-radius: 10px;
            background: var(--bg-sunken);
        }

        .segmented input {
            position: absolute;
            opacity: 0;
            pointer-events: none;
        }

        .segmented label {
            flex: 1;
            min-width: 50px;
            margin: 0;
            padding: 8px 14px;
            border-radius: 7px;
            font-size: 14px;
            font-weight: 500;
            color: var(--ink-soft);
            text-align: center;
            cursor: pointer;
            white-space: nowrap;
            transition: background-color 180ms ease, color 180ms ease;
        }

        .segmented input:checked + label {
            background: var(--navy);
            color: #F7F4EE;
        }

        .segmented input:focus-visible + label {
            box-shadow: 0 0 0 3px rgba(28, 39, 52, 0.14);
        }

        .field-hint {
            margin-top: 6px;
            font-size: 11.5px;
            color: var(--ink-faint);
        }

        .field-notice {
            grid-column: 1 / -1;
            margin: -4px 0 0;
            padding: 11px 14px;
            border-left: 2px solid var(--gold);
            background: var(--gold-bg);
            border-radius: 0 8px 8px 0;
            font-size: 13px;
            color: #6B5836;
        }

        .input-submit {
            grid-column: 1 / -1;
            display: flex;
            justify-content: flex-end;
            margin-top: 4px;
        }

        .input-submit .btn-primary {
            width: auto;
            min-width: 218px;
        }

        .form-group label {
            font-size: 13px;
            color: var(--ink-soft);
            margin-bottom: 6px;
            font-weight: 500;
        }

        .form-control {
            padding: 11px 13px;
            border: 1px solid var(--line-strong);
            border-radius: 10px;
            font-size: 15px;
            font-family: inherit;
            color: var(--ink);
            background: #FFFFFF;
            transition: border-color 180ms ease, box-shadow 180ms ease;
        }

        .form-control:focus {
            outline: none;
            border-color: var(--navy);
            box-shadow: 0 0 0 3px rgba(28, 39, 52, 0.08);
        }

        /* 버튼 */
        .btn-primary {
            width: 100%;
            padding: 14px 22px;
            background: var(--navy);
            color: #F7F4EE;
            border: 1px solid var(--navy);
            border-bottom: 2px solid var(--gold);
            border-radius: 10px;
            font-size: 15px;
            font-weight: 600;
            font-family: inherit;
            letter-spacing: 0.01em;
            cursor: pointer;
            transition: background-color 180ms ease;
        }

        .feature-strip {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 0;
            margin: 8px 0 44px;
            padding: 18px 8px;
            border-top: 1px solid var(--line);
            border-bottom: 1px solid var(--line);
        }

        .feature-item {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            min-width: 0;
            padding: 0 16px;
            border-right: 1px solid var(--line);
        }

        .feature-item:last-child { border-right: 0; }

        .feature-icon {
            flex: 0 0 42px;
            display: grid;
            place-items: center;
            width: 42px;
            height: 42px;
            border-radius: 50%;
            background: #ECE4D5;
            color: #8B6D40;
            font: 20px 'Noto Serif KR', serif;
        }

        .feature-item strong,
        .feature-item span:last-child { display: block; }
        .feature-item strong { font-size: 13px; }
        .feature-item div span { color: var(--ink-soft); font-size: 11.5px; }

        .btn-primary:hover {
            background: var(--navy-soft);
        }

        .btn-primary:active {
            background: var(--navy);
        }

        /* 로딩 */
        .loading {
            display: none;
            text-align: center;
            padding: 40px;
        }

        .loading.active {
            display: block;
        }

        .spinner {
            width: 50px;
            height: 50px;
            border: 4px solid #E5E7EB;
            border-top: 4px solid var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 16px;
        }

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

        /* 결과 섹션 */
        .result-section {
            display: none;
        }

        .result-section.active {
            display: block;
        }

        .report-cover {
            position: relative;
            display: flex;
            align-items: center;
            min-height: 276px;
            overflow: hidden;
            margin-bottom: 15px;
            padding: 34px 38px;
            border: 1px solid #E7DED0;
            border-radius: 17px;
            background: #F8F4EB url('/static/images/report-cover.webp') center center / cover no-repeat;
        }

        .report-cover-content { position: relative; z-index: 1; max-width: 520px; }
        .report-meta { display: flex; align-items: center; gap: 14px; color: #7C7368; font-size: 12px; }
        .report-badge { padding: 5px 10px; border-radius: 5px; background: #A58B60; color: #FFFDF8; font-size: 11px; font-weight: 700; }
        .report-cover h2 { margin: 15px 0 9px; color: var(--navy); font: 600 clamp(24px, 3vw, 34px)/1.4 'Noto Serif KR', serif; letter-spacing: -.03em; }
        .report-cover p { max-width: 500px; color: #5F5B55; font-size: 14px; }
        .report-cover-mark { position: absolute; right: 30px; bottom: 25px; color: rgba(104, 77, 38, .72); font: 22px 'Noto Serif KR', serif; letter-spacing: .2em; }
        .report-print { display: inline-flex; gap: 13px; align-items: center; margin-top: 24px; padding: 10px 14px; border: 1px solid var(--navy); border-radius: 7px; background: var(--navy); color: #fff; font: 600 12px 'Pretendard', sans-serif; cursor: pointer; }
        .report-print:hover { background: var(--navy-soft); }

        .result-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 34px; gap: 12px; }
        .cancel-button { padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); font: 600 12px 'Pretendard', sans-serif; cursor: pointer; }
        .report-nav { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 18px; padding: 7px 0; border-bottom: 1px solid var(--line-strong); background: var(--bg-page); scrollbar-width: thin; }
        .report-nav a { flex: 0 0 auto; padding: 9px 15px; border-radius: 7px; color: var(--ink-soft); font-size: 13px; font-weight: 600; text-decoration: none; }
        .report-nav a:first-child,
        .report-nav a:hover { background: var(--navy); color: #fff; }
        #reportSummary, #chartSection, #detailSection, #daeunSection, #aiBlock { scroll-margin-top: 72px; }


        /* ===== 대시보드 ===== */

        .dashboard {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
            margin-bottom: 18px;
            align-items: stretch;
        }

        .panel-myeongsik { grid-column: 1 / -1; }

        .dashboard .card {
            margin-bottom: 0;
        }

        .panel {
            display: flex;
            flex-direction: column;
        }

        .panel-head {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 18px;
        }

        .panel-head h2 {
            font-family: 'Noto Serif KR', serif;
            font-size: 18px;
            font-weight: 600;
            letter-spacing: -0.01em;
            color: var(--ink);
        }

        .panel-hanja {
            font-family: 'Noto Serif KR', serif;
            font-size: 13px;
            font-weight: 500;
            color: var(--ink-faint);
            margin-left: 2px;
        }

        .panel-note {
            font-size: 13px;
            color: var(--ink-soft);
        }

        .panel-foot {
            margin-top: auto;
            padding-top: 14px;
            font-size: 12.5px;
            color: var(--ink-faint);
        }

        /* ===== 명식표 ===== */

        .myeongsik {
            width: 100%;
            border-collapse: collapse;
            table-layout: fixed;
        }

        .myeongsik th,
        .myeongsik td {
            text-align: center;
            border: 1px solid var(--line);
            padding: 9px 4px;
        }

        .myeongsik thead td.corner {
            border: none;
        }

        .myeongsik thead th {
            border-bottom: 1px solid var(--line);
            background: none;
            padding-bottom: 10px;
        }

        .myeongsik tbody th {
            width: 40px;
            font-size: 12.5px;
            font-weight: 500;
            color: var(--ink-soft);
            background: var(--bg-sunken);
        }

        .col-label {
            display: block;
            font-size: 13px;
            font-weight: 600;
            color: var(--ink);
        }

        .col-hanja {
            display: block;
            font-family: 'Noto Serif KR', serif;
            font-size: 11px;
            color: var(--ink-faint);
            margin-top: 1px;
        }

        .cell-hanja {
            display: block;
            font-family: 'Noto Serif KR', serif;
            font-size: 30px;
            font-weight: 600;
            line-height: 1.15;
        }

        .cell-kor {
            display: block;
            font-size: 14px;
            font-weight: 500;
            color: var(--ink);
            margin-top: 2px;
        }

        .cell-oheng {
            display: block;
            font-size: 11.5px;
            color: var(--ink-faint);
            margin-top: 1px;
        }

        .myeongsik td.is-empty {
            font-size: 13px;
            color: var(--ink-faint);
        }

        .cell-sipseong {
            font-size: 13px;
            color: var(--ink-soft);
        }

        /* 일주 열 강조 — 가이드 §7 */
        .myeongsik th.is-day,
        .myeongsik td.is-day {
            background: var(--gold-bg);
            border-left: 1px solid var(--gold);
            border-right: 1px solid var(--gold);
        }

        .myeongsik thead th.is-day {
            border-top: 1px solid var(--gold);
        }

        .myeongsik tbody tr:last-child td.is-day {
            border-bottom: 1px solid var(--gold);
        }

        /* ===== 핵심 지표 ===== */

        .metric-score {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 178px;
            height: 178px;
            margin: 4px auto 20px;
            border: 12px solid transparent;
            border-radius: 50%;
            background: linear-gradient(var(--bg-surface), var(--bg-surface)) padding-box,
                        conic-gradient(var(--gold) calc(var(--score) * 1%), var(--line) 0) border-box;
            text-align: center;
        }

        .metric-caption {
            display: block;
            font-size: 12.5px;
            color: var(--ink-soft);
            margin-bottom: 6px;
        }

        .metric-number {
            display: block;
            font-family: 'Noto Serif KR', serif;
            font-size: 38px;
            font-weight: 600;
            line-height: 1.1;
            color: var(--ink);
        }

        .metric-number em {
            font-family: 'Pretendard', sans-serif;
            font-size: 14px;
            font-style: normal;
            font-weight: 400;
            color: var(--ink-faint);
            margin-left: 4px;
        }

        .metric-grade {
            display: inline-block;
            margin-top: 5px;
            padding: 4px 14px;
            border: 1px solid var(--line-strong);
            border-radius: 999px;
            background: var(--bg-sunken);
            font-size: 13px;
            font-weight: 600;
            color: var(--navy);
        }

        .spectrum {
            padding: 16px 0 14px;
            border-bottom: 1px solid var(--line);
        }

        .spectrum-track {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 3px;
        }

        .spectrum-step {
            height: 4px;
            border-radius: 2px;
            background: var(--line);
        }

        .spectrum-step.is-on {
            background: var(--gold);
        }

        .spectrum-labels {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 3px;
            margin-top: 7px;
            font-size: 10.5px;
            color: var(--ink-faint);
            text-align: center;
        }

        .spectrum-labels .is-on {
            color: var(--ink);
            font-weight: 600;
        }

        .metric-chips {
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding: 16px 0;
        }

        .metric-chip {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 10px 14px;
            border: 1px solid var(--line);
            border-radius: 10px;
            background: var(--bg-sunken);
        }

        .chip-label {
            font-size: 12.5px;
            color: var(--ink-soft);
        }

        .chip-body {
            display: flex;
            gap: 8px;
        }

        .chip-oheng {
            font-size: 14px;
            font-weight: 600;
        }

        .metric-note {
            font-size: 13px;
            color: var(--ink-soft);
            line-height: 1.65;
        }

        .metric-basis {
            margin-top: auto;
            padding-top: 12px;
            font-size: 11.5px;
            color: var(--ink-faint);
        }

        /* ===== 오행 ===== */

        .oheng-body {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
            align-items: center;
        }

        .chart-container {
            position: relative;
            height: 220px;
            min-width: 0;
        }

        .chart-wide {
            height: 260px;
            margin-top: 16px;
        }

        .oheng-legend {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 6px;
        }

        .legend-row {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
            padding: 6px 3px;
            border: 1px solid var(--line);
            border-radius: 7px;
        }

        .legend-name {
            font-size: 12.5px;
            font-weight: 600;
        }

        .legend-value {
            font-size: 12.5px;
            color: var(--ink);
            font-weight: 700;
            text-align: right;
        }

        .oheng-summary {
            margin-top: 16px;
            padding: 12px 14px;
            border: 1px solid var(--line);
            border-radius: 10px;
            background: var(--bg-sunken);
            font-size: 14px;
            color: var(--ink);
            text-align: left;
        }

        /* ===== 핵심 해석 요약 ===== */

        .summary-strip { padding: 25px 26px 20px; }
        .summary-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 17px; }
        .summary-head p { color: var(--ink-soft); font-size: 12px; }

        .summary-title {
            margin-top: 4px;
            font-family: 'Noto Serif KR', serif;
            font-size: 20px;
            font-weight: 600;
        }

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

        .summary-item {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 0;
            padding: 16px 17px;
            border: 1px solid var(--line);
            border-radius: 10px;
            background: #F9F7F2;
        }

        .summary-label { color: #8B795E; font-size: 11px; font-weight: 700; }
        .summary-item strong { color: var(--navy); font: 600 20px/1.4 'Noto Serif KR', serif; }
        .summary-detail { color: var(--ink-soft); font-size: 11.5px; }
        .summary-insight { margin-top: 15px; padding: 13px 16px; border-left: 3px solid var(--gold); background: var(--gold-bg); color: #544A3B; font-size: 13px; }

        /* ===== 상세 아코디언 ===== */

        .detail-list {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-bottom: 18px;
        }

        .detail-item {
            border: 1px solid var(--line);
            border-radius: 12px;
            background: var(--bg-surface);
            box-shadow: var(--shadow-card);
            min-width: 0;
        }

        .detail-item > summary {
            display: flex;
            align-items: center;
            gap: 16px;
            padding: 17px 22px;
            cursor: pointer;
            list-style: none;
        }

        .detail-item > summary::-webkit-details-marker {
            display: none;
        }

        .detail-item > summary::after {
            content: '';
            margin-left: auto;
            width: 8px;
            height: 8px;
            border-right: 1.5px solid var(--ink-faint);
            border-bottom: 1.5px solid var(--ink-faint);
            transform: rotate(45deg) translate(-2px, -2px);
            transition: transform 180ms ease;
        }

        .detail-item[open] > summary::after {
            transform: rotate(-135deg) translate(-2px, -2px);
        }

        .detail-name {
            font-size: 15px;
            font-weight: 600;
            color: var(--ink);
            flex: 0 0 auto;
            min-width: 118px;
        }

        .detail-lead {
            font-size: 13.5px;
            color: var(--ink-soft);
        }

        .detail-body {
            padding: 4px 22px 22px;
            border-top: 1px solid var(--line);
            margin-top: -1px;
            padding-top: 20px;
        }

        .section-note {
            font-size: 13.5px;
            line-height: 1.7;
            color: var(--ink-soft);
        }

        .empty-note {
            font-size: 13.5px;
            color: var(--ink-faint);
        }

        /* 십성 상위 3개 */
        .top-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
        }

        .top-item {
            display: flex;
            align-items: baseline;
            gap: 10px;
            padding: 14px 16px;
            border: 1px solid var(--line);
            border-left: 2px solid var(--gold);
            border-radius: 0 10px 10px 0;
            background: var(--bg-sunken);
        }

        .top-name {
            font-size: 16px;
            font-weight: 600;
        }

        .top-strength {
            font-size: 13px;
            color: var(--rust);
        }

        .top-count {
            margin-left: auto;
            font-size: 13px;
            color: var(--ink-faint);
        }

        .balance-box {
            margin-top: 18px;
            padding: 16px;
            border: 1px solid var(--line);
            border-radius: 10px;
        }

        .balance-cats {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 8px;
            margin-bottom: 12px;
        }

        .balance-cat {
            text-align: center;
            padding: 9px 4px;
            border-radius: 8px;
            background: var(--bg-sunken);
        }

        .balance-cat span {
            display: block;
            font-size: 11.5px;
            color: var(--ink-soft);
        }

        .balance-cat strong {
            display: block;
            font-size: 15px;
            margin-top: 2px;
        }

        .balance-note {
            font-size: 13px;
            color: var(--ink-soft);
        }

        /* 12신살 */
        .shinsal-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
            gap: 12px;
        }

        .shinsal-item {
            padding: 14px 16px;
            border: 1px solid var(--line);
            border-left: 2px solid var(--line-strong);
            border-radius: 0 10px 10px 0;
        }

        .shinsal-item.is-gil { border-left-color: var(--wood); }
        .shinsal-item.is-hyung { border-left-color: var(--fire); }
        .shinsal-item.is-neutral { border-left-color: var(--metal); }

        .shinsal-name {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 15px;
            font-weight: 600;
            margin-bottom: 6px;
        }

        .shinsal-type {
            padding: 1px 8px;
            border: 1px solid var(--line-strong);
            border-radius: 999px;
            font-size: 11px;
            font-weight: 500;
            color: var(--ink-soft);
        }

        .shinsal-meaning {
            font-size: 13.5px;
            color: var(--ink);
        }

        .shinsal-detail {
            margin-top: 4px;
            font-size: 12.5px;
            color: var(--ink-soft);
        }

        .shinsal-list + .section-note {
            margin-top: 14px;
        }

        /* 12운성 */
        .unseong-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
            gap: 12px;
        }

        .unseong-item {
            padding: 14px;
            border: 1px solid var(--line);
            border-radius: 10px;
            background: var(--bg-sunken);
            text-align: center;
        }

        .unseong-pos {
            display: block;
            font-size: 12.5px;
            color: var(--ink-soft);
        }

        .unseong-value {
            display: block;
            font-family: 'Noto Serif KR', serif;
            font-size: 19px;
            font-weight: 600;
            margin-top: 4px;
        }

        .unseong-phase {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin: 14px 0 10px;
        }

        .phase-chip {
            padding: 5px 12px;
            border: 1px solid var(--line);
            border-radius: 999px;
            font-size: 12.5px;
            color: var(--ink-faint);
        }

        .phase-chip.is-on {
            border-color: var(--gold);
            background: var(--gold-bg);
            color: #6B5836;
        }

        /* 오행 보완 */
        .rec-card {
            margin-top: 14px;
        }

        .rec-head {
            padding-left: 10px;
            border-left: 2px solid var(--line-strong);
            font-size: 14px;
            font-weight: 600;
            margin-bottom: 10px;
        }

        .rec-list {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 10px;
        }

        .rec-list > div {
            padding: 10px 12px;
            border: 1px solid var(--line);
            border-radius: 8px;
        }

        .rec-list dt {
            font-size: 11.5px;
            color: var(--ink-faint);
            margin-bottom: 2px;
        }

        .rec-list dd {
            font-size: 13.5px;
            color: var(--ink);
        }

        .jeolgi-info {
            margin-top: 18px;
            padding: 14px 16px;
            border: 1px solid var(--line);
            border-radius: 10px;
            background: var(--gold-bg);
        }

        .jeolgi-head {
            display: flex;
            align-items: baseline;
            gap: 10px;
            margin-bottom: 4px;
        }

        .jeolgi-name {
            font-family: 'Noto Serif KR', serif;
            font-size: 18px;
            font-weight: 600;
            color: #6B5836;
        }

        .jeolgi-meaning {
            font-size: 13px;
            color: #7A6742;
        }

        .jeolgi-info .section-note {
            color: #7A6742;
        }

        /* ===== 대운 타임라인 ===== */

        .daeun-section .panel-head {
            margin-bottom: 20px;
        }

        .daeun-timeline {
            position: relative;
            display: grid;
            grid-auto-flow: column;
            grid-auto-columns: minmax(115px, 1fr);
            gap: 0;
            overflow-x: auto;
            padding-top: 12px;
            scrollbar-width: thin;
        }

        .daeun-timeline::before {
            content: '';
            position: absolute;
            top: 40px;
            left: 48px;
            right: 48px;
            height: 1px;
            background: var(--line-strong);
        }

        .daeun-node {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 3px;
            min-width: 115px;
            padding: 8px 6px 14px;
            border: 1px solid transparent;
            border-radius: 9px;
            background: transparent;
            font-family: inherit;
            cursor: pointer;
            transition: border-color 180ms ease, background-color 180ms ease;
        }

        .daeun-node:hover {
            background: #F7F4ED;
        }

        .daeun-node.is-selected {
            border-color: #C8AC77;
            background: #F9F2E6;
        }

        .daeun-node.is-current {
            color: var(--navy);
        }

        .daeun-dot {
            display: block;
            width: 11px;
            height: 11px;
            margin: 15px 0 8px;
            border: 2px solid #C8BDAA;
            border-radius: 50%;
            background: var(--bg-surface);
            z-index: 1;
        }

        .daeun-node.is-current .daeun-dot,
        .daeun-node.is-selected .daeun-dot {
            border-color: var(--gold);
            background: var(--gold);
        }

        .daeun-flag {
            position: absolute;
            top: -2px;
            left: 50%;
            transform: translateX(-50%);
            padding: 2px 9px;
            border-radius: 999px;
            background: #A68448;
            color: #FFFFFF;
            font-size: 10.5px;
            font-weight: 600;
            white-space: nowrap;
        }

        .daeun-age {
            font-size: 11.5px;
            color: var(--ink-soft);
        }

        .daeun-hanja {
            font-family: 'Noto Serif KR', serif;
            font-size: 19px;
            font-weight: 600;
            color: var(--ink);
            line-height: 1.2;
        }

        .daeun-kor {
            font-size: 12px;
            color: var(--ink-soft);
        }

        .daeun-sipseong {
            font-size: 11.5px;
            color: var(--ink-faint);
        }

        .daeun-detail {
            margin-top: 20px;
            padding: 18px 20px;
            border: 1px solid var(--line);
            border-left: 2px solid var(--gold);
            border-radius: 0 10px 10px 0;
            background: #FAF7F0;
        }

        .daeun-detail-head {
            display: flex;
            flex-wrap: wrap;
            align-items: baseline;
            gap: 12px;
            margin-bottom: 8px;
        }

        .daeun-detail-period {
            font-size: 16px;
            font-weight: 600;
        }

        .daeun-detail-year,
        .daeun-detail-pillar {
            font-size: 13px;
            color: var(--ink-soft);
        }

        .daeun-detail-text {
            font-size: 14px;
            line-height: 1.75;
            color: var(--ink);
        }

        /* ===== AI 심층 해석 ===== */

        .ai-block {
            position: relative;
            margin-bottom: 20px;
            padding: 30px 32px 32px;
            border: 1px solid #DED5C7;
            border-radius: 16px;
            background: #FBF9F4;
            color: var(--ink);
            overflow: hidden;
        }

        .ai-head {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 22px;
        }

        .ai-mark {
            flex: 0 0 auto;
            width: 52px;
            height: 52px;
            display: grid;
            place-items: center;
            border: 1px solid #D9C8A9;
            border-radius: 50%;
            font-family: 'Noto Serif KR', serif;
            font-size: 23px;
            font-weight: 600;
            color: #977644;
            background: #F5EEDD;
        }

        .ai-head h2 {
            margin-top: 2px;
            font-family: 'Noto Serif KR', serif;
            font-size: 24px;
            font-weight: 600;
            color: var(--navy);
        }

        .ai-head p {
            margin-top: 3px;
            font-size: 13.5px;
            color: var(--ink-soft);
        }

        .ai-topics {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 18px;
            padding-bottom: 18px;
            border-bottom: 1px solid var(--line);
        }

        .ai-topics a {
            padding: 7px 12px;
            border: 1px solid var(--line);
            border-radius: 7px;
            background: #F5F2EB;
            font-size: 12.5px;
            color: var(--ink-soft);
            text-decoration: none;
        }

        .ai-topics a:hover,
        .ai-topics a:focus-visible { border-color: var(--gold); color: var(--ink); }

        .ai-body {
            position: relative;
        }

        .interpretation {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            font-size: 14px;
            line-height: 1.8;
            color: var(--ink);
        }

        .interpretation.is-streaming {
            display: block;
            min-height: 120px;
            padding: 18px;
            border: 1px solid var(--line);
            border-radius: 10px;
            background: #fff;
            white-space: pre-wrap;
        }

        .ai-section {
            min-width: 0;
            padding: 22px 23px 20px;
            border: 1px solid var(--line);
            border-radius: 11px;
            background: #fff;
            scroll-margin-top: 72px;
        }

        .ai-section.is-featured { grid-column: 1 / -1; border-color: #E3D9C6; background: #F6F2E9; }
        .ai-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
        .ai-section-number { color: #A48755; font-size: 12px; font-weight: 700; }
        .ai-section h3 { color: var(--navy); font: 600 19px/1.45 'Noto Serif KR', serif; }
        .ai-section-copy { overflow-wrap: anywhere; }
        .ai-section-copy h3,
        .ai-section-copy h4,
        .ai-section-copy h5 { margin: 16px 0 7px; color: var(--navy); font-size: 14px; }

        .interpretation p {
            margin-bottom: 10px;
        }

        .interpretation ul,
        .interpretation ol {
            margin: 0 0 14px 20px;
        }

        .interpretation li {
            margin-bottom: 5px;
        }

        .interpretation strong {
            color: var(--navy);
            font-weight: 600;
        }

        /* 잠금 상태에서만 나타나는 가림막 */
        .ai-veil {
            display: none;
        }

        .ai-block.is-locked .ai-body {
            max-height: 260px;
            overflow: hidden;
        }

        .ai-block.is-locked .ai-topics { display: none; }

        .ai-block.is-locked .ai-veil {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 14px;
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            padding: 118px 0 4px;
            background: linear-gradient(to bottom, rgba(251, 249, 244, 0), #FBF9F4 46%);
        }

        .ai-veil-text {
            font-size: 13.5px;
            color: var(--ink-soft);
        }

        .btn-gold {
            padding: 12px 26px;
            border: 1px solid var(--gold);
            border-radius: 10px;
            background: var(--gold);
            color: #1C2734;
            font-family: inherit;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: background-color 180ms ease;
        }

        .btn-gold:hover {
            background: #C4AA79;
        }

        .back-to-form { display: flex; justify-content: center; gap: 10px; width: fit-content; margin: 12px auto 0; color: var(--navy); font-size: 13px; font-weight: 600; text-decoration: none; }
        .back-to-form:hover { text-decoration: underline; }

        .disclaimer {
            padding: 8px 0 0;
            font-size: 12.5px;
            color: var(--ink-faint);
            text-align: center;
        }

        /* ===== 반응형 ===== */

        @media (max-width: 1080px) {
            .summary-grid {
                grid-template-columns: repeat(2, 1fr);
            }

            .feature-item { padding: 0 10px; }
        }

        @media (max-width: 900px) {
            .input-fields {
                grid-template-columns: repeat(3, minmax(0, 1fr));
            }

            .feature-strip { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
            .feature-item:nth-child(2) { border-right: 0; }
            .detail-list { grid-template-columns: 1fr; }
        }

        @media (max-width: 720px) {
            .container {
                padding: 0 16px 48px;
            }

            .header { gap: 8px; margin-bottom: 18px; }
            .header h1 { font-size: 15px; }
            .brand { gap: 5px; }
            .brand-mark { width: 30px; height: 30px; flex-basis: 30px; }
            .header-nav { gap: 11px; }
            .header-nav a { font-size: 11.5px; }

            .intro { min-height: 280px; padding: 25px 22px; background-position: left center; }
            .intro-copy { max-width: 450px; }
            .intro-stamp { display: none; }

            .intro-title {
                font-size: 27px;
            }

            .card {
                padding: 18px;
            }

            .input-panel { padding: 20px; }
            .input-aside { align-items: flex-start; flex-direction: column; gap: 4px; }
            .input-aside p { text-align: left; }
            .input-fields { grid-template-columns: 1fr; }
            .feature-strip { margin-bottom: 30px; }

            .report-cover { min-height: 260px; padding: 24px 21px; background-position: left center; }
            .report-cover-content { max-width: 94%; }
            .report-cover-mark { display: none; }
            .report-meta { flex-wrap: wrap; gap: 8px; }
            .report-nav a { padding: 8px 10px; font-size: 12px; }
            .summary-head { align-items: flex-start; flex-direction: column; gap: 0; }

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

            .input-fields {
                grid-template-columns: 1fr;
            }

            .input-submit .btn-primary {
                width: 100%;
                min-height: 48px;
            }

            .oheng-body {
                grid-template-columns: 1fr;
            }

            .chart-container {
                height: 240px;
            }

            .cell-hanja {
                font-size: 21px;
            }

            .myeongsik tbody th {
                width: 32px;
                font-size: 11.5px;
            }

            .top-grid,
            .balance-cats {
                grid-template-columns: 1fr;
            }

            .balance-cats {
                grid-template-columns: repeat(5, 1fr);
            }

            /* 대운은 세로로 쌓지 않고 가로 스크롤로 유지한다 — 가이드 §13 */
            .daeun-timeline {
                grid-auto-columns: 115px;
                overflow-x: auto;
                padding: 12px 2px;
                scroll-snap-type: x proximity;
                -webkit-overflow-scrolling: touch;
            }

            .daeun-section .panel-head { align-items: flex-start; flex-direction: column; gap: 4px; }

            .daeun-node {
                scroll-snap-align: center;
            }

            .detail-item > summary {
                flex-direction: column;
                align-items: flex-start;
                gap: 4px;
                padding: 15px 18px;
                position: relative;
            }

            .detail-item > summary::after {
                position: absolute;
                right: 18px;
                top: 20px;
                margin-left: 0;
            }

            .detail-name {
                min-width: 0;
            }

            .detail-body {
                padding: 18px 18px 20px;
            }

            .ai-block {
                padding: 24px 20px 26px;
            }

            .interpretation { grid-template-columns: 1fr; }
            .ai-section.is-featured { grid-column: auto; }

            .btn-gold {
                width: 100%;
                min-height: 48px;
            }
        }

        @media (max-width: 480px) {
            .intro { min-height: 290px; }
            .intro-title { font-size: 25px; }
            .intro-lead { font-size: 13px; }
            .feature-item { gap: 7px; justify-content: flex-start; padding: 0 5px; }
            .feature-icon { flex-basis: 34px; width: 34px; height: 34px; font-size: 17px; }
            .feature-item strong { font-size: 12px; }
            .feature-item div span { font-size: 10.5px; }
            .summary-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
            .summary-item { padding: 12px 10px; }
            .summary-item strong { font-size: 16px; }
            .summary-detail { font-size: 10.5px; }
            .oheng-legend { grid-template-columns: repeat(5, 1fr); gap: 3px; }
            .legend-name { font-size: 10.5px; }
            .legend-value { font-size: 11px; }
        }

        @media print {
            body { background: #fff; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
            .container { max-width: none; padding: 0; }
            .header, .intro, .input-panel, .feature-strip, .loading, .result-toolbar, .report-nav, .report-print, .back-to-form { display: none !important; }
            .result-section { display: block !important; }
            .report-cover, .card, .detail-item, .ai-block { box-shadow: none; break-inside: avoid; }
            .detail-item > .detail-body { display: block; }
            .daeun-timeline { overflow: visible; }
        }

/* (★중요) 정확한 시각 모드가 아닐 때 입력과 라벨을 함께 감춘다. */
#birthTime[hidden],
#exactTimeLabel[hidden] {
    display: none;
}

/* (★중요) 해석이 끝나면 중지 버튼을 숨긴다. */
#cancelAnalysis[hidden] { display: none; }
