:root {
    color-scheme: dark;
    --ink: #142320;
    --night: #101e1c;
    --cream: #f4efdf;
    --muted: #aab8ad;
    --sage: #a9c3ab;
    --gold: #d3b67c;
    --paper: #f6f2e7;
    --paper-line: #ddd8c9;
    --serif: 'Noto Serif CJK KR', 'Noto Serif KR', 'AppleMyungjo', Batang, serif;
    --sans: 'Pretendard', 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    font-family: var(--sans);
    font-size: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    color: var(--cream);
    background: radial-gradient(ellipse at 18% 53%, #233c32 0%, transparent 50%),
                radial-gradient(ellipse at 86% 2%, #1c322b 0%, transparent 37%), var(--night);
    word-break: keep-all;
}

h1, h2, h3, p, dl, dd, ul { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; }
svg { display: block; }
img { display: block; max-width: 100%; }
em { font-style: normal; }
[id] { scroll-margin-top: 1rem; }
:focus-visible { outline: 2px solid #ae8050; outline-offset: 4px; }

.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link { position: fixed; z-index: 2; top: 12px; left: 12px; padding: 12px; color: var(--ink); background: var(--paper); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.shell { width: min(1140px, calc(100% - 80px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid #e7d8ad25; }
.header-inner, .footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.header-inner { min-height: 79px; }

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    font-family: var(--serif);
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -.05em;
    line-height: 1.1;
}

.wordmark svg { width: 37px; height: 37px; color: var(--gold); }
.wordmark small { display: block; margin-top: 5px; color: var(--muted); font: 600 8px/1.1 var(--sans); letter-spacing: .22em; }
.service-nav { display: flex; align-items: center; gap: 3px; }
.service-nav a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: clamp(9px, 2vw, 15px); color: var(--muted); border: 1px solid transparent; border-radius: 999px; font-size: 12px; white-space: nowrap; text-decoration: none; }
.service-nav a:hover { color: var(--cream); background: #e7d8ad14; }
.service-nav a[aria-current] { color: #ebd5a8; border-color: #d3b67c55; background: #d3b67c14; }
.site-footer { margin-top: auto; border-top: 1px solid #e7d8ad25; color: var(--muted); }
.footer-inner { min-height: 62px; font-size: 12px; }

.home-page {
    padding-block: clamp(42px, 8vh, 94px) clamp(48px, 10vh, 110px);
}

.home-page .intro { text-align: center; }
.home-page .eyebrow { justify-content: center; }
.home-page .intro h1 { font-size: clamp(38px, 6vw, 68px); }
.home-page .intro-copy { margin-top: 12px; }
.home-menu {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(14px, 2vw, 24px);
    margin-top: clamp(28px, 6vh, 56px);
}

.home-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: clamp(232px, 29vw, 318px);
    padding: clamp(22px, 3vw, 38px);
    color: var(--ink);
    background: var(--tile-bg);
    border: 1px solid #fff6db70;
    border-radius: 14px;
    box-shadow: 0 14px 38px #07100e40;
    text-decoration: none;
    transition: transform .16s, box-shadow .16s;
}

.home-tile:hover { transform: translateY(-4px); box-shadow: 0 20px 46px #07100e70; }
.home-tile:focus-visible { outline-color: var(--gold); }
.home-tile--personality { --tile-bg: #dce8db; }
.home-tile--fortune { --tile-bg: #f1e1ba; }
.home-tile--saju { --tile-bg: #efe7dd; }
.home-tile-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    color: #2f4d40;
    border: 1px solid #314b4038;
    border-radius: 12px;
    background: #ffffff35;
}
.home-tile-icon svg { width: 30px; height: 30px; }
.home-tile-text { display: grid; gap: 8px; }
.home-tile-title { font: 700 clamp(24px, 3vw, 40px)/1.2 var(--serif); letter-spacing: -.06em; }
.home-tile-copy { color: #44554b; font-size: 14px; line-height: 1.55; }
.home-tile-arrow { position: absolute; top: clamp(22px, 3vw, 38px); right: clamp(22px, 3vw, 38px); width: 22px; height: 22px; color: #2f4d40; }

.landing {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .88fr);
    align-items: start;
    gap: clamp(28px, 6vw, 94px);
    padding-block: clamp(48px, 7vw, 92px) 56px;
}

.intro { padding-top: 13px; }
.eyebrow { display: flex; align-items: center; gap: 12px; color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .25em; }
.eyebrow-line { width: 26px; height: 1px; background: currentColor; }
.intro h1, .result-hero h1 {
    margin-top: 23px;
    font-family: var(--serif);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -.075em;
}
.intro h1 { font-size: clamp(51px, 5.3vw, 77px); }
.intro h1 em, .result-hero h1 em { color: var(--sage); }
.intro-copy { margin-top: 24px; color: #becabf; font-size: 15px; line-height: 1.85; }
.illustration { position: relative; width: min(100%, 510px); margin: -5px auto 0 0; }
.illustration img { width: 100%; height: auto; }
.art-caption {
    position: absolute;
    bottom: 4%;
    right: 3%;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid #d3b67c44;
    border-radius: 6px;
    background: #14251f;
    color: #dcc496;
    font-size: 10px;
    letter-spacing: .12em;
}
.art-caption svg { width: 14px; height: 14px; }

.paper {
    color-scheme: light;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid #fff7e6;
    border-radius: 23px;
    box-shadow: 0 24px 52px #07100e42;
}
.form-card { padding: clamp(25px, 3.3vw, 47px); }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 25px; color: #775b34; font-size: 10px; font-weight: 750; letter-spacing: .18em; }
.card-topline svg { width: 22px; height: 22px; color: #936f3a; }
.step-divider { margin-inline: 4px; color: #97846a; }
.paper h2 { margin-top: 10px; font-family: var(--serif); font-size: 36px; font-weight: 700; letter-spacing: -.07em; line-height: 1.15; }
.card-subtitle { margin-top: 10px; color: #56635a; font-size: 13px; line-height: 1.65; }
.birth-form { display: grid; gap: 20px; margin-top: 28px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { min-width: 0; }
.field > label:not(.check-label) { display: flex; align-items: center; gap: 7px; min-height: 20px; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.label-note { color: #6d695c; font-size: 10px; font-weight: 600; }

.field > input, .field select {
    width: 100%;
    min-width: 0;
    min-height: 49px;
    padding: 0 13px;
    color: var(--ink);
    background: #fdfaf2;
    border: 1px solid #d7d2c3;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color .16s, box-shadow .16s;
}
.field > input::placeholder, .field select:invalid { color: #69736b; }
.field > input:focus, .field select:focus { border-color: #547665; outline: 2px solid #547665; outline-offset: 1px; }
.field > input:disabled, .field select:disabled { color: #656e64; background: #eae7db; cursor: default; }
.field > input[aria-invalid='true'], .field select[aria-invalid='true'] { border-color: #9a4636; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 36px; cursor: pointer; }
.select-wrap svg { position: absolute; top: 50%; right: 12px; width: 17px; height: 17px; color: #53655a; transform: translateY(-50%); pointer-events: none; }
.check-label { display: flex; align-items: center; gap: 6px; width: fit-content; min-height: 27px; margin-top: 4px; color: #48584e; font-size: 12px; cursor: pointer; }
.check-label input { width: 15px; height: 15px; margin: 0; accent-color: #285242; }
.error-summary { margin-top: 16px; padding: 9px 12px; border-radius: 6px; background: #f5e3db; }
.error-summary, .field-error { color: #8d382a; font-size: 12px; line-height: 1.5; }
.field-error { margin-top: 6px; }

.primary-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 53px;
    padding: 10px 16px;
    border: 1px solid #1c4135;
    border-radius: 9px;
    color: #fff7e8;
    background: #244e40;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s;
}
.primary-button:hover { background: #163d30; }
.primary-button svg { width: 19px; height: 19px; color: #e4cd9e; }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: -8px; color: #5c675f; font-size: 11px; line-height: 1.5; }
.privacy-note svg { flex: 0 0 15px; width: 15px; height: 15px; }

.result-page { padding-block: 57px 72px; }
.result-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.result-hero > div { min-width: 0; }
.result-hero h1 { font-size: clamp(37px, 5vw, 60px); overflow-wrap: anywhere; }
.birth-summary { display: flex; flex-wrap: wrap; gap: 12px 26px; margin-top: 21px; }
.birth-summary div { display: flex; align-items: baseline; gap: 8px; }
.birth-summary dt { color: var(--muted); font-size: 12px; }
.birth-summary dd { color: var(--cream); font-size: 14px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; margin-top: 28px; }
.back-link, .detail-link { display: inline-flex; align-items: center; gap: 7px; padding: 10px 13px; border: 1px solid #e7d8ad55; border-radius: 8px; font-size: 13px; text-decoration: none; }
.back-link:hover { background: #e7d8ad18; }
.back-link svg { width: 17px; height: 17px; color: var(--gold); transform: rotate(180deg); }
.detail-link { background: #e7d8ad; color: var(--ink); font-weight: 700; }
.detail-link:hover { background: #f4e6c3; }
.detail-link svg, .detail-section summary svg { width: 17px; height: 17px; flex-shrink: 0; }
.chart-notice { display: flex; align-items: center; gap: 12px; margin-block: 28px 21px; padding: 13px 16px; border: 1px solid #d3b67c46; border-radius: 9px; background: #d3b67c0d; color: #e3d7bb; font-size: 13px; line-height: 1.6; }
.chart-notice strong { margin-right: 8px; color: #ebca88; }
.chart-notice svg { flex: 0 0 18px; width: 18px; height: 18px; color: var(--gold); }
.result-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 21px; }
.chart-card { padding: clamp(20px, 3vw, 36px); }
.chart-card h2 { font-size: 31px; }
.pillar-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 24px; }
.pillar { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 6px; min-width: 0; padding: 12px 5px 10px; border: 1px solid var(--paper-line); border-radius: 11px; background: #fffaf0; }
.pillar h3 { font-size: 13px; }
.pillar-detail { margin-bottom: 3px; color: #666e62; font-size: 10px; }
.pillar-character { display: grid; place-items: center; width: min(100%, 50px); aspect-ratio: 1; color: var(--tone-text); background: var(--tone-surface); border-radius: 8px; font: 700 clamp(20px, 3vw, 30px)/1 var(--serif); }
.pillar-empty { color: #776e60; background: #eee9df; }
.pillar-reading { margin-top: 2px; color: #46554d; font-size: 11px; }
.tone-wood { --tone: #62846d; --tone-surface: #e2ebdd; --tone-text: #385943; }
.tone-fire { --tone: #b76f62; --tone-surface: #f2dfd8; --tone-text: #91493c; }
.tone-earth { --tone: #ad8549; --tone-surface: #f0e5cd; --tone-text: #7f5e2e; }
.tone-metal { --tone: #7d817a; --tone-surface: #e7e8e2; --tone-text: #545b55; }
.tone-water { --tone: #66879a; --tone-surface: #dee9ee; --tone-text: #3b5b6d; }
.element-list { display: grid; gap: 11px; margin-top: 24px; padding: 0; list-style: none; }
.element-list li { display: grid; grid-template-columns: 59px minmax(0, 1fr) 34px; align-items: center; gap: 9px; }
.element-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; }
.element-glyph { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 6px; color: var(--tone-text); background: var(--tone-surface); font: 700 14px/1 var(--serif); }
.element-count { text-align: right; color: #56635a; font-size: 12px; }
.element-list meter { width: 100%; height: 11px; appearance: none; background: #e8e3d6; border: 0; border-radius: 999px; overflow: hidden; }
.element-list meter::-webkit-meter-bar { background: #e8e3d6; border: 0; }
.element-list meter::-webkit-meter-optimum-value { background: var(--tone); border-radius: 999px; }
.element-list meter::-moz-meter-bar { background: var(--tone); border-radius: 999px; }
.reading-card { margin-top: 21px; }
.reading-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.reading-section { padding: 20px; border: 1px solid var(--paper-line); border-radius: 11px; background: #fffaf0; }
.reading-section h3 { color: #244e40; font-size: 17px; }
.reading-section p { margin-top: 9px; color: #34493e; font-size: 14px; line-height: 1.85; }
.reading-section small { display: block; margin-top: 14px; color: #775b34; font-size: 11px; }
.detail-list { display: grid; gap: 9px; margin-top: 24px; }
.detail-section { border: 1px solid var(--paper-line); border-radius: 10px; background: #fffaf0; }
.detail-section summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; cursor: pointer; list-style: none; font-weight: 700; color: #244e40; }
.detail-section summary::-webkit-details-marker { display: none; }
.detail-section[open] summary { border-bottom: 1px solid var(--paper-line); }
.detail-section[open] summary svg { transform: rotate(180deg); }
.detail-content { padding: 0 16px 16px; }
.detail-entry { margin-top: 17px; }
.detail-entry h3, .detail-entry h4, .compatibility-panel h3 { margin: 0; color: #244e40; font-size: 14px; }
.detail-entry p { margin-top: 5px; color: #34493e; font-size: 14px; line-height: 1.8; }
.detail-entry small { display: block; margin-top: 5px; color: #775b34; font-size: 11px; }
.compatibility-panel { margin-top: 20px; padding: 16px; border: 1px solid var(--paper-line); border-radius: 8px; background: #f6f1e5; }
.compatibility-form { display: grid; gap: 12px; margin-top: 15px; }
.compatibility-result { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--paper-line); }

@media (max-width: 900px) {
    .shell { width: calc(100% - 52px); }
    .landing { grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr); }
    .intro h1 { font-size: clamp(41px, 6.3vw, 61px); }
    .intro-copy { font-size: 14px; }
    .form-card { padding: 26px; }
}

@media (max-width: 690px) {
    .shell { width: min(510px, calc(100% - 36px)); }
    .header-inner { min-height: 64px; }
    .home-menu { grid-template-columns: minmax(0, 1fr); }
    .home-tile { min-height: 155px; gap: 14px; }
    .home-tile-icon { width: 38px; height: 38px; border-radius: 8px; }
    .home-tile-icon svg { width: 23px; height: 23px; }
    .landing, .result-grid, .reading-grid { grid-template-columns: minmax(0, 1fr); }
    .landing { padding-block: 35px 42px; gap: 15px; }
    .intro { padding-top: 0; }
    .intro h1 { font-size: clamp(44px, 9vw, 60px); margin-top: 15px; }
    .intro-copy { margin-top: 14px; }
    .illustration { width: min(100%, 244px); margin-inline: auto; }
    .form-card { padding: 25px; }
    .result-page { padding-block: 35px 42px; }
    .result-hero { flex-direction: column; gap: 16px; }
    .result-hero h1 { margin-top: 16px; }
    .birth-summary { margin-top: 16px; }
    .result-actions { margin-top: 0; }
    .chart-notice { margin-top: 19px; }
    .pillar-character { font-size: 25px; }
    .field > input, .field select { font-size: 16px; }
}

@media (max-width: 520px) {
    .region-fields, .compatibility-form .field-row { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 440px) {
    .header-inner { flex-wrap: wrap; row-gap: 4px; padding-block: 8px; }
    .service-nav { flex-basis: 100%; }
}

@media (max-width: 380px) {
    .header-inner { column-gap: 8px; }
    .wordmark { gap: 7px; font-size: 20px; }
    .wordmark svg { width: 30px; height: 30px; }
    .service-nav a { padding-inline: 7px; }
    .form-card { padding: 20px; }
    .field-row { gap: 8px; }
    .field > input { padding-inline: 6px; }
    .pillar-grid { gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
    .home-tile:hover { transform: none; }
}
