@font-face {
  font-family: "Pretendard Sub";
  src: url("fonts/pretendard-sub.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0b0e;
  --panel: #141419;
  --line: rgba(255, 255, 255, .1);
  --line-2: rgba(255, 255, 255, .26);
  --fg: #f3f3f6;
  --dim: #8f8f99;
  --gold: #ffc94d;
  --gold-hi: #ffd879;
  --ink: #1b1404;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --pad: 24px;
  /* 무대 확대 칸 비율(이름 칸·결제 카드 둘레·방송 화면 전체) */
  --ar-name: 570 / 246;
  --ar-alert: 436 / 258;
  --ar-full: 1080 / 1920;
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--fg);
  font-family: "Pretendard Sub", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: max(32px, env(safe-area-inset-top)) max(var(--pad), env(safe-area-inset-right)) max(64px, env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-left));
  display: grid;
  gap: 64px;
}
main { display: grid; gap: 64px; }
.num { color: var(--gold); font-weight: 800; }

/* ---------- 맨 위 한눈에 ---------- */
.top { display: grid; gap: 20px; }
h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
h1 b { color: var(--gold); font-weight: 800; }

.glance { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.g {
  display: grid;
  gap: 12px;
  padding: 10px 10px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: transform 160ms var(--ease-out), border-color 160ms ease;
}
.g:active { transform: scale(.98); }
.thumb { display: block; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: #000; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb.empty {
  display: grid;
  place-items: center;
  background: radial-gradient(120% 90% at 50% 100%, rgba(255, 201, 77, .14), transparent 60%), #000;
}
.ghost { font-size: 96px; font-weight: 800; line-height: 1; color: rgba(255, 201, 77, .28); }
.cap { display: flex; align-items: center; gap: 10px; padding: 0 4px; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.cap .num { font-size: 30px; line-height: 1; }

/* ---------- 칸 셋 ---------- */
.part { display: grid; gap: 16px; scroll-margin-top: 20px; }
.phead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h2 { margin: 0; display: flex; align-items: center; gap: 12px; font-size: 26px; font-weight: 800; letter-spacing: -.015em; }
h2 .num { font-size: 42px; line-height: 1; }

.replay {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 201, 77, .45);
  background: rgba(255, 201, 77, .08);
  color: var(--gold);
  font-size: 15px;
  font-weight: 700;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, color 160ms ease;
}
.replay svg { width: 18px; height: 18px; }
.replay:active { transform: scale(.97); }
.ended .replay { background: var(--gold); color: var(--ink); box-shadow: 0 0 0 4px rgba(255, 201, 77, .18); }

.opts { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 10px; }
.opts.n4 { --n: 4; }
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .035);
  text-align: left;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.opt .code { flex: none; font-size: 24px; font-weight: 800; letter-spacing: -.01em; color: var(--gold); transition: color 150ms ease; }
.opt .nm { font-size: 16px; font-weight: 700; line-height: 1.25; }
.opt:active { transform: scale(.97); }
.opt[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.opt[aria-pressed="true"] .code { color: var(--ink); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; cursor: pointer; }
.pane { margin: 0; display: grid; gap: 8px; align-content: start; min-width: 0; }
figcaption { display: flex; align-items: baseline; gap: 8px; min-height: 26px; font-size: 16px; font-weight: 700; color: var(--dim); }
.pick figcaption { color: var(--fg); }
figcaption .code { font-size: 20px; font-weight: 800; color: var(--gold); }

.screen {
  --ar: var(--ar-alert);
  position: relative;
  aspect-ratio: var(--ar);
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
}
.f-name .screen { --ar: var(--ar-name); }
.full .screen { --ar: var(--ar-full); }
.pick .screen, .full .screen { border-color: rgba(255, 201, 77, .55); }
.screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease-out);
}
.screen iframe.on { opacity: 1; }
.again {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms var(--ease-out);
}
.again svg { width: 48px; height: 48px; color: rgba(255, 255, 255, .85); }
.ended .again { opacity: 1; transition-duration: 220ms; }

/* ---------- 골라서 합쳐 보기 ---------- */
.mixgrid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start; }
.mixside { display: grid; gap: 14px; align-content: start; }
.mrow { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 12px; }
.mrow > .num { font-size: 38px; line-height: 1; text-align: center; }
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chips .opt { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 68px; padding: 8px 14px; }
.chips .code { font-size: 22px; }
.chips .nm { font-size: 13px; font-weight: 600; color: var(--dim); transition: color 150ms ease; }
.chips .opt[aria-pressed="true"] .nm { color: rgba(27, 20, 4, .78); }

.combo {
  margin-top: 6px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 201, 77, .4);
  background: rgba(255, 201, 77, .06);
}
#combo { font-size: 42px; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; color: var(--gold); white-space: nowrap; }
.copy {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.copy .ic { display: inline-grid; width: 20px; height: 20px; }
.copy svg { width: 20px; height: 20px; }
.copy:active { transform: scale(.97); }
.copy.ok .ic { animation: pop 220ms var(--ease-out); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (hover: hover) and (pointer: fine) {
  .g:hover { border-color: var(--line-2); }
  .opt:hover { border-color: var(--line-2); }
  .opt[aria-pressed="true"]:hover { border-color: var(--gold); }
  .replay:hover { background: rgba(255, 201, 77, .16); }
  .ended .replay:hover, .copy:hover, .opt[aria-pressed="true"]:hover { background: var(--gold-hi); }
}

/* ---------- 휴대폰 ---------- */
@media (max-width: 760px) {
  :root { --pad: 14px; }
  .wrap { gap: 44px; padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(48px, env(safe-area-inset-bottom)); }
  main { gap: 48px; }
  h1 { font-size: 26px; }
  .top { gap: 14px; }
  .glance { grid-template-columns: 1fr; gap: 10px; }
  .g { grid-template-columns: 128px minmax(0, 1fr); align-items: center; gap: 14px; padding: 8px 12px 8px 8px; border-radius: 16px; }
  .thumb { border-radius: 10px; }
  .ghost { font-size: 46px; }
  .cap { font-size: 18px; padding: 0; }
  .cap .num { font-size: 28px; }

  h2 { font-size: 20px; gap: 8px; }
  h2 .num { font-size: 34px; }
  .replay { height: 38px; padding: 0 14px; font-size: 14px; }
  .opts { gap: 8px; }
  .opts.n4 { --n: 2; }
  .opt { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 64px; padding: 8px 12px; border-radius: 12px; }
  .opt .code { font-size: 20px; }
  .opt .nm { font-size: 13px; }
  .pair { grid-template-columns: 1fr; gap: 12px; }
  .screen { border-radius: 12px; }

  .mixgrid { grid-template-columns: 1fr; gap: 20px; }
  .mrow { grid-template-columns: 34px minmax(0, 1fr); gap: 8px; }
  .mrow > .num { font-size: 28px; }
  .chips { gap: 6px; }
  .chips .opt { min-height: 60px; padding: 7px 8px; }
  .chips .code { font-size: 18px; }
  .chips .nm { font-size: 11.5px; }
  .combo { padding: 14px 16px; gap: 10px; }
  #combo { font-size: 30px; }
  .copy { height: 44px; padding: 0 16px; font-size: 16px; }
  .full { width: 100%; max-width: 420px; justify-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  .g:active, .opt:active, .replay:active, .copy:active { transform: none; }
  .copy.ok .ic { animation: none; }
}
