:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --navy: #0b1022;
  --navy-2: #151d38;
  --primary: #facc15;
  --r10: #ef4444;
  --r20: #f97316;
  --r30: #eab308;
  --accent: #f97316;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 12px; }
body { margin: 0; background: var(--bg); line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
img, canvas { max-width: 100%; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ───── 버튼 ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; padding: 0 22px; border-radius: 999px; border: 0;
  font-weight: 700; font-size: 16px; text-decoration: none; white-space: nowrap;
  transition: transform 0.12s ease, background-color 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn--primary { background: var(--primary); color: #111827; box-shadow: 0 6px 20px rgba(250, 204, 21, 0.3); }
.btn--primary:hover { background: #fde047; }
.btn--ghost { background: rgba(255, 255, 255, 0.08); color: #fff; border: 1px solid rgba(255, 255, 255, 0.25); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.16); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--outline { background: transparent; border: 1.5px solid var(--line); color: var(--ink-2); }
.btn--outline:hover { border-color: var(--ink-2); }
.btn--small { min-height: 42px; padding: 0 16px; font-size: 14px; }
.btn--tiny { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn--wide { width: 100%; }

/* ───── 히어로 ───── */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(120% 90% at 85% 10%, #1e2a55 0%, var(--navy) 60%);
  padding: 40px 0 44px;
}
.hero__rings { position: absolute; right: -140px; top: -120px; width: 520px; height: 520px; pointer-events: none; }
.hero__rings i {
  position: absolute; inset: 0; margin: auto; border-radius: 50%;
  border: 2px solid; animation: ring 4.5s ease-out infinite;
}
.hero__rings i:nth-child(1) { width: 34%; height: 34%; border-color: rgba(239, 68, 68, 0.6); background: rgba(239, 68, 68, 0.1); }
.hero__rings i:nth-child(2) { width: 67%; height: 67%; border-color: rgba(249, 115, 22, 0.45); background: rgba(249, 115, 22, 0.06); animation-delay: 0.3s; }
.hero__rings i:nth-child(3) { width: 100%; height: 100%; border-color: rgba(234, 179, 8, 0.35); background: rgba(234, 179, 8, 0.04); animation-delay: 0.6s; }
@keyframes ring { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hero__rings i { animation: none; } }

.hero__inner { position: relative; }
.eyebrow { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--primary); letter-spacing: 0.02em; }
.hero h1 { margin: 0; font-size: clamp(30px, 8vw, 46px); line-height: 1.22; font-weight: 900; letter-spacing: -0.02em; }
.lead { margin: 14px 0 24px; color: #cbd5e1; font-size: 16px; }
.lead b { color: #fff; }
.br-wide { display: none; }
@media (min-width: 560px) { .br-wide { display: inline; } }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero__actions .btn { flex: 1 1 220px; }
.privacy { margin: 14px 0 0; font-size: 12.5px; color: #94a3b8; }

/* 친구 결과 배너 */
.friend {
  margin: 0 0 28px; padding: 16px 18px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 5px solid var(--accent);
}
.friend p { margin: 0; }
.friend__kicker { font-size: 12px; font-weight: 700; color: #94a3b8; }
.friend__type { font-size: 20px; font-weight: 900; margin-top: 2px !important; }
.friend__km { color: #cbd5e1; font-size: 14px; }
.friend__cta { margin-top: 8px !important; font-weight: 700; color: var(--primary); font-size: 14px; }
.friend__actions { display: flex; gap: 8px; margin-top: 10px; }

/* ───── 카드 공통 ───── */
.main { padding-top: 20px; padding-bottom: 40px; }
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
}
.card__title { margin: 0 0 12px; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.card__sub { margin: 18px 0 8px; font-size: 15px; font-weight: 800; color: var(--ink-2); }
.fine { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }

/* ───── 지도 ───── */
.map-card { padding: 14px; }
.search-box { position: relative; }
.search { display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0; height: 46px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: #f8fafc; outline: none;
}
.search input:focus { border-color: var(--ink-2); background: #fff; }
.search input:disabled { opacity: 0.6; }
.search-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: 52px; margin: 0; padding: 6px;
  list-style: none; background: #fff; border-radius: 16px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}
.search-results button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 10px;
}
.search-results button:hover { background: #f1f5f9; }
.search-results b { display: block; font-size: 15px; }
.search-results small { color: var(--muted); }
.search-empty { padding: 12px; color: var(--muted); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px;
  border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-size: 14px; font-weight: 700; color: var(--ink-2);
}
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip__km { font-weight: 600; color: var(--muted); }
.chip.is-active .chip__km { color: var(--primary); }
.chip__badge { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #fee2e2; color: #b91c1c; }

.map-wrap { position: relative; border-radius: 16px; overflow: hidden; background: #e5e7eb; }
.map { width: 100%; height: min(62vh, 520px); min-height: 360px; }
.map-notice {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 24px; text-align: center; background: repeating-linear-gradient(45deg, #f1f5f9 0 14px, #e2e8f0 14px 28px); color: var(--ink-2);
}
.map-notice strong { font-size: 17px; }
.map-notice p { margin: 0 auto; max-width: 420px; font-size: 14px; }
.map-warn {
  position: absolute; z-index: 10; left: 10px; right: 56px; top: 10px;
  padding: 9px 12px; border-radius: 12px; background: #fffbeb; border: 1px solid #fcd34d; color: #78350f;
  font-size: 13px; line-height: 1.45; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.map-warn b { color: #b45309; }
.map-status {
  position: absolute; z-index: 10; left: 10px; right: 10px; bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 10px 10px 16px; border-radius: 14px; background: rgba(11, 16, 34, 0.9); color: #fff; font-size: 14px;
  backdrop-filter: blur(6px); pointer-events: none;
}
.map-status > * { pointer-events: auto; }
.map-status b { color: var(--primary); font-size: 16px; }
.map-status__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-status__btn { flex: none; border: 0; border-radius: 999px; padding: 8px 14px; background: var(--primary); color: #111827; font-weight: 800; font-size: 13px; }
.map-status.is-pulse { animation: pulse 0.9s ease 2; }
@keyframes pulse { 50% { transform: scale(1.03); background: rgba(250, 204, 21, 0.95); color: #111827; } }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 12px 4px 2px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend__dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid; }
.legend__dot--10 { border-color: var(--r10); background: rgba(239, 68, 68, 0.2); }
.legend__dot--20 { border-color: var(--r20); background: rgba(249, 115, 22, 0.15); }
.legend__dot--30 { border-color: var(--r30); background: rgba(234, 179, 8, 0.12); }
.legend__line { width: 18px; border-top: 2.5px dashed #1e293b; }
.legend__toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-2); cursor: pointer; }

/* 지도 위 오버레이 (카카오 CustomOverlay) */
.plant-pin {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 3px; border-radius: 999px;
  border: 2px solid #111827; background: #fff; font-size: 12px; font-weight: 800; color: #111827;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); white-space: nowrap; transform: translateY(-2px);
}
.plant-pin__icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); font-size: 14px; }
.plant-pin.is-active { background: #111827; color: #fff; transform: translateY(-2px) scale(1.12); }
.ring-label {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.ring-label--10 { background: var(--r10); }
.ring-label--20 { background: var(--r20); }
.ring-label--30 { background: #ca8a04; }
.line-label {
  display: inline-block; padding: 4px 10px; border-radius: 999px; background: #111827; color: var(--primary);
  font-size: 14px; font-weight: 900; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ───── 결과 ───── */
.result { scroll-margin-top: 12px; }
.type-card {
  position: relative; overflow: hidden; text-align: center; color: #fff; border-radius: 24px; margin-bottom: 16px;
  padding: 30px 20px 24px;
  background:
    radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--accent) 45%, transparent) 0%, transparent 70%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  box-shadow: 0 14px 40px rgba(11, 16, 34, 0.25);
}
.type-card p { margin: 0; }
.type-card__kicker {
  display: inline-block; padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 800;
  background: color-mix(in srgb, var(--accent) 22%, transparent); color: color-mix(in srgb, var(--accent) 45%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
}
.type-card__emoji { font-size: 72px; line-height: 1.1; margin-top: 14px; animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }
.type-card__code {
  font-size: clamp(48px, 15vw, 68px); font-weight: 900; letter-spacing: 0.12em; line-height: 1.1; margin-top: 4px !important;
  color: color-mix(in srgb, var(--accent) 70%, #fff);
}
.type-card__name { margin: 6px 0 0; font-size: clamp(24px, 6.5vw, 30px); font-weight: 900; }
.type-card__tagline { color: #cbd5e1; margin-top: 4px !important; }
.type-card__distance {
  margin: 20px auto 0; max-width: 420px; padding: 16px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1);
}
.type-card__distance p:first-child { font-size: 14px; color: #cbd5e1; }
.type-card__distance b { color: #fff; }
.type-card__km strong { font-size: 56px; font-weight: 900; line-height: 1.1; color: color-mix(in srgb, var(--accent) 70%, #fff); }
.type-card__km span { font-size: 22px; font-weight: 800; margin-left: 4px; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; list-style: none; padding: 0; margin: 16px 0 0; }
.badge { font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px; }
.badge--hot { background: rgba(239, 68, 68, 0.2); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.45); }
.badge--warm { background: rgba(234, 179, 8, 0.16); color: #fde68a; border: 1px solid rgba(234, 179, 8, 0.4); }
.badge--cool { background: rgba(148, 163, 184, 0.16); color: #e2e8f0; border: 1px solid rgba(148, 163, 184, 0.35); }

.desc { margin: 0; color: var(--ink-2); }
.traits { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.traits li {
  padding: 11px 14px 11px 40px; border-radius: 14px; background: #f8fafc; position: relative; color: var(--ink-2); font-weight: 600; font-size: 15px;
}
.traits li::before { content: "✔"; position: absolute; left: 15px; color: var(--accent); font-weight: 900; }
.match { margin: 16px 0 0; padding: 14px; border-radius: 14px; border: 1.5px dashed var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.match__label { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #fdf2f8; color: #be185d; }
.match__type { font-weight: 800; color: var(--c); }
.match__why { color: var(--muted); font-size: 14px; flex-basis: 100%; }

/* 거리 눈금 */
.ruler { padding-top: 44px; }
.ruler__track { position: relative; }
.ruler__bar { display: flex; height: 56px; border-radius: 14px; overflow: hidden; }
.ruler__seg {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: color-mix(in srgb, var(--c) 16%, #fff); border-right: 1px solid #fff; opacity: 0.75;
}
.ruler__seg:last-child { border-right: 0; }
.ruler__seg.is-active { background: var(--c); opacity: 1; }
.ruler__seg.is-active .ruler__code { color: #fff; }
.ruler__emoji { font-size: 17px; line-height: 1; }
.ruler__code { font-size: 10px; font-weight: 900; letter-spacing: 0.04em; color: color-mix(in srgb, var(--c) 80%, #000); }
.ruler__pin { position: absolute; bottom: 100%; transform: translateX(-50%); margin-bottom: 6px; z-index: 2; }
.ruler__pin span {
  display: block; white-space: nowrap; font-size: 12px; font-weight: 800; color: #fff; background: var(--ink);
  padding: 3px 9px; border-radius: 999px; position: relative;
}
.ruler__pin span::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--ink);
}
.ruler__labels { position: relative; height: 20px; margin-top: 4px; font-size: 11px; color: var(--muted); }
.ruler__labels span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ruler__labels span:first-child { transform: none; }
.ruler__labels span:last-child { transform: translateX(-100%); }
.type-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.type-list li { display: grid; padding: 8px 10px; border-radius: 12px; background: #f8fafc; border: 1.5px solid transparent; font-size: 13px; }
.type-list li b { font-size: 13px; color: color-mix(in srgb, var(--c) 85%, #000); }
.type-list li span { font-weight: 700; color: var(--ink-2); }
.type-list li small { color: var(--muted); }
.type-list li.is-active { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); }
@media (min-width: 640px) { .type-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* 후쿠시마 비교 */
.compare__place { margin: 0; font-size: 24px; font-weight: 900; }
.compare__place small { font-size: 14px; font-weight: 600; color: var(--muted); }
.compare__note { margin: 6px 0 0; color: var(--ink-2); }

/* 원전별 거리 */
.counts { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.counts b { color: var(--ink); }
.plant-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.plant-row {
  width: 100%; display: grid; grid-template-columns: 7.5em 1fr auto; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; text-align: left;
}
.plant-row:hover { border-color: var(--ink-2); }
.plant-row.is-nearest { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, #fff); }
.plant-row__name { font-weight: 800; font-size: 15px; display: grid; line-height: 1.3; }
.plant-row__name small { font-weight: 500; color: var(--muted); font-size: 12px; }
.plant-row__bar { height: 8px; border-radius: 99px; background: #f1f5f9; overflow: hidden; }
.plant-row__bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--r10), var(--r30)); }
.plant-row__km { font-weight: 800; font-variant-numeric: tabular-nums; }

/* 공유 */
.share__opts { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.seg { display: inline-flex; padding: 4px; background: #f1f5f9; border-radius: 999px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.share__preview { display: grid; place-items: center; background: #0b1022; border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.share__preview canvas { display: block; width: auto; max-width: 100%; max-height: 520px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.sns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.sns__btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 4px 10px;
  border-radius: 14px; border: 1.5px solid var(--line); background: #fff; font-size: 12.5px; font-weight: 700; color: var(--ink-2);
}
.sns__btn:hover { border-color: var(--ink-2); }
.sns__btn svg { width: 26px; height: 26px; padding: 7px; box-sizing: content-box; border-radius: 12px; background: #f1f5f9; color: var(--ink); }
.sns__btn--ig svg { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); color: #fff; }
.sns__btn--fb svg { background: #1877f2; color: #fff; }
.sns__btn--th svg { background: #000; color: #fff; }
.sns__btn--kakao svg { background: #fee500; color: #191919; }
.sns__btn--x svg { background: #000; color: #fff; }
.caption { margin-top: 16px; }
.caption__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 14px; font-weight: 800; color: var(--ink-2); }
.caption textarea {
  width: 100%; resize: vertical; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: #f8fafc; font-size: 14px; line-height: 1.55; color: var(--ink-2);
}

/* 운영 계정 */
.accounts__lead { margin: -4px 0 12px; color: var(--muted); font-size: 14px; }
.accounts__links, .footer__accounts { display: flex; flex-wrap: wrap; gap: 8px; }
.account {
  display: inline-flex; flex-direction: column; padding: 10px 16px; border-radius: 14px; text-decoration: none; color: #fff; min-width: 130px;
}
.account b { font-size: 14px; }
.account span { font-size: 13px; opacity: 0.85; }
.account--ig { background: linear-gradient(45deg, #f09433, #dc2743 50%, #bc1888); }
.account--th { background: #000; }
.account--fb { background: #1877f2; }

.again { text-align: center; margin: 24px 0 8px; }

.footer { padding: 28px 0 48px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }
.footer p { margin: 8px 0 0; }
.footer__accounts:not(:empty) { margin-bottom: 14px; }

/* 다이얼로그 · 토스트 */
.dialog { border: 0; border-radius: 22px; padding: 24px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); }
.dialog::backdrop { background: rgba(11, 16, 34, 0.55); }
.dialog h3 { margin: 0 0 8px; font-size: 19px; }
.dialog p { margin: 0 0 10px; color: var(--ink-2); font-size: 14.5px; }
.dialog ol { margin: 0 0 10px; padding-left: 20px; font-size: 14.5px; display: grid; gap: 4px; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px; background: rgba(15, 23, 42, 0.94); color: #fff;
  font-size: 14px; font-weight: 600; text-align: center; transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 420px) {
  .card { padding: 16px; }
  .sns { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .sns__btn { font-size: 11.5px; }
  .plant-row { grid-template-columns: 6.5em 1fr auto; gap: 8px; }
}
