/* IQ Duel - style.css */
:root {
  --bg: #0B0F19;
  --surface: #111827;
  --surface-2: #161F33;
  --border: rgba(148, 163, 184, 0.14);
  --text: #F8FAFC;
  --muted: #94A3B8;
  --accent: #7C5CFF;
  --accent-2: #22D3EE;
  --success: #34D399;
  --danger: #F43F5E;
  --radius: 16px;
  --maxw: 480px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --glow: 0 0 0 1px rgba(124, 92, 255, 0.35), 0 12px 40px rgba(124, 92, 255, 0.25);
}
@media (min-width: 640px) { :root { --maxw: 640px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 50% -200px, rgba(124, 92, 255, 0.22), transparent 70%),
    radial-gradient(600px 400px at 100% 100%, rgba(34, 211, 238, 0.08), transparent 70%);
  background-attachment: fixed;
}
a { color: var(--accent-2); text-decoration: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1F2937; border-radius: 999px; }
* { scrollbar-width: thin; scrollbar-color: #1F2937 transparent; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.header {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: rgba(11, 15, 25, 0.72);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: -0.02em; font-size: 17px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-grid; place-items: center; color: #fff; font-size: 13px; font-weight: 900;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.lang-toggle {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; cursor: pointer;
  transition: color .2s, border-color .2s;
}
.lang-toggle:hover { color: var(--text); border-color: rgba(148,163,184,.4); }
.timer {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px;
}

.view { max-width: var(--maxw); width: 100%; margin: 0 auto; padding: 24px 20px 48px; animation: fadeUp .35s ease both; flex: 1; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.view.has-sticky { padding-bottom: 120px; }
@media (min-width: 640px) { .view.has-sticky { padding-bottom: 48px; } }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 20px 32px; }

/* Typography */
h1, h2, h3 { margin: 0; letter-spacing: -0.03em; line-height: 1.12; }
h1 { font-size: 36px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 700; }
@media (min-width: 640px) { h1 { font-size: 46px; } }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.num { font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.gradient-text {
  background: linear-gradient(135deg, #FFFFFF 0%, #C4B5FD 50%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 22px; border-radius: 14px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
  border: 1px solid transparent; cursor: pointer; width: 100%;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s, opacity .2s;
  text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #6D4BFF); color: #fff; box-shadow: var(--glow); }
.btn-primary:hover { box-shadow: 0 0 0 1px rgba(124,92,255,.5), 0 16px 48px rgba(124,92,255,.35); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: rgba(148,163,184,.4); }
.btn-ghost { background: transparent; color: var(--muted); padding: 10px; font-weight: 600; }
.btn-ghost:hover { color: var(--text); }
.btn-cyan { background: linear-gradient(135deg, var(--accent-2), #0EA5E9); color: #04121A; }
.btn-row { display: grid; gap: 10px; }
.btn-row.two { grid-template-columns: 1fr 1fr; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.stack > * + * { margin-top: 14px; }
.section { margin-top: 36px; }
.section-title { margin-bottom: 14px; }

/* Landing */
.hero { padding-top: 24px; text-align: center; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-2); background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.25); padding: 6px 12px; border-radius: 999px; margin-bottom: 18px;
}
.hero .eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.hero p.sub { margin-top: 14px; color: var(--muted); font-size: 17px; max-width: 420px; margin-left: auto; margin-right: auto; }
.hero .cta { margin-top: 26px; }
.hero .cta-sub { margin-top: 10px; font-size: 13px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 28px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 10px; text-align: center; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.stat .k { font-size: 11px; color: var(--muted); margin-top: 6px; font-weight: 600; letter-spacing: .02em; line-height: 1.25; }
.steps { display: grid; gap: 10px; }
.step { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.step .n { flex: 0 0 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: rgba(124,92,255,.15); color: #C4B5FD; }
.step h3 { margin-bottom: 4px; }
.step p { color: var(--muted); font-size: 14px; }
.hall { display: grid; gap: 8px; }
.hall-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.hall-row .p { display: flex; flex-direction: column; min-width: 0; }
.hall-row .p.r { text-align: right; }
.hall-row .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hall-row .iq { color: var(--muted); font-size: 12px; }
.hall-row .vs { font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .08em; }
.hall-row .win .name { color: var(--success); }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border); padding: 2px 7px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }

.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(11,15,25,.98), rgba(11,15,25,.9) 70%, transparent);
}
.sticky-cta .btn { max-width: 480px; margin: 0 auto; display: flex; }
@media (min-width: 640px) { .sticky-cta { display: none; } }

/* Test */
.progress-wrap { margin-bottom: 18px; }
.progress-meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; }
.progress-meta b { font-weight: 800; font-size: 14px; letter-spacing: -0.01em; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s cubic-bezier(.2,.8,.2,1); }
.matrix-card { background: #fff; border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); max-width: 330px; margin: 0 auto; }
@media (min-width: 640px) { .matrix-card { max-width: 380px; } }
.matrix-card svg { display: block; width: 100%; height: auto; }
.q-prompt { margin: 18px 0 12px; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; }
.q-prompt .hint { font-weight: 500; font-size: 12px; color: var(--muted); display: none; }
@media (min-width: 640px) { .q-prompt .hint { display: inline; } }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 400px; margin: 0 auto; }
.opt {
  position: relative; background: #fff; border: 2px solid transparent; border-radius: 14px; padding: 8px; cursor: pointer;
  transition: transform .15s ease, border-color .15s, box-shadow .2s; aspect-ratio: 1 / 1;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.opt svg { display: block; width: 100%; height: 100%; }
.opt:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.35); }
.opt.selected { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(124,92,255,.35), 0 8px 20px rgba(0,0,0,.35); transform: scale(0.97); }
.opt .k {
  position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; border-radius: 6px; font-size: 11px; font-weight: 800;
  background: rgba(11,15,25,.85); color: #fff; display: grid; place-items: center;
}
.diff-dots { display: inline-flex; gap: 3px; margin-left: 8px; vertical-align: middle; }
.diff-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--surface-2); }
.diff-dots i.on { background: var(--accent-2); }

/* Interstitial */
.inter { text-align: center; padding-top: 48px; }
.inter .big { font-size: 56px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin: 18px 0 8px; }
.inter .ring { width: 92px; height: 92px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; position: relative; }
.inter .ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.inter .ring b { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.inter .btn { margin-top: 32px; }

/* Forms */
.field { display: block; margin-bottom: 16px; }
.field span.label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font: inherit; font-size: 16px;
  padding: 14px; border-radius: 12px; outline: none; transition: border-color .2s, box-shadow .2s; appearance: none; -webkit-appearance: none;
}
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.25); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.field.error input { border-color: var(--danger); }
.err-msg { color: var(--danger); font-size: 13px; margin-top: 6px; }

/* Result */
.result-hero { text-align: center; padding: 20px 0 8px; }
.result-hero .label { font-size: 14px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.result-hero .iq { font-size: 112px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; margin: 6px 0; }
.result-hero .pct { font-size: 18px; font-weight: 600; }
.tier {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: rgba(124,92,255,.14); border: 1px solid rgba(124,92,255,.35); color: #DDD6FE;
}
.tier.t5 { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.4); color: #A7F3D0; }
.kv-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.kv { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 8px; text-align: center; }
.kv .v { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.kv .k { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 600; }
.curve { margin-top: 20px; }
.curve svg { width: 100%; height: auto; display: block; }
.bars { display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: 90px 1fr 40px; align-items: center; gap: 10px; font-size: 14px; }
.bar .track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar .track i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .9s cubic-bezier(.2,.8,.2,1); }
.bar .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.hard { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; }
.hard .thumb { background: #fff; border-radius: 12px; padding: 6px; }
.hard .thumb svg { width: 100%; height: auto; display: block; }
.hard .status { font-weight: 700; margin-top: 4px; }
.hard .status.ok { color: var(--success); }
.hard .status.miss { color: var(--danger); }
.actions { margin-top: 22px; display: grid; gap: 10px; }
.upsell { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.upsell .btn { padding: 14px 10px; font-size: 14px; }
.link-row { text-align: center; margin-top: 16px; }
.link-row a, .link-row button { color: var(--muted); font-size: 14px; font-weight: 600; background: none; border: 0; cursor: pointer; }
.link-row a:hover, .link-row button:hover { color: var(--text); }

/* Duel landing */
.duel-hero { text-align: center; padding-top: 32px; }
.duel-hero .avatar { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; font-weight: 800; font-size: 26px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; letter-spacing: -0.02em; }
.duel-hero .iq-inline { font-weight: 800; color: var(--accent-2); }
.duel-hero .meta { margin-top: 12px; color: var(--muted); font-size: 14px; }
.duel-hero .btn { margin-top: 28px; }

/* Head-to-head */
.vs-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; margin-top: 20px; }
.vs-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 10px; text-align: center; position: relative; }
.vs-col.winner { border-color: rgba(52,211,153,.5); box-shadow: 0 0 0 1px rgba(52,211,153,.3), 0 10px 30px rgba(52,211,153,.12); }
.vs-col .who { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-col .iq { font-size: 52px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; margin: 10px 0 4px; }
.vs-col .sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.vs-col .badge { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--success); color: #052e1c; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.vs-mid { display: grid; place-items: center; font-weight: 900; color: var(--muted); font-size: 13px; letter-spacing: .1em; }
.vs-line { text-align: center; margin-top: 20px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }

/* Modal / toast */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); z-index: 50; display: grid; place-items: end center; animation: fadeIn .2s both; }
@media (min-width: 640px) { .modal-bg { place-items: center; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px 20px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); animation: slideUp .25s cubic-bezier(.2,.8,.2,1) both; }
@media (min-width: 640px) { .modal { border-radius: 20px; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { margin-bottom: 8px; }
.modal p { color: var(--muted); }
.modal .btn { margin-top: 20px; }
.modal input.copy { width: 100%; margin-top: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); padding: 12px; border-radius: 10px; font: inherit; font-size: 13px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); z-index: 60;
  background: #1F2937; color: var(--text); border: 1px solid var(--border); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 48px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Footer links + business info */
.footer-links { display: flex; justify-content: center; gap: 16px; margin-top: 10px; }
.footer-links a { color: var(--muted); font-weight: 600; }
.footer-links a:hover { color: var(--text); }
.footer .biz { margin: 10px auto 0; max-width: 520px; font-size: 11px; line-height: 1.6; opacity: .8; }
.pay-note { grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--muted); }
.pay-note a { color: var(--muted); text-decoration: underline; }

/* Legal pages (terms / privacy / refund) */
.legal h1 { font-size: 28px; letter-spacing: -0.02em; margin: 8px 0 4px; }
.legal .updated { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.legal h2 { font-size: 17px; margin: 28px 0 8px; }
.legal p, .legal li { color: #CBD5E1; font-size: 15px; line-height: 1.7; }
.legal p { margin: 8px 0; }
.legal ul { padding-left: 20px; margin: 8px 0; }
.legal li + li { margin-top: 4px; }
.legal .summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.legal .summary p { margin: 0; color: var(--text); }
.legal .table-wrap { overflow-x: auto; margin: 8px 0; }
.legal table { border-collapse: collapse; width: 100%; font-size: 13px; min-width: 600px; }
.legal td:first-child { white-space: nowrap; }
.legal th, .legal td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; color: #CBD5E1; }
.legal th { background: var(--surface); color: var(--text); font-weight: 600; }
.legal-nav { display: flex; gap: 14px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 14px; }
.legal-nav a { color: var(--muted); font-weight: 600; }
.legal-nav a[aria-current] { color: var(--text); }
