/* =========================================================
   대한민국 인생 계급 측정기 — 플랫 다크 핀테크 스타일
   원칙: 그라데이션·테두리 최소화, 큰 숫자, 넉넉한 여백,
        라벨 왼쪽 / 값 오른쪽 리스트, 꽉 찬 단색 버튼
   ========================================================= */
:root {
  --bg: #0b0d12;
  --elev: #15181f;
  --elev2: #1e222b;
  --elev3: #272c37;
  --line: rgba(255, 255, 255, 0.06);
  --ink: #f2f4f6;
  --sub: #8b95a1;
  --dim: #5e6873;
  --neon: #39ff88;
  --neon-ink: #04140b;
  --up: #f04452;
  --down: #4c8dff;
  --radius: 20px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-feature-settings: "tnum";
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: var(--font); letter-spacing: -0.01em; }
button { cursor: pointer; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--sub); }
.app { max-width: 720px; margin: 0 auto; padding: 0 20px 48px; }
.muted { color: var(--sub); }
.small { font-size: 13px; line-height: 1.65; }
.caption { font-size: 13px; color: var(--sub); line-height: 1.6; }
.caption.center { text-align: center; }
.caption.foot { margin: 14px 0 0; color: var(--dim); }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; height: 60px; margin: 0 -20px; padding: 0 20px; background: rgba(11,13,18,.88); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--ink); font-weight: 700; font-size: 17px; padding: 0; }
.brand-mark { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--neon); color: var(--neon-ink); }
.sound-toggle { font-size: 13px; font-weight: 600; color: var(--sub); background: var(--elev2); border: 0; padding: 8px 12px; border-radius: 10px; }
.sound-toggle.on { color: var(--neon); }

/* ---------- buttons ---------- */
.btn-primary, .btn-secondary, .btn-ghost, .btn-kakao {
  border: 0; border-radius: 14px; padding: 15px 20px; font-weight: 700; font-size: 16px; transition: transform .1s ease, filter .15s ease, background .15s ease;
}
.btn-primary { background: var(--neon); color: var(--neon-ink); }
.btn-secondary, .btn-ghost { background: var(--elev2); color: var(--ink); }
.btn-kakao { background: #fee500; color: #191600; }
.btn-primary:hover, .btn-kakao:hover { filter: brightness(1.05); }
.btn-secondary:hover, .btn-ghost:hover { background: var(--elev3); }
.btn-primary:active, .btn-secondary:active, .btn-ghost:active, .btn-kakao:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-block { width: 100%; }
.btn-xl { padding: 18px 28px; font-size: 18px; border-radius: 16px; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }

/* ---------- home hook (번쩍이는 금수저) ---------- */
.hook { position: relative; text-align: center; padding: 48px 16px 36px; margin-top: 8px; border-radius: 28px; overflow: hidden; isolation: isolate;
  background: radial-gradient(520px 260px at 50% 55%, rgba(245,197,66,.22), transparent 70%), #17140b;
  animation: hookbg 1.6s ease-in-out infinite; }
.hook::after { content: ""; position: absolute; inset: -60%; background: conic-gradient(from 0deg, transparent, rgba(245,197,66,.14), transparent 25%, transparent 50%, rgba(255,246,207,.1), transparent 75%); animation: spin 7s linear infinite; z-index: -1; }
@keyframes hookbg { 0%,100% { box-shadow: inset 0 0 60px rgba(245,197,66,.05) } 50% { box-shadow: inset 0 0 100px rgba(245,197,66,.16) } }
.sparkles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.hook-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #f5c542; background: rgba(245,197,66,.12); padding: 7px 12px; border-radius: 99px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--neon); animation: pulse 1.6s infinite; }
.live-dot.gold { background: #f5c542; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
.hook-kicker { margin: 18px 0 0; font-size: clamp(17px, 2.6vw, 21px); font-weight: 700; color: var(--ink); }
.hook-level { margin-top: 12px; font-size: 14px; font-weight: 800; letter-spacing: .1em; color: #f5c542; }
.hook-name { font-size: clamp(76px, 18vw, 180px); line-height: 1.05; font-weight: 900; letter-spacing: -0.06em; margin-top: 4px; position: relative; z-index: 1;
  background: linear-gradient(100deg, #b8860b 0%, #f5c542 30%, #fff6cf 45%, #f5c542 60%, #b8860b 100%); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: goldsweep 1.8s linear infinite, goldflash 1.2s steps(1) infinite; filter: drop-shadow(0 0 28px rgba(245,197,66,.6)); }
@keyframes goldsweep { from { background-position: 150% 0 } to { background-position: -100% 0 } }
@keyframes goldflash { 0%, 100% { filter: drop-shadow(0 0 28px rgba(245,197,66,.6)) brightness(1) } 50% { filter: drop-shadow(0 0 70px rgba(255,230,140,.95)) drop-shadow(0 0 140px rgba(245,197,66,.5)) brightness(1.35) } }
.hook-you { margin: 4px 0 0; font-size: clamp(26px, 5vw, 38px); font-weight: 900; color: var(--neon); }
.hook-cta { position: relative; z-index: 3; margin-top: 22px; width: min(420px, 100%); padding: 20px 24px; font-size: clamp(18px, 3vw, 21px); font-weight: 800; border-radius: 16px; animation: ctapulse 1.6s ease-out infinite; }
@keyframes ctapulse { 0% { box-shadow: 0 0 0 0 rgba(57,255,136,.5) } 70% { box-shadow: 0 0 0 16px rgba(57,255,136,0) } 100% { box-shadow: 0 0 0 0 rgba(57,255,136,0) } }
.hook .hook-meta { position: relative; z-index: 3; color: #c9cfd8; font-size: 14px; font-weight: 600; margin-top: 30px; }

/* ---------- home ---------- */
.hero { padding: 44px 4px 8px; }
.hero h1 { font-size: clamp(28px, 5vw, 38px); font-weight: 800; letter-spacing: -0.04em; margin: 0 0 10px; line-height: 1.25; }
.hero-sub { color: var(--sub); font-size: 16px; margin: 0; line-height: 1.6; }
.home-note { margin-top: 24px; }

/* ---------- card / list rows ---------- */
.card { background: var(--elev); border-radius: var(--radius); padding: 24px; margin-top: 12px; }
.card h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.03em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.rows, .stats-grid { display: grid; grid-template-columns: 1fr; }
.stats-grid { grid-template-columns: 1fr 1fr; column-gap: 40px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; min-width: 0; }
.row-l { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-k { font-size: 15px; color: var(--sub); white-space: nowrap; }
.row-l { flex: none; max-width: 55%; }
.row-sub { font-size: 12px; color: var(--dim); }
.row-v { font-size: 17px; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.row.accent .row-v { color: var(--neon); }

/* ---------- form ---------- */
.form-wrap { padding: 12px 0 24px; }
.app:has(.form-wrap) { padding-bottom: 130px; }
.progress { height: 4px; background: var(--elev2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress div { height: 100%; background: var(--neon); border-radius: 4px; transition: width .35s ease; }
.step-count { margin-top: 18px; font-size: 14px; font-weight: 600; color: var(--sub); }
.form-card { padding: 0; }
.q-title { font-size: clamp(24px, 4.4vw, 30px); font-weight: 800; letter-spacing: -0.04em; margin: 10px 0 6px; line-height: 1.3; }
.q-sub { color: var(--sub); font-size: 15px; margin: 0 0 28px; }
.grid { display: grid; gap: 24px; }
.grid.two { grid-template-columns: 1fr 1fr; column-gap: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 14px; font-weight: 600; color: var(--sub); }
.field-label em { font-style: normal; font-size: 12px; color: var(--dim); margin-left: 4px; font-weight: 500; }
.money-wrap { position: relative; }
.money-wrap input { width: 100%; background: var(--elev2); border: 2px solid transparent; border-radius: 14px; color: var(--ink); font-size: 20px; font-weight: 700; padding: 16px 60px 16px 18px; transition: border-color .15s, background .15s; }
.money-wrap input::placeholder { color: #4a525e; font-weight: 600; }
.money-wrap input:focus { border-color: var(--neon); background: var(--elev); outline: none; }
.money-wrap select { width: 100%; height: 100%; min-height: 60px; background: var(--elev2); border: 2px solid transparent; border-radius: 14px; color: var(--ink); font-size: 17px; font-weight: 600; padding: 0 16px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--sub) 50%), linear-gradient(135deg, var(--sub) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.money-wrap select:focus { border-color: var(--neon); outline: none; }
.unit { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--sub); font-size: 16px; font-weight: 600; }
.field-hint { font-size: 13px; color: var(--dim); min-height: 18px; }
.has-error input { border-color: var(--up); }
.has-error .field-hint { color: var(--up); }
.birth-row { display: grid; grid-template-columns: 1fr 170px; gap: 10px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { background: var(--elev2); border: 0; color: var(--ink); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px; transition: background .15s, color .15s; }
.choice:hover { background: var(--elev3); }
.choice.on { background: var(--neon); color: var(--neon-ink); }
.form-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: 1fr 2fr; gap: 10px; max-width: 720px; margin: 0 auto;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(11,13,18,0), var(--bg) 30%); }
.form-actions button { padding: 17px; font-size: 17px; }
.note { border-radius: 14px; padding: 14px 16px; font-size: 14px; line-height: 1.65; margin-top: 12px; }
.note.info { background: var(--elev); color: var(--sub); margin: -8px 0 24px; }
.note.info b { color: var(--ink); font-weight: 700; }
.note.warn { background: rgba(245,197,66,.08); color: #f5d77a; }

/* ---------- analyzing ---------- */
.analyzing { min-height: 72vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }
.scan { position: relative; width: 140px; height: 140px; }
.scan-ring { position: absolute; inset: 0; border-radius: 50%; border: 4px solid var(--elev2); border-top-color: var(--neon); animation: spin .8s linear infinite; }
.scan-pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 32px; font-weight: 800; }
@keyframes spin { to { transform: rotate(360deg) } }
.an-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; font-size: 17px; }
.an-steps li { color: var(--dim); display: flex; gap: 10px; font-weight: 600; }
.an-steps li span { width: 18px; }
.an-steps li.cur { color: var(--ink); }
.an-steps li.cur span, .an-steps li.done span { color: var(--neon); }
.an-steps li.done { color: var(--sub); }
.bar { width: min(360px, 90%); height: 4px; background: var(--elev2); border-radius: 4px; overflow: hidden; }
.bar div { height: 100%; background: var(--neon); }

/* ---------- reveal (등급 공개) ---------- */
.result { padding: 4px 0; }
.reveal { position: relative; text-align: center; padding: 52px 12px 44px; overflow: hidden; border-radius: 28px; margin-top: 8px;
  background: radial-gradient(520px 260px at 50% 60%, color-mix(in srgb, var(--gc) 18%, transparent), transparent 70%), var(--elev); }
.reveal-label { font-size: 15px; color: var(--sub); font-weight: 600; }
.grade-level { margin-top: 14px; font-size: 14px; font-weight: 800; color: var(--gc); letter-spacing: .1em; }
.grade-emoji { font-size: 20px; vertical-align: -3px; margin-left: 4px; }
.grade-name { font-size: clamp(64px, 16vw, 168px); line-height: 1.05; font-weight: 900; margin: 8px 0 0; letter-spacing: -0.06em; color: var(--gc);
  text-shadow: 0 0 40px color-mix(in srgb, var(--gc) 45%, transparent); word-break: keep-all; position: relative; z-index: 1; }
.reveal.animate .grade-name { animation: slam .7s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes slam { 0% { transform: scale(2.6); opacity: 0; filter: blur(12px) } 60% { opacity: 1; filter: blur(0) } 100% { transform: scale(1) } }
.tier-low .grade-name { text-shadow: 0 0 30px rgba(255,31,61,.55), 0 0 80px rgba(255,31,61,.2); }
.red-flash { position: fixed; inset: 0; background: radial-gradient(circle, rgba(255,31,61,0) 30%, rgba(255,31,61,.5)); pointer-events: none; animation: flash 1.2s ease-out 2 both; z-index: 50; }
@keyframes flash { 0% { opacity: 0 } 15% { opacity: 1 } 100% { opacity: 0 } }
body.shake .app { animation: shake .8s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake { 10%,90% { transform: translate3d(-2px,0,0) } 20%,80% { transform: translate3d(5px,0,0) } 30%,50%,70% { transform: translate3d(-10px,2px,0) } 40%,60% { transform: translate3d(10px,-2px,0) } }
.tier-high .grade-name { animation: slam .7s cubic-bezier(.2,1.4,.4,1) both, goldglow 2.4s ease-in-out .7s infinite; }
.reveal:not(.animate) .grade-name { animation-name: none; }
.reveal.tier-high:not(.animate) .grade-name { animation: goldglow 2.4s ease-in-out infinite; }
@keyframes goldglow { 0%,100% { text-shadow: 0 0 30px color-mix(in srgb, var(--gc) 45%, transparent) } 50% { text-shadow: 0 0 60px rgba(245,197,66,.85), 0 0 120px rgba(245,197,66,.35) } }
.tier-high::after, .tier-top::after { content: ""; position: absolute; inset: -50%; background: conic-gradient(from 0deg, transparent, rgba(245,197,66,.1), transparent 30%); animation: spin 8s linear infinite; pointer-events: none; }
.tier-top .grade-name { background: linear-gradient(90deg, #ffe48a, var(--gc), var(--gc2), #ffe48a); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 0 24px rgba(245,197,66,.55)) drop-shadow(0 0 60px rgba(168,85,247,.35)); }
.reveal.tier-top .grade-name, .reveal.tier-top:not(.animate) .grade-name { animation: shimmer 3s linear infinite; }
.reveal.tier-top.animate .grade-name { animation: slam .7s cubic-bezier(.2,1.4,.4,1) both, shimmer 3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0 } }
.fireworks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

/* ---------- summary + share ---------- */
.summary { padding: 28px 4px 8px; }
.summary-k { font-size: 15px; color: var(--sub); font-weight: 600; }
.summary-v { font-size: clamp(32px, 6vw, 40px); font-weight: 800; letter-spacing: -0.04em; margin-top: 4px; }
.summary-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 15px; color: var(--sub); font-weight: 600; }
.summary-meta b { color: var(--neon); }
.summary-meta small { color: var(--dim); font-weight: 500; }
.share-bar { display: grid; gap: 8px; margin: 16px 0 4px; }
.share-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.share-row button { padding: 14px 8px; font-size: 15px; }

/* ---------- badges / notes ---------- */
.badge { font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 8px; white-space: nowrap; }
.badge.official { color: var(--neon); background: rgba(57,255,136,.1); }
.badge.estimate { color: #f5c542; background: rgba(245,197,66,.1); }
.badge.calc { color: var(--sub); background: var(--elev2); }
.badge.fun { color: #ff7ad9; background: rgba(255,122,217,.1); }
.leniency { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--elev2); border-radius: 14px; padding: 14px 16px; font-size: 14px; margin: 6px 0; line-height: 1.6; }
.leniency.override { background: rgba(255,0,64,.1); }

/* ---------- ruler ---------- */
.ruler { margin-top: 16px; }
.ruler-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--sub); margin-bottom: 12px; gap: 8px; }
.ruler-track { position: relative; height: 10px; border-radius: 6px; background: linear-gradient(90deg, rgba(240,68,82,.55), var(--elev3) 50%, rgba(57,255,136,.6)); }
.ruler-track i { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--elev); }
.ruler-range.wide { position: absolute; top: -5px; bottom: -5px; border: 2px dashed var(--ink); border-radius: 8px; }
.ruler-range:not(.wide) { display: none; }
.ruler-marker { position: absolute; top: -7px; width: 6px; height: 24px; border-radius: 3px; transform: translateX(-50%); box-shadow: 0 0 0 3px var(--elev); }
.ruler-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); margin-top: 8px; }

/* ---------- charts ---------- */
.chart-title { font-size: 17px; font-weight: 700; margin: 28px 0 12px; }
.chart-box { position: relative; width: 100%; margin-top: 8px; }
.chart-empty { padding: 28px; text-align: center; color: var(--dim); background: var(--elev2); border-radius: 14px; font-size: 14px; }

/* ---------- indices ---------- */
.indices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.index-card { background: var(--elev2); border-radius: 16px; padding: 18px; }
.index-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--sub); }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--sub); }
.meter-top b { font-size: 28px; color: var(--ink); font-weight: 800; }
.meter-top small { font-size: 13px; color: var(--dim); font-weight: 600; }
.meter-bar { height: 8px; background: var(--elev3); border-radius: 6px; overflow: hidden; margin: 10px 0; }
.meter-bar div { height: 100%; border-radius: 6px; transition: width 1s ease; }
.risk { display: flex; flex-direction: column; gap: 4px; }
.risk b { font-size: 28px; font-weight: 800; }
.risk span { font-size: 14px; color: var(--sub); }
.return-ctl { margin: 8px 0 4px; }
.return-ctl label { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--sub); flex-wrap: wrap; }
.return-ctl b { color: var(--ink); min-width: 48px; }
.return-ctl input[type=range] { flex: 1; min-width: 160px; accent-color: var(--neon); }

.sources ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 8px; font-size: 14px; color: var(--sub); line-height: 1.6; }
.sources b { color: var(--ink); margin-right: 6px; }

.footer { margin-top: 40px; padding-top: 24px; font-size: 13px; color: var(--dim); line-height: 1.75; }
.footer strong { color: var(--sub); margin-right: 6px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--elev3); color: var(--ink); padding: 14px 20px; border-radius: 14px; font-size: 15px; font-weight: 600; z-index: 100; box-shadow: 0 10px 40px rgba(0,0,0,.5); max-width: calc(100% - 32px); text-align: center; }
.crash { text-align: center; padding: 80px 16px; }

@media (max-width: 640px) {
  .app { padding: 0 16px 40px; }
  .topbar { margin: 0 -16px; padding: 0 16px; }
  .stats-grid, .grid.two, .indices { grid-template-columns: 1fr; }
  .card { padding: 20px; border-radius: 18px; }
  .birth-row { grid-template-columns: 1fr 120px; }
  .hook { padding: 40px 10px 30px; }
  .form-actions { padding-left: 16px; padding-right: 16px; }
  .row-v { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
