/* 우리 학교 시크릿 크러시: Arc:ade 모바일 디자인 시스템을 따른다.
   회색 단계 + 빨간 3D 하트만 색. 굵기 최대 700, 숫자는 tabular-nums. */
:root {
  --ink: #101828;      /* 강조, 주 버튼, 큰 숫자 */
  --title: #1e2939;    /* 제목 */
  --body: #364153;     /* 본문 */
  --muted: #6a7282;    /* 보조 */
  --tertiary: #99a1af; /* 3차, 아이콘, 라벨 */
  --input-line: #d4d4d8;
  --line: #e5e7eb;     /* 테두리, 구분선 */
  --surface: #f3f4f6;  /* 카드, 보조 버튼, 자리 표시 */
  --panel: #f9fafb;    /* 패널 */
  --error: #a3293a;    /* 오류 글자에만 */
  --chip-on: #1d293d;
  --notice-line: #e4e7ec;
  --notice-ink: #475467;
  /* 예전 이름 (관리자 화면 등에서 쓰는 변수) */
  --bg: #ffffff;
  --soft: var(--surface);
  --soft-hover: #e9eaee;
  --surface-2: var(--line);
  --radius: 16px;
  --ease: cubic-bezier(0.42, 0, 0.58, 1);
  --snap: cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #fff; min-height: 100%; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--body);
  background: #fff;
  word-break: keep-all;
  overflow-wrap: anywhere;
  letter-spacing: -0.02em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
b, strong { font-weight: 700; }
button, input { font: inherit; color: inherit; }
a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------- 머리 (56px, 내리면 숨고 올리면 나옴) ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; background: transparent; transition: transform 0.22s var(--snap), background 0.22s var(--snap), box-shadow 0.22s var(--snap); }
.topbar.scrolled { background: #fff; box-shadow: 0 1px 0 var(--line); }
.topbar.hidden { transform: translateY(-100%); }
.topbar-in { height: 56px; display: flex; align-items: center; justify-content: center; }
.brand { font-size: 12px; font-weight: 700; letter-spacing: 0.24em; color: var(--ink); text-decoration: none; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; }
.notice { background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; text-align: center; padding: 8px 16px; }

.wrap { max-width: 500px; margin: 0 auto; padding: 64px 16px 36px; }
#view { min-height: 60dvh; }

/* ---------- 글자 ---------- */
h1 { font-size: 24px; line-height: 1.3; font-weight: 700; margin: 8px 0 8px; letter-spacing: -0.035em; color: var(--title); }
h1.hero-title { font-size: 28px; line-height: 1.25; }
h2 { font-size: 24px; line-height: 1.3; font-weight: 700; margin: 4px 0 8px; letter-spacing: -0.035em; color: var(--title); }
h3 { font-size: 18px; line-height: 1.4; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.025em; color: var(--title); }
p { margin: 0 0 12px; }
.lead { color: var(--body); font-size: 16px; line-height: 1.5; }
.small { font-size: 14px; line-height: 1.8; color: var(--muted); letter-spacing: -0.01em; }
.helper { font-size: 14px; line-height: 1.8; color: var(--muted); margin: 8px 0 0; letter-spacing: -0.01em; }
.caption { font-size: 12px; line-height: 1.5; color: var(--muted); }
.center { text-align: center; }
.stack > * + * { margin-top: 8px; }
.step { font-size: 14px; font-weight: 500; color: var(--tertiary); margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.num, .big-num, .count b, .sr-top span, .pill, .f-count, .fn-right b { font-variant-numeric: tabular-nums; }
.unit { font-weight: 600; color: var(--muted); font-size: 0.8em; margin-left: 1px; letter-spacing: -0.01em; }
.big-num { font-size: 40px; font-weight: 700; color: var(--ink); text-align: center; line-height: 1.15; letter-spacing: -0.025em; }
.big-num .unit { font-size: 0.45em; margin-left: 2px; }
mark { background: var(--ink); color: #fff; border-radius: 4px; padding: 0 2px; }

/* ---------- 카드, 패널, 안내 상자 ---------- */
.card { background: var(--panel); border-radius: 16px; padding: 24px 16px; margin: 24px 0; }
.card > h3:first-child { margin-top: 0; }
.notice-box, .remember { padding: 16px; border: 1px solid var(--notice-line); border-radius: 16px; background: var(--panel); font-size: 13px; line-height: 1.6; color: var(--notice-ink); margin: 24px 0; }
.remember { font-size: 15px; font-weight: 700; color: var(--title); }
.remember small { display: block; font-size: 13px; font-weight: 500; color: var(--notice-ink); margin-top: 4px; }
.empty-callout { position: relative; background: var(--panel); padding-right: 84px; }
.empty-callout h1 { margin: 0; }
.empty-callout .lead { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 8px 0 0; }
.callout-emoji { position: absolute; right: 16px; top: 20px; }
.info-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 100px; background: var(--panel); color: var(--muted); font-size: 14px; padding: 6px 12px; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s var(--ease), opacity 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn.soft, .btn.ghost { background: var(--surface); color: var(--body); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: #0b111d; }
  .btn.soft:hover, .btn.ghost:hover { background: #e2e4e8; }
}
.btn[disabled] { opacity: 0.42; cursor: not-allowed; }
a.btn[disabled], .btn[aria-disabled="true"] { pointer-events: none; }
.btn.done { background: var(--surface); color: var(--body); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.link { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--input-line); display: inline-block; padding: 12px 2px; margin: -12px 0; }
.text-links { display: flex; justify-content: center; gap: 24px; margin: 24px 0 0; font-size: 14px; }
.text-links .link { font-weight: 500; color: var(--muted); }

/* ---------- 아래 떠 있는 버튼 섬 (화면마다 최대 두 개) ---------- */
.with-bar .wrap { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
.actionbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 500px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 15;
  background: #fff;
  border: 1px solid var(--surface);
  border-radius: 24px;
  padding: 12px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 4%);
}
.actionbar-in { display: flex; gap: 6px; }
.actionbar-in > .btn { flex: 1 1 0; min-width: 0; padding: 0 12px; }
.actionbar-in > .btn:first-child { flex-grow: 1.5; }
.actionbar-in.stacked { flex-direction: column; }
.kb-open .actionbar { display: none; }
.kb-open.with-bar .wrap { padding-bottom: 36px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 100px; font-size: 14px; font-weight: 600; z-index: 60; max-width: calc(100% - 32px); animation: toast-in 0.2s var(--snap); }
.with-bar .toast { bottom: calc(112px + env(safe-area-inset-bottom)); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 입력 ---------- */
.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-size: 14px; font-weight: 500; color: var(--tertiary); margin: 0 0 8px; letter-spacing: -0.01em; }
.input {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--input-line);
  border-radius: 16px;
  height: 54px;
  padding: 0 16px;
  transition: border-color 0.2s var(--ease), outline-color 0.2s var(--ease);
  outline: 2px solid transparent;
  outline-offset: 2px;
}
.input:focus-within { border-color: #4a5565; outline-color: color-mix(in srgb, #4a5565 60%, transparent); }
.input .at { color: var(--tertiary); font-weight: 600; margin-right: 2px; }
.input input { border: 0; outline: 0; background: transparent; width: 100%; height: 52px; font-size: 16px; color: var(--title); }
.input input::placeholder { color: var(--tertiary); }
.input.locked { background: var(--surface); border-color: transparent; color: var(--muted); justify-content: space-between; font-size: 15px; }
button.input.locked { width: 100%; cursor: pointer; font: inherit; text-align: left; }
.err { color: var(--error); font-size: 13px; font-weight: 500; margin: 8px 2px 0; display: flex; align-items: center; gap: 6px; }
.err:empty { display: none; }
.err.center { justify-content: center; }

.check { display: flex; gap: 12px; align-items: center; background: var(--panel); border-radius: 16px; padding: 16px; min-height: 56px; cursor: pointer; font-weight: 600; color: var(--title); margin-bottom: 8px; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; margin: 0; }
.terms { font-size: 13px; line-height: 1.6; color: var(--notice-ink); background: var(--panel); border: 1px solid var(--notice-line); border-radius: 16px; padding: 16px; margin: 0 0 16px; }
.terms dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.terms dt { font-weight: 600; color: var(--title); }
.terms dd { margin: 0; }

/* ---------- 칩, 알약 ---------- */
.chips { display: flex; gap: 8px; margin: 4px 0 16px; }
.chip { height: 36px; padding: 8px 16px; border: 0; border-radius: 12px; background: var(--surface); color: var(--body); font-size: 14px; line-height: 20px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.chip.on { background: var(--chip-on); color: #fff; }
.pill { font-size: 13px; font-weight: 600; color: var(--body); background: #fff; border-radius: 100px; padding: 4px 10px; white-space: nowrap; }

/* ---------- 목록 ---------- */
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li + li { margin-top: 8px; }
.list.compact li + li { margin-top: 0; }
.pick-school { width: 100%; text-align: left; border: 0; background: var(--panel); border-radius: 18px; padding: 12px 16px; min-height: 56px; display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; font-size: 16px; font-weight: 600; color: var(--title); }
@media (hover: hover) and (pointer: fine) { .pick-school:hover { background: var(--surface); } }
.pick-school .sido { font-style: normal; font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.sq-row { display: flex; justify-content: space-between; gap: 12px; padding: 16px 4px; min-height: 56px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 600; color: var(--title); }
.sq-row em { font-style: normal; color: var(--muted); font-size: 13px; font-weight: 500; }
.sq-row b { flex: none; }

/* 첫 화면 학교 목록 */
.school-rank { list-style: none; margin: 8px 0 0; padding: 0; }
.school-rank li { display: flex; gap: 12px; align-items: center; min-height: 56px; padding: 8px 0; }
.school-rank li + li { border-top: 1px solid var(--line); }
.sr-rank { width: 28px; height: 28px; border-radius: 12px; background: #fff; font-weight: 700; font-size: 13px; color: var(--title); display: grid; place-items: center; flex: none; font-variant-numeric: tabular-nums; }
.sr-main { flex: 1; min-width: 0; }
.sr-top { display: flex; align-items: baseline; gap: 6px; }
.sr-top b { font-size: 14px; color: var(--title); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-top em { font-style: normal; font-size: 12px; color: var(--muted); flex: none; }
.sr-top span { margin-left: auto; font-weight: 700; font-size: 14px; color: var(--ink); flex: none; }
.sr-bar, .bar { height: 4px; background: var(--line); border-radius: 100px; overflow: hidden; margin-top: 8px; }
.sr-bar i, .bar i { display: block; height: 100%; background: var(--title); border-radius: 100px; transition: width 0.45s var(--snap); }

/* 카운트다운 */
.count { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.count b { display: block; font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1.2; letter-spacing: -0.025em; }
.count span { font-size: 12px; color: var(--muted); font-weight: 500; }

.gauge { margin: 12px 0; }
.gauge-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; color: var(--title); }
.gauge-top em { font-style: normal; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

/* 하트 다섯 칸 */
.hearts { display: flex; justify-content: center; align-items: center; gap: 4px; margin: 8px 0 4px; }
.hearts b { font-size: 16px; font-weight: 700; margin-left: 4px; color: var(--ink); }
.num-emoji { width: 40px; height: 40px; vertical-align: -6px; margin-right: 6px; }

/* ---------- 3D 그림 ---------- */
.hero { position: relative; height: 168px; max-width: 300px; margin: 8px auto 0; }
.hero img { position: absolute; display: block; }
.hero-main { left: 50%; margin-left: -60px; top: 22px; animation: float 4.4s var(--ease) infinite; }
.float { animation: float 3.6s var(--ease) infinite; }
.f1 { left: 34px; top: 20px; animation-duration: 3.4s; }
.f2 { right: 40px; top: 6px; animation-duration: 4.2s; animation-delay: -1s; }
.f3 { right: 22px; top: 104px; animation-duration: 4.8s; animation-delay: -2s; }
.f4 { left: 58px; top: 120px; animation-duration: 3.9s; animation-delay: -0.5s; }
@keyframes float { 0%, 100% { translate: 0 0; rotate: -4deg; } 50% { translate: 0 -6px; rotate: 4deg; } }
.pop-emoji { display: block; margin: 4px auto 0; animation: pop-in 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes pop-in { from { scale: 0.2; rotate: -20deg; opacity: 0; } to { scale: 1; rotate: 0deg; opacity: 1; } }
.ok-mark { margin: 8px auto 0; width: 56px; }

/* 그림은 디코딩된 뒤 부드럽게 (뒤엔 회색 자리) */
#view img:not(.is-ready), .sheet img:not(.is-ready) { opacity: 0; }
#view img, .sheet img { transition: opacity 0.6s var(--ease); }

/* ---------- 홈 ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; padding: 8px 0 16px; }
.pf-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--surface); color: var(--muted); display: grid; place-items: center; font-size: 26px; font-weight: 700; flex: none; object-fit: cover; }
.pf-meta { display: flex; flex-direction: column; min-width: 0; }
.pf-meta > b { font-size: 18px; color: var(--title); letter-spacing: -0.025em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-name { font-size: 14px; color: var(--body); }
.pf-school { font-size: 14px; color: var(--muted); }
.pf-stats { display: flex; gap: 12px; font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.pf-stats b { color: var(--title); font-weight: 600; font-variant-numeric: tabular-nums; }
.pf-link { font-size: 13px; font-weight: 600; align-self: flex-start; padding: 12px 0; margin: -10px 0 -12px; color: var(--body); }
.school-line { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.8; margin: 8px 0 16px; }
.school-line b { color: var(--title); }
.preview-frame { width: 62%; margin: 8px auto 4px; border-radius: 18px; overflow: hidden; aspect-ratio: 9 / 16; background: var(--surface); }
.preview-frame .preview { width: 100%; height: 100%; display: block; }
.flash { animation: flash 1.2s var(--ease) 1; }
@keyframes flash { 0% { background: var(--line); } 100% { background: var(--panel); } }

/* 팔로우 */
.follow-card { background: var(--panel); border-radius: 16px; padding: 16px; margin: 24px 0; }
.follow-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 24px; flex: none; }
.avatar.sm { width: 40px; height: 40px; font-size: 17px; }
.follow-meta { display: flex; flex-direction: column; text-align: left; }
.follow-meta b { font-size: 16px; color: var(--title); }
.follow-meta span { font-size: 14px; color: var(--muted); }
.follow-card.compact .avatar { width: 44px; height: 44px; font-size: 19px; }
.follow-card.compact .follow-row { margin-bottom: 12px; }
.follow-link { display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: 16px; padding: 12px 16px; margin: 24px 0; color: var(--title); text-decoration: none; min-height: 64px; font-size: 15px; }
.follow-link small { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.follow-link > span:last-child { margin-left: auto; font-size: 22px; color: var(--tertiary); }

/* 결과: 봉투 */
.envelope { position: relative; width: 240px; height: 160px; margin: 120px auto 24px; perspective: 800px; cursor: pointer; border: 0; background: none; padding: 0; display: block; }
.env-body { position: absolute; inset: 0; background: var(--surface); border-radius: 18px; z-index: 2; overflow: hidden; }
.env-body::before, .env-body::after { content: ''; position: absolute; bottom: 0; width: 60%; height: 100%; background: var(--line); }
.env-body::before { left: 0; clip-path: polygon(0 0, 100% 62%, 100% 100%, 0 100%); }
.env-body::after { right: 0; clip-path: polygon(100% 0, 0 62%, 0 100%, 100% 100%); }
.env-flap { position: absolute; left: 0; right: 0; top: 0; height: 100px; background: var(--ink); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform 0.6s var(--ease) 0.1s; z-index: 4; border-radius: 18px 18px 0 0; }
.env-seal { position: absolute; left: 50%; top: 74px; transform: translate(-50%, -50%); z-index: 5; font-size: 34px; transition: opacity 0.3s var(--ease); color: #fff; }
.env-letter { position: absolute; left: 16px; right: 16px; top: 14px; height: 130px; background: #fff; border-radius: 12px; z-index: 1; transition: transform 0.7s cubic-bezier(0.2, 0.9, 0.2, 1.1) 0.5s; display: grid; place-items: center; font-weight: 700; color: var(--title); font-size: 15px; border: 1px solid var(--line); }
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .env-seal { opacity: 0; }
.envelope.open .env-letter { transform: translateY(-90px); z-index: 3; }
.envelope.locked { cursor: default; }
.envelope.locked .env-seal { font-size: 30px; }
.wiggle { animation: wiggle 2.6s var(--ease) infinite; }
@keyframes wiggle { 0%, 80%, 100% { rotate: 0deg; } 85% { rotate: -3deg; } 90% { rotate: 3deg; } 95% { rotate: -2deg; } }
.burst { position: fixed; pointer-events: none; z-index: 30; font-size: 22px; color: var(--ink); animation: burst 1.1s var(--snap) forwards; }
@keyframes burst { from { opacity: 1; transform: translate(0, 0) scale(0.6); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.3); } }
.partner { display: flex; justify-content: space-between; align-items: center; background: var(--panel); border-radius: 18px; padding: 16px; font-size: 18px; font-weight: 700; text-decoration: none; color: var(--title); min-height: 64px; }
.partner span { font-size: 14px; color: var(--muted); font-weight: 600; }
.reveal-in > * { animation: rise 0.6s var(--snap) both; }

footer { margin-top: 36px; text-align: center; font-size: 13px; }
footer a { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; text-decoration: none; }
.closed { min-height: 70dvh; display: grid; place-items: center; text-align: center; }

/* ---------- 인증 화면: 태그 안내 ---------- */
.vf-head { text-align: left; margin-bottom: 16px; }
.vf-head h2 { margin: 0 0 12px; }
.tag-pill { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 12px; border: 0; border-radius: 100px; background: var(--surface); color: var(--title); font-size: 16px; cursor: pointer; }
.tag-pill b { font-weight: 700; letter-spacing: -0.02em; }
.tag-pill svg { color: var(--tertiary); }
.tag-heart { width: 18px; height: 18px; }
.vf-sub { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 8px 0 0; }
.vf-hint { color: var(--muted); font-size: 14px; text-align: center; margin: 12px 0 0; }
.segs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: -8px 0 -6px; }
.seg { height: 44px; padding: 0; display: flex; align-items: center; border: 0; cursor: pointer; background: linear-gradient(var(--line), var(--line)) no-repeat center / 100% 4px; }
.seg i { display: block; height: 4px; width: 0; border-radius: 100px; background: var(--title); transition: width 0.12s linear; }
.seg-cap { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; font-size: 15px; font-weight: 600; color: var(--title); min-height: 24px; }
.seg-cap b { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.device { background: var(--surface); border-radius: 36px; padding: 10px; max-width: 320px; margin: 0 auto; }
.dv-screen { background: #fff; border-radius: 28px; padding: 8px 16px 12px; overflow: hidden; }
.dv-status { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; color: var(--title); padding: 2px 4px 6px; }
.dv-dots { display: flex; gap: 3px; }
.dv-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--title); }
.dv-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; font-size: 14px; padding: 6px 0 10px; color: var(--title); }
.dv-nav > span:first-child { color: var(--muted); }
.dv-nav b { font-weight: 700; }
.dv-done { justify-self: end; font-weight: 700; padding: 4px 10px; border-radius: 100px; transition: background 0.4s var(--ease), color 0.4s var(--ease); }
.dv-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--surface); color: var(--tertiary); display: grid; place-items: center; font-size: 22px; font-weight: 700; margin: 2px auto 6px; }
.dv-photo { text-align: center; font-size: 13px; font-weight: 600; color: var(--title); margin: 0 0 8px; }
.dv-rows { border-top: 1px solid var(--line); }
.dv-row { display: grid; grid-template-columns: 84px 1fr; align-items: center; min-height: 42px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--title); }
.dv-row > span { color: var(--muted); font-size: 13px; }
.dv-row em { font-style: normal; color: var(--tertiary); }
.dv-row b { font-weight: 600; min-width: 0; white-space: nowrap; }
.dv-typed { background-image: linear-gradient(var(--ink), var(--ink)); background-size: 0 2px; background-repeat: no-repeat; background-position: 0 100%; padding-bottom: 2px; transition: background-size 0.7s cubic-bezier(0.65, 0, 0.35, 1); }
.dv-caret { display: inline-block; width: 2px; height: 1.1em; background: var(--ink); vertical-align: -3px; margin-left: 1px; opacity: 0; }
.device[data-step="1"] .dv-caret { opacity: 1; animation: caret 1s steps(1) infinite; }
.device.typing .dv-caret { animation: none; }
.device.marked .dv-typed { background-size: 100% 2px; }
.device.marked .dv-caret { opacity: 0; animation: none; }
.device[data-step="2"] .dv-done { background: var(--ink); color: #fff; animation: done-pulse 1.4s var(--ease) infinite; }
@keyframes caret { 50% { opacity: 0; } }
@keyframes done-pulse { 0%, 100% { scale: 1; } 50% { scale: 1.08; } }

/* ---------- 시트, 대화상자 ---------- */
.sheet { position: fixed; inset: 0; background: rgb(16 24 40 / 48%); z-index: 40; display: grid; place-items: end center; padding: 16px 0 0; animation: fade-in 0.2s var(--ease); }
.sheet-in { position: relative; background: #fff; border-radius: 20px 20px 0 0; padding: 24px; padding-top: 32px; width: 100%; max-width: 500px; max-height: 94dvh; overflow-y: auto; text-align: center; padding-bottom: calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 16px 60px #00000012; animation: sheet-in 0.52s cubic-bezier(0.2, 0.8, 0.2, 1) both; transform-origin: bottom center; }
.sheet-in::before { content: ''; position: absolute; top: 10px; left: 50%; width: 80px; height: 8px; margin-left: -40px; border-radius: 100px; background: var(--surface); }
@keyframes sheet-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
.sheet-title { font-size: 20px; line-height: 1.4; font-weight: 600; color: var(--title); margin: 0 0 12px; }
.sheet-img { width: auto; height: min(38dvh, 340px); aspect-ratio: 9 / 16; border-radius: 12px; margin: 4px auto 8px; display: block; background: var(--surface); }
.sheet-steps { list-style: none; padding: 0; margin: 16px 0 8px; text-align: left; display: grid; gap: 8px; }
.sheet-steps li { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; color: var(--title); }
.sheet-steps b { width: 24px; height: 24px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 12px; flex: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

/* ---------- 소개 확인 중 로딩 ---------- */
.checking { position: fixed; inset: 0; z-index: 50; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 24px; animation: fade-in 0.15s var(--ease) both; }
.checking.out { animation: fade-out 0.15s var(--ease) both; }
.ck-stage { position: relative; width: 180px; height: 180px; perspective: 600px; margin-bottom: 16px; }
.ck-letter { position: absolute; left: 42px; top: 42px; animation: ck-spin 1.6s var(--ease) infinite; }
@keyframes ck-spin { 0% { transform: rotateY(0deg); } 50% { transform: rotateY(180deg); } 100% { transform: rotateY(360deg); } }
.ck-orbit { position: absolute; inset: 0; animation: ck-orbit 3.2s linear infinite; }
@keyframes ck-orbit { to { transform: rotate(360deg); } }
.ck-heart { position: absolute; }
.ck-heart.o1 { left: 77px; top: 0; }
.ck-heart.o2 { left: 6px; top: 118px; width: 20px; height: 20px; }
.ck-heart.o3 { right: 6px; top: 118px; width: 22px; height: 22px; }
.ck-msg { font-size: 18px; font-weight: 600; letter-spacing: -0.025em; color: var(--title); margin: 0; text-align: center; }
.ck-slow { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
@keyframes ck-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---------- 화면 등장: 흐림 + 살짝 위로, 목록은 40ms 씩 ---------- */
@keyframes rise { 0% { opacity: 0; filter: blur(4px); transform: translateY(7px); } 35% { filter: blur(0); } 100% { opacity: 1; filter: none; transform: none; } }
.screen > * { animation: rise 0.6s var(--snap) both; }
.screen > :nth-child(2) { animation-delay: 40ms; }
.screen > :nth-child(3) { animation-delay: 80ms; }
.screen > :nth-child(4) { animation-delay: 120ms; }
.screen > :nth-child(5) { animation-delay: 160ms; }
.screen > :nth-child(6) { animation-delay: 200ms; }
.screen > :nth-child(n + 7) { animation-delay: 240ms; }

/* ---------- 작은 화면 (iPhone SE 375×667 등) ---------- */
@media (max-height: 740px) {
  .wrap { padding-top: 56px; }
  h1, h2 { font-size: 22px; margin: 2px 0 6px; }
  h1.hero-title { font-size: 26px; }
  .lead { font-size: 15px; margin-bottom: 8px; }
  .field { margin-bottom: 12px; }
  .vf-head { margin-bottom: 8px; }
  .vf-head h2 { margin-bottom: 8px; }
  .tag-pill { height: 40px; font-size: 15px; }
  .vf-sub { font-size: 13px; margin-top: 4px; line-height: 1.6; }
  .seg-cap { margin-bottom: 8px; font-size: 14px; }
  .device { max-width: 290px; border-radius: 30px; padding: 8px; }
  .dv-screen { border-radius: 24px; padding: 6px 14px 8px; }
  .dv-avatar { width: 44px; height: 44px; font-size: 18px; margin-bottom: 4px; }
  .dv-photo { display: none; }
  .dv-row { min-height: 38px; }
}
@media (max-width: 360px) {
  .count b { font-size: 24px; }
  .actionbar-in > .btn { font-size: 15px; padding: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .checking .ck-letter { animation: ck-pulse 1.6s ease-in-out infinite !important; }
  #view img, .sheet img { opacity: 1 !important; }
}
/* 등장 애니메이션과 자기 애니메이션이 겹치는 요소 */
.screen > .wiggle { animation: rise 0.6s var(--snap) both, wiggle 2.6s var(--ease) 0.6s infinite; }
.screen > .flash, .screen > .card.flash { animation: flash 1.2s var(--ease) 1; }
/* 시트가 열려 있으면 토스트는 위쪽에 */
body:has(.sheet) .toast { bottom: auto; top: calc(16px + env(safe-area-inset-top)); }
.sheet-img { border: 1px solid var(--line); }
/* 학교 (결과 열림에만): 열렸어요 알약, 학교 단계의 고른 학교 */
.rank-on { font-style: normal; font-size: 11px; font-weight: 700; background: var(--ink); color: #fff; border-radius: 100px; padding: 2px 8px; margin-right: 6px; vertical-align: 1px; }
.school-line .link { font-size: 13px; margin-left: 6px; color: var(--muted); }
.picked-school { display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--notice-line); border-radius: 16px; padding: 12px 16px; margin: 8px 0 16px; }
.picked-school b { font-size: 16px; color: var(--title); }
.pick-school.on { background: var(--chip-on); color: #fff; }
.pick-school.on .sido, .pick-school.on .unit { color: #cbd2dc; }
.pick-school.on mark { background: #fff; color: var(--ink); }
.actionbar-in.stacked > .btn { flex: none; width: 100%; }
