:root {
  color-scheme: light dark;
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f4f1ea;
  --text: #1c1f24;
  --muted: #5b6270;
  --line: #e7e2d8;
  --line-strong: #d6cfc2;
  --brand: #e2572b;
  --brand-dark: #b8431d;
  --brand-soft: #fdeee7;
  --brand-ring: rgba(226, 87, 43, 0.22);
  --ok: #1d7347;
  --ok-soft: #e7f4ec;
  --warn: #8f5b00;
  --warn-soft: #fff4dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --shadow-sm: 0 1px 2px rgba(28, 31, 36, 0.05);
  --shadow-md: 0 1px 2px rgba(28, 31, 36, 0.04), 0 8px 24px -12px rgba(28, 31, 36, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --max: 760px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --surface: #1d2025;
    --surface-2: #24282e;
    --text: #eceae6;
    --muted: #a3a8b1;
    --line: #2f343b;
    --line-strong: #3d434b;
    --brand: #f0703f;
    --brand-dark: #ff9a72;
    --brand-soft: #3a2219;
    --brand-ring: rgba(240, 112, 63, 0.3);
    --ok: #6fd3a0;
    --ok-soft: #173326;
    --warn: #f2c063;
    --warn-soft: #362a12;
    --bad: #ff8a80;
    --bad-soft: #3b1c1a;
    --shadow-sm: none;
    --shadow-md: 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 76px;
}

@media (max-width: 560px) {
  html { scroll-padding-top: 100px; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16.5px;
  line-height: 1.75;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-dark); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--brand); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.logo { font-weight: 800; font-size: 1.1rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; letter-spacing: -0.02em; white-space: nowrap; }
.logo span { color: var(--brand); }
.logo:hover { color: var(--text); }
.nav { display: flex; gap: 4px; font-size: .93rem; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease;
}
.nav a[aria-current="page"] { color: var(--brand-dark); background: var(--brand-soft); font-weight: 700; }

/* Main */
main { padding: 32px 0 64px; }
h1 { font-size: 1.85rem; line-height: 1.3; margin: 8px 0 14px; letter-spacing: -0.03em; }
h2 { font-size: 1.3rem; line-height: 1.4; margin: 48px 0 12px; letter-spacing: -0.02em; }
h3 { font-size: 1.08rem; margin: 28px 0 6px; letter-spacing: -0.01em; }
p { margin: 0 0 14px; }
ul, ol { padding-left: 1.3em; margin: 0 0 16px; }
li { margin-bottom: 6px; }
li::marker { color: var(--muted); }
strong { font-weight: 700; }

.lead { color: var(--muted); font-size: 1.06rem; }
.meta { color: var(--muted); font-size: .85rem; margin-bottom: 22px; }
.breadcrumb { font-size: .84rem; color: var(--muted); margin-bottom: 2px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-dark); }

/* Hero facts (home) */
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; padding: 0; list-style: none; }
.facts li {
  margin: 0;
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .88rem; color: var(--muted);
}
.facts b { color: var(--text); font-size: .95rem; font-variant-numeric: tabular-nums; }

/* Cards & boxes */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0;
  box-shadow: var(--shadow-md);
}
.box { border-radius: var(--radius-sm); padding: 14px 16px; margin: 20px 0; font-size: .96rem; border: 1px solid transparent; }
.box.tip { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 18%, transparent); }
.box.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 18%, transparent); }
.box.info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 18%, transparent); }
.box strong:first-child { display: block; margin-bottom: 2px; }

.table-scroll { overflow-x: auto; margin: 14px 0 22px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; font-variant-numeric: tabular-nums; }
.table-scroll table { margin: 0; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
tr:last-child > th, tr:last-child > td { border-bottom: 0; }
thead th { background: var(--surface-2); font-weight: 700; font-size: .88rem; color: var(--muted); }
tbody th { font-weight: 700; white-space: nowrap; }

/* Forms */
.field { margin-bottom: 18px; }
.field > label, .field > .label { display: block; font-weight: 700; margin-bottom: 8px; font-size: .94rem; }
.hint { color: var(--muted); font-size: .84rem; margin: 6px 0 0; }
input[type="number"], input[type="date"], input[type="text"], select {
  width: 100%; min-height: 46px; padding: 10px 14px;
  font-size: 16px; /* 16px 미만이면 iOS가 입력 시 화면을 확대함 */
  font-family: inherit;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
input[type="number"] { font-variant-numeric: tabular-nums; }

.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-row label {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 42px; padding: 8px 14px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); cursor: pointer; font-size: .94rem;
  user-select: none; touch-action: manipulation;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out);
}
.radio-row label small { color: var(--muted); }
.radio-row label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.radio-row label:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--brand-ring); }
.radio-row label:active { transform: scale(0.97); }
.radio-row input { accent-color: var(--brand); margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; border: 0; border-radius: var(--radius-sm); padding: 12px 22px;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 1rem; font-family: inherit;
  cursor: pointer; text-decoration: none; touch-action: manipulation;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, var(--shadow-sm);
  transition: background-color 150ms ease, transform 160ms var(--ease-out);
}
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn:active { transform: scale(0.97); }
.btn.secondary { background: var(--surface); color: var(--brand-dark); border: 1px solid var(--line-strong); box-shadow: none; }
.btn.secondary:hover { border-color: var(--brand); background: var(--brand-soft); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
form .btn[type="submit"] { width: 100%; margin-top: 4px; }

/* Result */
.result:empty { display: none; }
.result { margin-top: 20px; }
.verdict {
  border-radius: 12px; padding: 18px 20px; margin-bottom: 12px;
  border: 1px solid transparent;
  animation: verdict-in 240ms var(--ease-out);
}
.verdict.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 20%, transparent); }
.verdict.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 20%, transparent); }
.verdict.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 20%, transparent); }
.verdict .big { font-size: 1.45rem; font-weight: 800; display: block; line-height: 1.35; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.verdict.ok .big { color: var(--ok); }
.verdict.warn .big { color: var(--warn); }
.verdict.bad .big { color: var(--bad); }
.verdict p { margin: 8px 0 0; }
.verdict table { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; border-collapse: separate; border-spacing: 0; overflow: hidden; margin: 12px 0 4px; }
.verdict table th { white-space: nowrap; color: var(--muted); font-weight: 500; }

@keyframes verdict-in {
  from { opacity: 0; transform: translateY(6px); }
}

/* Guide list */
.guide-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.guide-list li { margin: 0; }
.guide-list a {
  position: relative;
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 44px 14px 16px; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 150ms ease, transform 160ms var(--ease-out);
}
.guide-list a::after {
  content: "→";
  position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  transition: transform 200ms var(--ease-out), color 150ms ease;
}
.guide-list a:active { transform: scale(0.99); }
.guide-list strong { display: block; letter-spacing: -0.01em; }
.guide-list span { color: var(--muted); font-size: .88rem; }

/* Coupon list (alarm) */
.coupon-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; animation: verdict-in 240ms var(--ease-out); }
.coupon-item:last-child { border-bottom: 0; }
.coupon-item > div:last-child { display: flex; gap: 6px; }
.dday { font-weight: 800; padding: 2px 10px; border-radius: 999px; font-size: .85rem; margin-left: 4px; font-variant-numeric: tabular-nums; }
.dday.safe { background: var(--ok-soft); color: var(--ok); }
.dday.soon { background: var(--warn-soft); color: var(--warn); }
.dday.over { background: var(--bad-soft); color: var(--bad); }

.sources { font-size: .86rem; color: var(--muted); border-top: 1px solid var(--line); margin-top: 40px; padding-top: 16px; }
.sources a { color: var(--muted); }
.sources ul { padding-left: 1.1em; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0 36px; font-size: .86rem; color: var(--muted); }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand-dark); }

/* 호버는 마우스가 있는 기기에서만 (터치 기기에서 눌린 상태로 남는 문제 방지) */
@media (hover: hover) and (pointer: fine) {
  .nav a:hover { color: var(--text); background: var(--surface-2); }
  .nav a[aria-current="page"]:hover { color: var(--brand-dark); background: var(--brand-soft); }
  .radio-row label:hover { border-color: var(--brand); }
  .guide-list a:hover { border-color: var(--brand); }
  .guide-list a:hover::after { color: var(--brand); transform: translate(3px, -50%); }
}

@media (prefers-reduced-motion: reduce) {
  .verdict, .coupon-item { animation: none; }
  .btn:active, .radio-row label:active, .guide-list a:active { transform: none; }
  .guide-list a:hover::after { transform: translateY(-50%); }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  main { padding-top: 24px; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; margin-top: 40px; }
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .card { padding: 18px; border-radius: 14px; }
  .site-header .wrap { flex-wrap: wrap; gap: 0; padding-top: 10px; padding-bottom: 8px; min-height: 0; }
  .logo { font-size: 1rem; }
  .nav { width: 100%; font-size: .88rem; margin: 6px -10px 0; }
  .nav a { padding: 5px 10px; }
  .facts li { font-size: .82rem; padding: 4px 10px; }
  .facts b { font-size: .88rem; }
  .verdict .big { font-size: 1.3rem; }
}
