:root {
  --navy: #16213e;
  --navy-soft: #22304f;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --line: #e8ebf0;
  --line-strong: #d8dde6;
  --text: #1a2233;
  --text-soft: #667085;
  --text-faint: #8b95a7;
  --blue: #2563eb;
  --green: #16a34a;
  --green-ink: #0f7a38;
  --green-soft: #eefbf3;
  --green-line: #bbf7d0;
  --amber: #b45309;
  --amber-soft: #fef6e7;
  --amber-line: #fde3b3;
  --red: #b91c1c;
  --red-soft: #fef3f2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(22, 33, 62, .05);
  --font: "Pretendard", system-ui, -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

h1, h2, h3 { margin: 0; line-height: 1.35; letter-spacing: -.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 30;
  background: var(--surface); color: var(--navy); padding: .6rem 1rem;
}
.skip-link:focus { left: 0; }

/* ---------- top bar ---------- */

.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar__inner {
  max-width: 1280px; margin: 0 auto; padding: .65rem 1.5rem;
  display: flex; align-items: center; gap: 1.75rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  color: #fff; text-decoration: none; font-weight: 700; font-size: 1.06rem;
  letter-spacing: -.02em; white-space: nowrap;
}
.brand__mark {
  display: grid; place-items: center; width: 28px; height: 28px;
  color: #7aa7ff;
}
.topbar__inner nav { margin-left: auto; }
.topbar__menu { display: flex; gap: .2rem; flex-wrap: wrap; }
.topbar__menu a {
  display: inline-block; padding: .45rem .7rem; border-radius: 7px;
  color: #c6d0e2; text-decoration: none; font-size: .9rem; white-space: nowrap;
}
.topbar__menu a:hover { background: var(--navy-soft); color: #fff; }
.topbar__menu a[aria-current="page"] {
  color: #fff; font-weight: 600;
  box-shadow: inset 0 -2px 0 #7aa7ff;
  border-radius: 7px 7px 0 0;
}
.topbar__menu a.is-soon { color: #8e9cb5; cursor: not-allowed; }
.topbar__menu a.is-soon::after {
  content: "준비 중"; margin-left: .35rem; font-size: .64rem;
  padding: 0 .28rem; border: 1px solid currentColor; border-radius: 4px;
  vertical-align: 1px;
}
/* ---------- 후보 검색 (추천 결과와 전체 후보 사이) ---------- */

.list-search {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .6rem .9rem;
  box-shadow: var(--shadow);
}
.list-search__label {
  font-size: .82rem; font-weight: 700; color: var(--text-soft); white-space: nowrap;
}
.list-search__field {
  flex: 1 1 220px; min-width: 0;
  display: flex; align-items: center; gap: .5rem;
  background: #f6f8fb; border: 1px solid var(--line);
  border-radius: 999px; padding: .38rem .85rem; color: #93a1b8;
}
.list-search__field input {
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: .88rem; width: 100%; outline: none;
}
.list-search__field input::placeholder { color: #9aa7bb; }
.list-search__field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 107, 255, .14); }

/* ---------- layout ---------- */

.shell { max-width: 1280px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }

.page-intro { display: flex; gap: .85rem; align-items: flex-start; margin-bottom: .9rem; }
.page-intro__icon {
  flex: none; display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 11px;
  background: #e8f0ff; color: var(--blue);
}
.page-intro h1 { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.85rem); font-weight: 800; }
.lede { color: var(--text-soft); font-size: .95rem; margin-top: .3rem; max-width: 70ch; }

.status-banner {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  background: var(--amber-soft); border: 1px solid var(--amber-line);
  color: #7c4a06; border-radius: var(--radius-sm);
  padding: .55rem .85rem; font-size: .84rem; margin: 0 0 1.25rem;
}
.status-banner .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; }

.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.sidebar {
  display: grid; gap: 1.1rem; align-content: start;
  position: sticky; top: 4.75rem;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto; overscroll-behavior: contain;
  padding-right: .35rem;
  scrollbar-width: thin; scrollbar-color: #cbd3df transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #cbd3df; border-radius: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.content { display: grid; gap: 1.1rem; }

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap; margin-bottom: .9rem;
}
.card__title {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .98rem; font-weight: 700;
}
.card__title svg { color: var(--text-soft); }

.pill {
  font-size: .74rem; font-weight: 700; color: var(--blue);
  background: #eaf1ff; border: 1px solid #d3e2ff;
  padding: .18rem .55rem; border-radius: 999px;
}

/* ---------- form controls ---------- */

.field { margin-bottom: .9rem; }
.field:last-of-type { margin-bottom: .75rem; }
.field__label {
  display: block; font-size: .77rem; font-weight: 700; letter-spacing: .03em;
  color: var(--text-soft); margin-bottom: .35rem;
}

select {
  width: 100%; padding: .55rem .7rem; font: inherit; font-size: .9rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  appearance: none; padding-right: 1.9rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23667085' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center;
}
select:focus-visible,
.segmented button:focus-visible,
.card__toggle:focus-visible,
.link:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}

.segmented {
  display: flex; gap: .2rem; background: #f1f3f7;
  padding: .2rem; border-radius: var(--radius-sm);
}
.segmented button {
  flex: 1 1 0; min-width: 0; padding: .45rem .25rem;
  font: inherit; font-size: .82rem; font-weight: 600; color: var(--text-soft);
  background: transparent; border: 0; border-radius: 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .05rem;
}
.segmented button small, .segmented button span { font-size: .65rem; font-weight: 400; opacity: .75; }
.segmented button[aria-checked="true"] {
  background: var(--surface); color: var(--navy);
  box-shadow: 0 1px 2px rgba(22, 33, 62, .14);
}

.summary {
  margin: .9rem 0 0; padding-top: .85rem; border-top: 1px dashed var(--line);
  display: grid; gap: .35rem; font-size: .84rem;
}
.summary div { display: flex; justify-content: space-between; gap: .5rem; }
.summary dt { color: var(--text-soft); }
.summary dd { margin: 0; font-weight: 600; text-align: right; }

.note-box {
  margin-top: .7rem; background: #f7f9fc; border-radius: var(--radius-sm);
  padding: .55rem .7rem; font-size: .78rem; color: var(--text-soft);
}

.index-legend { font-size: .86rem; color: var(--text-soft); }
.index-legend strong { color: var(--text); }
.index-examples { margin: .7rem 0; display: grid; gap: .35rem; font-size: .84rem; }
.index-examples li {
  display: flex; justify-content: space-between; gap: .5rem;
  background: #f7f9fc; border-radius: 6px; padding: .35rem .55rem;
}
.index-examples b { font-variant-numeric: tabular-nums; }
.index-calc { font-size: .82rem; color: var(--green-ink); background: var(--green-soft);
  border-radius: 6px; padding: .45rem .55rem; }
.index-caveat { margin-top: .55rem; font-size: .76rem; color: var(--text-faint); }

.rule-formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem; background: #f2f4f8; border-radius: 6px;
  padding: .45rem .55rem; color: var(--navy);
}
.rule-formula--soft { background: #eef4ff; color: #1d4ed8; font-family: var(--font); }
.rule-text { font-size: .82rem; color: var(--text-soft); margin: .55rem 0 .6rem; }
.link { font-size: .82rem; font-weight: 600; color: var(--blue); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- top pick ---------- */

.card--pick { border-color: var(--line); }
#top-pick { display: grid; gap: .75rem; }

.pick-top {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px); gap: 1rem;
  background: linear-gradient(180deg, #f4fdf7, #ffffff 65%);
  border: 1.5px solid var(--green-line);
  border-radius: var(--radius); padding: 1rem 1.1rem;
}
.pick-top__main { display: grid; gap: .35rem; align-content: start; }
.pick-top__rank {
  justify-self: start; font-size: .76rem; font-weight: 800; color: #fff;
  background: var(--green); border-radius: 999px; padding: .15rem .6rem;
}
.pick-top__name { font-size: 1.3rem; font-weight: 800; }
.pick-top__name--warn { font-size: 1.02rem; line-height: 1.45; }
.pick-top__sub { font-size: .84rem; color: var(--text-soft); }
.pick-top__why { font-size: .86rem; color: #24543a; }
.pick-top__side {
  background: #fff; border: 1px solid var(--green-line); border-radius: var(--radius-sm);
  padding: .7rem .8rem; display: grid; gap: .25rem; align-content: start;
}
.pick-top__side dt { font-size: .76rem; color: var(--text-soft); }
.pick-top__side dd { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--green-ink); }
.pick-top__side small { font-size: .76rem; color: var(--text-soft); }

.pick-top--warn {
  background: linear-gradient(180deg, #fffaf0, #ffffff 65%);
  border-color: var(--amber-line);
}
.pick-top--warn .pick-top__rank { background: var(--amber); }
.pick-top--warn .pick-top__side { border-color: var(--amber-line); }
.pick-top--warn .pick-top__side dd { color: var(--amber); }

/* ---------- candidate grid ---------- */

.results__meta { font-size: .8rem; color: var(--text-soft); }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem;
}

.part {
  border: 1px solid var(--line); border-radius: 10px; padding: .8rem .85rem;
  display: grid; gap: .45rem; background: #fff;
}
.part--top { border-color: var(--green-line); background: #fbfefc; }
.part__head { display: flex; align-items: flex-start; gap: .5rem; }
.part__title { flex: 1 1 auto; min-width: 0; }
.part__rank {
  flex: none; display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: #eef2f8; color: var(--text-soft);
  font-size: .74rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.part--top .part__rank { background: var(--green); color: #fff; }
.part__name { font-size: .95rem; font-weight: 700; }
.part__vendor { font-size: .72rem; color: var(--text-faint); letter-spacing: .04em; text-transform: uppercase; }

.badge {
  flex: none; font-size: .68rem; font-weight: 800; letter-spacing: .03em;
  padding: .18rem .45rem; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent;
}
.badge--good { background: var(--green-soft); color: var(--green-ink); border-color: var(--green-line); }
.badge--ok { background: #eef4ff; color: #1d4ed8; border-color: #d3e2ff; }
.badge--warn { background: var(--red-soft); color: var(--red); border-color: #fbd5d1; }

.part__chips { display: flex; gap: .3rem; flex-wrap: wrap; font-size: .74rem; }
.part__chips span {
  background: #f2f4f8; color: var(--text-soft); border-radius: 5px; padding: .08rem .4rem;
}
.part__chips span.is-delta { background: #eef4ff; color: #1d4ed8; font-weight: 700; }

/* ---------- balance gauge ---------- */

.gauge { display: grid; gap: .3rem; margin: .1rem 0; }
.gauge__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
}
.gauge__caption { font-size: .73rem; color: var(--text-soft); }
.gauge__value {
  font-size: 1rem; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text);
}
.gauge__value--good { color: var(--green-ink); }
.gauge__value--ok { color: #1d4ed8; }
.gauge__value--warn { color: var(--red); }

.gauge__track {
  position: relative; height: 9px; border-radius: 999px;
  background: #eef1f6; overflow: hidden;
}
.gauge__zone { position: absolute; top: 0; bottom: 0; }
.gauge__zone--low { background: #f6c9c6; }
.gauge__zone--near { background: #fbe3bd; }
.gauge__zone--sweet { background: #a9dfbe; }
.gauge__zone--high { background: #f6c9c6; }

.gauge__pin {
  position: absolute; top: -2px; width: 3px; height: 13px;
  margin-left: -1.5px; border-radius: 2px;
  background: #16213e; box-shadow: 0 0 0 1.5px #fff;
}

.gauge__legend {
  display: flex; justify-content: space-between; gap: .4rem;
  font-size: .68rem; color: var(--text-faint);
}
.gauge__legend span:nth-child(2) { color: var(--green-ink); font-weight: 600; }

.part__reason { font-size: .8rem; color: var(--text-soft); }

.card__toggle {
  justify-self: start; background: none; border: 0; padding: 0;
  font: inherit; font-size: .78rem; font-weight: 600; color: var(--blue); cursor: pointer;
}
.part__detail {
  font-size: .78rem; color: var(--text-soft);
  border-top: 1px dashed var(--line); padding-top: .5rem;
}
.part__detail[hidden] { display: none; }
.part__detail strong { color: var(--text); }

.empty { color: var(--text-soft); font-size: .86rem; }

/* ---------- method ---------- */

.method__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; }
.subhead { font-size: .84rem; font-weight: 700; color: var(--text-soft); margin-bottom: .45rem; }
.method__note { font-size: .82rem; color: var(--text-soft); margin: .5rem 0; }
.limits { display: grid; gap: .35rem; font-size: .82rem; color: var(--text-soft); }
.limits li { padding-left: .9rem; position: relative; }
.limits li::before {
  content: ""; position: absolute; left: 0; top: .55em;
  width: 4px; height: 4px; border-radius: 50%; background: var(--text-faint);
}

.bands { width: 100%; border-collapse: collapse; font-size: .78rem; margin-top: .7rem; }
.bands caption { text-align: left; color: var(--text-soft); font-size: .75rem; padding-bottom: .35rem; }
.bands th, .bands td {
  text-align: left; padding: .35rem .4rem; border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.bands th { font-size: .72rem; letter-spacing: .03em; color: var(--text-soft); font-weight: 700; }

/* ---------- 문서 페이지 (개인정보처리방침 등) ---------- */

.doc { padding: 1.4rem 1.5rem 1.6rem; }
.doc__meta {
  margin: 0 0 1rem; display: grid; gap: .3rem; font-size: .84rem; max-width: 520px;
  background: #f7f9fc; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .65rem .8rem;
}
.doc__meta div { display: flex; justify-content: space-between; gap: .5rem; }
.doc__meta dt { color: var(--text-soft); }
.doc__meta dd { margin: 0; font-weight: 600; }
.doc h2 {
  font-size: .95rem; font-weight: 700; margin: 1.5rem 0 .45rem;
  padding-top: 1.1rem; border-top: 1px solid var(--line);
}
.doc h2:first-of-type { margin-top: .5rem; padding-top: 0; border-top: 0; }
.doc p { font-size: .88rem; color: var(--text); margin-bottom: .5rem; max-width: 74ch; }
.doc ul { list-style: disc; margin: .3rem 0 .6rem 1.1rem; display: grid; gap: .35rem; }
.doc li { font-size: .88rem; max-width: 74ch; }
.doc a { color: var(--blue); }

/* ---------- footer ---------- */

.footer { border-top: 1px solid var(--line); background: #fff; }
.footer__inner { max-width: 1280px; margin: 0 auto; padding: 1.4rem 1.5rem; }
.footer__inner p { font-size: .82rem; color: var(--text-soft); }
.footer__fine { font-size: .76rem !important; color: var(--text-faint) !important; margin-top: .3rem; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    max-height: none; overflow: visible; padding-right: 0;
  }
}

@media (max-width: 900px) {
  .topbar__inner { flex-wrap: wrap; gap: .75rem 1.25rem; }
}

@media (max-width: 720px) {
  .shell { padding: 1.25rem 1rem 2.5rem; }
  .topbar__inner { padding: .6rem 1rem; }
  .topbar__menu { gap: 0; overflow-x: auto; }
  .topbar__menu a { font-size: .84rem; padding: .35rem .55rem; }
  .topbar__menu a.is-soon::after { display: none; }
  .pick-top { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
}
