/* 눈치게임 — 도트(픽셀) 스타일. 크림색 바탕, 3px 도트 테두리, 갈무리 글꼴 */

@font-face {
  font-family: 'Galmuri11';
  src: url('/fonts/Galmuri11.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Galmuri11';
  src: url('/fonts/Galmuri11-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #fbf3dc;
  --panel: #fffaf0;
  --panel2: #f7ecd2;
  --ink: #3d2b24;
  --ink2: #6b5545;
  --muted: #8c7563;
  --yellow: #ffd23f;
  --yellow2: #ffe89c;
  --yellow3: #e0a800;
  --pink: #ff6f91;
  --red: #ff5a6e;
  --red2: #d8364d;
  --green: #4cc38a;
  --green2: #2f9a68;
  --orange: #ffa94d;
  --blue: #4dabf7;
  --sea: #5ec2f1;
  --gray: #d9d2c5;
  --px: 3px;
  --border: 0 calc(-1 * var(--px)) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink), calc(-1 * var(--px)) 0 0 0 var(--ink),
    var(--px) 0 0 0 var(--ink);
  color-scheme: light;
  font-family: 'AppFont', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; /* AppFont: font.js 가 프리텐다드 또는 갈무리로 등록 */
  color: var(--ink);
  word-break: keep-all;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100dvh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  /* 은은한 반짝이 무늬 */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' shape-rendering='crispEdges'><g fill='%23f3dfa6'><rect x='20' y='14' width='2' height='6'/><rect x='18' y='16' width='6' height='2'/><rect x='88' y='70' width='2' height='6'/><rect x='86' y='72' width='6' height='2'/><rect x='52' y='100' width='2' height='2'/><rect x='104' y='22' width='2' height='2'/></g></svg>");
  background-size: 240px 240px;
  image-rendering: pixelated;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h2,
h3,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.center {
  text-align: center;
}

.stack {
  display: grid;
  gap: 12px;
}

/* ── 도트 상자 ───────────────────────────────────── */

.px,
.card {
  background: var(--panel);
  box-shadow: var(--border), inset 0 calc(-1 * var(--px)) 0 0 rgba(61, 43, 36, 0.1);
  margin: var(--px);
}

.card {
  padding: 16px;
}

.btn {
  border: 0;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 16px;
  background: var(--panel);
  box-shadow: var(--border), inset 0 calc(-1 * var(--px)) 0 0 rgba(61, 43, 36, 0.18);
  margin: var(--px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none; /* 아이폰: 꾹 눌러도 글자 선택·미리 보기 메뉴가 뜨지 않게 */
}

.btn.primary {
  background: var(--yellow);
  box-shadow: var(--border), inset 0 calc(-1 * var(--px)) 0 0 var(--yellow3), inset 0 var(--px) 0 0 #fff2b8;
}

.btn.pink {
  background: var(--pink);
  color: #fff;
  box-shadow: var(--border), inset 0 calc(-1 * var(--px)) 0 0 #d84a6f;
}

.btn:active:not(:disabled) {
  transform: translateY(2px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.big {
  width: calc(100% - 2 * var(--px));
  font-size: 18px;
  padding: 14px 16px;
}

.btn.huge {
  width: calc(100% - 2 * var(--px));
  font-size: clamp(20px, 2.4vw, 30px);
  padding: 18px;
}

.btn.tiny {
  font-size: 12px;
  padding: 6px 10px;
}

.field {
  width: calc(100% - 2 * var(--px));
  margin: var(--px);
  border: 0;
  background: #fff;
  box-shadow: var(--border), inset 0 var(--px) 0 0 rgba(61, 43, 36, 0.08);
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
}

.field:focus {
  background: #fffdf3;
  box-shadow: var(--border), inset 0 0 0 var(--px) var(--yellow);
}

.label {
  font-weight: 700;
}

/* 글씨에 도트 테두리 */
.outlined {
  color: var(--yellow);
  text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 3px 3px 0 var(--ink),
    -3px 3px 0 var(--ink), 3px -3px 0 var(--ink), -3px -3px 0 var(--ink), 0 6px 0 rgba(61, 43, 36, 0.25);
}

.logo {
  font-weight: 700;
  font-size: 33px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.logo b {
  color: var(--pink);
}

.hero-logo {
  font-size: clamp(44px, 14vw, 66px);
  text-align: center;
  margin: 18px 0 6px;
}

.tag {
  text-align: center;
  color: var(--ink2);
}

/* ── 틀 ───────────────────────────────────────────── */

.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px calc(28px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
}

.host-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px clamp(14px, 3vw, 36px) 36px;
  display: grid;
  gap: 14px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--ink2);
}

.top .logo {
  font-size: 22px;
}

.top b {
  color: var(--ink);
}

.top-info {
  white-space: nowrap;
}

/* 게임 이름: 로아의(작게, 분홍) / 눈치게임!(크게, 노랑) 두 줄 */
.logo {
  display: inline-grid;
  justify-items: start;
  line-height: 1;
}

.logo-pre {
  font-size: 0.5em;
  color: var(--pink);
  text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink), 2px 2px 0 var(--ink),
    -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
  margin-bottom: 0.12em;
  margin-left: 0.08em;
}

.hero-logo .logo {
  justify-items: center;
  font-size: clamp(44px, 13vw, 66px);
}

.sound-btn,
.speed-btn {
  white-space: nowrap;
  padding: 5px 8px;
}

.out-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  background: #ffe6ea;
}

.out-card img {
  width: 54px;
  height: 78px;
  image-rendering: pixelated;
}

.out-card .title {
  font-weight: 700;
  font-size: 22px;
  color: var(--red2);
}

.out-text {
  color: var(--red2);
}

.host-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.room-code {
  font-size: clamp(14px, 1.6vw, 20px);
  color: var(--ink2);
}

.room-code b {
  color: var(--ink);
}

.host-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink2);
}

.host-meta b {
  color: var(--ink);
}

/* ── 무대 ─────────────────────────────────────────── */

.stage-slot {
  margin: var(--px);
  box-shadow: var(--border);
  background: var(--sea);
}

.stage {
  position: relative;
  width: 100%;
  height: var(--stage-h, 200px);
  overflow: hidden;
  background: var(--sea);
}

.stage canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.stage-px {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.stage-tx {
  pointer-events: none;
}

.page .stage {
  --stage-h: clamp(140px, 27vh, 230px);
}

.page .stage.tall {
  --stage-h: clamp(170px, 36vh, 300px);
}

.host-page .stage {
  --stage-h: clamp(240px, 52vh, 620px);
}

/* 참가자 화면 틀: 머리 / 무대 / 옆칸 */
.page-grid {
  display: grid;
  gap: 10px;
}

.page-main,
.page-side {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

/* 넓은 화면(웹): 무대는 왼쪽에 크게, 입력·카드는 오른쪽에 */
@media (min-width: 900px) {
  .page {
    max-width: 1180px;
    padding: 18px 28px 40px;
    gap: 14px;
  }

  .page-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(330px, 1fr);
    gap: 18px;
    align-items: start;
  }

  .page .stage,
  .page .stage.tall {
    --stage-h: clamp(300px, 58vh, 600px);
  }

  .page .top .logo {
    font-size: 33px;
  }

  .page .top {
    font-size: 16px;
  }

  .page .count-num {
    font-size: clamp(77px, 12vh, 132px);
  }

  .page .count-sub {
    font-size: 18px;
  }

  .page .bar {
    height: 26px;
  }

  .page .mycard img {
    width: 72px;
    height: 104px;
  }

  .page .mycard .title {
    font-size: 33px;
  }

  .page.landing .hero-logo .logo {
    font-size: 88px;
  }

  .page.landing .tag {
    font-size: 18px;
  }
}

/* 폰에서 숫자를 내는 동안: 카운트·무대·키패드를 줄여 한 화면에 다 들어가게 */
@media (max-width: 899px) {
  .page.compact {
    gap: 6px;
    padding-top: 8px;
  }

  .page.compact .page-grid,
  .page.compact .page-side {
    gap: 6px;
  }

  .page.compact .count-num {
    font-size: clamp(44px, 8vh, 66px);
    font-size: clamp(44px, 8svh, 66px);
  }

  .page.compact .count-sub {
    font-size: 13px;
  }

  .page.compact .stage {
    --stage-h: clamp(104px, 18vh, 170px);
    --stage-h: clamp(104px, 18svh, 170px);
  }

  .page.compact .display {
    font-size: clamp(28px, 5svh, 44px);
    line-height: 1.25;
  }

  .page.compact .hint {
    min-height: 0;
    font-size: 12px;
  }

  .page.compact .keypad {
    gap: 4px;
  }

  .page.compact .keypad button {
    padding: clamp(3px, 0.9svh, 10px) 0;
    font-size: clamp(20px, 3svh, 26px);
  }

  .page.compact .rps button {
    padding: 8px 0 6px;
  }
}

/* 방장 화면을 폰으로 열었을 때 */
@media (max-width: 700px) {
  .host-page {
    padding: 10px 12px 28px;
    gap: 10px;
  }

  .host-page .stage {
    --stage-h: clamp(190px, 38vh, 340px);
  }

  .host-page .count-num {
    font-size: clamp(66px, 11vh, 110px);
  }

  .host-top .logo {
    font-size: 24px;
  }
}

/* ── 카운트다운 ───────────────────────────────────── */

.count {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.count-num {
  font-weight: 700;
  font-size: clamp(66px, 13vh, 99px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.host-page .count-num {
  font-size: clamp(88px, 16vh, 176px);
}

.count-num.hurry {
  color: var(--red);
  animation: shake 0.24s steps(2) infinite;
}

@keyframes shake {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(2px, -2px);
  }
  100% {
    transform: translate(-2px, 0);
  }
}

.count-sub {
  color: var(--ink2);
  font-size: 15px;
  text-align: center;
}

.count-sub b {
  color: var(--ink);
}

.host-page .count-sub {
  font-size: clamp(16px, 2vw, 26px);
}

/* 참고 그림 같은 노란 사선 진행 바 */
.bar {
  position: relative;
  height: 20px;
  margin: var(--px);
  background: var(--gray);
  box-shadow: var(--border);
  overflow: hidden;
  width: calc(100% - 2 * var(--px));
}

.host-page .bar {
  height: 28px;
}

.bar i {
  display: block;
  height: 100%;
  width: 100%;
  background-color: var(--yellow2);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' shape-rendering='crispEdges'><path fill='%23ffd23f' d='M0 0h4v1H0zM7 1h1v1H7zM0 1h3v1H0zM6 2h2v1H6zM0 2h2v1H0zM5 3h3v1H5zM0 3h1v1H0zM4 4h4v1H4zM3 5h4v1H3zM2 6h4v1H2zM1 7h4v1H1z'/></svg>");
  background-size: 16px 16px;
  image-rendering: pixelated;
  box-shadow: inset calc(-1 * var(--px)) 0 0 0 var(--yellow3);
  animation: stripes 0.8s steps(8) infinite;
}

.bar.hurry i {
  background-color: #ffb3bf;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' shape-rendering='crispEdges'><path fill='%23ff5a6e' d='M0 0h4v1H0zM7 1h1v1H7zM0 1h3v1H0zM6 2h2v1H6zM0 2h2v1H0zM5 3h3v1H5zM0 3h1v1H0zM4 4h4v1H4zM3 5h4v1H3zM2 6h4v1H2zM1 7h4v1H1z'/></svg>");
  box-shadow: inset calc(-1 * var(--px)) 0 0 0 var(--red2);
}

@keyframes stripes {
  to {
    background-position: 16px 0;
  }
}

/* ── 입력 ─────────────────────────────────────────── */

.ask {
  text-align: center;
  font-size: 16px;
}

.ask b {
  color: var(--red);
}

.display {
  font-weight: 700;
  font-size: clamp(36px, 6.5vh, 52px);
  text-align: center;
  line-height: 1.3;
  background: #fff;
  box-shadow: var(--border), inset 0 var(--px) 0 0 rgba(61, 43, 36, 0.08);
  margin: var(--px);
  font-variant-numeric: tabular-nums;
}

.display.empty {
  color: #d8cbb4;
}

.display.bad {
  color: var(--red);
}

.hint {
  text-align: center;
  color: var(--ink2);
  font-size: 13px;
  min-height: 19px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.keypad button {
  border: 0;
  margin: var(--px);
  background: var(--panel);
  box-shadow: var(--border), inset 0 calc(-1 * var(--px)) 0 0 rgba(61, 43, 36, 0.18);
  font-weight: 700;
  font-size: clamp(22px, 3.6vh, 28px);
  padding: clamp(6px, 1.5vh, 14px) 0;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.keypad button:active {
  transform: translateY(2px);
  background: var(--panel2);
}

.keypad .ok {
  background: var(--yellow);
  box-shadow: var(--border), inset 0 calc(-1 * var(--px)) 0 0 var(--yellow3);
  font-size: clamp(17px, 2.8vh, 22px);
}

.keypad.mini button {
  font-size: 18px;
  padding: 6px 0;
}

.rps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.rps button {
  border: 0;
  margin: var(--px);
  background: var(--panel);
  box-shadow: var(--border), inset 0 calc(-1 * var(--px)) 0 0 rgba(61, 43, 36, 0.18);
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 12px 0 10px;
  font-weight: 700;
  font-size: 18px;
  touch-action: manipulation;
}

.rps button img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  object-fit: contain;
}

.rps button:active {
  transform: translateY(2px);
  background: var(--yellow2);
}

.rps.mini button img {
  width: 32px;
  height: 32px;
}

.sub {
  text-align: center;
  color: var(--ink2);
}

.sub b {
  color: var(--ink);
}

.sent,
.watch {
  padding: 16px;
  text-align: center;
  display: grid;
  gap: 4px;
  justify-items: center;
}

.sent-num {
  font-weight: 700;
  font-size: 66px;
  line-height: 1.1;
}

.sent img {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
}

/* ── 결과 ─────────────────────────────────────────── */

.mycard {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.mycard img {
  width: 54px;
  height: 78px;
  image-rendering: pixelated;
}

.mycard .title {
  font-weight: 700;
  font-size: 26px;
  line-height: 1.2;
}

.mycard.good {
  background: #e6f8ee;
}

.mycard.good .title {
  color: var(--green2);
}

.mycard.bad {
  background: #ffe6ea;
}

.mycard.bad .title {
  color: var(--red2);
}

.mycard.void {
  background: #fff4cc;
}

.mycard.void .title {
  color: #b07d00;
}

.mycard .with {
  font-size: 13px;
  color: var(--ink2);
}

.next {
  text-align: center;
  color: var(--ink2);
}

.next b {
  color: var(--ink);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.stat {
  background: var(--panel);
  box-shadow: var(--border);
  margin: var(--px);
  padding: 8px 2px;
  text-align: center;
}

.stat b {
  display: block;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat span {
  font-size: 11px;
  color: var(--ink2);
}

.stat.good b {
  color: var(--green2);
}

.stat.bad b {
  color: var(--red);
}

.stat.warn b {
  color: #e07b1c;
}

/* 빌런 심술쟁이가 저격한 수 — 한 줄을 다 쓴다 */
.stat.villain {
  grid-column: 1 / -1;
  background: #2a1b3d;
}

.stat.villain b {
  color: #ff5a6e;
}

.stat.villain span {
  color: #ffd23f;
}

/* 로아에게 달리기(구명보트 판)에서 성문에 막힌 수 */
.stat.gate {
  grid-column: 1 / -1;
  background: #ffe3ee;
}

.stat.gate b {
  color: #e5367a;
}

/* 부활 수호천사가 되살린 수 */
.stat.savior {
  grid-column: 1 / -1;
  background: #fff6d6;
}

.stat.savior b {
  color: #e8a400;
}

.host-page .stat b {
  font-size: clamp(26px, 3.4vw, 44px);
}

.host-page .stat span {
  font-size: 14px;
}

.notice {
  background: #fff4cc;
  box-shadow: var(--border);
  margin: var(--px);
  padding: 10px 12px;
  text-align: center;
  font-weight: 700;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: #fff;
  box-shadow: 0 -2px 0 0 var(--ink), 0 2px 0 0 var(--ink), -2px 0 0 0 var(--ink), 2px 0 0 0 var(--ink);
  margin: 2px;
  padding: 3px 8px;
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip b {
  margin-left: 2px;
}

.chip.good {
  background: #dff6e9;
}

.chip.bad {
  background: #ffdfe4;
}

.host-page .chip {
  font-size: 16px;
  padding: 5px 10px;
}

.winner {
  text-align: center;
  padding: 18px 14px;
  background: #fff4cc;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.winner img {
  width: 72px;
  height: 104px;
  image-rendering: pixelated;
}

.w-label {
  font-weight: 700;
  color: var(--ink2);
}

.winner.mine .w-label {
  color: var(--green2);
}

.w-name {
  font-weight: 700;
  font-size: clamp(33px, 9vw, 55px);
  line-height: 1.15;
  word-break: break-all;
}

.w-sub {
  color: var(--ink2);
}

.w-sub b {
  color: var(--ink);
}

.host-page .w-name {
  font-size: clamp(44px, 7vw, 99px);
}

/* ── 대기실 ───────────────────────────────────────── */

.join {
  width: 100%;
  display: grid;
  gap: 8px;
}

/* 닉네임 칸 위 안내(2026-11-03 밤 사장님 " 닉네임을 적어주세요 라고 분명하게") */
.join-label {
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
}

.count-line {
  color: var(--ink2);
  font-size: 15px;
}

.count-line b {
  color: var(--red);
  font-size: 26px;
  font-weight: 700;
  margin-right: 2px;
}

.pill {
  display: inline-block;
  background: var(--green);
  color: #fff;
  padding: 3px 10px;
  font-weight: 700;
  box-shadow: 0 -2px 0 0 var(--ink), 0 2px 0 0 var(--ink), -2px 0 0 0 var(--ink), 2px 0 0 0 var(--ink);
}

.me-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.me-line img {
  width: 45px;
  height: 65px;
  image-rendering: pixelated;
}

.me-name {
  font-weight: 700;
  font-size: 22px;
  word-break: break-all;
}

.me-name small {
  font-size: 13px;
  color: var(--ink2);
}

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr minmax(240px, 320px);
  gap: 14px;
  align-items: start;
}

@media (max-width: 980px) {
  .lobby-grid {
    grid-template-columns: 1fr;
  }
}

.qr-card,
.count-card,
.join-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.qr {
  background: #fff;
  padding: 10px;
  aspect-ratio: 1;
  width: 100%;
  max-width: 260px;
  justify-self: center;
  box-shadow: var(--border);
  margin: var(--px);
}

.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.url {
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 700;
  text-align: center;
  word-break: break-all;
}

.url b {
  color: var(--red);
}

.count-big {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.count-big b {
  font-size: clamp(66px, 8vw, 121px);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.count-big span {
  font-size: clamp(15px, 1.6vw, 20px);
  color: var(--ink2);
}

.recent {
  min-height: 60px;
  align-content: flex-start;
}

/* 방장 참가 칸 */
.me-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.me-panel h3 {
  font-size: 15px;
}

.round-grid {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 300px);
  gap: 14px;
  align-items: start;
}

@media (max-width: 980px) {
  .round-grid {
    grid-template-columns: 1fr;
  }

  /* 좁은 창에서는 방장이 낼 칸을 무대 위로 — 아래로 밀려 안 보이는 일이 없게 */
  .round-grid .me-panel {
    order: -1;
  }
}

.reveal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.reveal-head h2 {
  font-size: clamp(22px, 3vw, 40px);
}

.reveal-head .next {
  font-size: clamp(15px, 1.8vw, 22px);
}

/* ── 규칙 ─────────────────────────────────────────── */

.rules h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.rules ol {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 4px;
  color: var(--ink2);
  font-size: 13px;
  line-height: 1.55;
}

.rules b {
  color: var(--ink);
}

/* ── 알림·로딩 ───────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  top: calc(10px + env(safe-area-inset-top));
  transform: translateX(-50%);
  background: var(--panel);
  color: var(--ink);
  padding: 8px 14px;
  z-index: 50;
  font-size: 14px;
  font-weight: 700;
  max-width: calc(100% - 32px);
  text-align: center;
  box-shadow: var(--border), 0 9px 0 0 rgba(61, 43, 36, 0.15);
}

.toast.warn {
  background: var(--red);
  color: #fff;
}

.loading {
  min-height: 70dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--ink2);
}

.spinner {
  width: 24px;
  height: 24px;
  background: var(--yellow);
  box-shadow: var(--border);
  animation: hop 0.6s steps(2) infinite;
}

@keyframes hop {
  50% {
    transform: translateY(-8px);
  }
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
  image-rendering: pixelated;
}

@media (prefers-reduced-motion: reduce) {
  .count-num.hurry,
  .spinner,
  .bar i {
    animation: none;
  }
}

/* ── 우승자 수 · 다음 스테이지 · 패자부활전 · 나와 겹친 사람 (2026-10-17) ── */

.rep-tag {
  display: inline-block;
  background: #8e6cf0;
  color: #fff;
  padding: 1px 8px;
  margin: 2px 4px 2px 2px;
  font-weight: 700;
  font-size: 0.85em;
  vertical-align: middle;
  box-shadow: 0 -2px 0 0 var(--ink), 0 2px 0 0 var(--ink), -2px 0 0 0 var(--ink), 2px 0 0 0 var(--ink);
}

.notice.win {
  background: #e6f8ee;
}

.win-set {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  font-size: 18px;
}

.win-set .btn.tiny {
  font-size: 20px;
  padding: 4px 14px;
}

.field.win-input {
  width: 90px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 6px 4px;
  -moz-appearance: textfield;
  appearance: textfield;
}

.win-input::-webkit-inner-spin-button,
.win-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.next-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.btn.big.next-btn {
  width: auto;
  min-width: 260px;
  font-size: clamp(18px, 2vw, 26px);
  animation: nudge 1.2s steps(2) infinite;
}

@keyframes nudge {
  50% {
    transform: translateY(-3px);
  }
}

.next.wait {
  background: var(--panel2);
  box-shadow: var(--border);
  margin: var(--px);
  padding: 10px 12px;
}

.mycard.win,
.out-card.won {
  background: #fff4cc;
}

.mycard.win .title,
.out-card.won .title,
.win-text {
  color: #b07d00;
}

.dup-btn {
  margin-top: 6px;
}

.dup-list {
  display: grid;
  gap: 8px;
}

.dup-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.dup-person {
  display: grid;
  justify-items: center;
  width: 64px;
  font-size: 12px;
  text-align: center;
}

.dup-person img {
  width: 36px;
  height: 52px;
  image-rendering: pixelated;
}

.dup-person b {
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.winner.many .w-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  max-width: 100%;
}

.w-one {
  display: grid;
  justify-items: center;
  width: 78px;
}

.winner .w-one img {
  width: 48px;
  height: 69px;
}

.w-one b {
  max-width: 78px;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.w-one.me b {
  color: var(--green2);
}

.w-one.more {
  align-self: center;
  color: var(--ink2);
}

/* 구슬 레이스 우승자: 들어온 등수 */
.w-rank {
  font-size: 12px;
  font-weight: 700;
  color: #b8860b;
}

/* 구슬 레이스 당첨 등수: 숫자 넣고 '+ 추가' → 아래 딱지(누르면 빠짐) */
.field.rank-input {
  width: 90px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 6px 4px;
}

.rank-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 2px;
  max-height: 120px;
  overflow-y: auto;
}

.rank-chip {
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #2a1b3d;
  background: #ffd23f;
  border: 2px solid #2a1b3d;
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
}

.rank-chip b {
  margin-left: 4px;
  color: #c0392b;
}

.rank-chip:hover {
  background: #ffe680;
}

/* 봇에게 우승을 양보받은 사람 */
.w-yield {
  max-width: 78px;
  font-size: 10px;
  font-weight: 700;
  color: #ff6f91;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .btn.big.next-btn {
    animation: none;
  }
}

/* ── 컨셉 맵 연출: 소개 카드 · GO · 마지막 3초 · 내 결과 알림 · 방송용 한 화면 (2026-10-17) ── */

.stage-slot {
  position: relative;
}

/* 판 소개 카드(카운트다운 동안 무대 위) */
.intro-card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: min(92%, 640px);
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 14px 16px 16px;
  text-align: center;
  color: #fff;
  background: rgba(30, 22, 48, 0.88);
  box-shadow: var(--border);
  animation: intro-in 0.5s steps(5) both;
  pointer-events: none;
}

.intro-card.comic {
  background: rgba(214, 120, 26, 0.92);
}

.intro-card.arcade {
  background: rgba(124, 58, 237, 0.9);
}

.intro-card.thriller {
  background: rgba(120, 18, 32, 0.92);
}

.intro-card.final {
  background: rgba(200, 30, 60, 0.92);
}

.ic-stage {
  font-weight: 700;
  font-size: clamp(13px, 1.8vw, 20px);
  letter-spacing: 0.12em;
  color: #ffe89c;
}

.ic-title {
  font-weight: 700;
  font-size: clamp(26px, 5vw, 58px);
  line-height: 1.1;
}

.ic-desc {
  font-size: clamp(12px, 1.6vw, 18px);
  opacity: 0.95;
}

.ic-info {
  margin-top: 4px;
  font-weight: 700;
  font-size: clamp(13px, 1.8vw, 20px);
  background: rgba(0, 0, 0, 0.28);
  padding: 2px 10px;
}

@keyframes intro-in {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.4);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* 판이 열리는 순간 GO! */
.go-pop {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  font-weight: 700;
  font-size: clamp(54px, 12vw, 160px);
  color: var(--yellow);
  pointer-events: none;
  animation: go-pop 1.3s steps(10) forwards;
}

@keyframes go-pop {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(2);
  }
  25% {
    transform: translate(-50%, -50%) scale(1);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(1);
  }
}

/* 마지막 3초: 무대 테두리가 빨갛게 두근두근 */
.hurry .stage-slot::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  box-shadow: inset 0 0 0 6px rgba(255, 90, 110, 0.9), inset 0 0 40px rgba(255, 40, 70, 0.55);
  animation: hurry-pulse 0.5s steps(2) infinite;
}

@keyframes hurry-pulse {
  50% {
    opacity: 0.35;
  }
}

/* 내 결과 알림(폰): 화면 가득 성공·실패 */
.result-pop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: #fff;
  pointer-events: none;
  animation: result-pop 2.3s steps(12) forwards;
}

.result-pop.safe {
  background: rgba(47, 154, 104, 0.88);
}

.result-pop.out {
  background: rgba(216, 54, 77, 0.9);
}

.result-pop.void {
  background: rgba(176, 125, 0, 0.88);
}

.rp-word {
  font-weight: 700;
  font-size: clamp(38px, 12vw, 84px);
  text-align: center;
  line-height: 1.1;
  padding: 0 16px;
}

.rp-num {
  font-weight: 700;
  font-size: clamp(20px, 6vw, 36px);
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 14px;
}

@keyframes result-pop {
  0% {
    opacity: 0;
    transform: scale(1.3);
  }
  12% {
    opacity: 1;
    transform: scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.result-pop.out .rp-word {
  animation: shake 0.24s steps(2) 3;
}

/* 방송용 한 화면: 무대를 화면 높이에 맞춰 크게(넓은 화면) */
.host-page {
  min-height: 100vh;
  align-content: start;
}

.host-page .count-num {
  font-size: clamp(60px, 10vh, 124px);
}

.host-page .stage {
  --stage-h: clamp(260px, calc(100vh - 300px), 860px);
}

.host-page .stage-slot.lobby .stage {
  --stage-h: clamp(170px, 30vh, 380px);
}

.reveal-grid {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 340px);
  gap: 14px;
  align-items: start;
}

.host-page .reveal-grid .stage {
  --stage-h: clamp(260px, calc(100vh - 170px), 900px);
}

.reveal-side {
  display: grid;
  gap: 10px;
  align-content: start;
  max-height: calc(100vh - 170px);
  overflow: auto;
}

.reveal-side .stats {
  grid-template-columns: repeat(2, 1fr);
}

.reveal-head h2 small {
  font-size: 0.55em;
  color: var(--ink2);
  margin-left: 6px;
}

@media (max-width: 1100px) {
  .reveal-grid {
    grid-template-columns: 1fr;
  }

  .reveal-side {
    max-height: none;
  }

  .host-page .reveal-grid .stage {
    --stage-h: clamp(240px, 58vh, 700px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-card,
  .go-pop,
  .h3-pick.fresh,
  .h3-pick-num.pop,
  .result-pop,
  .hurry .stage-slot::after {
    animation: none;
  }
}

/* ── 1단계 두더지굴 3D 무대(방송 화면) · 참가자 폰 안내 (2026-10-17) ── */

/* 3D 무대 뒤 하늘(숲 위·다음 층 둘레로 보인다) */
.stage3d {
  background: linear-gradient(180deg, #6ec3f2 0%, #a9dcfa 45%, #dff3ff 100%);
}

.stage3d canvas {
  left: 0;
  top: 0;
  transform: none;
}

.stage-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 92px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #a6e38a, #86cf62);
  color: #2a1b3d;
  text-align: left;
}

.stage-mini img {
  width: 54px;
  image-rendering: pixelated;
}

.stage-mini b {
  display: block;
  font-size: 22px;
}

.stage-mini span {
  font-size: 13px;
}

/* ── 3D 레이스 방: 로고 표시 · 첫 화면 버튼 · 레이스 중 안내 (2026-10-17) ── */

.logo-3d {
  display: inline-block;
  margin-left: 0.18em;
  padding: 0 0.18em;
  font-size: 0.62em;
  color: #fff;
  background: #ff5a4e;
  box-shadow: var(--border);
  text-shadow: none;
  vertical-align: middle;
}

.btn-3d {
  color: #fff;
  background: #ff5a4e;
}

/* 첫 화면(3D 방만 — 2026-10-18): 참가 코드 · 방 만들기 · 규칙을 가운데 한 줄로 */
.landing-box {
  display: grid;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
}

.race-card {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
  background: #2a1b3d;
  color: #fff;
}

.race-card .title {
  font-size: 28px;
}

/* ── 3D 방 방장 화면: 3D 무대가 화면을 꽉 채우고 안내·버튼은 그 위에 겹친다 (2026-10-17 사장님 "레퍼런스처럼 꽉 차게") ── */

.host3d {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #8fd3ff;
}

.host3d .stage-slot.full {
  position: absolute;
  inset: 0;
  margin: 0;
  box-shadow: none;
}

.host3d .stage-slot.full .stage {
  --stage-h: 100dvh;
  height: 100%;
}

/* 윗줄: 왼쪽 로고·참가 주소, 오른쪽 접속 수·소리·새 게임 */
.h3-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 0;
  pointer-events: none;
}

.h3-top > * {
  pointer-events: auto;
}

.h3-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.h3-brand .logo {
  font-size: 26px;
}

.h3-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: var(--px);
  padding: 4px 10px;
  font-size: 14px;
  color: var(--ink2);
  background: rgba(255, 250, 240, 0.92);
  box-shadow: var(--border);
}

.h3-pill b {
  color: var(--ink);
}

/* 숫자를 고르는 동안: 무대 한가운데 큰 카운트다운(2026-10-17 밤 사장님 "지금 빨리 번호를 선택하라는 문구와 함께 가운데에 크게") */
.h3-pick {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: min(760px, 72vw);
  transform: translate(-50%, -54%);
  text-align: center;
  pointer-events: none;
}

.h3-pick.fresh {
  animation: h3-pick-in 0.4s steps(5) both;
}

@keyframes h3-pick-in {
  0% {
    opacity: 0;
    transform: translate(-50%, -54%) scale(1.6);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -54%) scale(1);
  }
}

.h3-pick-msg {
  font-weight: 700;
  font-size: clamp(26px, 5.4vh, 60px);
  line-height: 1.15;
}

.h3-pick-num {
  font-weight: 700;
  font-size: clamp(120px, 32vh, 340px);
  line-height: 0.9;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* 초가 바뀔 때마다 톡(마지막 3초는 빨갛게 더 크게) */
.h3-pick-num.pop {
  animation: h3-pick-pop 0.35s steps(5);
}

.h3-pick-num.hurry {
  color: var(--red);
}

.h3-pick-num.hurry.pop {
  animation: h3-pick-pop-big 0.35s steps(5);
}

@keyframes h3-pick-pop {
  0% {
    transform: scale(1.35);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes h3-pick-pop-big {
  0% {
    transform: scale(1.7);
  }
  100% {
    transform: scale(1);
  }
}

.h3-pick .bar {
  width: min(520px, 60vw);
  height: 18px;
}

.h3-pick-sub {
  margin: var(--px);
  padding: 4px 12px;
  font-size: clamp(14px, 2.1vh, 22px);
  color: var(--ink2);
  background: rgba(255, 250, 240, 0.9);
  box-shadow: var(--border);
}

.h3-pick-sub b {
  color: var(--ink);
}

/* 대기실: 봇 넣기(3D 방장) */
.bot-set {
  flex-wrap: wrap;
  font-size: 15px;
}

.win-set.bot-set .btn.tiny {
  font-size: 15px;
  padding: 3px 10px;
}

/* 남은 시간: 윗줄 가운데 */
.h3-count {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 6;
  width: min(640px, 46vw);
  transform: translateX(-50%);
  pointer-events: none;
}

/* 숫자는 왼쪽, 막대·문구는 오른쪽 — 낮게 */
.h3-count .count {
  grid-template-columns: auto 1fr;
  justify-items: stretch;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  padding: 4px 12px 6px;
  background: rgba(255, 250, 240, 0.9);
  box-shadow: var(--border);
}

.h3-count .count-num {
  grid-row: span 2;
  font-size: clamp(40px, 7vh, 72px);
}

.h3-count .count-sub {
  font-size: clamp(12px, 1.3vw, 17px);
  text-align: left;
}

.h3-count .bar {
  height: 16px;
}

/* 겹친 칸: 대기실(QR·시작) · 생존자 명단 · 우승자 — 오른쪽 */
.h3-panel {
  position: absolute;
  z-index: 4;
  display: grid;
  gap: 8px;
  align-content: start;
  overflow: auto;
  scrollbar-width: thin;
}

.h3-right {
  top: 78px;
  right: 14px;
  bottom: 14px;
  width: min(380px, 32vw);
}

.h3-list,
.h3-win {
  bottom: 108px;
  animation: h3-in 0.45s steps(6) both;
}

@keyframes h3-in {
  0% {
    opacity: 0;
    transform: translateX(60px);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

.h3-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: var(--px);
  padding: 8px 12px;
  color: #fff;
  background: rgba(30, 22, 48, 0.88);
  box-shadow: var(--border);
}

.h3-head h2 {
  font-size: 18px;
}

/* 생존자 명단 */
.sv-board {
  display: grid;
  gap: 8px;
}

.sv-title {
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 32px);
  text-align: center;
}

.sv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 6px;
}

.sv-one {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  padding: 4px 2px;
  text-align: center;
  background: #eafbe9;
  box-shadow: inset 0 0 0 2px var(--green2);
}

.sv-one img {
  width: 34px;
  height: 49px;
  image-rendering: pixelated;
}

.sv-one b {
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sv-one span {
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--green2);
}

.sv-one.more {
  align-content: center;
  font-weight: 700;
  color: var(--ink2);
  background: var(--panel2);
  box-shadow: none;
}

/* 오른쪽 아래: 다음 버튼(레이스가 끝나면) */
.h3-next {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 6;
  display: grid;
  gap: 2px;
  width: min(380px, 32vw);
}

.h3-next .next {
  justify-self: end;
  margin: var(--px);
  padding: 2px 10px;
  font-size: 13px;
  background: rgba(255, 250, 240, 0.92);
  box-shadow: var(--border);
}

.h3-next .btn.tiny {
  justify-self: end;
}

/* 우승 뒤: '명장면 다시 보기' 아래에 '새 게임 열기' */
.h3-next .next-btn + .next-btn {
  margin-top: 6px;
}

/* 대기실 오른쪽 칸: QR 은 작게 옆으로, 시작 버튼까지 한눈에 */
.h3-right .qr-card {
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 12px;
  row-gap: 4px;
}

.h3-right .qr {
  grid-row: 1 / span 2;
  width: min(150px, 19vh);
  padding: 6px;
}

/* 참가 주소는 QR 아래 한 줄로 */
.h3-right .url {
  grid-column: 1 / -1;
  grid-row: 3;
  font-size: clamp(15px, 1.5vw, 20px);
}

.h3-right .count-big b {
  font-size: clamp(44px, 7vh, 80px);
}

.h3-right .recent {
  min-height: 0;
  max-height: 64px;
  overflow: hidden;
}

/* 대기실(시작하기 화면) 가운데: 게임 이름만 — 오른쪽 칸 왼쪽 무대 한가운데(2026-10-19 사장님 "게임 설명은 필요 없어. 그냥 가운데에 로아의 눈치게임") */
.h3-title {
  position: absolute;
  left: 14px;
  right: calc(min(380px, 32vw) + 28px);
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  font-size: clamp(36px, 5.4vw, 104px);
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  color: var(--yellow);
  text-shadow: 5px 0 0 var(--ink), -5px 0 0 var(--ink), 0 5px 0 var(--ink), 0 -5px 0 var(--ink), 5px 5px 0 var(--ink),
    -5px 5px 0 var(--ink), 5px -5px 0 var(--ink), -5px -5px 0 var(--ink), 0 10px 0 rgba(61, 43, 36, 0.3);
  pointer-events: none;
}

.h3-title .pre {
  color: var(--pink);
}

/* 대기실 자동 시작 카운트다운(방송 화면 가운데 게임 이름 아래 · 폰 참가·대기 화면 한 줄) — 마지막 10초는 빨갛게 */
.h3-clock {
  margin-top: 0.25em;
  font-size: 0.5em;
  color: #fff;
}

.h3-clock.soon,
.start-clock.soon {
  color: var(--red);
}

.start-clock {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.p3f-status .start-clock {
  display: block;
  font-size: 17px;
  color: #ffd23f;
}

.auto-on {
  justify-content: space-between;
  font-weight: 700;
}

.mg-rank {
  margin: 0;
  font-size: 18px;
}

.mg-rank b {
  font-size: 24px;
  color: var(--red2);
}

/* 정한 우승 선물: 게임 이름 아래 한 줄 */
.h3-gift {
  display: inline-block;
  margin-top: 0.3em;
  padding: 0.12em 0.6em;
  font-size: 0.34em;
  color: #fff;
  text-shadow: none;
  background: rgba(30, 22, 48, 0.82);
  border-radius: 0.5em;
  box-shadow: 0 0 0 3px #ffd23f;
}

.h3-gift b {
  color: #ffd23f;
}

/* 우승 선물 입력창(방장 — 시작 화면 '🎁 우승 선물 정하기') */
.gift-pop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 14, 32, 0.55);
}

.gift-pop .card {
  width: min(440px, 100%);
}

.gift-pop-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.gift-pop-btns .btn {
  flex: 1;
}

.gift-btn {
  font-size: 16px;
}

/* 참가자 보기 · 내보내기 창(방장 — 시작 화면 '👥 참가자 보기 · 내보내기' · 방금 들어온 이름을 눌러도) */
.who-list {
  list-style: none;
  margin: var(--px);
  padding: 0;
  max-height: min(50vh, 460px);
  overflow-y: auto;
  background: #fff;
  box-shadow: var(--border);
}

.who-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
}

.who-list li:nth-child(even) {
  background: var(--panel);
}

.who-list img {
  flex: none;
  width: 24px;
  height: 35px;
  image-rendering: pixelated;
}

.who-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.who-list small {
  color: var(--ink2);
}

.who-list em {
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}

.who-list .btn.tiny {
  flex: none;
  margin: 0;
}

.who-list .who-more {
  justify-content: center;
  padding: 10px 8px;
  color: var(--muted);
}

.chips.recent [data-id] {
  cursor: pointer;
}

.who-btn,
.me-leave {
  justify-self: start;
}

/* 게임 고르기(시작하기 화면 오른쪽 칸 맨 위 — 방장만) */
.game-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 6px;
}

.game-btn {
  margin: 0;
  font-size: 17px;
}

/* 참가자 폰 · 우승자 칸의 선물 */
.gift-line {
  margin: 4px 0;
  font-weight: 700;
}

.gift-line b {
  color: var(--pink);
}

.w-gift {
  margin-top: 6px;
  font-size: 1.1em;
  font-weight: 700;
  color: var(--pink);
}

/* 게임 완전 종료: 시작하기 화면 · 우승자 화면 왼쪽 아래 모서리(방장만) */
.h3-end {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 6;
  margin: 0;
  padding: 10px 18px;
  font-size: 15px;
}

/* 방장도 같이 할 때 숫자 판: 오른쪽 아래 */
.h3-me {
  right: 14px;
  bottom: 14px;
  width: min(320px, 30vw);
}

/* 가운데 남은 시간과 겹치지 않게: 조금 좁은 화면에서는 참가 주소를 숨긴다(대기실 QR 칸에 있다) */
@media (max-width: 1500px) {
  .h3-brand .h3-pill {
    display: none;
  }
}

/* 좁은 화면(작은 창·폰): 겹친 칸을 아래쪽에 */
@media (max-width: 760px) {
  .h3-brand .logo {
    font-size: 20px;
  }

  .h3-count {
    top: 62px;
    width: calc(100% - 16px);
  }

  .h3-pick {
    width: calc(100% - 16px);
  }

  .h3-right,
  .h3-next,
  .h3-me {
    left: 8px;
    right: 8px;
    width: auto;
  }

  .h3-right {
    top: auto;
    bottom: 8px;
    max-height: 46vh;
  }

  .h3-list,
  .h3-win {
    bottom: 104px;
    max-height: 38vh;
  }

  .h3-title {
    right: 14px;
    top: 30%;
  }

  .h3-end {
    left: 8px;
    bottom: calc(46vh + 16px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .h3-list,
  .h3-win {
    animation: none;
  }
}

/* ── 3D 방 참가자 폰: 이름과 숫자만 (2026-10-17 사장님 "핸드폰은 이름과 숫자만 입력") ── */

.phone3d {
  max-width: 460px;
}

/* 3D 방 참가자 폰 — 내 캐릭터 따라가기(2026-10-18): 3D 무대가 화면을 채우고 위아래에 얇은 띠, 탈락하면 화면이 어두워진다 */
.p3f {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #8fd3ff;
}

.p3f .stage-slot.full {
  position: absolute;
  inset: 0;
  margin: 0;
  box-shadow: none;
}

.p3f .stage-slot.full .stage {
  --stage-h: 100dvh;
  height: 100%;
}

.p3f-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 14px;
  background: linear-gradient(rgba(30, 20, 45, 0.55), rgba(30, 20, 45, 0));
}

.p3f-top .logo {
  font-size: 17px;
}

.p3f-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.p3f-status {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  z-index: 3;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  color: #fff;
  background: rgba(30, 20, 45, 0.68);
}

.p3f-status b {
  color: #ffd23f;
}

.p3f-status small {
  font-weight: 400;
  opacity: 0.85;
}

.p3f-left {
  margin-left: 6px;
  color: #ffd23f;
}

.p3f-left:not(:empty)::after {
  content: '초';
}

/* 깜짝 규칙 알림(세 숫자 고르기 — 폰 · 방송 화면) */
.twist {
  margin: 8px 0;
  padding: 8px 12px;
  border: 3px solid #2a1b3d;
  border-radius: 12px;
  background: #fff3b0;
  color: #2a1b3d;
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
}

.twist.mini {
  margin: 2px 0 6px;
  padding: 3px 8px;
  border-width: 2px;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.twist-tag {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #2a1b3d;
  color: #ffd23f;
}

.twist-name {
  color: #e5364b;
}

.h3-twist {
  margin: 10px auto 0;
  max-width: min(720px, 92%);
  font-size: clamp(15px, 1.6vw, 22px);
}

/* 참가자 폰 채팅 입력줄(방송 화면과 모든 참가자 폰에 뜬다 — 2026-11-02) — 따라가기 화면은 맨 아래, 글자 화면은 카드 아래 · 💬 = 이 폰에서 보이기/숨기기 */
.chat-bar {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.chat-bar .field {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  font-size: 16px;
}

.chat-bar .btn {
  flex: none;
  min-width: 68px;
  padding: 9px 12px;
}

.chat-bar .pchat-btn {
  min-width: 0;
  padding: 9px 8px;
  font-size: 15px;
}

/* 참가자 폰 채팅 칸(2026-11-02 사장님 "채팅하면 각자 플레이어의 핸드폰에 표시되도록"): 최근 4줄 · 12초 뒤 사라짐 ·
   2026-11-03 밤 사장님 "사용자가 보는 채팅도 방장처럼 왼쪽 위에 나오게" — 어느 화면이든 윗줄 바로 아래 왼쪽에 겹쳐 띄운다(누르는 데 방해되지 않게 손이 안 닿는 칸) */
.pchat {
  position: fixed;
  left: 10px;
  top: calc(env(safe-area-inset-top, 0px) + 60px);
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  max-width: min(78vw, 380px);
  margin: 0;
  pointer-events: none;
}

.pchat:empty {
  display: none;
}

.pchat-line {
  max-width: 100%;
  padding: 2px 9px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  background: rgba(30, 22, 48, 0.72);
  overflow-wrap: anywhere;
  animation: h3-chat-in 0.25s ease;
}

.pchat-line.me {
  background: rgba(80, 52, 20, 0.8);
}

.pchat-line b {
  margin-right: 4px;
}

.p3f-chat {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 4;
  margin: 0;
}

/* 방송 화면 채팅창: 왼쪽 위 로고 아래, 반투명 줄 — 새 줄이 아래에 붙고 20초 뒤 사라진다. 20줄까지(사장님) —
   화면 높이가 모자라면 오래된 줄부터 위로 잘린다(새 줄은 늘 보인다). 왼쪽 아래 '완전 종료'가 있으면 그 위까지만 */
.h3-chat {
  position: absolute;
  left: 14px;
  top: 74px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 2px;
  width: min(340px, 26vw);
  max-height: calc(100vh - 92px);
  overflow: hidden;
  pointer-events: none;
}

.host3d:has(.h3-end) .h3-chat {
  max-height: calc(100vh - 150px);
}

.h3-chat-line {
  flex: none;
  max-width: 100%;
  padding: 2px 9px;
  border-radius: 9px;
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  background: rgba(30, 22, 48, 0.72);
  overflow-wrap: anywhere;
  animation: h3-chat-in 0.25s ease;
}

.h3-chat-line b {
  margin-right: 4px;
}

@keyframes h3-chat-in {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
}

.p3f-out {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 6, 18, 0.74);
  animation: p3f-dim 0.7s ease;
}

@keyframes p3f-dim {
  from {
    background: rgba(10, 6, 18, 0);
  }
}

.p3f-card {
  display: grid;
  gap: 10px;
  justify-items: center;
  width: min(420px, 100%);
  max-height: 100%;
  overflow-y: auto;
  text-align: center;
  color: #fff;
  animation: p3f-in 0.5s ease 0.25s both;
}

@keyframes p3f-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.p3f-where {
  font-size: 14px;
  opacity: 0.85;
}

.p3f-title {
  font-size: clamp(40px, 13vw, 64px);
  font-weight: 700;
  line-height: 1.1;
  color: #ff5a6e;
}

.p3f-msg {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
}

.p3f-with b {
  color: #ffd23f;
}

.p3f-people {
  justify-content: center;
  max-height: 38vh;
  overflow-y: auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.p3f-people .dup-person {
  width: 84px;
}

.p3f-people .dup-person b {
  max-width: 84px;
  color: #fff;
}

.phone3d .count-num {
  font-size: clamp(54px, 11vh, 88px);
}

.phone3d .ask {
  font-size: 19px;
  font-weight: 700;
}

.phone3d .keypad button {
  padding: clamp(8px, 1.9vh, 16px) 0;
  font-size: clamp(24px, 4.2vh, 32px);
}

.p3-wait {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 24px 16px;
  text-align: center;
}

.p3-wait .title {
  font-weight: 700;
  font-size: clamp(30px, 9vw, 44px);
  line-height: 1.15;
}

.p3-name {
  font-weight: 700;
  color: var(--ink2);
}

.p3-big {
  font-weight: 700;
  font-size: 76px;
  line-height: 1.05;
}

/* ── 3D 방 숫자 세 개 미리 고르기 (2026-10-18 사장님 "숫자 세 개를 미리 고르고 시작") ── */
/* 폰·방장 참가 칸: 1·2·3단계 세 칸 + 숫자판. 지금 칸은 노랗게 들어 올린다 */
.pk3 {
  display: grid;
  gap: 8px;
}

.pk3-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.pk3-slot {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  border: 0;
  margin: var(--px);
  padding: 8px 4px 6px;
  background: #fff;
  box-shadow: var(--border), inset 0 calc(-1 * var(--px)) 0 0 rgba(61, 43, 36, 0.12);
  font: inherit;
  color: var(--ink);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.pk3-slot.on {
  background: var(--yellow2);
  box-shadow: var(--border), inset 0 0 0 3px var(--yellow3);
  transform: translateY(-3px);
}

.pk3-st {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.pk3-st small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink2);
}

.pk3-val {
  font-size: clamp(30px, 6vh, 46px);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.pk3-val.empty {
  color: #d8cbb4;
}

.pk3-val.bad {
  color: var(--red);
}

.pk3-rg {
  font-size: 12px;
  color: var(--ink2);
}

.pk3 .keypad .ok.ready {
  background: var(--red);
  color: #fff;
  box-shadow: var(--border), inset 0 calc(-1 * var(--px)) 0 0 var(--red2);
}

/* 폰: 세 칸이 더 있으니 키패드를 조금 낮게, '다음 ▶'·'세 개 내기'는 한 줄로 */
.phone3d .pk3 .keypad button {
  padding: clamp(7px, 1.6vh, 14px) 0;
}

.phone3d .pk3 .keypad .ok,
.pk3 .keypad .ok {
  font-size: clamp(15px, 2.5vh, 21px);
  white-space: nowrap;
}

.pk3.mini {
  gap: 4px;
}

.pk3.mini .pk3-slot {
  padding: 4px 2px;
}

.pk3.mini .pk3-val {
  font-size: 24px;
}

/* 고치는 중(2026-11-02 — 낸 뒤 '수정하기'): 위에 한 줄 · '그대로 두기' */
.pk3-edit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.pk3-edit-bar b {
  color: var(--red);
}

.p3-wait .pk3-edit {
  min-width: 60%;
  margin-top: 4px;
  font-size: 19px;
}

/* 폰 대기실 '나가기' */
.p3-wait .p3-leave {
  margin-top: 8px;
}

.p3f-status .p3-leave {
  margin: 0 0 0 6px;
  padding: 4px 10px;
  font-size: 13px;
  vertical-align: middle;
}

.p3f-status .pk3-edit {
  margin: 0 0 0 6px;
  padding: 4px 10px;
  font-size: 13px;
  vertical-align: middle;
}

.me-panel .pk3-edit {
  margin-top: 4px;
}

/* 낸 뒤(폰): 단계마다 고른 숫자 */
.pk3-done {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.pk3-done span {
  display: grid;
  justify-items: center;
  padding: 6px 2px;
  background: var(--panel);
  box-shadow: var(--border);
}

.pk3-done small {
  font-size: 12px;
  color: var(--ink2);
}

.pk3-done b {
  font-size: 34px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* 방송 화면: 단계마다 범위 */
.h3-pick-stages {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.h3-pick-stages span {
  margin: var(--px);
  padding: 4px 12px;
  font-size: clamp(15px, 2.3vh, 24px);
  background: rgba(255, 250, 240, 0.92);
  box-shadow: var(--border);
}

.h3-pick-stages .rg {
  color: var(--red2);
}

/* 3D 방장 화면 오른쪽 참가자 목록(2026-10-18 사장님 "오른쪽에 참가자의 목록을 계속 띄워 주고 한 번에 30명까지 보이게 · 마우스 휠로 내려서")
   — 30줄이 화면 높이에 맞춰 들어가고 나머지는 휠로 내려 본다. 로아에게 달리기 때는 순위(1·2·3등 금·은·동) */
.h3-roster {
  --roh: clamp(15px, calc((100vh - 170px) / 30), 25px);
  top: 70px;
  bottom: auto;
  width: min(260px, 22vw);
  gap: 0;
  padding: 8px 6px 8px 10px;
  color: #fff;
  background: rgba(30, 22, 48, 0.86);
  border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22);
  overflow: hidden;
  pointer-events: auto;
}

.ro-head {
  padding: 0 4px 6px;
  font-size: calc(var(--roh) * 0.68);
  font-weight: 700;
  color: #ffd23f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ro-head b {
  color: #fff;
}

.ro-head small {
  font-size: 0.85em;
  font-weight: 400;
  color: #d8cff0;
}

.ro-list {
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
  max-height: calc(var(--roh) * 30);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
}

.ro-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--roh);
  padding: 0 4px;
  font-size: calc(var(--roh) * 0.6);
  white-space: nowrap;
  border-radius: 4px;
}

.ro-list li.e {
  background: rgba(255, 255, 255, 0.05);
}

/* 보이는 줄 위·아래 빈 칸(app.js drawRoster — 그리지 않은 줄 높이만큼) */
.ro-list li.ro-pad {
  padding: 0;
  background: none;
}

.ro-list li.me {
  background: rgba(255, 210, 63, 0.24);
}

.ro-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ro-list em {
  font-style: normal;
  font-size: 0.85em;
  color: #d8cff0;
}

.ro-n {
  min-width: calc(var(--roh) * 0.86);
  height: calc(var(--roh) * 0.86);
  padding: 0 3px;
  font-size: 0.9em;
  line-height: calc(var(--roh) * 0.86);
  text-align: center;
  color: #fff;
  background: #6c5f8a;
  border-radius: calc(var(--roh) * 0.43);
}

.ro-n.m1 {
  color: #2a1b3d;
  background: #ffd23f;
}

.ro-n.m2 {
  color: #2a1b3d;
  background: #dfe6ee;
}

.ro-n.m3 {
  color: #2a1b3d;
  background: #e3a36a;
}

.ro-sub em,
.ro-done em,
.ro-done .ro-name {
  color: #7dffa8;
}

.ro-late em {
  color: #ffb36b;
}

.ro-out {
  opacity: 0.45;
}

.ro-out em {
  color: #ff8a9a;
}

/* 구슬 레이스 순위: 떨어진 공(drop) · 결승선에 아깝게 들어온 공(miss) */
.ro-drop {
  opacity: 0.45;
}

.ro-drop em {
  color: #ff8a9a;
}

.ro-miss em {
  color: #ffb36b;
}

/* 구슬 레이스 순위: 방장이 정한 등수로 들어온 공(우승) */
.ro-win {
  background: rgba(255, 210, 63, 0.22);
}

.ro-win em,
.ro-win .ro-name {
  color: #ffd23f;
}

/* 목록이 떠 있으면 가운데 큰 남은 초 · 방장 숫자 판을 그만큼 왼쪽으로 */
.with-roster .h3-pick {
  left: calc(50% - (min(260px, 22vw) + 14px) / 2);
}

.with-roster .h3-me {
  right: calc(min(260px, 22vw) + 28px);
}

/* ── 무궁화 꽃이 피었습니다(2026-11-03) — 참가자 폰: 큰 '꾹 누르기' 단추 화면 ──
   화면 전체 색이 로아 상태를 알린다: 노래 중 초록 · 로아가 보는 동안 빨강 · 판 소개·돌아서는 중 크림 */
.mgp {
  position: fixed;
  inset: 0;
  max-width: none;
  margin: 0;
  overflow-y: auto;
  align-content: start;
  justify-items: center;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg);
  transition: background-color 0.12s steps(2);
  user-select: none;
  -webkit-user-select: none;
}

.mgp > * {
  width: min(460px, 100%);
}

.mgp.ph-green {
  background: #d7f6c4;
}

.mgp.ph-red {
  background: #ffd0d6;
}

.mgp.ph-red.turning {
  background: #ff8a9a;
}

.mgp-name {
  font-weight: 700;
  color: var(--ink2);
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mgp-stat {
  text-align: center;
  font-size: 13px;
  color: var(--ink2);
  background: rgba(255, 250, 240, 0.85);
  box-shadow: var(--border);
  margin: var(--px);
  width: calc(min(460px, 100%) - 2 * var(--px));
  padding: 4px 8px;
}

.mgp-stat b {
  color: var(--ink);
}

/* 길: 출발선(왼쪽) → 로아(오른쪽) · 내 캐릭터 · 앞선 사람(점선) */
.mgp-track {
  display: grid;
  gap: 2px;
}

.mgp-line {
  position: relative;
  height: 46px;
  margin: 0 30px 0 12px;
  background: linear-gradient(180deg, transparent 0 58%, #a8733f 58% 72%, transparent 72%);
}

.mgp-line::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 12px;
  width: 4px;
  height: 22px;
  background: #fff;
  box-shadow: var(--border);
}

.mgp-me {
  position: absolute;
  bottom: 13px;
  width: 30px;
  transform: translateX(-50%);
  image-rendering: pixelated;
  transition: left 0.06s linear;
  z-index: 2;
}

.mgp-lead {
  position: absolute;
  bottom: 8px;
  width: 0;
  height: 34px;
  border-left: 3px dashed var(--pink);
  transform: translateX(-50%);
}

.mgp-goal {
  position: absolute;
  right: -30px;
  bottom: 10px;
  width: 34px;
  image-rendering: pixelated;
}

.mgp-dist {
  text-align: center;
  font-size: 13px;
  color: var(--ink2);
}

.mgp-dist b {
  font-size: 20px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* 폰 위쪽 작은 3D 화면(2026-11-03 밤 사장님 "위에 작게 내 주변의 화면" · "죽었을때는 게임화면 볼수있게") — 3D 가 켜지면 2D 로아 그림 대신(단추가 화면 밖으로
   밀리지 않게) · 걸리거나 닿아 '계속 구경하기'를 누르면(또는 구경하는 폰) 크게, 단추는 작게 */
.mgp-3d {
  display: none;
  position: relative;
  height: clamp(150px, 26vh, 240px);
  width: calc(min(460px, 100%) - 2 * var(--px));
  margin: 2px var(--px) 4px;
  overflow: hidden;
  box-shadow: var(--border);
  background: #9fdcf5;
}

.mgp.has3d .mgp-3d {
  display: block;
}

.mgp-3d .stage-slot {
  position: absolute;
  inset: 0;
  margin: 0;
  box-shadow: none;
}

.mgp-3d .stage {
  --stage-h: 100%;
  height: 100%;
}

.mgp.has3d .mgp-gonju {
  display: none;
}

.mgp.watching .mgp-3d {
  height: clamp(260px, 54vh, 560px);
}

.mgp.watching .mgp-btn {
  min-height: 64px;
}

.mgp.watching .mgp-btn b {
  font-size: 24px;
}

/* 로아와 노래 글자 */
.mgp-stage {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 4px 0;
}

.mgp-gonju {
  width: clamp(96px, 20vh, 150px);
  image-rendering: pixelated;
}

.mgp.turning .mgp-gonju {
  animation: mgp-spin 0.3s steps(4);
}

@keyframes mgp-spin {
  0% {
    transform: scaleX(-1) scale(1.1);
  }
  100% {
    transform: none;
  }
}

.mgp-msg {
  min-height: 1.2em;
  font-weight: 700;
  font-size: clamp(22px, 4.4vh, 34px);
  line-height: 1.2;
  text-align: center;
}

.mgp.ph-red .mgp-msg {
  color: #fff;
  animation: mgp-blink 0.5s steps(2) infinite;
}

@keyframes mgp-blink {
  50% {
    color: var(--red);
  }
}

.mgp-song {
  display: flex;
  justify-content: center;
  gap: 2px;
  font-weight: 700;
  font-size: clamp(24px, 7.4vw, 38px);
  line-height: 1.2;
}

.mgp-song span {
  color: rgba(61, 43, 36, 0.22);
}

.mgp-song span.on {
  color: var(--ink);
}

.mgp-song span.now {
  color: var(--green2);
  transform: scale(1.3) translateY(-2px);
}

.mgp.ph-red .mgp-song span.on {
  color: var(--red2);
}

/* 큰 단추: 누르고 있는 동안 초록으로 눌림 · 로아가 보면 빨강(누르고 있으면 깜빡) */
.mgp-btn {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  width: min(420px, calc(100% - 2 * var(--px)));
  min-height: clamp(150px, 27vh, 250px);
  margin: 6px var(--px);
  border: 0;
  background: var(--yellow);
  box-shadow: var(--border), inset 0 -8px 0 0 var(--yellow3), inset 0 6px 0 0 #fff2b8;
  color: var(--ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}

.mgp-btn b {
  font-size: clamp(34px, 7vh, 54px);
  line-height: 1.1;
}

.mgp-btn small {
  font-size: 14px;
  color: var(--ink2);
}

.mgp.held .mgp-btn {
  background: var(--green);
  box-shadow: var(--border), inset 0 4px 0 0 var(--green2);
  transform: translateY(4px);
}

.mgp.held .mgp-btn b,
.mgp.held .mgp-btn small {
  color: #fff;
}

.mgp.ph-red .mgp-btn {
  background: #ffe1e5;
  box-shadow: var(--border), inset 0 -8px 0 0 #ffb3bd;
}

.mgp.ph-red.held .mgp-btn {
  background: var(--red);
  animation: mgp-alarm 0.25s steps(2) infinite;
}

@keyframes mgp-alarm {
  50% {
    background: var(--red2);
  }
}

.mgp-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.mgp.is-out .mgp-btn,
.mgp.is-fin .mgp-btn {
  opacity: 0.6;
}

.mgp-watch {
  text-align: center;
  color: var(--ink2);
  padding: 18px 8px;
}

.mgp-chat {
  margin-top: 4px;
}

/* 걸림·도착 알림: 화면 가득 어둡게 + 가운데 카드 */
.mgp-over {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(24, 14, 30, 0.72);
}

.mgp-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(380px, 100%);
  padding: 22px 16px 16px;
  text-align: center;
  background: var(--panel);
  box-shadow: var(--border);
}

.mgp-card.win {
  background: #fff6d1;
}

.mgp-card-title {
  font-weight: 700;
  font-size: clamp(40px, 12vw, 58px);
  line-height: 1.05;
}

.mgp-card.out .mgp-card-title {
  color: var(--red);
}

.mgp-card-big {
  font-weight: 700;
  font-size: 44px;
  line-height: 1;
  color: #fff;
}

/* ── 무궁화 — 방송 화면: 맨 위 가운데 노래 열 글자 · 로아가 보면 빨간 글 · 판 소개는 규칙 카드 ── */
.h3-mg {
  position: absolute;
  left: 50%;
  top: clamp(62px, 9vh, 96px);
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: min(980px, 78vw);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.with-roster .h3-mg {
  left: calc(50% - (min(260px, 22vw) + 14px) / 2);
}

.h3-mg-stat {
  padding: 4px 14px;
  font-size: clamp(13px, 1.9vh, 20px);
  color: var(--ink2);
  background: rgba(255, 250, 240, 0.9);
  box-shadow: var(--border);
}

.h3-mg-stat b {
  color: var(--ink);
}

.h3-mg-song {
  display: flex;
  gap: clamp(2px, 0.6vw, 10px);
  font-weight: 700;
  font-size: clamp(36px, 7.4vh, 92px);
  line-height: 1.1;
}

.h3-mg-song span {
  opacity: 0.28;
  color: #fff;
}

.h3-mg-song span.on {
  opacity: 1;
  color: var(--yellow);
}

.h3-mg-song span.now {
  color: #fff;
  transform: scale(1.28) translateY(-4px);
}

.h3-mg.ph-red .h3-mg-song span.on {
  color: var(--red);
}

.h3-mg.ph-intro .h3-mg-song,
.h3-mg.ph-intro .h3-mg-msg {
  display: none;
}

.h3-mg-msg {
  min-height: 1.2em;
  font-weight: 700;
  font-size: clamp(26px, 5.6vh, 64px);
  line-height: 1.15;
}

.h3-mg.ph-red .h3-mg-msg {
  color: #fff;
  animation: mgp-blink 0.5s steps(2) infinite;
}

.h3-mg-intro {
  display: none;
  justify-items: center;
  gap: 10px;
  margin-top: 4vh;
  padding: 18px 26px;
  background: rgba(255, 250, 240, 0.94);
  box-shadow: var(--border);
}

.h3-mg.ph-intro .h3-mg-intro {
  display: grid;
  animation: mg-pop-in 0.4s steps(5) both;
}

@keyframes mg-pop-in {
  0% {
    opacity: 0;
    transform: scale(1.4);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.h3-mg-title {
  font-weight: 700;
  font-size: clamp(34px, 6.6vh, 76px);
  line-height: 1.1;
}

.h3-mg-intro ol {
  margin: 0;
  padding-left: 1.4em;
  text-align: left;
  font-size: clamp(16px, 2.6vh, 28px);
  line-height: 1.55;
  color: var(--ink);
}

.h3-mg-count {
  font-weight: 700;
  font-size: clamp(60px, 13vh, 150px);
  line-height: 1;
  color: #fff;
}

/* 무궁화 새 규칙(2026-11-03 사장님 "너무 많은 사람이 남는데... 색다른 룰이 더 추가 되어야") — 폰: 길 위 얼음 구간 · 내 자리 경고 줄 */
.mgp-ice {
  position: absolute;
  bottom: 12px;
  height: 9px;
  background: repeating-linear-gradient(90deg, #d9f3ff 0 6px, #b5e4fb 6px 12px);
  box-shadow: 0 -2px 0 0 #fff, 0 2px 0 0 #7cc7ea;
}

.mgp-ice::after {
  content: '❄';
  position: absolute;
  left: 50%;
  bottom: 9px;
  transform: translateX(-50%);
  font-size: 12px;
  line-height: 1;
}

.mgp-warn {
  justify-self: center;
  margin: 2px var(--px) 0;
  padding: 3px 10px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  background: var(--yellow2);
  box-shadow: var(--border);
  animation: mgp-blink 0.8s steps(2) infinite;
}

/* 방송 화면: 규칙 한 줄(판 소개 동안은 소개 칸이 대신 설명) */
.h3-mg-rules {
  padding: 3px 12px;
  font-size: clamp(12px, 1.6vh, 17px);
  color: #fff;
  background: rgba(61, 43, 36, 0.62);
}

.h3-mg.ph-intro .h3-mg-rules {
  display: none;
}

/* 방장 노래 단추: 무대 왼쪽 아래(가운데 아래는 로아 자리) — 누르고 있는 동안 로아가 느리게, 떼면 빠르게(스페이스바 · 무대 아무 곳 눌러도 같다) */
.h3-sing {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 5;
}

.h3-sing-btn {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: min(360px, 34vw);
  padding: 12px 26px 14px;
  border: 0;
  font: inherit;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: var(--border), inset 0 -6px 0 0 var(--yellow3), inset 0 5px 0 0 #fff2b8;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}

.h3-sing-btn b {
  font-size: clamp(20px, 3.2vh, 34px);
  line-height: 1.15;
}

.h3-sing-btn small {
  font-size: clamp(12px, 1.7vh, 17px);
  color: var(--ink2);
}

.h3-sing.held .h3-sing-btn {
  background: var(--green);
  box-shadow: var(--border), inset 0 4px 0 0 var(--green2);
  transform: translateY(4px);
}

.h3-sing.held .h3-sing-btn b,
.h3-sing.held .h3-sing-btn small {
  color: #fff;
}

/* 무대를 눌러도 노래한다 — 무대 위에서는 글자가 잡히지 않게 */
.host3d:has(.h3-sing) .stage-slot {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ── 투표(vote.js) — 게임 화면 위에 덮는 층 ─────────────────── */
#voteLayer {
  position: relative;
  z-index: 30;
}

.vote-fab {
  position: fixed;
  left: 14px;
  bottom: 70px;
  z-index: 30;
  font-size: 15px;
  padding: 10px 18px;
}

.vote-pop {
  position: fixed;
  inset: 0;
  z-index: 48;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 14, 32, 0.55);
  overflow-y: auto;
}

.vote-setup {
  width: min(640px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.vote-setup h3 {
  margin: 0;
}

.vote-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.vote-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: start;
}

.vote-fields {
  display: grid;
  gap: 2px;
}

.vote-fields .field {
  padding: 9px 12px;
  font-size: 15px;
}

.vote-pop-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.vote-no {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  margin-top: 4px;
  font-weight: 700;
  background: var(--yellow);
  box-shadow: var(--border);
}

.vote-txt {
  display: grid;
  min-width: 0;
  text-align: left;
}

.vote-txt b {
  overflow-wrap: anywhere;
}

.vote-txt small {
  color: var(--ink2);
}

/* 큰 화면: 투표 중 · 결과 */
.vote-full {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 14, 32, 0.6);
  overflow-y: auto;
}

.vote-board {
  width: min(1100px, 100%);
  background: var(--panel);
  box-shadow: var(--border), inset 0 calc(-1 * var(--px)) 0 0 rgba(61, 43, 36, 0.1);
  padding: clamp(18px, 3vw, 40px);
  display: grid;
  gap: 14px;
  text-align: center;
}

.vote-kicker {
  margin: 0;
  font-weight: 700;
  color: var(--ink2);
}

.vote-q {
  margin: 0;
  font-size: clamp(26px, 3.6vw, 52px);
  line-height: 1.25;
}

.vote-q-phone {
  margin: 0;
  font-size: 20px;
}

.vote-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.vote-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 18px;
  background: #fff;
  box-shadow: var(--border);
  margin: var(--px);
}

.vote-list.big {
  font-size: clamp(18px, 2vw, 28px);
}

.vote-how {
  margin: 0;
  color: var(--ink2);
}

.vote-count {
  margin: 0;
  font-size: clamp(18px, 2vw, 26px);
}

.vote-count b {
  color: var(--pink);
}

.vote-mini {
  position: fixed;
  left: 50%;
  top: 64px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 14px;
  background: var(--panel);
  box-shadow: var(--border);
  font-weight: 700;
  white-space: nowrap;
}

/* 폰 */
.vote-full.phone {
  padding: 12px;
  place-items: start center;
}

.vote-phone {
  width: min(480px, 100%);
  text-align: center;
}

.vote-choice {
  width: calc(100% - 2 * var(--px));
  margin: var(--px);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 0;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--border);
  cursor: pointer;
  touch-action: manipulation;
}

.vote-choice.on {
  background: var(--yellow2);
  box-shadow: var(--border), inset 0 0 0 var(--px) var(--yellow3);
}

.vote-choice .vote-txt {
  flex: 1;
}

.vote-mine {
  flex: none;
  align-self: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--green2);
}

.vote-done {
  margin: 0;
  font-weight: 700;
  color: var(--green2);
}

.vote-done small {
  font-weight: 400;
  color: var(--ink2);
}

.vote-mini.phone {
  top: auto;
  bottom: 12px;
  font-size: 14px;
}

/* 결과: 한 줄씩(꼴찌부터) 나타나고 막대가 차오른다 — --d 늦춤 · --w 막대 길이 */
.vote-res {
  display: grid;
  grid-template-columns: 5.5em 1fr;
  grid-template-areas: 'rank txt' 'bar bar' 'n n';
  gap: 4px 12px;
  align-items: center;
  padding: 12px 16px;
  margin: var(--px);
  background: #fff;
  box-shadow: var(--border);
  text-align: left;
  opacity: 0;
  animation: voteIn 0.5s ease-out var(--d, 0s) forwards;
}

@media (min-width: 760px) {
  .vote-list.big .vote-res {
    grid-template-columns: 6.5em minmax(0, 2.2fr) minmax(0, 1fr) 6.5em;
    grid-template-areas: 'rank txt bar n';
  }
}

.vote-rank {
  grid-area: rank;
  font-weight: 700;
}

.vote-res .vote-txt {
  grid-area: txt;
}

.vote-bar {
  grid-area: bar;
  height: 18px;
  background: var(--panel2);
  box-shadow: var(--border);
  margin: var(--px);
}

.vote-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue);
  animation: voteBar 1s ease-out var(--d, 0s) forwards;
}

.vote-n {
  grid-area: n;
  text-align: right;
  white-space: nowrap;
}

.vote-n small {
  color: var(--ink2);
}

.vote-res.win {
  background: var(--yellow2);
  box-shadow: var(--border), inset 0 0 0 var(--px) var(--yellow3);
}

.vote-res.win .vote-bar i {
  background: var(--pink);
}

.vote-list.big .vote-res.win .vote-txt b,
.vote-list.big .vote-res.win .vote-rank {
  color: var(--red2);
}

.vote-res.mine .vote-rank::after {
  content: ' · 내 표';
  font-size: 12px;
  color: var(--green2);
}

@keyframes voteIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes voteBar {
  to {
    width: var(--w);
  }
}

@media (prefers-reduced-motion: reduce) {
  .vote-res,
  .vote-bar i {
    animation-duration: 0.01s;
  }
}

/* ── 방장 비밀번호 창(hostlock.js) ─────────────────────────── */
.hostlock-card {
  width: min(420px, 100%);
  text-align: center;
}

.hostlock-card h3 {
  margin: 0;
}

.hostlock-mini {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 30;
}

/* 투표 중 큰 화면: 후보 목록 + 오른쪽 QR */
.vote-open-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
}

.vote-open-grid.no-qr {
  grid-template-columns: 1fr;
}

.vote-qr {
  margin: 0;
  display: grid;
  gap: 8px;
  justify-items: center;
  font-weight: 700;
  color: var(--ink2);
}

.vote-qr-img {
  width: clamp(150px, 16vw, 240px);
  padding: 10px;
  background: #fff;
  box-shadow: var(--border);
}

.vote-qr-img svg {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 760px) {
  .vote-open-grid {
    grid-template-columns: 1fr;
  }
}

/* 대기실 참가 QR: 눌러서 크게 보기 */
.qr[data-act='qrBig'] {
  cursor: zoom-in;
}

.qr-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.qr-big {
  position: fixed;
  inset: 0;
  z-index: 49;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 14, 32, 0.7);
  cursor: zoom-out;
}

.qr-big-card {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(16px, 3vw, 48px);
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 3vw, 40px);
  background: var(--panel);
  box-shadow: var(--border);
  max-width: 100%;
}

.qr-big-img {
  width: min(70vh, 80vw, 620px);
  padding: 16px;
  background: #fff;
  box-shadow: var(--border);
}

.qr-big-img svg {
  display: block;
  width: 100%;
  height: auto;
}

.qr-big-side {
  display: grid;
  gap: 12px;
  text-align: center;
}

.qr-big-side p {
  margin: 0;
}

.qr-big-title {
  font-size: clamp(22px, 2.6vw, 38px);
  font-weight: 700;
}

.qr-big-url {
  font-size: clamp(22px, 3vw, 44px);
  font-weight: 700;
}

.qr-big-url b {
  color: var(--pink);
}

.qr-big-count {
  font-size: clamp(18px, 2vw, 28px);
}

.qr-big-count b {
  color: var(--pink);
}

.qr-big-hint {
  color: var(--muted);
}

/* 방장 진행 도움말 */
.help-card {
  width: min(620px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.help-card h3,
.help-card h4 {
  margin: 0;
}

.help-card h4 {
  margin-top: 6px;
  color: var(--ink2);
}

.help-steps,
.help-keys,
.help-tips {
  margin: 0;
  padding-left: 1.4em;
  display: grid;
  gap: 6px;
}

.help-keys {
  list-style: none;
  padding-left: 0;
}

kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 1px 6px;
  margin-right: 2px;
  font: inherit;
  font-size: 0.85em;
  font-weight: 700;
  text-align: center;
  background: #fff;
  box-shadow: var(--border);
}
