/* SPK Lab — Slush DESIGN.md 확정안(제목 Bagel Fat One · 본문 Noto Sans KR · 검은 띠 없음)
   규칙: 그림자 없음 · 그라데이션 없음(리본 입체감만 예외) · 모든 조작 요소에 검정 1px 외곽선 · 알약/둥근 모서리 */
:root {
  --ink: #000;
  --paper: #fff;
  --sky: #dceeff;
  --blue: #4da2ff;
  --blue-dark: #2f86ea;
  --blue-hi: #c6e2ff;
  --mint: #55db9c;
  --lav: #e9ccff;
  --ember: #fb4903;
  --sun: #ffd731;
  --vio: #5c4ade;
  --mist: #e9e9e9;
  --sub: #444;
  --line: 1.2px solid var(--ink);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --f-display: "Bagel Fat One", "Noto Sans KR", sans-serif;
  --f-num: "Gasoek One", "Bagel Fat One", sans-serif;
  --f-body: "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { overflow-x: hidden; overflow-x: clip; } /* clip을 모르는 옛 브라우저는 앞줄(hidden)을 쓴다 */
body {
  font-family: var(--f-body);
  color: var(--ink);
  background: var(--sky);
  -webkit-font-smoothing: antialiased;
  transition: background-color .5s var(--ease);
  overflow-x: hidden;
  overflow-x: clip;
}
body[data-screen="quiz"] { background: var(--paper); }
body[data-screen="result"] { background: var(--lav); }
body[data-screen="loading"] { background: var(--sun); }
button { font: inherit; color: inherit; cursor: pointer; }
.defs { position: absolute; }

.app { position: relative; max-width: 460px; min-height: 100dvh; margin: 0 auto; }
.screen { display: none; position: relative; min-height: 100dvh; padding: 20px 22px 110px; overflow-x: hidden; overflow-x: clip; }
.screen.is-active { display: block; animation: enter .6s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* 공통 부품 */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 999px; border: var(--line);
  background: var(--paper); font-weight: 700; font-size: 14px; letter-spacing: .03em;
  transition: transform .18s var(--ease);
}
.pill:hover { transform: translateY(-2px) rotate(-1deg); }
.pill:active { transform: scale(.96); }
.pill-ink { background: var(--ink); color: var(--paper); }
.pill-lg { padding: 16px 24px; font-size: 16px; }
.pill:focus-visible, .opt:focus-visible, .fab:focus-visible { outline: 3px solid var(--vio); outline-offset: 3px; }

/* 리본 — 파랑 튜브(아래 그림자 한 줄 + 몸통 + 윗면 빛) + 결 */
.ribbon { position: absolute; left: -12%; width: 124%; pointer-events: none; z-index: 0; overflow: visible; }
.ribbon path { fill: none; stroke-linecap: round; }
.ribbon .r-shade { stroke: var(--blue-dark); stroke-width: 60; }
.ribbon .r-body { stroke: var(--blue); stroke-width: 54; }
.ribbon .r-hi { stroke: var(--blue-hi); stroke-width: 10; opacity: .85; }
.ribbon-hero { top: 300px; height: 260px; }
.ribbon-foot { bottom: -10px; height: 120px; }
.ribbon-result { top: 60px; height: 190px; }

/* 시작 */
.nav { position: relative; z-index: 3; display: flex; justify-content: space-between; align-items: center; }
.logo-sticker {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: var(--line); background: var(--paper); font-family: var(--f-display); font-size: 18px;
}
.hero-title {
  position: relative; z-index: 2; margin: 44px 0 0;
  font-family: var(--f-display); font-weight: 400;
  font-size: clamp(76px, 23vw, 104px); line-height: .86; letter-spacing: -.01em;
}
.stickers { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.sticker {
  position: absolute; display: inline-grid; place-items: center;
  padding: 8px 16px; border-radius: 999px; border: var(--line);
  font-family: var(--f-display); font-size: 18px;
  transform: rotate(var(--r)); animation: bob 4.8s ease-in-out infinite;
}
.sticker:nth-child(2) { animation-delay: -1.2s; } .sticker:nth-child(3) { animation-delay: -2.1s; }
.sticker:nth-child(4) { animation-delay: -3s; } .sticker:nth-child(5) { animation-delay: -.6s; } .sticker:nth-child(6) { animation-delay: -1.8s; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(var(--r)); } 50% { transform: translateY(-9px) rotate(calc(var(--r) * -.4)); } }
.s-ai { top: 126px; right: 22px; background: var(--vio); color: var(--paper); font-size: 21px; width: 56px; height: 56px; padding: 0; }
.s-life { top: 214px; right: 18px; background: var(--mint); }
.s-semi { top: 318px; right: 64px; background: var(--sun); }
.s-space { top: 404px; right: 18px; background: var(--lav); }
.s-robot { left: 4px; top: 22px; background: var(--ember); color: var(--paper); }
.s-star { right: 30px; top: 8px; width: 58px; height: 58px; padding: 0; border-radius: 50%; background: var(--sun); font-size: 24px; }
.hero-sub { position: relative; z-index: 2; margin: 150px 0 0; font-size: 15px; font-weight: 500; line-height: 1.55; }
.stickers-low { position: relative; height: 96px; margin-top: 20px; }
.stickers-low .sticker { position: absolute; }
.hero-cta { position: relative; z-index: 4; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* 문제 */
.quiz-top { position: relative; display: flex; align-items: center; gap: 14px; }
.back { width: 40px; height: 40px; border-radius: 50%; border: var(--line); background: var(--paper); font-size: 18px; }
.back[disabled] { opacity: .25; cursor: default; }
.qnum { font-family: var(--f-num); font-size: 104px; line-height: .8; letter-spacing: -.02em; }
.dots { display: flex; gap: 8px; margin: 0 0 0 auto; padding: 0; list-style: none; }
.dots li { width: 16px; height: 16px; border-radius: 50%; border: var(--line); background: var(--mist); transition: background-color .3s; }
.dots li.done:nth-child(6n+1) { background: var(--vio); } .dots li.done:nth-child(6n+2) { background: var(--sun); }
.dots li.done:nth-child(6n+3) { background: var(--mint); } .dots li.done:nth-child(6n+4) { background: var(--ember); }
.dots li.done:nth-child(6n+5) { background: var(--lav); } .dots li.done:nth-child(6n) { background: var(--blue); }
.qtitle { margin: 40px 0 6px; font-size: 27px; line-height: 1.32; font-weight: 900; letter-spacing: -.01em; }
.qhint { margin: 0 0 22px; font-size: 14px; color: var(--sub); font-weight: 500; }
.options { position: relative; z-index: 2; display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 13px 18px 13px 13px; border-radius: 28px; border: var(--line); background: var(--paper);
  font-size: 16px; font-weight: 700; transition: transform .18s var(--ease), background-color .18s;
}
.opt:hover { transform: translateX(3px); }
.opt[aria-pressed="true"] { background: var(--sun); }
.opt[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.opt .ico {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: var(--line); background: var(--c, var(--lav)); font-family: var(--f-mono); font-weight: 600; font-size: 15px;
}
.opt[aria-pressed="true"] .ico { background: var(--paper); }
.opt small { display: block; font-weight: 500; font-size: 12px; color: var(--sub); margin-top: 2px; }
.opt-group { margin: 14px 0 4px; font-size: 13px; font-weight: 700; color: var(--sub); }
.next { position: relative; z-index: 2; margin-top: 18px; }

/* 맞춰 보는 중 */
.screen-loading { display: none; place-items: center; text-align: center; }
.screen-loading.is-active { display: grid; }
.orbit { position: relative; width: 240px; height: 240px; animation: spin 6s linear infinite; }
.orbit span {
  position: absolute; left: 50%; top: 50%; padding: 8px 14px; border-radius: 999px; border: var(--line);
  background: var(--paper); font-family: var(--f-display); font-size: 16px;
  transform: rotate(calc(var(--i) * 60deg)) translate(104px) rotate(calc(var(--i) * -60deg)) translate(-50%, -50%);
}
@keyframes spin { to { rotate: 360deg; } }
.loading-text { font-family: var(--f-display); font-size: 26px; margin-top: 28px; }

/* 결과 */
.screen-result { padding-bottom: 40px; }
.result-head { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; }
.result-title { margin: 22px 0 0; font-family: var(--f-display); font-weight: 400; font-size: clamp(50px, 15vw, 64px); line-height: .9; white-space: nowrap; }
.tag-tilt { position: absolute; right: 0; top: 4px; transform: rotate(8deg); font-size: 12px; white-space: nowrap; }
.panel {
  position: relative; z-index: 2; margin: 90px -22px 0; padding: 26px 22px 30px;
  background: var(--paper); border: var(--line); border-radius: 40px 40px 0 0; min-height: 60vh;
}
.result-summary { margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: var(--sub); font-weight: 500; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.card {
  position: relative; padding: 18px 18px 18px 88px; border-radius: 28px; border: var(--line); background: var(--paper);
  opacity: 0; transform: translateY(24px) rotate(-1.5deg); animation: reveal .7s var(--ease) forwards;
}
.card:nth-child(2) { animation-delay: .35s; } .card:nth-child(3) { animation-delay: .7s; }
@keyframes reveal { to { opacity: 1; transform: none; } }
.rank {
  position: absolute; left: 16px; top: 18px; display: grid; place-items: center; width: 56px; height: 56px;
  border-radius: 50%; border: var(--line); font-family: var(--f-display); font-size: 28px; transform: rotate(-8deg);
}
.card:nth-child(1) .rank { background: var(--sun); } .card:nth-child(2) .rank { background: var(--mint); } .card:nth-child(3) .rank { background: var(--blue); }
.card h3 { margin: 0; font-size: 21px; font-weight: 900; }
.card .meta { margin: 4px 0 10px; font-size: 13px; color: var(--sub); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 11px; border-radius: 999px; border: var(--line); font-size: 12px; font-weight: 700; background: var(--lav); }
.chip:nth-child(3n+2) { background: var(--mint); } .chip:nth-child(3n) { background: var(--sun); }
.evidence { margin: 12px 0 0; padding-top: 12px; border-top: 1px dashed #bbb; font-size: 12.5px; line-height: 1.55; color: var(--sub); }
.evidence b { color: var(--ink); }
.card-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.card-links a, .card-links button {
  padding: 7px 12px; border-radius: 999px; border: var(--line); background: var(--paper);
  font-size: 12.5px; font-weight: 700; color: var(--ink); text-decoration: none;
}
.card-links .ask { background: var(--ink); color: var(--paper); }
.more { margin-top: 18px; border: var(--line); border-radius: 24px; padding: 14px 18px; }
.more summary { font-weight: 700; cursor: pointer; }
.more-list { margin: 12px 0 0; padding-left: 22px; display: grid; gap: 10px; font-size: 14px; }
.more-list li span { color: var(--sub); font-size: 12.5px; }
.more-list a { color: var(--ink); font-weight: 700; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.fine { margin-top: 18px; font-size: 11.5px; line-height: 1.6; color: #666; font-family: var(--f-mono); letter-spacing: -.01em; }

/* 제미나이 버튼·도움 창 */
.fab {
  position: fixed; z-index: 20; right: max(18px, calc(50% - 212px)); bottom: calc(22px + env(safe-area-inset-bottom));
  display: grid; justify-items: start; gap: 1px; padding: 10px 20px 11px; border-radius: 26px; border: var(--line);
  background: var(--ink); color: var(--paper); text-align: left; transition: transform .2s var(--ease);
}
.fab b { font-size: 15px; font-weight: 900; letter-spacing: .01em; }
.fab small { font-size: 11.5px; font-weight: 700; color: var(--sun); letter-spacing: .02em; }
.fab:hover { transform: translateY(-3px) rotate(-2deg); }
body[data-screen="start"] .fab, body[data-screen="loading"] .fab { display: none; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop[hidden] { display: none; }
.sheet {
  position: relative; width: min(460px, 100%); max-height: 88dvh; overflow: auto;
  padding: 26px 22px calc(26px + env(safe-area-inset-bottom)); background: var(--sky);
  border: var(--line); border-radius: 36px 36px 0 0; animation: up .45s var(--ease);
}
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-close { position: absolute; right: 16px; top: 16px; width: 40px; height: 40px; border-radius: 50%; border: var(--line); background: var(--paper); font-size: 22px; line-height: 1; }
.eyebrow { margin: 0; font-family: var(--f-mono); font-size: 12px; letter-spacing: .12em; }
.sheet-title { margin: 8px 0 10px; font-family: var(--f-display); font-weight: 400; font-size: 34px; line-height: 1; }
.sheet-lead { margin: 0 0 16px; font-size: 14px; line-height: 1.6; font-weight: 500; }
.prompt-list { display: grid; gap: 10px; }
.prompt {
  display: grid; gap: 6px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 22px; border: var(--line); background: var(--paper);
  transition: transform .18s var(--ease);
}
.prompt:hover { transform: translateY(-2px); }
.prompt b { font-size: 15px; } .prompt span { font-size: 12.5px; color: var(--sub); line-height: 1.5; }
.prompt:nth-child(1) b::before { content: "①  "; } .prompt:nth-child(2) b::before { content: "②  "; } .prompt:nth-child(3) b::before { content: "③  "; }
.offer { margin-top: 16px; padding: 14px 16px; border-radius: 22px; border: var(--line); background: var(--lav); font-size: 13px; line-height: 1.6; }
.offer summary { font-weight: 700; cursor: pointer; }
.how-list { margin: 0; padding-left: 20px; display: grid; gap: 12px; font-size: 14px; line-height: 1.6; }
.toast {
  position: fixed; left: 50%; bottom: 90px; z-index: 60; transform: translate(-50%, 20px); opacity: 0;
  padding: 12px 18px; border-radius: 999px; border: var(--line); background: var(--sun); font-weight: 700; font-size: 14px;
  transition: all .3s var(--ease); pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 900px) {
  .screen-start .hero-title { font-size: 112px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card { opacity: 1; transform: none; }
}

/* 결과: 나의 연구자 유형 */
.type-card { position: relative; z-index: 2; margin-top: 18px; }
.type-kicker { margin: 0; font-weight: 900; font-size: 22px; }
.type-name { margin: 6px 0 10px; font-family: var(--f-display); font-weight: 400; font-size: clamp(46px, 13vw, 60px); line-height: .98; }
.type-name span:last-child { display: inline-block; margin-top: 4px; padding: 2px 16px 6px; border: var(--line); border-radius: 999px; background: var(--tc, var(--sun)); transform: rotate(-2deg); }
.type-tagline { margin: 0; font-weight: 700; font-size: 16px; }
.type-tag { position: absolute; right: 0; top: 0; transform: rotate(8deg); font-family: var(--f-display); font-weight: 400; font-size: 16px; background: var(--tc, var(--sun)); }
.type-tag[hidden] { display: none; }
.ribbon-result { top: 150px; height: 170px; }
.panel { margin-top: 70px; }
.panel-title { margin: 0 0 14px; font-size: 19px; font-weight: 900; }

/* 결과: 공유 */
.share { margin-top: 20px; padding: 18px; border: var(--line); border-radius: 28px; background: var(--sky); }
.share-preview { display: block; width: 62%; margin: 0 auto 14px; aspect-ratio: 9 / 16; object-fit: cover; border: var(--line); border-radius: 18px; background: var(--paper); transform: rotate(-2deg); }
.share-actions { display: grid; gap: 8px; }
.share-actions .pill { justify-content: center; }

/* 제미나이 창 상단: 바로 가기 + 대학생 혜택 */
.gem-go { display: flex; justify-content: center; width: calc(100% - 56px); padding: 18px 20px; font-size: 18px; font-weight: 900; text-decoration: none; }
.offer-big { margin: 14px 0 22px; padding: 22px 18px 18px; border: var(--line); border-radius: 30px; background: var(--paper); text-align: center; }
.offer-kicker { margin: 0; font-weight: 900; font-size: 15px; }
.offer-title { margin: 4px 0 14px; font-family: var(--f-display); font-weight: 400; font-size: 40px; line-height: .95; }
.offer-qr { display: inline-block; padding: 10px; border: var(--line); border-radius: 22px; background: var(--paper); }
.offer-qr img { display: block; width: min(220px, 58vw); height: auto; image-rendering: pixelated; }
.offer-link { display: block; margin: 12px 0 10px; font-family: var(--f-mono); font-weight: 600; font-size: 24px; color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
.offer-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.offer-actions a { text-decoration: none; }
.offer-fine { margin: 14px 0 0; font-size: 11.5px; line-height: 1.6; color: #555; }
.sheet-sub { margin: 0 0 6px; font-size: 18px; font-weight: 900; }

/* 결과: 학교 고르기 */
.school-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.school-pill { padding: 7px 13px; font-size: 13px; }
.school-pill[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.school-pill[disabled] { opacity: .4; cursor: not-allowed; transform: none; }
.fix { margin: 8px 0 0; font-size: 13px; font-weight: 700; }
.fix a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* 숨은 연구실 추천 */
.hidden-lab { margin-top: 18px; padding: 16px; border: var(--line); border-radius: 28px; background: var(--mint); }
.hidden-lab[hidden] { display: none; }
.hidden-lab .panel-title { margin-bottom: 4px; }
.hidden-lead { margin: 0 0 12px; font-size: 13px; font-weight: 500; line-height: 1.5; }
.hidden-cards .card { animation-delay: .9s; }
.hidden-cards .rank { background: var(--paper) !important; font-size: 17px; }
