/* =================================================================
   내 자산 라인업 진단 (v2: 리스크 포트폴리오) — 공용 스타일 (mobile-first)
   --brand = GA 브랜드색(JS 주입). 포지션색은 리스크 의미색(인라인).
   ================================================================= */
:root {
  --brand: #03264f;
  --ink: #1a2230;
  --ink-soft: #5b667a;
  --line: #e6e9f0;
  --bg: #f4f6fb;
  --card: #fff;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(18, 28, 51, 0.08);
  --maxw: 520px;
  --tap: 48px;
}
* { box-sizing: border-box; }
/* hidden 속성이 .loading{display:flex} 등 클래스 규칙에 묻히지 않도록 강제 */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 20px 18px 40px; min-height: 100vh; display: flex; flex-direction: column; }

h1, h2, h3 { margin: 0; line-height: 1.3; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: var(--tap);
  padding: 14px 18px; border: 2px solid transparent; border-radius: 999px; font-size: 16px; font-weight: 700;
  cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .12s, background .12s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(3, 38, 79, .22); }
.btn-outline { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn[disabled] { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, #fff); outline-offset: 2px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-title { font-size: 15px; font-weight: 800; }
.card-sub { font-size: 12.5px; color: var(--ink-soft); margin: 3px 0 10px; }

/* ================= 인트로 ================= */
.intro { text-align: center; flex: 1; }
.intro-hero { padding: 18px 0 6px; }
.intro-kicker { display: inline-block; font-size: 12px; font-weight: 700; color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, #fff); border-radius: 999px; padding: 6px 12px; margin-bottom: 14px; }
.intro h1 { font-size: 26px; letter-spacing: -.01em; }
.intro h1 .accent { color: var(--brand); }
.intro-sub { margin: 12px 4px 0; font-size: 15px; color: var(--ink-soft); }
.pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0; text-align: left; }
.pos-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; border-top: 3px solid var(--pc); }
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pc-code { font-size: 11px; font-weight: 800; color: #fff; background: var(--pc); border-radius: 6px; padding: 2px 7px; }
.pc-risk { font-size: 10.5px; font-weight: 700; color: var(--pc); }
.pc-name { font-weight: 800; margin-top: 8px; font-size: 15px; }
.pc-desc { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.intro-meta { display: flex; justify-content: center; gap: 16px; margin: 6px 0 18px; font-size: 13px; color: var(--ink-soft); }
.intro-meta span { display: inline-flex; align-items: center; gap: 5px; }
.intro-cta { position: sticky; bottom: 0; padding-top: 8px; }
.foot { margin-top: 18px; font-size: 11.5px; color: #9aa3b2; }
.foot .ga-name { color: var(--ink-soft); font-weight: 600; }

/* 연령대 선택 */
.age-select { margin: 4px 0 14px; text-align: center; border-radius: 12px; }
.age-label { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.age-label small { font-weight: 500; color: var(--ink-soft); font-size: 11.5px; }
.age-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.age-chip { border: 1.5px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; font-weight: 700; cursor: pointer; min-height: 40px; -webkit-tap-highlight-color: transparent; }
.age-chip[aria-checked="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, #fff); color: var(--brand); }
.btn.is-disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
@keyframes flashpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(226, 56, 47, 0); } 50% { box-shadow: 0 0 0 4px rgba(226, 56, 47, .35); } }
.age-select.flash { animation: flashpulse .7s ease; }

/* 퀴즈 안내 문구 */
.q-guide { text-align: center; font-size: 12.5px; color: var(--ink-soft); margin: 8px 0 0; }
.q-guide b { color: var(--brand); }

/* ================= 퀴즈 ================= */
.quiz { flex: 1; display: flex; flex-direction: column; }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.progress-head .step-count { font-weight: 800; color: var(--brand); font-size: 15px; }
.progress-head .step-count b { font-size: 20px; }
.progress-head .pos-tag { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.progress-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-bar > i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 999px; transition: width .3s; }
.q-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 18px 0; }
.q-pos { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-size: 13px; font-weight: 700;
  color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; margin-bottom: 14px; }
.q-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.q-text { font-size: 21px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 22px; min-height: 2.6em; }
.scale { display: flex; flex-direction: column; gap: 9px; }
.scale .opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap); padding: 12px 14px;
  background: var(--card); border: 2px solid var(--line); border-radius: 12px; font-size: 15.5px; font-weight: 600;
  color: var(--ink); cursor: pointer; text-align: left; transition: border-color .12s, background .12s; }
.scale .opt .dot { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); }
.scale .opt .num { margin-left: auto; font-size: 12px; color: #aab2c0; font-weight: 700; }
.scale .opt:hover { border-color: color-mix(in srgb, var(--brand) 40%, #fff); }
.scale .opt[aria-checked="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, #fff); }
.scale .opt[aria-checked="true"] .dot { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px #fff; }
.scale .opt[aria-checked="true"] .num { color: var(--brand); }
.q-nav { display: flex; gap: 10px; margin-top: 18px; }
.q-nav .btn { width: auto; flex: 1; }
.q-nav .btn-back { flex: 0 0 auto; width: 56px; padding: 0; }

/* ================= 결과 ================= */
.result { flex: 1; }
.result-head { text-align: center; margin-bottom: 6px; }
.type-badge { display: inline-flex; background: var(--brand); color: #fff; font-weight: 800; font-size: 14px; border-radius: 999px; padding: 7px 16px; }
.result-head h1 { font-size: 21px; margin: 12px 0 6px; letter-spacing: -.01em; }
.type-summary { font-size: 14px; color: var(--ink-soft); margin: 0 4px; }
.viz-card { margin: 16px 0; }

/* 도넛 */
.donut-wrap { max-width: 230px; margin: 2px auto 0; }
.donut-wrap svg { width: 100%; height: auto; display: block; }
.donut-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: 14px; }
.leg-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.leg-dot { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.leg-name { font-weight: 700; line-height: 1.2; }
.leg-name small { display: block; font-weight: 500; color: var(--ink-soft); font-size: 10.5px; }
.leg-pct { margin-left: auto; font-weight: 800; }

/* 스쿼드 / 피치 */
.formation-tag { font-size: 12px; font-weight: 800; color: var(--brand); margin-left: 6px; }
.squad-wrap { margin-top: 4px; }
.pitch { position: relative; background: #1f8a4c;
  background-image: repeating-linear-gradient(0deg, #1f8a4c 0 14.28%, #1c8044 14.28% 28.57%);
  border-radius: 14px; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.pitch::before { content: ""; position: absolute; left: 10px; right: 10px; top: 50%; height: 2px; background: rgba(255,255,255,.30); }
.pitch::after { content: ""; position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; transform: translate(-50%,-50%);
  border: 2px solid rgba(255,255,255,.30); border-radius: 50%; }
.squad-line { position: relative; z-index: 1; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 4px 0; }
.line-tag { font-size: 11px; font-weight: 800; color: #fff; background: rgba(0,0,0,.26); border-left: 3px solid var(--rc);
  border-radius: 6px; padding: 2px 8px; align-self: flex-start; }
.players { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.player { position: relative; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: var(--ring);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ring); }
.player .ph { position: absolute; inset: 0; }
.player .ph svg { width: 100%; height: 100%; display: block; }
.player .avatar { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player .avatar.hide { display: none; }
.empty-line { font-size: 12px; font-weight: 700; color: #fff; background: rgba(226,56,47,.9); border: 1px dashed #fff; border-radius: 8px; padding: 6px 12px; }
.line-gk::before { content: ""; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); width: 130px; height: 34px;
  border: 2px solid rgba(255,255,255,.35); border-bottom: none; border-radius: 4px 4px 0 0; z-index: 0; }

/* 진단 박스 */
.diag-box { border-radius: 12px; padding: 14px 16px; margin: 12px 0; }
.diag-box.top { background: #f3f6fc; border: 1px solid #e1e8f5; }
.diag-box.gap { background: #fff4f4; border: 1px solid #f7d2d2; }
.diag-head { display: flex; align-items: center; gap: 8px; font-size: 14.5px; margin-bottom: 5px; }
.diag-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.diag-comment { font-size: 14px; color: #444f60; margin: 0; }
.diag-box.gap .diag-comment { color: #6a3b3b; }

/* 벤치마크 */
.bench-card { margin: 16px 0; }
.bench-row { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; column-gap: 10px; margin: 10px 0; }
.bench-name { grid-row: 1 / 3; align-self: center; font-size: 12.5px; font-weight: 700; }
.bench-bars { grid-column: 2; display: flex; flex-direction: column; gap: 3px; align-self: center; }
.bar { height: 7px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; }
.bar.bench i { background: #aeb6c4; }
.bench-vals { grid-column: 2; font-size: 11px; color: var(--ink-soft); margin-top: 3px; }
.bench-vals b { color: var(--ink); }
.disclaimer { font-size: 11px; color: #9aa3b2; margin-top: 10px; }

/* 상품군 */
.cat-card { margin: 16px 0; }
.cat-list { margin-top: 4px; }
.cat-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); position: relative; }
.cat-item:first-child { border-top: none; }
.cat-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; flex: 0 0 auto; }
.cat-body b { font-size: 13.5px; }
.cat-body b small { font-weight: 500; color: var(--ink-soft); font-size: 11px; }
.cat-body p { font-size: 12.5px; color: var(--ink-soft); margin: 2px 0 0; }
.cat-item.boost { background: #fff8f0; border-radius: 10px; border-top: none; padding: 10px; margin: 4px 0; }
.cat-flag { position: absolute; right: 8px; top: 10px; font-size: 10px; font-weight: 800; color: #fff; background: var(--brand); border-radius: 5px; padding: 2px 6px; }

/* CTA / 공통 */
.cta-block { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.cta-block .cta-help { text-align: center; font-size: 12.5px; color: var(--ink-soft); margin: 2px 0 4px; }
.share-row { display: flex; gap: 10px; }
.share-row .btn { flex: 1; }
.restart { margin-top: 14px; text-align: center; }
.restart button { background: none; border: none; color: var(--ink-soft); font-size: 13px; text-decoration: underline; cursor: pointer; }
.compliance { list-style: none; padding: 0; margin: 18px 0 0; }
.compliance li { font-size: 11px; color: #9aa3b2; line-height: 1.5; padding-left: 12px; position: relative; }
.compliance li::before { content: "·"; position: absolute; left: 3px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #1a2230; color: #fff;
  font-size: 13.5px; font-weight: 600; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--ink-soft); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fade .3s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (min-width: 600px) { .intro h1 { font-size: 30px; } .q-text { font-size: 23px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
