@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css");

:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f9fafb;
    --line: #e5e8eb;
    --line-strong: #d8dde3;
    --text: #191f28;
    --muted: #8b95a1;
    --blue: #3182f6;
    --blue-dark: #1b64da;
    --chip: #eef5ff;
    --shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #fbfcfd 0%, #f3f6fa 100%);
    color: var(--text);
    font-family: "Pretendard", "Malgun Gothic", sans-serif;
}

.app-shell {
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(49, 130, 246, 0.22);
}

.brand-name {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.brand-sub {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.hero-panel,
.result-hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

.hero-copy h1,
.result-hero h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1.22;
    letter-spacing: -0.05em;
}

.eyebrow,
.section-kicker {
    margin: 0 0 10px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.hero-description,
.section-head p {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.7;
    font-size: 16px;
}

.hero-image-box {
    width: min(100%, 180px);
    margin-left: auto;
    padding: 14px;
    border-radius: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.hero-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.form-card,
.side-card,
.result-card,
.policy-panel {
    padding: 28px;
}

.section-head {
    margin-bottom: 18px;
}

.section-head.compact h2 {
    margin-bottom: 0;
}

.section-head h2,
.policy-panel h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.3;
    letter-spacing: -0.04em;
}

.form-block + .form-block {
    margin-top: 24px;
}

.block-head {
    margin-bottom: 12px;
}

.block-head h3 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.03em;
}

.block-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.birth-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
    gap: 12px;
}

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

.option-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field span {
    color: #4e5968;
    font-size: 14px;
    font-weight: 600;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    min-height: 54px;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    background: #fff;
    border-color: rgba(49, 130, 246, 0.5);
    box-shadow: 0 0 0 4px rgba(49, 130, 246, 0.12);
}

.primary-button,
.ghost-button {
    border: 0;
    cursor: pointer;
}

.primary-button {
    width: 100%;
    min-height: 56px;
    margin-top: 20px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(49, 130, 246, 0.2);
}

.result-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
}

.main-column {
    display: grid;
    gap: 20px;
}

.result-flow {
    gap: 18px;
}

.details-card {
    margin-top: 4px;
}

.detail-info-list {
    margin-top: 18px;
}

.info-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.info-list div {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.info-list dt {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.info-list dd {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
}

.menu-box {
    margin-top: 18px;
    padding: 16px;
    border-radius: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.menu-title {
    margin: 0 0 12px;
    color: #4e5968;
    font-size: 13px;
    font-weight: 700;
}

.menu-stack {
    display: grid;
    gap: 10px;
}

.menu-stack form {
    margin: 0;
}

.ghost-button,
.ghost-link,
.back-link,
.page-link {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.ghost-button.active,
.ghost-link.active {
    border-color: rgba(49, 130, 246, 0.2);
    background: var(--chip);
    color: var(--blue-dark);
}

.back-link {
    margin-top: 18px;
    background: transparent;
}

.content-box,
.history-answer {
    white-space: pre-wrap;
    line-height: 1.84;
    font-size: 16px;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--chip);
    color: var(--blue-dark);
    font-size: 13px;
    font-weight: 700;
}

.summary-box {
    margin-bottom: 18px;
}

.summary-title {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.summary-subtitle {
    margin: 0;
    color: var(--muted);
}

.fluid-grid,
.month-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.soft-card,
.month-card,
.history-card {
    padding: 18px;
    border-radius: 20px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    min-width: 0;
}

.soft-card h3,
.month-card h3 {
    margin: 0 0 10px;
    font-size: 18px;
    letter-spacing: -0.03em;
}

.soft-card p,
.month-card p,
.month-helper p,
.history-question,
.history-answer,
.policy-copy p {
    margin: 0;
    line-height: 1.75;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.soft-card p + p,
.month-card p + p,
.month-helper p + p,
.policy-copy p + p {
    margin-top: 8px;
}

.month-helper {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line-strong);
}

.followup-submit {
    width: auto;
    min-width: 220px;
    margin-top: 0;
}

.followup-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
}

.loading-state {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-weight: 600;
}

.loading-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid rgba(49, 130, 246, 0.18);
    border-top-color: var(--blue);
    animation: spin 0.8s linear infinite;
}

.notice-box {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #f8fbff;
    border: 1px solid #e3eefc;
    color: #4e5968;
    line-height: 1.7;
}

.history-list {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.history-label {
    margin-bottom: 8px;
    color: var(--blue-dark);
    font-size: 12px;
    font-weight: 700;
}

.history-label.answer {
    margin-top: 14px;
}

.history-question {
    font-weight: 600;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

.page-link {
    width: auto;
    min-width: 76px;
}

.page-status {
    color: var(--muted);
    font-weight: 600;
}

.alert {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #fff5f3;
    border: 1px solid #fde1da;
    color: #c23a2b;
}

.footer-link {
    margin-top: 18px;
    text-align: center;
}

.footer-link a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.policy-shell {
    max-width: 860px;
}

.policy-hero {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 18px;
    padding: 28px;
    margin-bottom: 20px;
}

.policy-hero-copy h1 {
    margin: 0;
    font-size: clamp(28px, 4.8vw, 44px);
    line-height: 1.28;
    letter-spacing: -0.05em;
}

.policy-hero-copy p:last-child {
    margin: 14px 0 0;
    color: var(--muted);
    line-height: 1.8;
}

.policy-meta {
    display: grid;
    gap: 12px;
}

.policy-meta-item,
.highlight-item,
.policy-note {
    padding: 16px;
    border-radius: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.policy-meta-item span,
.history-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.policy-meta-item strong,
.highlight-item strong {
    font-size: 16px;
    letter-spacing: -0.02em;
}

.policy-grid {
    display: grid;
    gap: 20px;
}

.policy-highlight,
.policy-document {
    padding: 28px;
}

.policy-highlight h2,
.policy-document h2 {
    margin: 0 0 14px;
    font-size: 24px;
    letter-spacing: -0.04em;
}

.highlight-list {
    display: grid;
    gap: 12px;
}

.highlight-item p,
.policy-section p,
.policy-note p {
    margin: 8px 0 0;
    color: #4e5968;
    line-height: 1.8;
}

.policy-section + .policy-section {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.policy-note {
    margin-top: 24px;
    background: #f8fbff;
    border-color: #e3eefc;
}

.policy-note strong {
    display: block;
    margin-bottom: 6px;
    color: var(--blue-dark);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 960px) {
    .hero-panel,
    .result-hero,
    .result-layout,
    .result-flow,
    .birth-grid,
    .time-grid,
    .option-grid,
    .policy-hero {
        grid-template-columns: 1fr;
    }

    .hero-image-box {
        margin-left: 0;
    }
}

@media (max-width: 720px) {
    .app-shell {
        width: min(100% - 18px, 1160px);
        padding-top: 18px;
        padding-bottom: 36px;
    }

    .form-card,
    .side-card,
    .result-card,
    .policy-highlight,
    .policy-document,
    .policy-panel {
        padding: 22px;
        border-radius: 22px;
    }

    .hero-copy h1,
    .result-hero h1 {
        font-size: 30px;
    }

    .section-head h2,
    .policy-panel h1 {
        font-size: 24px;
    }

    .policy-hero-copy h1 {
        font-size: 30px;
    }

    .followup-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .followup-submit {
        width: 100%;
        min-width: 0;
    }
}
