:root {
  --navy-900: #0e2a4a;
  --navy-800: #143a63;
  --navy-700: #1b4c80;
  --navy-600: #23609e;
  --blue-500: #2e7cc4;
  --blue-100: #e3eefa;
  --blue-50: #f2f7fc;
  --ink: #1c2733;
  --ink-sub: #5a6b7d;
  --line: #d8e2ec;
  --bg: #f6f8fb;
  --white: #ffffff;
  --warn-bg: #fdf3e7;
  --warn-border: #e8b167;
  --warn-ink: #8a5a12;
  --danger: #c0392b;
  --radius: 14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── 상단바 ─────────────────────────── */
.topbar {
  background: var(--navy-900);
  color: #fff;
  padding: 14px 20px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: baseline; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 2px; }
.brand-mark {
  background: #fff; color: var(--navy-900);
  font-weight: 800; font-size: 18px;
  width: 26px; height: 26px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 700; font-size: 19px; margin-left: 4px; }
.brand-sub { font-size: 12px; color: #a8c2dd; }

.container { max-width: 640px; margin: 0 auto; padding: 24px 20px 60px; }

/* ── 홈 ─────────────────────────────── */
.hero { text-align: center; padding: 18px 0 26px; }
.hero h1 { font-size: 24px; font-weight: 800; color: var(--navy-900); line-height: 1.4; }
.hero-sub { margin-top: 10px; color: var(--ink-sub); font-size: 14.5px; }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(14, 42, 74, 0.05);
}
.card-title { font-size: 16.5px; font-weight: 700; color: var(--navy-900); margin-bottom: 12px; }

.photo-tips { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.photo-tips span {
  background: var(--blue-50); color: var(--navy-700);
  font-size: 12.5px; padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--blue-100);
}

.upload-slots { display: flex; gap: 12px; margin-bottom: 14px; }
.upload-slot {
  flex: 1; aspect-ratio: 4/3;
  border: 2px dashed var(--line); border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer; color: var(--ink-sub);
  background-size: cover; background-position: center;
  transition: border-color .15s;
}
.upload-slot:hover { border-color: var(--blue-500); }
.upload-slot.filled { border-style: solid; border-color: var(--blue-500); color: transparent; }
.slot-icon { font-size: 26px; color: var(--blue-500); }
.upload-slot.filled .slot-icon { display: none; }
.slot-label { font-size: 13px; }

.btn-primary, .btn-secondary {
  width: 100%; padding: 14px; border-radius: 12px;
  font-size: 16px; font-weight: 700; cursor: pointer; border: none;
}
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:disabled { background: #b8c5d3; cursor: not-allowed; }
.btn-primary:not(:disabled):hover { background: var(--navy-700); }
.btn-secondary { background: var(--blue-100); color: var(--navy-800); }
.btn-secondary:hover { background: #d3e4f5; }

.notice {
  margin-top: 10px; font-size: 13px; color: var(--warn-ink);
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  border-radius: 8px; padding: 8px 12px;
}
.notice a { color: var(--navy-700); font-weight: 600; }
.model-note { margin-top: 8px; font-size: 12.5px; color: var(--ink-sub); text-align: center; }

.key-row { display: flex; gap: 8px; margin-top: 10px; }
.key-row input {
  flex: 1; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px;
}
.btn-key-save { width: auto; padding: 11px 20px; font-size: 14.5px; }
.key-error { margin-top: 8px; font-size: 13px; color: var(--danger); }
.key-ok { margin-top: 10px; font-size: 13.5px; color: #19703a; font-weight: 600; }
.link-btn {
  background: none; border: none; color: var(--navy-700);
  font-size: 12.5px; cursor: pointer; text-decoration: underline; padding: 0; margin-left: 6px;
}

.feature-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-sub); }
.field select, .field input, .search-input {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; background: #fff; color: var(--ink); width: 100%;
}
.imprint-row { display: flex; gap: 8px; }

.search-input { margin-bottom: 4px; }
.search-results { list-style: none; }
.search-results li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid var(--blue-50); cursor: pointer;
}
.search-results li:hover { background: var(--blue-50); }
.search-results img { width: 52px; height: 29px; object-fit: cover; border-radius: 6px; background: var(--blue-50); }
.search-results .sr-name { font-size: 14.5px; font-weight: 600; }
.search-results .sr-entp { font-size: 12.5px; color: var(--ink-sub); }

/* ── 결과 ────────────────────────────── */
.btn-back {
  background: none; border: none; color: var(--navy-700);
  font-size: 15px; font-weight: 600; cursor: pointer; padding: 4px 0; margin-bottom: 12px;
}
.results-title { font-size: 21px; font-weight: 800; color: var(--navy-900); }
.results-caption { color: var(--ink-sub); font-size: 14px; margin: 6px 0 14px; }

.banner {
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px;
  margin-bottom: 14px; background: var(--warn-bg);
  border: 1px solid var(--warn-border); color: var(--warn-ink);
}

.candidate {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; cursor: pointer;
  display: flex; gap: 14px; align-items: center;
  transition: border-color .15s, box-shadow .15s;
}
.candidate:hover { border-color: var(--blue-500); box-shadow: 0 2px 8px rgba(14,42,74,.08); }
.candidate img {
  width: 96px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--blue-50);
  flex-shrink: 0;
}
.cand-body { flex: 1; min-width: 0; }
.cand-name { font-weight: 700; font-size: 15.5px; line-height: 1.35; }
.cand-entp { font-size: 13px; color: var(--ink-sub); margin-top: 2px; }
.cand-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.cand-tags span {
  font-size: 11.5px; background: var(--blue-50); color: var(--navy-700);
  padding: 2px 8px; border-radius: 99px; border: 1px solid var(--blue-100);
}
.cand-score { text-align: center; flex-shrink: 0; width: 74px; }
.score-num { font-size: 22px; font-weight: 800; color: var(--navy-800); }
.score-num small { font-size: 13px; }
.score-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 99px; margin-top: 3px;
}
.score-badge.high { background: #e5f4ea; color: #19703a; }
.score-badge.mid { background: var(--blue-100); color: var(--navy-700); }

.disclaimer {
  font-size: 13px; color: var(--warn-ink); background: var(--warn-bg);
  border: 1px solid var(--warn-border); border-radius: 10px;
  padding: 10px 14px; margin-top: 18px;
}

.empty-state { text-align: center; padding: 40px 0; color: var(--ink-sub); }

/* ── 상세 ────────────────────────────── */
.detail-header {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 14px;
}
.detail-header img { width: 100%; max-width: 300px; border-radius: 10px; display: block; margin: 0 auto 14px; }
.detail-name { font-size: 19px; font-weight: 800; color: var(--navy-900); }
.detail-entp { font-size: 14px; color: var(--ink-sub); margin-top: 2px; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px;
  background: var(--blue-50); color: var(--navy-700); border: 1px solid var(--blue-100);
}
.badge.source { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }

.warn-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px;
}
.warn-chip {
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-ink);
  font-size: 13.5px; font-weight: 700; padding: 8px 14px; border-radius: 10px;
}

.detail-section {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 12px;
}
.detail-section h3 { font-size: 15.5px; color: var(--navy-900); margin-bottom: 8px; }
.detail-section p { font-size: 14.5px; color: var(--ink); white-space: pre-line; }
.official-link {
  display: inline-block; margin-top: 14px; padding: 11px 16px;
  background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: 10px;
  color: var(--navy-700); font-size: 14px; font-weight: 700; text-decoration: none;
}
.official-link:hover { background: #d3e4f5; }
.cand-tags .tag-detail {
  background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink);
}
.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-table td { padding: 6px 0; border-bottom: 1px solid var(--blue-50); }
.spec-table td:first-child { color: var(--ink-sub); width: 90px; }

/* ── 로딩/푸터 ───────────────────────── */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(14,42,74,.55);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; z-index: 50; color: #fff; font-weight: 600;
}
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.3); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer {
  background: var(--navy-900); color: #cfdded;
  padding: 24px 20px 32px; text-align: center;
}
.emergency {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 14px; font-size: 14px; color: #fff;
}
.btn-emergency {
  background: var(--danger); color: #fff; text-decoration: none;
  font-weight: 800; padding: 8px 18px; border-radius: 10px; font-size: 15px;
}
.footer-legal { font-size: 12px; line-height: 1.7; color: #a8c2dd; }
