/* 스텔스 인베스팅 데이 — 화이트 테마, 모바일 앱형 */
:root {
  --ink: #050810;          /* Stage Black */
  --indigo: #1E1B4B;       /* Deep Indigo */
  --purple: #7C3AED;       /* Stage Purple — 파운더, 투자 */
  --magenta: #C026D3;      /* Cloud Magenta */
  --cyan: #0891B2;         /* Beam Cyan 의 텍스트용 짙은 톤 — 구매 */
  --cyan-bright: #22D3EE;
  --bg: #F6F5FB;
  --surface: #FFFFFF;
  --line: #E7E5F0;
  --muted: #5B5872;
  --faint: #8C89A3;
  --danger: #DC2626;
  --ok: #059669;
  --purple-soft: #F1EAFE;
  --cyan-soft: #E3F7FB;

  --r-sm: 12px; --r-md: 18px; --r-lg: 26px;
  --shadow-1: 0 1px 2px rgba(30, 27, 75, .06), 0 2px 8px rgba(30, 27, 75, .05);
  --shadow-2: 0 8px 28px rgba(30, 27, 75, .12);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --t-fast: 160ms; --t: 260ms;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 16px; line-height: 1.5; word-break: keep-all;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
img { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- 상단 바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-t) + 10px) 20px 10px;
  display: flex; align-items: center; gap: 10px; min-height: 56px;
  background: rgba(246, 245, 251, .86);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.topbar img { width: 32px; height: 32px; border-radius: 50%; }
.topbar .t { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.topbar .back { width: 44px; height: 44px; margin-left: -12px; display: grid; place-items: center; border-radius: 50%; }
.topbar .back:active { background: var(--line); }
.topbar .spacer { flex: 1; }
.chip { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--purple-soft); color: var(--purple); }
.chip.closed { background: #FEE2E2; color: var(--danger); }
.chip.cyan { background: var(--cyan-soft); color: var(--cyan); }

/* ---------- 화면 ---------- */
main { padding: 4px 20px calc(var(--tab-h) + var(--safe-b) + 28px); max-width: 560px; margin: 0 auto; outline: none; }
.view-enter { animation: enter var(--t) var(--ease) both; }
.view-back { animation: enterBack var(--t) var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateX(18px); } }
@keyframes enterBack { from { opacity: 0; transform: translateX(-18px); } }
h1 { font-size: 28px; line-height: 1.25; font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin: 28px 0 12px; }
.lead { color: var(--muted); margin-top: 8px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 14px; }

/* ---------- 지갑 카드 ---------- */
.wallet {
  position: relative; overflow: hidden; margin-top: 8px;
  border-radius: var(--r-lg); padding: 22px 22px 18px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #3B2A8C 0%, var(--indigo) 46%, var(--ink) 100%);
  box-shadow: var(--shadow-2);
}
.wallet::after {
  content: ''; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, .45), transparent 65%);
  pointer-events: none;
}
.wallet .label { font-size: 13px; opacity: .72; }
.wallet .total { font-size: 36px; font-weight: 800; letter-spacing: -.03em; margin: 2px 0 16px; }
.wallet .total small { font-size: 16px; font-weight: 600; opacity: .8; margin-left: 4px; }
.pockets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; z-index: 1; }
.pocket { background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; padding: 10px; }
.pocket b { display: block; font-size: 15px; }
.pocket span { font-size: 12px; opacity: .75; }
.bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .15); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--cyan-bright); transform-origin: left; transition: transform var(--t) var(--ease); }
.pocket.inv .bar i { background: #A78BFA; }
.pocket.free .bar i { background: #F0ABFC; }

/* ---------- 카드 · 리스트 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.pressable { transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.pressable:active { transform: scale(.975); box-shadow: none; }
.products { display: grid; gap: 12px; }
.product { display: grid; grid-template-columns: 76px 1fr; gap: 14px; padding: 12px; text-decoration: none; align-items: center; }
.product .thumb { width: 76px; height: 76px; border-radius: 14px; object-fit: cover; background: var(--purple-soft); }
.thumb.ph { display: grid; place-items: center; font-weight: 800; font-size: 26px; color: var(--purple); background: linear-gradient(135deg, var(--purple-soft), var(--cyan-soft)); }
.product .title { font-weight: 700; font-size: 16px; line-height: 1.35; }
.product .tag { font-size: 14px; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product .meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 13px; color: var(--faint); }
.product .meta .done { color: var(--ok); font-weight: 700; }
.stagger > * { animation: rise var(--t) var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: 40ms; } .stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; } .stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(n+6) { animation-delay: 200ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg { margin: 0 auto 12px; color: var(--faint); }

/* ---------- 제품 상세 ---------- */
.hero-img { width: calc(100% + 40px); margin: 0 -20px; aspect-ratio: 16 / 10; object-fit: cover; background: var(--purple-soft); }
.hero-img.ph { display: grid; place-items: center; font-size: 64px; font-weight: 800; color: var(--purple); background: linear-gradient(135deg, var(--purple-soft), var(--cyan-soft)); }
.detail { padding-top: 18px; }
.founder-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin-top: 10px; }
.dot-purple { width: 10px; height: 10px; border-radius: 50%; background: var(--purple); }
.price-row { display: flex; align-items: baseline; gap: 6px; margin-top: 14px; }
.price-row b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.block { padding: 16px; margin-top: 16px; }
.block h3 { font-size: 14px; color: var(--faint); font-weight: 600; margin-bottom: 6px; }
.block p { white-space: pre-line; }
.did { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- 하단 고정 CTA ---------- */
.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  padding: 12px 20px calc(var(--safe-b) + 12px);
  background: linear-gradient(to top, var(--bg) 70%, rgba(246, 245, 251, 0));
  display: flex; gap: 10px; max-width: 560px; margin: 0 auto;
}
.btn {
  min-height: 52px; padding: 0 20px; border-radius: 16px; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: 1;
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast), background var(--t-fast);
}
.btn:active { transform: scale(.96); }
.btn[disabled] { opacity: .42; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.buy { background: var(--cyan); color: #fff; }
.btn.invest { background: var(--purple); color: #fff; }
.btn.ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.btn.block-btn { width: 100%; margin-top: 20px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 폼 ---------- */
.field { margin-top: 18px; }
.field label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.field .help { font-size: 13px; color: var(--faint); margin-top: 6px; }
.input {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: 16px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 4px rgba(124, 58, 237, .14); }
.input[aria-invalid='true'] { border-color: var(--danger); }
.err { color: var(--danger); font-size: 14px; margin-top: 6px; min-height: 1em; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px; margin-top: 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--purple); flex: none; }
.check span { font-size: 14px; color: var(--muted); }
.check b { color: var(--ink); }

/* ---------- 시트 ---------- */
.sheet-scrim { position: fixed; inset: 0; background: rgba(5, 8, 16, .45); z-index: 40; animation: fade var(--t) var(--ease) both; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto;
  background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-2);
  padding: 10px 20px calc(var(--safe-b) + 20px); max-height: 92dvh; overflow-y: auto;
  animation: sheetUp 320ms var(--ease) both; touch-action: pan-y;
}
.sheet.closing { animation: sheetDown 200ms ease-in both; }
.sheet-scrim.closing { animation: fadeOut 200ms ease-in both; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { margin: 0 0 4px; font-size: 21px; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }

.amount { text-align: center; margin: 18px 0 8px; }
.amount b { font-size: 40px; font-weight: 800; letter-spacing: -.03em; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.round { width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; background: var(--surface); transition: transform var(--t-fast) var(--spring); }
.round:active { transform: scale(.88); }
.round[disabled] { opacity: .35; }
.quick { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.quick button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.quick button[aria-pressed='true'] { border-color: var(--purple); color: var(--purple); background: var(--purple-soft); }

.score-q { font-weight: 700; margin-top: 22px; }
.score-q small { display: block; font-weight: 500; color: var(--faint); font-size: 13px; margin-top: 2px; }
.scores { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.scores button {
  min-height: 48px; border-radius: 14px; border: 1.5px solid var(--line); font-weight: 800; font-size: 17px;
  transition: transform var(--t-fast) var(--spring), background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.scores button:active { transform: scale(.9); }
.scores button[aria-checked='true'] { background: var(--ink); color: #fff; border-color: var(--ink); transform: scale(1.04); }
.scores button.hi[aria-checked='true'] { background: var(--purple); border-color: var(--purple); }
.notice { margin-top: 14px; padding: 12px 14px; border-radius: 14px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; transition: background var(--t), color var(--t); }
.notice.share { background: var(--purple-soft); color: #5B21B6; }
.notice.keep { background: #F3F4F6; color: var(--muted); }
.split { font-size: 13px; color: var(--faint); text-align: center; margin-top: 6px; }

/* 결과 */
.result { text-align: center; padding: 24px 0 6px; }
.check-anim { width: 76px; height: 76px; margin: 0 auto 14px; }
.check-anim circle { fill: none; stroke: var(--purple); stroke-width: 4; stroke-dasharray: 220; stroke-dashoffset: 220; animation: draw 520ms var(--ease) forwards; }
.check-anim path { fill: none; stroke: var(--purple); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw 320ms 380ms var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- 탭 바 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: rgba(255, 255, 255, .92); border-top: 1px solid var(--line);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 600;
  transition: color var(--t-fast);
}
.tabbar a svg { transition: transform var(--t-fast) var(--spring); }
.tabbar a:active svg { transform: scale(.86); }
.tabbar a[aria-current='page'] { color: var(--ink); }
.tabbar a[aria-current='page'] svg { color: var(--purple); }
.tabbar[hidden], .cta-bar[hidden] { display: none; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 18px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 600;
  max-width: calc(100% - 40px); box-shadow: var(--shadow-2);
  transition: transform var(--t) var(--spring), opacity var(--t) var(--ease);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- 내 지갑 · 파운더 ---------- */
.list { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); text-decoration: none; }
a.row:active { background: var(--bg); }
.row:first-child { border-top: 0; }
.row .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.row .ic.buy { background: var(--cyan-soft); color: var(--cyan); }
.row .ic.invest { background: var(--purple-soft); color: var(--purple); }
.row .grow { flex: 1; min-width: 0; }
.row .grow b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .grow span { font-size: 13px; color: var(--faint); }
.row .amt { font-weight: 800; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px; }
.stat span { font-size: 13px; color: var(--faint); }
.stat b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat small { font-size: 12px; color: var(--faint); }
.contact a { color: var(--purple); font-weight: 600; text-decoration: none; }
.qr-box { padding: 20px; text-align: center; }
.qr-box #qr { display: inline-block; padding: 12px; background: #fff; border-radius: 16px; border: 1px solid var(--line); }
.qr-box #qr img, .qr-box #qr canvas { width: 200px; height: 200px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 관리 ---------- */
body.wide main { max-width: 1100px; }
.board { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.award { padding: 18px; }
.award h3 { font-size: 14px; color: var(--faint); }
.award .win { font-size: 22px; font-weight: 800; margin: 6px 0 2px; }
.award ol { margin: 10px 0 0 18px; color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--faint); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { padding: 6px 10px; font-size: 13px; min-height: 36px; }
.seg button[aria-pressed='true'] { background: var(--ink); color: #fff; }
body.stage { background: #fff; }
body.stage .topbar, body.stage .tabbar { display: none; }
body.stage main { max-width: none; padding: 48px 64px; }
body.stage .award .win { font-size: 40px; }
body.stage .award h3 { font-size: 20px; }

/* ---------- 제출 ---------- */
.tally-frame { width: calc(100% + 40px); margin: 12px -20px 0; border: 0; min-height: 70dvh; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}
@media (min-width: 720px) {
  .product { grid-template-columns: 96px 1fr; }
  .product .thumb { width: 96px; height: 96px; }
}
