:root {
  --ink: #09090d;
  --paper: #f4f2ec;
  --lime: #caff23;
  --purple: #713cff;
  --pink: #ff5a91;
  --muted: #77747c;
  --line: rgba(9, 9, 13, .13);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); scroll-behavior: smooth; }
body { margin: 0; min-height: 100%; overflow-x: hidden; background: var(--paper); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
body::before { position: fixed; z-index: -1; inset: 0; background: radial-gradient(circle at 7% 12%, rgba(202,255,35,.18), transparent 28rem), radial-gradient(circle at 90% 80%, rgba(113,60,255,.16), transparent 34rem), var(--paper); content: ""; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; }
[hidden] { display: none !important; }

.skip-link { position: fixed; z-index: 100; top: 1rem; left: 1rem; padding: .7rem 1rem; border-radius: 999px; background: var(--lime); transform: translateY(-180%); font-weight: 800; }
.skip-link:focus { transform: translateY(0); }

.test-header { position: relative; z-index: 10; display: flex; align-items: center; justify-content: space-between; width: min(100% - 2rem, 74rem); min-height: 5.2rem; margin: 0 auto; }
.test-brand { display: inline-flex; align-items: center; gap: .62rem; font-weight: 850; letter-spacing: -.04em; }
.test-brand img { width: 2rem; height: 2rem; border-radius: .6rem; }
.test-badge { padding: .5rem .72rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .64rem; font-weight: 800; letter-spacing: .12em; }

.test-shell { width: min(100% - 2rem, 74rem); min-height: calc(100vh - 10rem); margin: 0 auto; }
.view { animation: view-in .42s cubic-bezier(.2,.75,.2,1) both; }
.eyebrow, .panel-kicker, .question-kicker { margin: 0 0 .9rem; color: var(--purple); font-size: .68rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }

.intro-view { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(20rem, .95fr); gap: clamp(2rem, 6vw, 6rem); align-items: center; padding: clamp(2rem, 6vh, 5rem) 0 4rem; }
.intro-copy { grid-column: 1; }
.intro-copy h1 { max-width: 12ch; margin: 0; font-size: clamp(3rem, 7vw, 6.7rem); line-height: .89; letter-spacing: -.075em; }
.intro-copy h1 span { background: linear-gradient(100deg, #5d28ff, #9f3cff 48%, #ff547d); background-clip: text; color: transparent; }
.intro-lede { max-width: 35rem; margin: 1.6rem 0 0; color: #5f5c64; font-size: clamp(1rem, 1.5vw, 1.22rem); line-height: 1.7; }
.intro-preview { position: relative; grid-column: 2; grid-row: 1 / span 2; min-height: 39rem; }
.preview-card { position: absolute; width: min(72%, 20rem); aspect-ratio: 1; overflow: hidden; border: .46rem solid white; border-radius: 2rem; background: #ddd; box-shadow: 0 2.4rem 5rem rgba(34,22,69,.2); }
.preview-card img { width: 200%; max-width: none; height: 100%; object-fit: cover; }
.preview-a { top: 0; left: 0; rotate: -7deg; }
.preview-b { right: 0; bottom: 0; rotate: 7deg; }
.preview-b img { transform: translateX(-50%); }
.preview-or { position: absolute; z-index: 3; top: 48%; left: 50%; display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 50%; background: var(--ink); color: var(--lime); box-shadow: 0 1rem 3rem rgba(0,0,0,.25); font-size: .72rem; font-weight: 950; transform: translate(-50%,-50%); }

.nickname-card { grid-column: 1; width: min(100%, 36rem); padding: 1.35rem; border: 1px solid rgba(255,255,255,.64); border-radius: 1.55rem; background: rgba(255,255,255,.72); box-shadow: 0 1.8rem 4rem rgba(27,16,59,.11); backdrop-filter: blur(20px); }
.nickname-card > label:first-child { display: block; margin-bottom: .68rem; font-size: .78rem; font-weight: 820; }
.nickname-control { position: relative; }
.nickname-control input { width: 100%; height: 3.8rem; padding: 0 4.3rem 0 1rem; border: 1px solid var(--line); border-radius: 1rem; outline: none; background: white; font-size: 1.05rem; font-weight: 720; transition: border-color .2s, box-shadow .2s; }
.nickname-control input:focus { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(113,60,255,.1); }
.nickname-control span { position: absolute; top: 50%; right: 1rem; color: #918e95; font-size: .7rem; transform: translateY(-50%); }
.field-note, .field-error { margin: .55rem 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.field-error { min-height: 1rem; color: #c6294a; font-weight: 700; }
.consent-check { display: grid !important; grid-template-columns: auto 1fr; gap: .6rem; align-items: start; margin: .8rem 0 1rem !important; color: #68656d; font-size: .72rem !important; font-weight: 560 !important; line-height: 1.55; }
.consent-check input { width: 1.05rem; height: 1.05rem; margin: .12rem 0 0; accent-color: var(--purple); }
.consent-check a { color: var(--purple); font-weight: 780; text-decoration: underline; text-underline-offset: 2px; }
.primary-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 3.9rem; padding: 0 1.2rem; border: 0; border-radius: 1rem; background: var(--ink); color: white; cursor: pointer; font-weight: 850; box-shadow: 0 .9rem 2rem rgba(9,9,13,.18); transition: transform .18s, background .18s; }
.primary-button:hover { background: var(--purple); transform: translateY(-2px); }
.primary-button:disabled { cursor: wait; opacity: .55; transform: none; }
.primary-button span { color: var(--lime); font-size: 1.3rem; }
.intro-footnote { grid-column: 1; margin: -1rem 0 0; color: #8a878e; font-size: .7rem; }

.question-view { max-width: 68rem; margin: 0 auto; padding: clamp(1rem, 4vh, 3rem) 0 4rem; }
.question-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.question-head h2 { margin: 0; font-size: clamp(2rem, 5vw, 4.2rem); line-height: .95; letter-spacing: -.06em; }
.question-counter { color: #96929b; font-size: .8rem; font-weight: 800; }
.question-counter b { color: var(--ink); font-size: 1.7rem; }
.progress-track { height: .42rem; margin: 1.3rem 0 1rem; overflow: hidden; border-radius: 999px; background: rgba(9,9,13,.09); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--pink), var(--lime)); transition: width .35s ease; }
.question-guide { margin: 0 0 1.2rem; color: var(--muted); font-size: .85rem; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(.75rem, 2vw, 1.4rem); }
.choice-card { position: relative; display: flex; min-width: 0; padding: 0; overflow: hidden; flex-direction: column; border: 0; border-radius: clamp(1rem, 2vw, 1.7rem); background: var(--ink); cursor: pointer; box-shadow: 0 1.5rem 3.5rem rgba(31,18,64,.13); transition: transform .18s, box-shadow .18s; }
.choice-card:hover { transform: translateY(-5px); box-shadow: 0 2rem 4rem rgba(31,18,64,.2); }
.choice-card:focus-visible { outline: 4px solid var(--lime); outline-offset: 4px; }
.choice-media { display: block; width: 100%; aspect-ratio: 1; overflow: hidden; }
.choice-grid[data-aspect="portrait"] .choice-media { aspect-ratio: 4/5; }
.choice-media img { width: 200%; max-width: none; height: 100%; object-fit: cover; pointer-events: none; }
.choice-card[data-choice="b"] img { transform: translateX(-50%); }
.choice-label { position: static; display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 3.8rem; padding: .75rem 1rem; border-top: 1px solid rgba(255,255,255,.12); background: var(--ink); color: white; text-align: left; }
.choice-label span { font-size: clamp(.76rem, 1.5vw, .93rem); font-weight: 780; line-height: 1.35; }
.choice-label b { display: grid; flex: 0 0 auto; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--lime); color: var(--ink); font-size: .76rem; }
.choice-card.is-selected::after { position: absolute; inset: 0; border: .42rem solid var(--lime); border-radius: inherit; content: ""; pointer-events: none; }
.back-button { margin-top: 1rem; padding: .7rem 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .78rem; font-weight: 730; }

.loading-view, .error-view { display: grid; place-items: center; align-content: center; min-height: 65vh; text-align: center; }
.loading-view h2, .error-view h2 { max-width: 14ch; margin: 0; font-size: clamp(2.6rem, 7vw, 5.8rem); line-height: .94; letter-spacing: -.07em; }
.loading-view > p:last-child, .error-view > p { max-width: 34rem; margin: 1.3rem auto 0; color: var(--muted); line-height: 1.7; }
.loading-mark { display: flex; gap: .45rem; margin-bottom: 1.8rem; }
.loading-mark span { width: .8rem; height: .8rem; border-radius: 50%; background: var(--purple); animation: loading-bounce 1s infinite alternate; }
.loading-mark span:nth-child(2) { background: var(--pink); animation-delay: .18s; }
.loading-mark span:nth-child(3) { background: var(--lime); animation-delay: .36s; }
.error-view .primary-button { width: auto; margin-top: 1.4rem; padding: 0 1.5rem; }

.result-view { max-width: 64rem; margin: 0 auto; padding: 1rem 0 5rem; }
.result-hero { position: relative; isolation: isolate; min-height: 34rem; overflow: hidden; padding: clamp(2rem, 6vw, 4.5rem); border-radius: clamp(1.5rem, 4vw, 3rem); background: radial-gradient(circle at 80% 20%, rgba(202,255,35,.18), transparent 18rem), radial-gradient(circle at 10% 90%, rgba(255,90,145,.24), transparent 22rem), linear-gradient(145deg, #120c28, #09090d 56%, #1f0a37); color: white; box-shadow: 0 2.6rem 5.5rem rgba(28,14,63,.24); }
.result-hero::after { position: absolute; z-index: 0; right: -8%; bottom: -35%; width: 30rem; height: 30rem; border: 1px solid rgba(255,255,255,.12); border-radius: 44% 56% 63% 37%; content: ""; pointer-events: none; rotate: 20deg; }
.result-character { position: absolute; z-index: 1; top: 1.5rem; right: .5rem; width: min(44%, 28rem); height: calc(100% - 4rem); object-fit: contain; object-position: center top; filter: drop-shadow(0 1.4rem 1.8rem rgba(0,0,0,.28)); pointer-events: none; user-select: none; }
.result-owner, .result-code, .result-hero h1, .result-alias, .result-description { position: relative; z-index: 2; max-width: 57%; }
.result-owner { margin: 0 0 3rem; color: rgba(255,255,255,.62); font-size: .78rem; font-weight: 720; }
.result-owner span { color: var(--lime); }
.result-code { margin: 0; color: var(--lime); font-size: clamp(3.5rem, 9vw, 8rem); font-weight: 950; letter-spacing: -.075em; line-height: .8; }
.result-hero h1 { max-width: 14ch; margin: 1rem 0 .5rem; font-size: clamp(2.3rem, 6vw, 5rem); line-height: .98; letter-spacing: -.065em; }
.result-alias { margin: 0; color: #ba9dff; font-size: .78rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.result-description { max-width: 34rem; margin: 1.5rem 0 0; color: rgba(255,255,255,.72); font-size: clamp(.92rem, 1.5vw, 1.08rem); line-height: 1.7; }
.score-orbit { position: absolute; z-index: 3; right: clamp(2rem, 6vw, 5rem); bottom: clamp(2rem, 5vw, 4rem); display: grid; place-items: center; width: clamp(8rem, 16vw, 11rem); aspect-ratio: 1; border: 1px solid rgba(202,255,35,.5); border-radius: 50%; background: rgba(9,9,13,.68); backdrop-filter: blur(18px); }
.score-orbit span { align-self: end; color: rgba(255,255,255,.6); font-size: .62rem; font-weight: 750; }
.score-orbit strong { font-size: clamp(2.6rem, 6vw, 4.8rem); line-height: .8; letter-spacing: -.08em; }
.score-orbit small { align-self: start; color: var(--lime); font-weight: 800; }
.percentile-note { position: absolute; right: clamp(2rem, 6vw, 5rem); bottom: 1rem; margin: 0; color: rgba(255,255,255,.55); font-size: .66rem; }

.result-panel, .share-panel, .app-cta { margin-top: 1.2rem; padding: clamp(1.5rem, 4vw, 3rem); border: 1px solid rgba(255,255,255,.7); border-radius: clamp(1.3rem, 3vw, 2.2rem); background: rgba(255,255,255,.72); box-shadow: 0 1.5rem 4rem rgba(31,18,64,.08); backdrop-filter: blur(20px); }
.result-panel h2, .share-panel h2, .app-cta h2 { margin: 0 0 1.5rem; font-size: clamp(1.8rem, 4vw, 3.2rem); line-height: 1; letter-spacing: -.06em; }
.trait-list { display: grid; gap: .9rem; }
.trait-row { display: grid; grid-template-columns: 5.5rem 1fr 3rem; gap: .8rem; align-items: center; }
.trait-row span { font-size: .76rem; font-weight: 780; }
.trait-row b { color: var(--purple); text-align: right; font-size: .78rem; }
.trait-bar { width: 100%; height: .65rem; overflow: hidden; appearance: none; border: 0; border-radius: 999px; background: rgba(9,9,13,.08); }
.trait-bar::-webkit-progress-bar { border-radius: inherit; background: rgba(9,9,13,.08); }
.trait-bar::-webkit-progress-value { border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--pink)); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.trait-bar::-moz-progress-bar { border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--pink)); }

.code-panel { background: linear-gradient(140deg, rgba(202,255,35,.12), rgba(255,255,255,.82) 44%, rgba(113,60,255,.1)); }
.code-panel-intro { max-width: 40rem; margin: -.45rem 0 1.5rem; color: var(--muted); font-size: .82rem; line-height: 1.65; }
.axis-explanation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.axis-explanation-card { display: grid; grid-template-columns: auto 1fr; gap: .9rem; align-items: start; min-width: 0; padding: 1rem; border: 1px solid rgba(9,9,13,.08); border-radius: 1.25rem; background: rgba(255,255,255,.78); }
.axis-letter { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 1rem; background: var(--ink); color: var(--lime); font-size: 1.45rem; font-weight: 950; line-height: 1; }
.axis-explanation-card h3 { margin: .08rem 0 .35rem; font-size: .88rem; line-height: 1.3; }
.axis-explanation-card p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.55; }

.match-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.match-card { display: grid; grid-template-rows: auto 1fr; min-width: 0; overflow: hidden; border-radius: 1.3rem; background: var(--ink); color: white; }
.match-character-wrap { display: grid; place-items: center; height: 11rem; margin: .38rem .38rem 0; overflow: hidden; border-radius: 1rem; background: radial-gradient(circle at 50% 42%, rgba(113,60,255,.48), transparent 62%), linear-gradient(145deg, #20133c, #111018); }
.match-character { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 .7rem .8rem rgba(0,0,0,.28)); }
.match-copy { min-width: 0; padding: .9rem 1.1rem 1.1rem; }
.match-card small { color: var(--lime); font-size: .62rem; font-weight: 850; letter-spacing: .08em; }
.match-card strong { display: block; margin: .55rem 0 .45rem; font-size: .95rem; line-height: 1.35; }
.match-card p { margin: 0; color: rgba(255,255,255,.56); font-size: .68rem; line-height: 1.5; }

.share-panel { background: linear-gradient(135deg, rgba(113,60,255,.1), rgba(255,255,255,.78) 42%, rgba(202,255,35,.13)); }
.share-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .7rem; }
.share-button { min-height: 3.2rem; padding: .65rem; border: 1px solid var(--line); border-radius: 1rem; background: white; cursor: pointer; font-size: .72rem; font-weight: 830; transition: transform .18s, box-shadow .18s; }
.share-button:hover { transform: translateY(-3px); box-shadow: 0 .8rem 1.8rem rgba(22,15,43,.12); }
.share-button.kakao { background: #fee500; border-color: transparent; color: #191600; }
.share-button.naver { background: #03c75a; border-color: transparent; color: white; }
.share-button.instagram { background: linear-gradient(120deg, #ffb13b, #ef2777, #713cff); border-color: transparent; color: white; }
.share-button.story { background: #17131e; border-color: transparent; color: white; }
.share-status { min-height: 1rem; margin: .75rem 0 0; color: var(--purple); font-size: .7rem; font-weight: 700; }

.app-cta { position: relative; overflow: hidden; background: var(--ink); color: white; }
.app-cta::after { position: absolute; right: -7rem; bottom: -10rem; width: 22rem; height: 22rem; border-radius: 50%; background: radial-gradient(circle, rgba(113,60,255,.65), transparent 68%); content: ""; }
.app-cta .panel-kicker { color: var(--lime); }
.app-cta h2 { max-width: 17ch; }
.app-cta > p:not(.panel-kicker) { max-width: 36rem; color: rgba(255,255,255,.6); line-height: 1.65; }
.store-actions { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.4rem; }
.store-button { display: grid; grid-template-columns: auto 1fr; gap: .7rem; align-items: center; min-width: 12rem; padding: .72rem 1rem; border: 1px solid rgba(255,255,255,.17); border-radius: 1rem; background: rgba(255,255,255,.08); }
.store-button > span:first-child { color: var(--lime); }
.store-button small, .store-button strong { display: block; }
.store-button small { color: rgba(255,255,255,.52); font-size: .55rem; }
.store-button strong { margin-top: .12rem; font-size: .82rem; }
.restart-button { display: flex; align-items: center; justify-content: center; gap: .55rem; width: min(100%, 28rem); min-height: 3.8rem; margin: 1.35rem auto 0; padding: .75rem 1.2rem; border: 2px solid var(--ink); border-radius: 1.1rem; background: rgba(255,255,255,.78); color: var(--ink); cursor: pointer; box-shadow: 0 .9rem 2rem rgba(31,18,64,.1); font-size: .82rem; font-weight: 860; transition: transform .18s, background .18s, color .18s, box-shadow .18s; }
.restart-button span { color: var(--purple); font-size: 1.2rem; line-height: 1; }
.restart-button:hover { background: var(--ink); color: white; box-shadow: 0 1.2rem 2.6rem rgba(31,18,64,.2); transform: translateY(-2px); }
.restart-button:hover span { color: var(--lime); }
.restart-button:focus-visible { outline: 4px solid rgba(113,60,255,.2); outline-offset: 3px; }

.test-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: min(100% - 2rem, 74rem); min-height: 6rem; margin: 0 auto; border-top: 1px solid rgba(255,255,255,.12); color: #8c8992; font-size: .67rem; }
.test-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 1rem; }
.test-footer a:hover { color: var(--lime); }

@keyframes view-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes loading-bounce { to { transform: translateY(-.8rem); } }

@media (max-width: 860px) {
  .intro-view { grid-template-columns: 1fr; padding-top: 2rem; }
  .intro-preview { grid-column: 1; grid-row: auto; min-height: 28rem; }
  .nickname-card, .intro-footnote { grid-column: 1; }
  .preview-card { width: min(62%, 17rem); }
  .result-character { top: 3.5rem; right: -.5rem; width: min(46%, 23rem); height: calc(100% - 7rem); }
  .score-orbit { position: relative; right: auto; bottom: auto; margin: 2rem 0 0 auto; }
  .percentile-note { position: static; margin-top: .8rem; }
  .match-list { grid-template-columns: 1fr; }
  .match-card { grid-template-columns: minmax(8rem, 9.5rem) 1fr; grid-template-rows: none; align-items: center; }
  .match-character-wrap { width: calc(100% - .38rem); height: 9rem; margin: .38rem; }
  .match-copy { padding: 1rem 1rem 1rem .55rem; }
  .share-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .test-header, .test-shell, .test-footer { width: min(100% - 1.25rem, 74rem); }
  .test-header { min-height: 4.5rem; }
  .test-badge { font-size: .55rem; }
  .intro-view { gap: 1.4rem; padding-top: 1.2rem; }
  .intro-copy h1 { font-size: clamp(2.9rem, 15vw, 4.5rem); }
  .intro-preview { min-height: 22rem; }
  .preview-card { width: 58%; border-width: .3rem; border-radius: 1.35rem; }
  .preview-or { width: 3.2rem; height: 3.2rem; }
  .choice-grid { gap: .55rem; }
  .choice-card { border-radius: 1rem; }
  .choice-label { min-height: 3.3rem; padding: .55rem .65rem; }
  .choice-label span { font-size: .68rem; }
  .choice-label b { width: 1.65rem; height: 1.65rem; }
  .result-hero { min-height: 0; padding: 2rem 1.4rem; }
  .result-owner { margin-bottom: 2.2rem; }
  .result-owner, .result-code, .result-hero h1, .result-alias, .result-description { max-width: 100%; }
  .result-description { max-width: 22rem; }
  .result-character { position: relative; top: auto; right: auto; width: min(96%, 22rem); height: auto; margin: .5rem auto -1rem; object-position: center; }
  .score-orbit { margin-top: .5rem; }
  .trait-row { grid-template-columns: 4.3rem 1fr 2.4rem; gap: .55rem; }
  .axis-explanation-grid { grid-template-columns: 1fr; }
  .match-card { grid-template-columns: 7.5rem 1fr; }
  .match-character-wrap { height: 7.5rem; }
  .share-grid { grid-template-columns: 1fr 1fr; }
  .share-button.copy { grid-column: 1 / -1; }
  .test-footer { align-items: flex-start; flex-direction: column; justify-content: center; padding: 1.2rem 0; }
  .test-footer nav { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
