:root {
    color-scheme: light;
    --ink: #172033;
    --muted: #5c687b;
    --line: #dfe5ee;
    --surface: #ffffff;
    --soft: #f5f8fc;
    --primary: #1769e0;
    --primary-dark: #0d51b8;
    --accent: #eaf3ff;
    --danger: #b42318;
    --shadow: 0 18px 50px rgba(31, 46, 78, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: #f7f9fc;
    line-height: 1.6;
}
a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 66px;
    padding: 12px max(20px, calc((100% - 1180px) / 2));
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid rgba(223,229,238,.9);
    backdrop-filter: blur(16px);
}
.brand { font-weight: 850; text-decoration: none; letter-spacing: -.03em; }
.site-header nav { display: flex; gap: 18px; }
.site-header nav a { color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: none; }
.site-header nav a:hover { color: var(--primary); }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
    gap: 38px;
    align-items: center;
    padding: 72px 0 46px;
}
.hero-copy h1 {
    margin: 8px 0 18px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.13;
    letter-spacing: -.055em;
}
.hero-copy > p:last-child { max-width: 650px; margin: 0; color: var(--muted); font-size: 18px; }
.eyebrow {
    margin: 0;
    color: var(--primary);
    font-size: 13px;
    font-weight: 850;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.search-panel,
.calculator-card,
.status-card,
.result-card,
.next-links {
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.search-panel { padding: 25px; border-radius: 22px; }
.search-panel > label,
.calculator-card > label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 800; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-row input,
.input-with-unit input {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid #cbd4e1;
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    outline: none;
}
.search-row input:focus,
.input-with-unit input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23,105,224,.12); }
.search-row button,
.calculate-button,
.result-actions button {
    border: 0;
    border-radius: 11px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}
.search-row button { min-width: 128px; padding: 0 18px; }
.search-row button:hover,
.calculate-button:hover,
.result-actions button:hover { background: var(--primary-dark); }
.search-row button:disabled { opacity: .6; cursor: wait; }
.search-hint { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.quick-search { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quick-search button {
    padding: 7px 11px;
    border: 1px solid #ccd8e8;
    border-radius: 999px;
    background: #f8fbff;
    color: #36506f;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.quick-search button:hover { border-color: var(--primary); color: var(--primary); }

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 26px;
    align-items: start;
    padding: 24px 0 64px;
}
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 16px; }
.section-heading h2,
.calculator-card h2,
.next-links h2 { margin: 5px 0 0; letter-spacing: -.035em; }
.period-badge { padding: 7px 10px; border-radius: 999px; background: var(--accent); color: #1556aa; font-size: 13px; font-weight: 800; }
.status-card { padding: 22px; border-radius: 16px; color: var(--muted); box-shadow: none; }
.status-card.loading { color: #1556aa; background: #f3f8ff; }
.status-card.error { color: var(--danger); background: #fff6f5; border-color: #f3c7c2; }
.status-card.empty { background: #fffaf0; border-color: #f0d6a8; color: #725012; }
.result-list { display: grid; gap: 14px; margin-top: 14px; }
.result-card { padding: 21px; border-radius: 18px; box-shadow: 0 10px 30px rgba(31,46,78,.05); }
.result-header { display: flex; justify-content: space-between; gap: 18px; }
.result-region { margin: 0 0 2px; color: var(--primary); font-size: 12px; font-weight: 800; }
.result-card h3 { margin: 0; font-size: 21px; letter-spacing: -.03em; }
.result-card h3 a { text-decoration: none; }
.result-card h3 a:hover { color: var(--primary); text-decoration: underline; }
.result-address { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.result-price { flex: 0 0 auto; text-align: right; }
.result-price span { display: block; color: var(--muted); font-size: 12px; }
.result-price strong { display: block; margin-top: 2px; color: #0f5dcc; font-size: 21px; }
.result-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.result-meta span { padding: 5px 8px; border-radius: 7px; background: var(--soft); color: #536176; font-size: 12px; }
.price-range { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.price-range span { padding: 11px; border: 1px solid #e8edf4; border-radius: 11px; background: #fbfcfe; }
.price-range small { display: block; color: var(--muted); font-size: 11px; }
.price-range strong { display: block; margin-top: 3px; font-size: 14px; }
.result-actions { display: flex; gap: 9px; margin-top: 15px; }
.result-actions button,
.result-actions a { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 14px; border-radius: 9px; font-size: 14px; font-weight: 800; text-decoration: none; }
.result-actions a { border: 1px solid #cbd6e5; color: #36506f; background: #fff; }
.result-actions a:hover { border-color: var(--primary); color: var(--primary); }

.calculator-card { position: sticky; top: 88px; padding: 24px; border-radius: 20px; }
.calculator-card h2 { margin-bottom: 8px; }
.selected-apartment { min-height: 48px; margin: 0 0 18px; padding: 11px 12px; border-radius: 10px; background: var(--soft); color: var(--muted); font-size: 13px; }
.input-with-unit { position: relative; margin-bottom: 16px; }
.input-with-unit input { padding-right: 55px; }
.input-with-unit span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.calculate-button { width: 100%; min-height: 48px; margin-top: 2px; }
.calculation-result { margin: 20px 0 0; }
.calculation-result div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid #edf0f5; }
.calculation-result dt { color: var(--muted); font-size: 13px; }
.calculation-result dd { margin: 0; font-weight: 850; }
.calculation-result div:nth-child(2) dd { color: var(--primary); }
.calculator-note { margin: 15px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }

.next-links { margin-bottom: 55px; padding: 28px; border-radius: 20px; }
.next-links > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 17px; }
.next-links a { display: block; padding: 17px; border: 1px solid #e0e7f0; border-radius: 13px; text-decoration: none; }
.next-links a:hover { border-color: var(--primary); transform: translateY(-1px); }
.next-links strong, .next-links span { display: block; }
.next-links span { margin-top: 4px; color: var(--muted); font-size: 13px; }

footer { padding: 30px 16px 46px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 13px; }
footer p { margin: 5px 0; }
footer a { color: var(--primary); font-weight: 700; }

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; padding-top: 48px; }
    .content-grid { grid-template-columns: 1fr; }
    .calculator-card { position: static; }
}

@media (max-width: 640px) {
    .site-header { min-height: 58px; padding: 10px 16px; }
    .site-header nav { display: none; }
    main { width: min(100% - 22px, 1180px); }
    .hero { gap: 25px; padding: 36px 0 24px; }
    .hero-copy h1 { font-size: 36px; }
    .hero-copy > p:last-child { font-size: 16px; }
    .search-panel { padding: 17px; border-radius: 17px; }
    .search-row { grid-template-columns: 1fr; }
    .search-row button { min-height: 48px; }
    .content-grid { padding-top: 15px; }
    .section-heading { align-items: start; }
    .result-card { padding: 17px; }
    .result-header { display: block; }
    .result-price { margin-top: 12px; text-align: left; }
    .price-range { grid-template-columns: 1fr; }
    .result-actions { flex-direction: column; }
    .next-links { padding: 20px; }
    .next-links > div { grid-template-columns: 1fr; }
}
