@font-face {
  font-family: 'NSR';
  src: url('../fonts/NanumSquareRoundR.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'NSR';
  src: url('../fonts/NanumSquareRoundB.woff2') format('woff2');
  font-weight: 700 900;
  font-display: swap;
}

:root {
  --bg: #fff8ef;
  --ink: #2f2a3b;
  --ink-soft: #6d6578;
  --line: #efe3d3;
  --card: #ffffff;
  --accent: #ff7a45;
  --accent-2: #ffb547;
  --accent-ink: #ffffff;
  --warn-bg: #fff3e0;
  --warn-ink: #b45309;
  --danger: #e5484d;
  --shadow: 0 10px 30px rgba(120, 80, 40, 0.10), 0 2px 6px rgba(120, 80, 40, 0.06);
  /* 1920×1080 기준 단위 (추첨 화면 HUD) */
  --u: min(calc(100vw / 1920), calc(100vh / 1080));
  font-family: 'NSR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; }

.screen { display: none; }
.screen.active { display: block; }

/* ====================================================== 설정 화면 */
#setup {
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 181, 71, 0.16), transparent 32%),
    radial-gradient(circle at 88% 8%, rgba(255, 122, 69, 0.12), transparent 30%),
    var(--bg);
}
.setup-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(16px, 2.6vh, 36px) clamp(16px, 3vw, 48px) 28px;
}
.hero { text-align: center; position: relative; }
#heroCats { width: min(560px, 90%); height: auto; display: block; margin: 0 auto -6px; cursor: pointer; }
.hero h1 .e { -webkit-text-fill-color: initial; color: initial; background: none; }
.hero h1 .g {
  background: linear-gradient(90deg, #ff7a45, #ff5e7e 55%, #a66cff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero h1 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(34px, 4.2vw, 68px);
  letter-spacing: 0.02em;
}
.hero .sub {
  margin: 6px 0 0;
  font-size: clamp(16px, 1.5vw, 24px);
  color: var(--ink-soft);
  font-weight: 700;
}

.panels {
  margin-top: clamp(16px, 2.6vh, 32px);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(16px, 2vw, 28px);
  align-items: start;
}
@media (max-width: 900px) { .panels { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: clamp(18px, 2vw, 28px);
}
.card h2 { margin: 0; font-size: 22px; font-weight: 800; }
.card-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.hint { color: var(--ink-soft); font-size: 14px; }

textarea#names {
  margin-top: 14px;
  width: 100%;
  height: clamp(240px, 40vh, 460px);
  resize: vertical;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  font: 600 19px/1.6 'NSR', sans-serif;
  color: var(--ink);
  background: #fffdfa;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea#names:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(255, 181, 71, 0.2); }

.count-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 12px; flex-wrap: wrap; }
.count { font-size: 22px; font-weight: 800; }
.warn-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.warn-list li {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 700;
}

.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 18px 0 8px; }
.step {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 3px 0 #eadcc9;
  transition: transform .08s, background .15s;
}
.step:hover { background: #fff4e8; }
.step:active { transform: translateY(2px); box-shadow: 0 1px 0 #eadcc9; }
.step:disabled { opacity: .35; cursor: default; }
.num, .num-input {
  min-width: 150px;
  height: 76px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(180deg, #fff3e6, #ffe6cc);
  font-size: 44px;
  font-weight: 800;
  color: #d35a22;
  text-align: center;
}
.num-input { width: 150px; outline: 3px solid var(--accent-2); font-family: 'NSR', sans-serif; }
.summary { text-align: center; font-size: 18px; font-weight: 700; margin: 10px 0 18px; color: var(--ink); min-height: 1.4em; }
.summary b { color: var(--accent); }

.options { display: flex; flex-direction: column; gap: 4px; border-top: 1px dashed var(--line); padding-top: 14px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 9px 4px; cursor: pointer; user-select: none; font-size: 17px; font-weight: 700; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .box {
  width: 26px; height: 26px; flex: none;
  border-radius: 8px;
  border: 2px solid #d9c9b5;
  background: #fff;
  display: grid; place-items: center;
  transition: background .15s, border-color .15s;
}
.opt input:checked + .box { background: var(--accent); border-color: var(--accent); }
.opt input:checked + .box::after { content: ''; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg); }
.opt input:focus-visible + .box { outline: 3px solid rgba(255, 122, 69, 0.4); outline-offset: 2px; }
.opt .txt { flex: 1; }
.link { border: none; background: none; color: var(--accent); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; padding: 4px; }

.error { color: var(--danger); font-weight: 700; min-height: 1.3em; margin: 12px 0 6px; text-align: center; font-size: 15px; }

.btn {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 10px 18px;
  font-weight: 800;
  font-size: 16px;
  transition: transform .08s, background .15s, box-shadow .15s;
}
.btn:hover { background: #fff6ec; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f5d0d0; }
.btn.danger:hover { background: #fff1f1; }
.btn.danger-fill { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.primary {
  display: block;
  width: 100%;
  padding: 20px;
  font-size: 26px;
  border: none;
  color: var(--accent-ink);
  border-radius: 20px;
  background: linear-gradient(180deg, #ff9a5c, #ff6a3d);
  box-shadow: 0 6px 0 #d9502a, 0 14px 30px rgba(255, 106, 61, 0.35);
}
.btn.primary:hover { filter: brightness(1.04); background: linear-gradient(180deg, #ff9a5c, #ff6a3d); }
.btn.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #d9502a, 0 8px 18px rgba(255, 106, 61, 0.3); }
.btn.primary:disabled { filter: grayscale(.6); opacity: .6; cursor: not-allowed; }
#btnReset { display: block; margin: 14px auto 0; font-size: 14px; padding: 8px 16px; }
.footnote { text-align: center; color: var(--ink-soft); font-size: 13px; margin-top: 22px; }

/* ====================================================== 대화상자 */
.dlg {
  border: none;
  border-radius: 22px;
  padding: 22px 24px;
  width: min(520px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(40, 20, 10, 0.3);
  color: var(--ink);
  font-family: 'NSR', sans-serif;
}
.dlg.wide { width: min(1100px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(40, 28, 20, 0.45); }
.dlg h3 { margin: 0 0 8px; font-size: 22px; }
.dlg p { font-size: 16px; line-height: 1.6; color: var(--ink-soft); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dlg .x { border: none; background: #f6efe6; width: 38px; height: 38px; border-radius: 50%; font-size: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 70vh;
  overflow: auto;
  padding: 4px;
}
.list-item {
  display: flex; align-items: center; gap: 8px;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px 10px 6px 6px;
  font-weight: 700;
  font-size: 16px;
  min-width: 0;
}
.list-item .no { color: var(--ink-soft); font-size: 12px; min-width: 20px; text-align: right; }
.list-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item.dup { background: var(--warn-bg); border-color: #ffd79a; }
.list-item.ex { opacity: .5; }
.list-item .tag { font-size: 11px; background: #eee; border-radius: 6px; padding: 2px 5px; white-space: nowrap; }
.prev-body { max-height: 50vh; overflow: auto; }
.prev-body .round { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.prev-body .round .when { font-size: 13px; color: var(--ink-soft); }
.prev-body .round .who { font-size: 17px; font-weight: 800; margin-top: 4px; }
.prev-body .empty { color: var(--ink-soft); padding: 20px 0; text-align: center; }

.count-btns { display: flex; gap: 8px; flex-wrap: wrap; }
/* 전체 삭제 */
.btn.clear-all { color: var(--danger); border-color: #f5d0d0; }
.btn.clear-all:hover { background: #fff1f1; }
/* 참가자 이름 칩 (✕로 한 명씩 삭제) */
.name-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 12px; padding: 10px;
  max-height: 168px; overflow: auto;
  border: 1px dashed var(--line); border-radius: 14px;
  background: #fffaf3;
}
.name-chips:empty { display: none; }
.name-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 4px 3px 12px; font-size: 15px; font-weight: 700;
}
.name-chip.dup { background: var(--warn-bg); border-color: #ffd79a; }
.name-chip button { border: none; background: #f6efe6; width: 22px; height: 22px; border-radius: 50%; font-size: 11px; line-height: 1; padding: 0; }
.name-chip button:hover { background: #ffe1e1; color: var(--danger); }
.dlg.mid { width: min(720px, calc(100vw - 32px)); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { filter: brightness(1.05); background: var(--accent); }
.btn.arm { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.saved-body { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow: auto; }
.saved-body .empty { color: var(--ink-soft); padding: 24px 0; text-align: center; }
.saved-item {
  display: flex; align-items: center; gap: 12px;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}
.saved-item .info { flex: 1; min-width: 0; }
.saved-item .ttl { font-size: 18px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-item .sub { font-size: 13px; color: var(--ink-soft); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-item .acts { display: flex; gap: 6px; flex-shrink: 0; }
.saved-item .btn { font-size: 14px; padding: 7px 12px; }
.saved-item.def { border-color: var(--accent-2); background: #fff4dc; }
.saved-item .badge { font-size: 12px; font-weight: 800; color: #fff; background: var(--accent-2); border-radius: 8px; padding: 2px 7px; margin-left: 6px; vertical-align: 2px; }
.loaded-note { margin: 8px 0 0; font-size: 15px; font-weight: 700; color: var(--accent); min-height: 0; }
.loaded-note:empty { display: none; }
.dlg p.saved-note { margin: 10px 0 0; font-size: 14px; min-height: 1.4em; }
.dlg p.saved-local { margin: 4px 0 0; font-size: 13px; color: var(--ink-soft); }
.saved-io { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.saved-io .btn { font-size: 14px; padding: 7px 12px; }
.ed-label { display: block; font-size: 14px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.ed-input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  font: 700 17px 'NSR', sans-serif;
  color: var(--ink);
  background: #fffdfa;
  outline: none;
}
.ed-input:focus { border-color: var(--accent-2); }
.ed-add { display: flex; gap: 8px; margin-top: 14px; }
.ed-add .btn { white-space: nowrap; }
.ed-meta { display: flex; gap: 12px; align-items: baseline; margin: 12px 0 8px; font-weight: 800; flex-wrap: wrap; }
.ed-dupes { color: var(--warn-ink); font-size: 14px; }
.ed-list {
  list-style: none; margin: 0; padding: 4px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  max-height: 40vh;
  overflow: auto;
  border: 1px dashed var(--line);
  border-radius: 14px;
}
.ed-list:empty::before { content: '아직 이름이 없습니다. 위에서 추가해 주세요.'; color: var(--ink-soft); padding: 16px; grid-column: 1 / -1; text-align: center; }
.ed-list li { display: flex; align-items: center; gap: 6px; }
.ed-list .no { color: var(--ink-soft); font-size: 12px; min-width: 22px; text-align: right; }
.ed-list .ed-input { padding: 6px 10px; font-size: 16px; min-width: 0; }
.ed-list li.dup .ed-input { background: var(--warn-bg); border-color: #ffd79a; }
.ed-list .del { border: none; background: #f6efe6; width: 30px; height: 30px; border-radius: 50%; font-size: 13px; flex-shrink: 0; }
.ed-list .del:hover { background: #ffe1e1; color: var(--danger); }

/* ====================================================== 추첨 화면 */
#show { position: fixed; inset: 0; background: #8fd3f4; overflow: hidden; }
#show.active { display: block; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: absolute; inset: 0; pointer-events: none; font-family: 'NSR', sans-serif; }
#hud > * { position: absolute; }

.hud-intro {
  left: 50%; top: 9%;
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
  transition: opacity .35s, transform .35s;
}
.hud-intro.on { opacity: 1; }
.hud-intro.off { opacity: 0; transform: translate(-50%, -30px); }
.hud-intro .t, .hud-final .t {
  font-weight: 800;
  font-size: calc(110 * var(--u));
  color: #fff;
  letter-spacing: 0.03em;
  white-space: nowrap;
  -webkit-text-stroke: calc(4 * var(--u)) #ff6a3d;
  paint-order: stroke fill;
  text-shadow: 0 calc(8 * var(--u)) 0 #d9502a, 0 calc(18 * var(--u)) calc(40 * var(--u)) rgba(80, 30, 10, 0.3);
}
.hud-intro .m, .hud-final .m {
  margin-top: calc(18 * var(--u));
  display: inline-block;
  font-weight: 800;
  font-size: calc(42 * var(--u));
  color: #3b2f3a;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  padding: calc(10 * var(--u)) calc(34 * var(--u));
  box-shadow: 0 calc(6 * var(--u)) calc(20 * var(--u)) rgba(0, 0, 0, 0.12);
}

.hud-count {
  left: 50%; top: 56%;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: calc(260 * var(--u));
  color: #fff;
  -webkit-text-stroke: calc(8 * var(--u)) #ff6a3d;
  paint-order: stroke fill;
  text-shadow: 0 calc(12 * var(--u)) 0 #d9502a, 0 calc(24 * var(--u)) calc(50 * var(--u)) rgba(80, 30, 10, 0.3);
  line-height: 1;
  white-space: nowrap;
}
.hud-count.pop { animation: countPop .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.hud-count.go { color: #fffbe6; -webkit-text-stroke-color: #2bb673; text-shadow: 0 calc(12 * var(--u)) 0 #1c8f58, 0 calc(24 * var(--u)) calc(50 * var(--u)) rgba(10, 60, 30, 0.3); }
.hud-count.out { animation: countOut .35s ease-in both; }
@keyframes countPop { 0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; } 60% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes countOut { to { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } }

.hud-pill {
  left: 50%; top: calc(26 * var(--u));
  transform: translateX(-50%);
  font-weight: 800;
  font-size: calc(30 * var(--u));
  color: #3b2f3a;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  padding: calc(10 * var(--u)) calc(28 * var(--u));
  box-shadow: 0 calc(4 * var(--u)) calc(16 * var(--u)) rgba(0, 0, 0, 0.1);
  opacity: 0;
  transition: opacity .4s;
  white-space: nowrap;
}
.hud-pill.on { opacity: 1; }

/* 딴짓 고양이 자막 */
.hud-spot {
  left: 50%; top: calc(100 * var(--u));
  transform: translateX(-50%) scale(0.6);
  font-weight: 800;
  font-size: calc(46 * var(--u));
  color: #fff;
  background: linear-gradient(180deg, #ff9a5c, #ff6a3d);
  border: calc(4 * var(--u)) solid #fff;
  border-radius: 999px;
  padding: calc(12 * var(--u)) calc(40 * var(--u));
  box-shadow: 0 calc(8 * var(--u)) calc(24 * var(--u)) rgba(80, 30, 10, 0.25);
  opacity: 0;
  transition: opacity .25s, transform .35s cubic-bezier(.34, 1.56, .64, 1);
  white-space: nowrap;
}
.hud-spot.on { opacity: 1; transform: translateX(-50%) scale(1); }
.hud-spot.low { top: calc(250 * var(--u)); }

/* 레이스 시작 전 문구 */
.hud-motto {
  inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(22 * var(--u));
  background: rgba(40, 24, 60, 0.55);
  opacity: 0;
  transition: opacity .4s;
}
.hud-motto.on { opacity: 1; }
.hud-motto p {
  margin: 0;
  font-weight: 800;
  font-size: calc(78 * var(--u));
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 calc(6 * var(--u)) calc(24 * var(--u)) rgba(0, 0, 0, 0.35);
  opacity: 0;
}
.hud-motto p.last { font-size: calc(96 * var(--u)); color: #ffd36b; margin-top: calc(14 * var(--u)); }
.hud-motto.on p { animation: mottoIn .6s ease-out both; }
.hud-motto.on p:nth-child(2) { animation-delay: .7s; }
.hud-motto.on p:nth-child(3) { animation-delay: 1.4s; }
.hud-motto.off p { opacity: 1; }
@keyframes mottoIn { from { opacity: 0; transform: translateY(calc(24 * var(--u))); } to { opacity: 1; transform: none; } }

.hud-final {
  left: 50%; top: calc(26 * var(--u));
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
}
.hud-final .t { font-size: calc(84 * var(--u)); -webkit-text-stroke-color: #ff4f3d; }
.hud-final .m { font-size: calc(32 * var(--u)); margin-top: calc(8 * var(--u)); }
.hud-final.on { animation: bannerIn .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.hud-final.off { opacity: 1; animation: bannerOut .35s ease-in both; }
@keyframes bannerIn { 0% { opacity: 0; transform: translateX(-50%) scale(.4); } 100% { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes bannerOut { to { opacity: 0; transform: translateX(-50%) translateY(-40px); } }

.hud-who {
  left: 50%; top: 20%;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: calc(92 * var(--u));
  color: #fff;
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-shadow: 0 0 calc(30 * var(--u)) rgba(255, 220, 120, 0.8), 0 calc(6 * var(--u)) 0 rgba(90, 50, 120, 0.6);
  opacity: 0;
  transition: opacity .4s;
}
.hud-who.on { opacity: 1; animation: whoPulse 1.1s ease-in-out infinite alternate; }
@keyframes whoPulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.04); } }

/* 결과 */
.result { inset: 0; opacity: 0; visibility: hidden; transition: opacity .5s; }
.result.on { opacity: 1; visibility: visible; }
.r-title {
  position: absolute; left: 50%; top: 2.6%;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: calc(78 * var(--u));
  white-space: nowrap;
  color: #fff;
  -webkit-text-stroke: calc(4 * var(--u)) #ff5e7e;
  paint-order: stroke fill;
  text-shadow: 0 calc(7 * var(--u)) 0 #d93d63, 0 calc(16 * var(--u)) calc(36 * var(--u)) rgba(120, 20, 50, 0.25);
}
.result.on .r-title { animation: bannerIn .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.cards {
  position: absolute;
  left: 50%; top: 61%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(28 * var(--u));
  width: calc(1760 * var(--u));
}
.lc-card {
  width: var(--cw);
  background: rgba(255, 255, 255, 0.96);
  border-radius: calc(28 * var(--u));
  padding: calc(14 * var(--u)) calc(18 * var(--u)) calc(18 * var(--u));
  box-shadow: 0 calc(12 * var(--u)) calc(34 * var(--u)) rgba(150, 60, 40, 0.22);
  border: calc(4 * var(--u)) solid #ffd36b;
  display: flex;
  align-items: center;
  gap: calc(14 * var(--u));
}
.result.on .lc-card { animation: cardIn .55s cubic-bezier(.2, 1.3, .4, 1) both; }
.lc-card canvas { flex: none; width: var(--av) !important; height: var(--av) !important; }
.lc-card .nm {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  font-size: var(--fs);
  color: #2f2a3b;
  text-align: center;
  line-height: 1.15;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(calc(40 * var(--u))) scale(.9); } to { opacity: 1; transform: none; } }
.r-congrats {
  position: absolute; left: 50%; bottom: 9%;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: calc(56 * var(--u));
  letter-spacing: 0.12em;
  white-space: nowrap;
  color: #ff5e7e;
  text-shadow: 0 calc(3 * var(--u)) 0 #fff;
}
.r-actions {
  position: absolute; left: 50%; bottom: 2.4%;
  transform: translateX(-50%);
  display: flex; gap: 12px;
  pointer-events: auto;
}
.btn.small { font-size: 15px; padding: 8px 18px; background: rgba(255, 255, 255, 0.85); border-color: rgba(255, 255, 255, 0.9); }
.btn.small:hover { background: #fff; }

.exit {
  top: 12px; right: 12px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  font-size: 16px;
  pointer-events: auto;
  opacity: 0;
  transition: opacity .3s;
}
#show.mouse .exit, .exit:focus-visible { opacity: 1; }
#show:not(.mouse) { cursor: none; }

/* ====================================================== 광고 칸 (js/ads.js — 기본은 꺼짐) */
.ad-slot[hidden] { display: none; }
.ad-slot { width: var(--ad-w, 320px); max-width: 100%; text-align: center; }
.ad-label { display: block; font-size: 11px; color: var(--ink-soft); text-align: left; margin-bottom: 2px; }
.ad-fake {
  width: var(--ad-w); height: var(--ad-h); max-width: 100%;
  display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, #e9e4ee, #e9e4ee 10px, #f3eff6 10px, #f3eff6 20px);
  border: 1px dashed #b9b0c4; color: #8a8096; font-size: 14px;
}
.ad-main { margin: clamp(20px, 3vh, 36px) auto 0; }
/* 결과 화면: 당첨자 카드·버튼과 겹치지 않게 오른쪽 아래 구석 */
.ad-result { position: absolute; right: 16px; bottom: 16px; pointer-events: auto; }
.ad-result .ad-label { color: rgba(255, 255, 255, 0.85); }
