.stage { position: fixed; inset: 0; overflow: hidden; touch-action: manipulation; }
.stage canvas.full { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25); pointer-events: none;
}
.top > * { pointer-events: auto; }
.dots { display: flex; gap: 6px; transition: opacity 0.5s var(--ease); }
.dots.hide { opacity: 0; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); transition: background 0.5s var(--ease), transform 0.5s var(--ease); }
.dots i.on { background: #fff; transform: scale(1.25); }

.panel {
  position: fixed; z-index: 5;
  left: 50%; bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(calc(100% - 24px), 440px);
  transform: translateX(-50%);
  max-height: calc(100dvh - 84px); overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 18px 16px;
  border-radius: 28px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  will-change: transform, opacity; /* 따로 합성해서 뒤의 애니메이션이 카드를 다시 그리게 하지 않는다 */
  transition: opacity 0.45s var(--ease), translate 0.55s var(--ease);
}
.panel.away { opacity: 0; translate: 0 24px; pointer-events: none; }
.panel.away.prerender { opacity: 0.004; } /* 완전히 투명하면 브라우저가 안 그려서, 거의 안 보이게만 둔다 */
.panel.slim {
  top: calc(54px + env(safe-area-inset-top)); bottom: auto; padding: 12px 16px 14px; border-radius: 22px;
  background: rgba(20, 18, 44, 0.62);
}
.panel.slim.away { translate: 0 -16px; }
.panel.slim .qhead { margin-bottom: 2px; }
.panel.slim .q { margin: 0; font-size: 21px; }
@media (min-width: 720px) { .panel:not(.slim) { bottom: 6vh; padding: 26px 24px 22px; } }

.kicker { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.03em; }
h1 { margin: 0; font-size: clamp(30px, 8vw, 40px); line-height: 1.1; letter-spacing: -0.03em; font-weight: 800; }
.sub, .desc { margin: 8px 0 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-soft); }

.primary, .ghost {
  display: block; width: 100%; border: 0; border-radius: 18px; padding: 15px; font-size: 16px; font-weight: 700; text-align: center; text-decoration: none;
  transition: transform 0.25s var(--ease), background 0.3s;
}
.primary { background: #fff; color: #17142e; margin-top: 18px; }
.ghost { background: rgba(255, 255, 255, 0.1); margin-top: 8px; color: var(--ink); }
.primary:active, .ghost:active { transform: scale(0.97); }
.row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; }
.row .primary, .row .ghost { margin: 0; padding: 14px 16px; font-size: 15px; }
.ghost.icon { white-space: nowrap; }

.friend { display: flex; gap: 10px; align-items: center; margin-top: 16px; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.08); font-size: 14px; line-height: 1.45; }
.sw {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.sw i { font-style: normal; font-size: 18px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.sw.big { width: 52px; height: 52px; }
.sw.big i { font-size: 28px; }

.qhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.back { border: 0; background: none; padding: 4px 8px 4px 0; font-size: 20px; opacity: 0.8; }
.back[disabled] { visibility: hidden; }
.count { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.q { margin: 0 0 16px; font-size: 24px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 800; }
.qhint { margin: 4px 0 0; font-size: 13px; color: var(--ink-soft); }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opts.n3 > :last-child { grid-column: 1 / -1; }
.opt {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  border: 1px solid var(--glass-line); background: rgba(255, 255, 255, 0.07);
  border-radius: 20px; padding: 16px 10px 14px; font-size: 15px; font-weight: 600; line-height: 1.3; text-align: center;
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease), background 0.3s, border-color 0.3s;
}
.opt .sw { width: 46px; height: 46px; transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease); }
.opt:hover { background: rgba(255, 255, 255, 0.12); }
.opt:active { transform: scale(0.96); }
.opt.picked { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.6); }
.opt.picked .sw { transform: scale(1.18); box-shadow: 0 0 28px 4px rgba(255, 255, 255, 0.35); }
.opts.chosen .opt:not(.picked) { opacity: 0.25; transform: scale(0.94); }

#reveal {
  position: fixed; inset: 0; z-index: 4; display: grid; place-content: center; text-align: center; padding: 0 20px;
  pointer-events: none; opacity: 0; transition: opacity 0.9s var(--ease), transform 1.2s var(--ease);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45); transform: scale(0.96); will-change: transform, opacity;
}
#reveal.show { opacity: 1; transform: none; }
#reveal p { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--ink-soft); }
#reveal b { font-size: clamp(40px, 12vw, 68px); letter-spacing: -0.04em; font-weight: 800; line-height: 1.1; }

.rhead { display: flex; align-items: center; gap: 12px; }
.pairs { display: grid; gap: 6px; margin-top: 14px; }
.pair {
  display: flex; gap: 12px; align-items: center; text-align: left; width: 100%;
  border: 1px solid transparent; background: rgba(255, 255, 255, 0.08); border-radius: 16px; padding: 9px 12px;
  transition: border-color 0.3s, background 0.3s;
}
.pair.previewing { border-color: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.16); }
.pair .sw { width: 32px; height: 32px; }
.pair small { display: inline; font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; margin-right: 6px; }
.pair.good small { color: #a8ffcf; }
.pair.bad small { color: #ffb0b8; }
.pair b { display: inline; font-size: 15px; }
.pair span.why { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; line-height: 1.35; }
.hint { margin: 0 2px 2px; font-size: 11.5px; color: var(--ink-soft); text-align: right; }

.score { display: flex; align-items: baseline; gap: 2px; margin-top: 4px; }
.score span { font-size: 64px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.score small { font-size: 24px; font-weight: 700; color: var(--ink-soft); }
.duo { margin: 10px 0 0; font-size: 17px; }
.duo em { font-style: normal; font-size: 12px; color: var(--ink-soft); margin-right: 4px; }

.next { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 8px -18px 0; padding: 0 18px 2px; }
.next::-webkit-scrollbar { display: none; }
.next a {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 7px 12px 7px 7px; font-size: 13px !important; border-radius: 999px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--a) 35%, transparent), color-mix(in srgb, var(--b) 35%, transparent));
  border: 1px solid rgba(255, 255, 255, 0.14); font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.next a i { font-style: normal; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.18); font-size: 13px; }

.swap-in { animation: swapIn 0.5s var(--ease) both; will-change: transform, opacity; }
@keyframes swapIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.swap-out { animation: swapOut 0.24s ease-in both; }
@keyframes swapOut { to { opacity: 0; transform: translateY(-8px); } }

.modal {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: end center; padding: 12px;
  background: rgba(6, 5, 18, 0.6); opacity: 0; transition: opacity 0.3s var(--ease);
}
.modal.show { opacity: 1; }
.modal .sheet {
  width: min(100%, 440px); max-height: calc(100dvh - 24px); overflow: auto; border-radius: 26px; padding: 18px;
  background: #1b1838; border: 1px solid var(--glass-line); transform: translateY(30px); transition: transform 0.4s var(--ease);
  margin-bottom: env(safe-area-inset-bottom);
}
.modal.show .sheet { transform: none; }
.modal p { margin: 0 0 12px; font-weight: 700; text-align: center; }
.modal .shot { display: block; width: 100%; border-radius: 16px; -webkit-touch-callout: default; }
.modal .primary { margin-top: 12px; }
.copybox { width: 100%; padding: 14px; border-radius: 14px; border: 1px solid var(--glass-line); background: rgba(255,255,255,.06); color: var(--ink); font: inherit; font-size: 14px; }

body.og .top, body.og .panel, body.og #reveal, body.og .stage { display: none !important; }
#ogc { position: fixed; left: 0; top: 0; width: 1200px; height: 630px; z-index: 50; }
#ogt { position: fixed; left: 64px; bottom: 56px; z-index: 9; text-shadow: 0 2px 30px rgba(0, 0, 0, 0.5); }
#ogt span { display: block; font-size: 26px; font-weight: 600; opacity: 0.85; }
#ogt b { display: block; font-size: 88px; letter-spacing: -0.04em; line-height: 1.05; margin-top: 6px; }
#ogt em { display: block; font-style: normal; font-size: 34px; font-weight: 700; opacity: 0.85; margin-top: 4px; }

/* 결과 카드: 손잡이, 내리기(peek), 링크 줄 */
.grab { display: block; width: 100%; border: 0; background: none; padding: 0 0 10px; margin-top: -8px; cursor: pointer; }
.grab i { display: block; width: 40px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.35); margin: 0 auto; }
.panel { transition: opacity 0.45s var(--ease), translate 0.55s var(--ease), transform 0.55s var(--ease); }
.panel.peek { translate: 0 calc(100% - 128px); }
.panel.peek .grab i { background: rgba(255,255,255,.7); }
.rhead .sw.big { width: 44px; height: 44px; }
.rhead .sw.big i { font-size: 24px; }
.rhead h1 { font-size: clamp(28px, 7.6vw, 36px); }
.desc { font-size: 15px; margin-top: 6px; }
.pairs { margin-top: 12px; }
.pair { padding: 8px 10px 8px 10px; }
.pair .eye { margin-left: auto; flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.4); position: relative; font-style: normal; }
.pair .eye::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: rgba(255,255,255,.6); }
.pair.previewing .eye { border-color: #fff; }
.row { margin-top: 12px; }
.links { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding: 0 2px; }
.links span { font-size: 12px; font-weight: 700; color: var(--ink-soft); letter-spacing: .03em; }
.link { border: 0; background: none; padding: 6px 0; font-size: 14px; font-weight: 700; color: var(--ink); opacity: .85; }
.score span { font-size: 58px; }

.ic { display: inline-block; vertical-align: -0.18em; flex: none; }
.back .ic { vertical-align: middle; }
.ghost.icon, .link, .chip.clear { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.links span { display: inline-flex; align-items: center; gap: 4px; }

/* 이모지 미리 그리기용: 화면 안에 있어야 실제로 그려지므로 거의 투명하게 둔다 */
.emoji-warm { position: fixed; left: 0; bottom: 0; opacity: 0.01; pointer-events: none; z-index: 1; white-space: nowrap; line-height: 1; }
