/* =====================================================================
   qnack live — 디자인 시스템
   ---------------------------------------------------------------------
   방향: 거의 검정에 가까운 무채색 위에, 포인트는 딱 한 색.

   왜 이렇게 바꿨나
     · 보라→파랑 그라디언트와 발광 그림자는 어디서나 본 화면을 만든다.
       화려한 것과 좋은 것은 다르다
     · 색을 줄이면 남은 색이 뜻을 갖는다. 여기서 초록은 '맞음',
       빨강은 '틀림', 금색은 '지금 여기를 보라' 세 가지뿐이다
     · 빔프로젝터는 색을 흐리게 뭉갠다. 대비로 읽히게 만들어야 한다

   글자 무게는 700을 넘지 않는다. 850~900은 화면을 싸구려로 만든다.
   ===================================================================== */

:root {
  /* ---- 바탕 ---- */
  --bg:        #0b0b0c;
  --surface:   #131315;      /* 카드 */
  --surface2:  #1b1b1e;      /* 카드 위의 칸 */
  --line:      rgba(255, 255, 255, .07);
  --line-2:    rgba(255, 255, 255, .15);

  /* ---- 글자 ---- */
  --text:      #ececed;
  --muted:     #8b8b93;

  /* ---- 포인트 한 색 ----
     큐낵 브랜드 색이 정해지면 이 한 줄만 바꾸면 전체가 따라온다. */
  --accent:     #e0b356;
  --accent-ink: #17120a;     /* 포인트색 위에 얹는 글자 */
  --accent-dim: rgba(224, 179, 86, .13);

  /* ---- 뜻이 있는 색 ---- */
  --ok:   #58b98a;
  --no:   #dc6a5e;
  --warn: #e0b356;

  /* 예전 이름들 — 코드 곳곳에 남아 있어서 살려 둔다 */
  --card: var(--surface);
  --fg:   var(--text);
  --accent-2: var(--accent);
  --border-strong: var(--line-2);

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;

  --font: 'Pretendard Variable', Pretendard, ui-sans-serif, system-ui,
          -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;

  /* 그림자는 띄우는 용도가 아니라 경계를 만드는 용도다 */
  --shadow:    0 1px 2px rgba(0,0,0,.5), 0 10px 30px rgba(0,0,0,.32);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-feature-settings: 'tnum' 1, 'ss01' 1;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#app { min-height: 100dvh; display: flex; flex-direction: column; }

h1, h2, h3 { margin: 0 0 .45em; line-height: 1.22; letter-spacing: -.014em; font-weight: 650; }
p  { margin: 0 0 .55em; line-height: 1.65; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
ol, ul { margin: 0; }

.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.pad  { padding: 1rem; }
.mt   { margin-top: 1rem; }

.row { display: flex; align-items: center; }
.row.gap { gap: .55rem; }
/* between 과 center 를 같이 쓰면 뒤에 오는 쪽이 이긴다.
   실제로 "0명 참가 | 입장 마감" 이 가운데로 뭉쳐 보이던 원인이었다.
   그래서 between 을 더 구체적인 선택자로 올려 항상 이기게 한다. */
.row.center { justify-content: center; }
.row.between, .row.between.center { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.stack.sm { gap: .45rem; }
.stack.lg { gap: 1.25rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.center-col { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1.25rem; }
.page { padding: 1.75rem 1.25rem; max-width: 1040px; margin: 0 auto; width: 100%; }

.section { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em;
           color: var(--muted); margin: 1.6rem 0 .65rem; font-weight: 600; }
.section:first-child { margin-top: 0; }

/* 아이콘 — 글자와 같은 색, 같은 줄에 앉는다 */
.ico { flex: none; display: block; }
.ico.big { color: var(--muted); }

/* ---------------------------------------------------------------------
   상단 바 — 모든 화면이 같은 모양을 쓴다 (js/ui.js 의 appBar)
   --------------------------------------------------------------------- */
.bar {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem 1rem;
  background: rgba(11, 11, 12, .82);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  min-height: 52px;
}

/* 이름표 */
.brand {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--text); flex: none; display: flex; align-items: center;
  opacity: .95; transition: opacity .15s;
}
.brand:hover { opacity: 1; }
.brand.static { cursor: default; }
.bar-div { width: 1px; height: 18px; background: var(--line-2); flex: none; margin: 0 .15rem; }
.bar-title {
  margin: 0; font-size: .95rem; font-weight: 550; letter-spacing: 0;
  color: var(--muted);
}
.bar .title-input { font-size: .95rem; font-weight: 550; }
.bar .save-state { margin-left: auto; }

@media (max-width: 560px) {
  .bar { gap: .45rem; padding: .6rem .75rem; }
  .brand .logo.sm { font-size: .9rem; }
  .bar-title { display: none; }
}

/* 참가자 화면의 얇은 머리 */
.play-top {
  display: flex; align-items: center; gap: .5rem;
  padding-bottom: .1rem;
}
.logo.xs { font-size: .78rem; color: var(--muted); font-weight: 550; letter-spacing: -.01em; }
.logo.xs::after { content: '.'; color: var(--accent); }
.badge.sm { font-size: .75rem; padding: .16rem .5rem; }

/* ---------------------------------------------------------------------
   카드 · 폼
   --------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.6rem;
  width: 100%;
  box-shadow: var(--shadow);
}
.card.wide  { max-width: 620px; }
.join-card  { max-width: 390px; display: flex; flex-direction: column; gap: .85rem; text-align: center; }
.join-card > * { margin: 0; }

/* 로고 — 소문자 그대로, 마침표 하나로 끝을 맺는다 */
.logo { font-size: 1.9rem; font-weight: 600; letter-spacing: -.035em; color: var(--text); }
.logo b { font-weight: 600; }
.logo i { font-style: normal; color: var(--muted); font-weight: 400; }
.logo::after { content: '.'; color: var(--accent); }
.logo.sm { font-size: 1.02rem; text-align: left; }

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

input[type=text], input[type=url], input[type=email], input[type=number],
textarea, select {
  width: 100%;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: .68rem .8rem;
  outline: none;
  transition: border-color .15s, background .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--muted);
  background: rgba(255, 255, 255, .055);
}
textarea { resize: vertical; }

.field { display: flex; flex-direction: column; gap: .32rem; text-align: left; }
.field > label { font-size: .78rem; color: var(--muted); font-weight: 600; }

.check { display: flex; align-items: center; gap: .45rem; font-size: .9rem; cursor: pointer; }
.check input { width: auto; }

/* 토글 스위치 */
.opt-list { display: flex; flex-direction: column; gap: .1rem; }
.switch { display: flex; align-items: center; gap: .7rem; cursor: pointer;
          padding: .5rem 0; font-size: .93rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 40px; height: 23px; border-radius: 999px; flex: none;
  background: rgba(255,255,255,.13); position: relative; transition: background .2s;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 17px; height: 17px; border-radius: 50%; background: #fff;
  transition: transform .22s var(--ease);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { background: var(--accent-ink); }
.switch input:checked + .track::after { transform: translateX(17px); }

.title-input {
  flex: 1; background: transparent; border: 1px solid transparent;
  font-size: 1.05rem; font-weight: 700;
}
.title-input:hover { border-color: var(--line-2); }

.big-input { font-size: 1.3rem; padding: 1rem; text-align: center; font-weight: 600; }

.pin-input {
  font-size: 2.2rem; font-weight: 850; text-align: center;
  letter-spacing: .32em; padding: .85rem .5rem .85rem .82rem;
}

/* ---------------------------------------------------------------------
   버튼
   --------------------------------------------------------------------- */
.btn {
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: .6rem 1rem;
  cursor: pointer;
  font-weight: 550;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .1); border-color: var(--line-2); }
.btn:active:not(:disabled) { background: rgba(255, 255, 255, .14); }
.btn:disabled { opacity: .35; cursor: not-allowed; }

/* 주된 행동 — 화면에 하나뿐이어야 한다 */
.btn.accent {
  background: var(--accent); color: var(--accent-ink);
  border-color: var(--accent); font-weight: 650;
}
.btn.accent:hover:not(:disabled) { background: #eec269; border-color: #eec269; }
.btn.accent:active:not(:disabled) { background: #d0a447; }

.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: rgba(255,255,255,.06); }
.btn.sm  { padding: .34rem .7rem; font-size: .84rem; border-radius: 7px; }
.btn.big { padding: .9rem 1.3rem; font-size: 1.02rem; width: 100%; }
.btn.danger { color: var(--no); }
.btn.danger:hover:not(:disabled) { background: rgba(220,106,94,.12); border-color: var(--no); }
.wide-btn { width: 100%; margin-top: .9rem; }

.icon-btn {
  background: transparent; border: 1px solid var(--line-2);
  color: var(--muted); border-radius: 7px;
  width: 32px; height: 32px; cursor: pointer; flex: none;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover:not(:disabled) { color: var(--text); background: rgba(255,255,255,.06); }
.icon-btn:disabled { opacity: .28; }

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
  border-radius: 999px; padding: .24rem .7rem; font-size: .82rem; font-weight: 550;
  color: var(--muted);
}
.badge.ghost { background: transparent; }
.badge.lg { font-size: 1.25rem; padding: .45rem 1.2rem; font-weight: 650; color: var(--text); }

.pill {
  border: 1px solid var(--line-2); background: transparent; color: var(--muted);
  border-radius: 999px; padding: .28rem .75rem; font-size: .78rem; cursor: pointer;
  flex: none; font-weight: 700; transition: all .16s;
}
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.hint { color: var(--muted); font-size: .86rem; }
.hint.center { text-align: center; }
.label { color: var(--muted); font-size: .78rem; font-weight: 700;
         letter-spacing: .07em; text-transform: uppercase; }

.notice {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  background: var(--accent-dim); border: 1px solid rgba(224,179,86,.28);
  border-radius: var(--r-sm); padding: .7rem .95rem; margin-bottom: 1.1rem; font-size: .88rem;
}
.notice span { flex: 1; min-width: 200px; }

/* =====================================================================
   시간 — 이 앱의 심장
   ===================================================================== */
.timebar {
  position: fixed; top: 0; left: 0; right: 0; height: 5px;
  background: rgba(255, 255, 255, .06); z-index: 30; overflow: hidden;
}
.timebar .fill {
  height: 100%; width: 100%; transform-origin: left center;
  background: var(--text);
  transition: background .5s linear;
  will-change: transform;
}

.clock {
  font-size: clamp(3rem, 8.5vw, 5.6rem);
  font-weight: 600; line-height: 1; letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  transition: color .4s;
  color: var(--text);
}
.clock[data-level="warn"]  { color: var(--warn); }
.clock[data-level="panic"] { color: var(--no); }
.clock.sm { font-size: 1.75rem; }
.clock.beat { animation: beat .34s var(--ease); }
@keyframes beat {
  0%   { transform: scale(1.24); }
  60%  { transform: scale(.97); }
  100% { transform: scale(1); }
}

/* 5초 이하 경고 섬광 */
.fx-alarm::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 25;
  box-shadow: inset 0 0 0 3px var(--no), inset 0 0 110px rgba(220,106,94,.28);
  animation: alarmPulse 1s ease-in-out infinite;
}
@keyframes alarmPulse { 0%, 100% { opacity: .35; } 50% { opacity: .95; } }

/* =====================================================================
   무대 (호스트)
   ===================================================================== */
.stage {
  flex: 1; display: flex; flex-direction: column; gap: 1.1rem;
  padding: 1.5rem 1.5rem 1.25rem; max-width: 1180px; margin: 0 auto; width: 100%;
}
.stage-top { display: flex; align-items: center; gap: .5rem; }
.stage-mid { display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.stage-bottom {
  margin-top: auto; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; padding-top: .6rem;
}
.stage-bottom .btn.big { width: auto; min-width: 220px; margin-left: auto; }

.prompt {
  font-size: clamp(1.6rem, 4vw, 3rem);
  font-weight: 600; text-align: center; text-wrap: balance; letter-spacing: -.02em;
  animation: riseIn .5s var(--ease) both;
}
.prompt.sm { font-size: clamp(1.15rem, 2.4vw, 1.75rem); }
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.stage-img { max-height: 27vh; object-fit: contain; border-radius: var(--r); }
.stage-note { text-align: center; color: var(--muted); font-size: 1.05rem; }

/* 응답 진행 미터 */
.answer-meter { display: flex; align-items: center; gap: .6rem; }
.am-bar { width: 130px; height: 7px; border-radius: 999px;
          background: rgba(255,255,255,.1); overflow: hidden; }
.am-fill { height: 100%; width: 0; border-radius: 999px;
           background: var(--accent); transition: width .35s var(--ease); }
.am-num { font-size: .9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.answer-meter.bump { animation: beat .22s var(--ease); }

/* 보기 타일 (호스트 = 표시 전용) */
.choice-grid {
  display: grid; gap: .7rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
/* --c 가 없어도 반드시 보이도록 폴백을 둔다 */
.choice-tile {
  --c: var(--muted);
  display: flex; align-items: center; gap: .85rem;
  border-radius: var(--r); padding: 1.05rem 1.15rem;
  font-size: 1.12rem; font-weight: 500; color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--line-2);
  animation: tileIn .45s var(--ease) both;
}
@keyframes tileIn {
  from { opacity: 0; transform: translateY(22px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
/* 색은 이 뱃지 하나만 갖는다. 폰과 큰 화면을 눈으로 잇는 표식이다 */
.choice-tile .k, .ans-tile .k {
  width: 30px; height: 30px; flex: none; border-radius: 7px;
  background: var(--c); color: #fff; display: grid; place-items: center;
  font-weight: 650; font-size: .88rem;
}
.choice-tile .ct { min-width: 0; }

.initial-hint {
  font-size: clamp(3rem, 11vw, 6.5rem); font-weight: 600;
  letter-spacing: .22em; text-align: center;
  color: var(--accent);
}
.initial-hint.sm { font-size: clamp(2rem, 14vw, 3.4rem); }

.puzzle-preview { display: flex; flex-direction: column; gap: .5rem; max-width: 620px; margin: 0 auto; width: 100%; }
.pp-item {
  background: var(--surface2); border: 1px solid var(--line-2);
  border-radius: 12px; padding: .8rem 1rem; animation: tileIn .45s var(--ease) both;
}
.slide-body { font-size: 1.25rem; line-height: 1.85; white-space: pre-wrap; max-width: 780px; margin: 0 auto; }

/* ---------------------------------------------------------------------
   결과 차트
   --------------------------------------------------------------------- */
.reveal-in { animation: riseIn .45s var(--ease) both; }

.bars {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 1.1rem; height: 46vh; min-height: 220px; padding: 0 1rem;
}
.bar-col { flex: 1; max-width: 165px; display: flex; flex-direction: column;
           align-items: center; height: 100%; justify-content: flex-end; gap: .45rem; }
.bar {
  --c: var(--line-2); --h: 60%;
  width: 100%; border-radius: 6px 6px 2px 2px; height: 0;
  background: var(--c);
  animation: growBar .85s var(--ease) forwards;
}
@keyframes growBar { to { height: var(--h); } }
.bar.correct { background: var(--ok); }
.bar-val { font-weight: 600; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.bar-label { font-size: .86rem; display: flex; gap: .35rem; align-items: center;
             max-width: 100%; color: var(--muted); }
.bar-label.hit { color: var(--ok); font-weight: 700; }
.bar-label .k { background: rgba(255,255,255,.09); border-radius: 6px;
                padding: 0 .4rem; font-weight: 800; flex: none; }
.tick { flex: none; }

.answer-line {
  text-align: center; font-size: 1.3rem; font-weight: 600; color: var(--ok);
  animation: riseIn .5s var(--ease) .1s both;
}
.explain {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: .85rem 1.1rem; color: var(--muted);
  max-width: 720px; margin: 0 auto; text-align: center;
}

.cloud { display: flex; flex-wrap: wrap; gap: .5rem 1.15rem; justify-content: center;
         align-items: center; padding: 1.5rem; min-height: 200px; }
.cw { line-height: 1.05; font-weight: 550; color: var(--text);
      animation: tileIn .5s var(--ease) both; }

/* ---------------------------------------------------------------------
   순위표 · 포디움
   --------------------------------------------------------------------- */
.board { list-style: none; padding: 0; margin: 0 auto; max-width: 580px; width: 100%; }
.board li {
  display: flex; align-items: center; gap: .8rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: .75rem 1.05rem; margin-bottom: .4rem;
  animation: slideIn .45s var(--ease) both;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
.board li.top { border-color: rgba(224,179,86,.4); background: var(--accent-dim); }
.board .rk { width: 1.6rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.board .nm { flex: 1; font-weight: 500; }
.board .sc { font-variant-numeric: tabular-nums; font-weight: 600; }
.board.sm li { padding: .45rem .9rem; font-size: .9rem; }

.podium-stage { justify-content: center; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 1.1rem; margin: 1rem 0 1.6rem; }
.pod { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 150px; max-width: 30vw; }
.pod.empty { visibility: hidden; }
.pod-crown { height: 2rem; display: grid; place-items: center; color: var(--accent); }
.pod-name { font-weight: 550; max-width: 100%; }
.pod-score { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.pod-block {
  width: 100%; border-radius: 14px 14px 0 0;
  background: var(--surface2);
  border: 1px solid var(--line-2); border-bottom: 0;
  display: grid; place-items: center; font-size: 1.9rem; font-weight: 600;
  animation: podRise .7s var(--ease) both;
}
.pod.r1 .pod-block { height: 190px; background: var(--accent); color: var(--accent-ink);
                     border-color: var(--accent); animation-delay: .35s; }
.pod.r2 .pod-block { height: 140px; animation-delay: .15s; }
.pod.r3 .pod-block { height: 105px; animation-delay: 0s; }
@keyframes podRise { from { transform: scaleY(0); transform-origin: bottom; } to { transform: none; } }

/* =====================================================================
   플레이어
   ===================================================================== */
.play { flex: 1; display: flex; flex-direction: column; gap: .9rem; padding: .9rem; }

.nick-sm { font-size: .9rem; color: var(--muted); text-align: center; }
.play-prompt { font-size: 1.2rem; text-align: center; text-wrap: balance; margin: 0; }

.answer-grid { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; flex: 1; align-content: stretch; }
.answer-grid.n2 { grid-template-columns: 1fr; }
.answer-grid.n3 { grid-template-columns: 1fr; }
.span-all { grid-column: 1 / -1; }

.ans-tile {
  --c: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .55rem; border: 1px solid var(--line-2); border-radius: var(--r);
  min-height: 108px; padding: 1rem; color: var(--text); font-weight: 500; font-size: 1.05rem;
  cursor: pointer; text-align: center; position: relative; overflow: hidden;
  background: var(--surface2);
  animation: tileIn .4s var(--ease) both;
  transition: transform .12s var(--ease), border-color .16s, background .16s;
}
.ans-tile:active { transform: scale(.97); }
.ans-tile.picked {
  border-color: var(--accent); background: var(--accent-dim);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.ans-tile.locked { animation: lockIn .45s var(--ease) both; }
@keyframes lockIn {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.05); box-shadow: 0 0 0 6px var(--accent-dim); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}
.ans-tile .at { line-height: 1.3; }

.sortable { list-style: none; padding: 0; margin: 0;
            display: flex; flex-direction: column; gap: .5rem; }
.sortable .k {
  width: 28px; height: 28px; flex: none; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--line-2); color: var(--muted);
  display: grid; place-items: center; font-size: .8rem; font-weight: 600;
}

.slider { width: 100%; accent-color: var(--accent); height: 44px; }
.slider-val { text-align: center; font-size: 2.8rem; font-weight: 600;
              font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.slider-val small { font-size: 1.1rem; color: var(--muted); margin-left: .2rem; }

/* 대기 인디케이터 */
.orbit { position: relative; height: 46px; display: grid; place-items: center; }
.orbit i {
  position: absolute; width: 11px; height: 11px; border-radius: 50%;
  background: var(--muted);
  animation: orbit 1.25s var(--ease) infinite;
}
.orbit i:nth-child(2) { animation-delay: .16s; }
.orbit i:nth-child(3) { animation-delay: .32s; }
@keyframes orbit {
  0%   { transform: translateX(-24px) scale(.55); opacity: .35; }
  50%  { transform: translateX(0) scale(1.15);    opacity: 1; }
  100% { transform: translateX(24px) scale(.55);  opacity: .35; }
}
.nick { font-size: 1.45rem; font-weight: 600; }
.score-line { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }

/* 이름 고치기 (대기 화면) */
.nick-edit { display: flex; flex-direction: column; gap: .4rem; }
.nick-edit .row { gap: .4rem; }
.nick-input {
  flex: 1; min-width: 0; text-align: center;
  font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em;
  padding: .6rem .7rem;
}
.nick-note { margin: 0; transition: color .2s; }
.nick-note.ok  { color: var(--ok); }
.nick-note.bad { color: var(--no); }

/* 결과 */
.result { align-items: center; justify-content: center; text-align: center; gap: .6rem; }
.result.ok { background: radial-gradient(760px 460px at 50% 10%, rgba(88,185,138,.13), transparent 70%); }
.result.no { background: radial-gradient(760px 460px at 50% 10%, rgba(220,106,94,.11), transparent 70%); }
.result-icon {
  width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line-2); color: var(--muted);
  animation: popIn .45s var(--ease) both;
}
@keyframes popIn { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.result.ok .result-icon { border-color: var(--ok); color: var(--ok); }
.result.no .result-icon { border-color: var(--no); color: var(--no); }
.result.neutral .result-icon { border-color: var(--line-2); color: var(--muted); }
.result-title { font-size: 1.9rem; font-weight: 600; margin: 0; }
.gain { font-size: 2.4rem; font-weight: 600; font-variant-numeric: tabular-nums;
        letter-spacing: -.035em; margin: 0; }
.bonus { color: var(--accent); font-weight: 550; margin: 0;
         display: inline-flex; align-items: center; gap: .35rem; }

.result-foot, .final-stats { display: flex; gap: 1.6rem; justify-content: center; margin-top: 1rem; }
.rstat { display: flex; flex-direction: column; gap: .1rem; }
.rstat .lbl { font-size: .74rem; color: var(--muted); font-weight: 600; }
.rstat strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* 결과 한가운데 놓이는 큰 아이콘 */
.big-emoji { line-height: 1; animation: popIn .5s var(--ease) both;
             display: grid; place-items: center; color: var(--text); }
.big-emoji.dim { opacity: .45; }
.big-emoji .ico { color: inherit; }

/* =====================================================================
   로비
   ===================================================================== */
.lobby {
  flex: 1; display: grid; gap: 1.5rem; padding: 1.5rem;
  grid-template-columns: minmax(300px, 380px) 1fr; align-items: start;
  max-width: 1180px; margin: 0 auto; width: 100%;
}
.pin-panel {
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.4rem; text-align: center; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .9rem;
}
.pin-panel > * { margin: 0; }
.pin-panel .qr { align-self: center; }
.url-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.url-row .join-url {
  min-width: 0; padding: .4rem .6rem; border-radius: 6px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  font-size: .84rem; font-variant-numeric: tabular-nums;
}
.join-url { font-size: .88rem; color: var(--muted); flex: 1; text-align: left; }

.warn-box {
  text-align: left; margin-top: 1rem; padding: .8rem .9rem;
  background: var(--accent-dim); border: 1px solid rgba(224,179,86,.28);
  border-radius: var(--r-sm); font-size: .82rem; line-height: 1.6;
}
.warn-box strong { display: block; margin-bottom: .2rem; color: var(--warn); }
.warn-box p { margin: 0; color: var(--muted); }
.warn-box code {
  background: rgba(0,0,0,.4); border-radius: 5px; padding: .1rem .35rem;
  font-size: .8em; color: var(--text);
}
.pin { display: flex; gap: .3rem; justify-content: center; }
.pin-d {
  font-size: 2.6rem; font-weight: 500; font-variant-numeric: tabular-nums;
  background: var(--surface2); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); width: 48px; padding: .18rem 0; letter-spacing: 0;
  animation: popIn .5s var(--ease) both;
}
.qr { border-radius: var(--r-sm); background: #fff; padding: 8px; }

.lobby-right {
  display: flex; flex-direction: column; gap: 1rem;
  min-height: 100%;
}
.lobby-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.lobby-head h3 {
  margin: 0; font-size: 1.05rem; font-weight: 600;
  display: flex; align-items: baseline; gap: .35rem;
}
.lobby-head h3 span { font-variant-numeric: tabular-nums; }
.player-chips {
  display: flex; flex-wrap: wrap; gap: .45rem; align-content: flex-start;
  min-height: 112px; padding: .85rem;
  border: 1px dashed var(--line); border-radius: var(--r-sm);
  background: rgba(255,255,255,.014);
}
/* 아무도 없을 때 — 빈 상자만 덩그러니 두지 않는다 */
.player-chips:empty::before {
  content: '아직 아무도 없습니다. QR 을 찍으면 여기에 이름이 뜹니다';
  color: var(--muted); font-size: .86rem; align-self: center;
  width: 100%; text-align: center; line-height: 1.6;
}
/* 발표 화면에서는 테두리 없이 이름만 크게 */
.player-chips.big {
  border: 0; background: none; padding: 0; min-height: 0;
}
.player-chips.big:empty::before { content: none; }
.chip {
  background: var(--surface2); border: 1px solid var(--line-2);
  border-radius: 999px; padding: .38rem .85rem; cursor: pointer; font-size: .88rem;
  font-weight: 500; animation: popIn .35s var(--ease) both;
}
.chip.alive { background: rgba(88,185,138,.12); border-color: rgba(88,185,138,.34); cursor: default; }

.lobby-actions {
  margin-top: auto; display: flex; flex-direction: column; gap: .6rem;
  padding-top: 1rem; border-top: 1px solid var(--line);
}
.lobby-actions .hint { margin: 0; }

.game-panel {
  border: 1px solid var(--line); border-radius: var(--r);
  padding: .9rem 1rem; background: var(--surface);
  display: flex; flex-direction: column; gap: .6rem;
  max-width: 640px; margin: 0 auto; width: 100%;
}
.game-picker { display: flex; gap: .55rem; flex-wrap: wrap; }
.game-chip {
  display: flex; align-items: center; gap: .65rem; flex: 1; min-width: 190px;
  background: var(--surface2); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: .7rem .9rem; cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
}
.game-chip:hover:not(:disabled) {
  border-color: var(--accent); background: var(--accent-dim);
}
.game-chip:disabled { cursor: not-allowed; opacity: .55; }
.game-chip.locked { border-style: dashed; }
.game-chip .gi { flex: none; color: var(--muted); display: grid; place-items: center; }
.game-chip:hover:not(:disabled) .gi { color: var(--accent); }
.game-chip .gl { display: flex; flex-direction: column; min-width: 0; }
.game-chip .gl strong { font-weight: 600; font-size: .94rem; }
.game-chip .gl small { color: var(--muted); font-size: .74rem;
                       overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.exp-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.exp {
  display: flex; flex-direction: column; gap: .2rem; text-align: left;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: .9rem; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.exp.on { border-color: var(--accent); background: var(--accent-dim); }
.exp strong { font-weight: 600; }
.exp span { font-size: .78rem; color: var(--muted); }

/* 발표 화면 주소 상자 */
.present-box {
  display: flex; flex-direction: column; gap: .55rem;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); padding: .95rem 1.1rem;
  max-width: 1180px; margin: 1.2rem auto 0; width: calc(100% - 3rem);
}
.present-box strong { font-weight: 600; font-size: .95rem; }
.present-box p { margin: 0; }
.present-box .row { color: var(--muted); }
.present-box.live {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-dim);
}
.present-box.live .row, .present-box.live strong { color: var(--accent); }

/* =====================================================================
   미니게임
   ===================================================================== */
.game-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1.1rem; padding: 1.5rem;
  max-width: 1000px; margin: 0 auto; width: 100%; text-align: center;
  position: relative;
}
.game-play {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1rem; padding: 1.4rem; text-align: center;
  position: relative;
}
.game-title { font-size: clamp(1.45rem, 3.8vw, 2.3rem); font-weight: 600; margin: 0;
              display: flex; align-items: center; gap: .6rem; justify-content: center; }
.game-sub { color: var(--muted); margin: 0; }
.game-result {
  font-size: clamp(1.9rem, 6.5vw, 3.2rem); font-weight: 600; margin: 0;
  color: var(--text); letter-spacing: -.025em;
}

/* 사다리 */
.prize-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); width: 100%; }
.prize-cell { display: flex; align-items: center; gap: .5rem; }
.prize-no { width: 28px; height: 28px; flex: none; border-radius: 7px;
            display: grid; place-items: center; font-weight: 600; font-size: .82rem; color: #fff; }
.lane-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); width: 100%; }
.lane-card {
  border: 1px dashed var(--line-2); border-radius: var(--r); padding: .9rem .6rem;
  display: flex; flex-direction: column; gap: .3rem; transition: all .2s;
}
.lane-card.taken { border-style: solid; border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.lane-no { font-size: 1.45rem; font-weight: 600; }
.lane-who { font-size: .85rem; color: var(--muted); }
.lane-pick { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); width: 100%; max-width: 420px; }
.lane-btn {
  --c: var(--accent);
  border: 1px solid var(--c); border-radius: var(--r); min-height: 84px; cursor: pointer;
  font-size: 1.7rem; font-weight: 600; color: var(--text);
  background: color-mix(in srgb, var(--c) 16%, var(--surface));
  transition: transform .12s var(--ease);
}
.lane-btn:active { transform: scale(.94); }
.ladder-wrap { width: 100%; max-width: 860px; }
.ladder-wrap.small { max-width: 460px; opacity: .75; }
.ladder-svg { width: 100%; height: auto; }

.result-list { list-style: none; padding: 0; width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: .4rem; }
.result-list li {
  display: flex; align-items: center; gap: .6rem; padding: .6rem .85rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  animation: slideIn .4s var(--ease) both;
}
.result-list li.hit { border-color: var(--ok); background: rgba(88,185,138,.11); }
.rl-no { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
         font-size: .78rem; font-weight: 600; color: #fff; flex: none; }

/* 레인 번호 — 이 클래스에 스타일이 아예 없어서 숫자만 덩그러니 있었다.
   사다리 줄 색과 같은 색을 줘야 "저 줄이 이 사람" 이 눈으로 이어진다. */
.rl-lane {
  width: 24px; height: 24px; flex: none; border-radius: 6px;
  display: grid; place-items: center;
  font-size: .76rem; font-weight: 600; color: #fff;
  background: var(--c, var(--muted));
}
.rl-name { font-weight: 550; }
.rl-arrow { color: var(--muted); }
.rl-prize { margin-left: auto; font-weight: 600; }

/* 가위바위보 */
.rps-count { font-size: clamp(4rem, 16vw, 9rem); font-weight: 600; letter-spacing: -.05em;
             color: var(--accent); animation: beat .5s var(--ease) both;
             font-variant-numeric: tabular-nums; }
.rps-hands { display: flex; gap: 1.5rem; }
.rps-hands.big span { color: var(--muted); animation: bob 1.1s ease-in-out infinite; }
.rps-hands.big span:nth-child(2) { animation-delay: .16s; }
.rps-hands.big span:nth-child(3) { animation-delay: .32s; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

.rps-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
            width: 100%; max-width: 700px; }
.rps-cell {
  border-radius: var(--r); padding: 1rem .5rem; display: flex; flex-direction: column;
  align-items: center; gap: .35rem; border: 1px solid var(--line);
  background: var(--surface); animation: popIn .4s var(--ease) both;
}
.rps-cell.win  { border-color: var(--ok); background: rgba(88,185,138,.1); }
.rps-cell.win .rps-emoji { color: var(--ok); }
.rps-cell.lose { opacity: .38; }
.rps-emoji { line-height: 1; color: var(--muted); display: grid; place-items: center; }
.rps-nick { font-size: .82rem; font-weight: 500; }

.rps-pick { display: grid; gap: .7rem; grid-template-columns: 1fr 1fr 1fr; width: 100%; max-width: 460px; }
.rps-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  border: 1px solid var(--line-2); border-radius: var(--r); min-height: 130px; cursor: pointer;
  background: var(--surface2); font-weight: 550; color: var(--text);
  transition: transform .12s var(--ease), border-color .16s, background .16s;
}
.rps-btn:active { transform: scale(.96); }
.rps-btn.chosen { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

.alive-chips { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; max-width: 640px; }

/* 순발력 */
.rx { padding: 0; }
.rx-pad {
  flex: 1; width: 100%; border: none; cursor: pointer; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .6rem; font-weight: 750; font-size: 1.05rem; min-height: 70dvh;
  transition: background .08s;
}
.rx-pad.wait { background: #2a1416; }
.rx-pad.go   { background: #13372a; animation: goFlash .25s var(--ease); }
@keyframes goFlash { from { transform: scale(1.06); } to { transform: scale(1); } }
.rx-big { font-size: clamp(3rem, 14vw, 6rem); font-weight: 600; letter-spacing: -.04em;
          font-variant-numeric: tabular-nums; }
.rx-wait { font-size: clamp(2.4rem, 8.5vw, 4.6rem); font-weight: 600; color: var(--no);
           animation: alarmPulse 1.1s ease-in-out infinite; }
.rx-go   { font-size: clamp(3.4rem, 13vw, 7.5rem); font-weight: 600; color: var(--ok); }

/* 눈치싸움 */
.nz-preview { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.nz-chip {
  width: 50px; height: 50px; border-radius: var(--r-sm); display: grid; place-items: center;
  background: var(--surface2); border: 1px solid var(--line-2);
  font-size: 1.25rem; font-weight: 550; font-variant-numeric: tabular-nums;
}
.nz-grid { display: grid; gap: .5rem; width: 100%; max-width: 760px;
           grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.nz-cell {
  border: 1px solid var(--line); border-radius: var(--r); padding: .8rem .5rem;
  display: flex; flex-direction: column; gap: .25rem; position: relative;
  background: var(--surface); animation: popIn .35s var(--ease) both;
}
.nz-cell.safe  { border-color: var(--ok); background: rgba(88,185,138,.1); }
.nz-cell.clash { border-color: var(--no); background: rgba(220,106,94,.1); }
.nz-num { font-size: 1.65rem; font-weight: 550; font-variant-numeric: tabular-nums; }
.nz-names { font-size: .8rem; color: var(--muted); }
.nz-tag { position: absolute; top: .4rem; right: .5rem; font-size: .68rem;
          color: var(--no); font-weight: 600; }
.nz-pick { display: grid; gap: .6rem; width: 100%; max-width: 420px;
           grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.nz-btn {
  border: 1px solid var(--line-2); border-radius: var(--r); min-height: 92px; cursor: pointer;
  background: var(--surface2); font-size: 1.9rem; font-weight: 550; color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: transform .12s var(--ease), border-color .16s, background .16s;
}
.nz-btn:active { transform: scale(.96); }
.nz-btn.chosen { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

/* 룰렛 */
.wheel-wrap { width: 100%; max-width: 340px; }
.wheel { width: 100%; height: auto; }
.spinner.dice { color: var(--muted); animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 에디터의 게임 헤더 */
.game-head {
  display: flex; align-items: center; gap: .8rem;
  padding-bottom: .8rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem;
}
.game-head .gi { color: var(--muted); display: grid; place-items: center; }
.game-head p { margin: 0; }
.qcard.game { border-left: 2px solid var(--accent); }

/* 홈 — 두 갈래 입구 */
.entry-grid { display: grid; gap: .8rem; margin: .3rem 0 1.2rem;
              grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.entry-grid.games { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.entry {
  display: flex; flex-direction: column; align-items: flex-start; gap: .3rem;
  border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 1.35rem; cursor: pointer; text-align: left;
  background: var(--surface);
  transition: border-color .16s, background .16s;
}
.entry:hover { border-color: var(--accent); background: var(--accent-dim); }
.entry-icon { color: var(--muted); margin-bottom: .35rem; }
.entry:hover .entry-icon { color: var(--accent); }
.entry strong { font-size: 1.1rem; font-weight: 600; }
.entry-desc { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.game-pick .badge { margin-top: .35rem; }

/* 진행 방식 선택 */
.mode-grid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.mode-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: .3rem;
  border: 1px solid var(--line-2); border-radius: var(--r); padding: 1.15rem;
  cursor: pointer; text-align: left;
  background: var(--surface); position: relative;
  transition: border-color .16s, background .16s;
}
.mode-card:hover { border-color: var(--accent); background: var(--accent-dim); }
.mode-card.recommended { border-color: rgba(224,179,86,.4); }
.mc-tag {
  position: absolute; top: -8px; right: 12px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; padding: .1rem .55rem; font-size: .68rem; font-weight: 600;
}
.mc-icon { color: var(--muted); margin-bottom: .3rem; }
.mode-card:hover .mc-icon, .mode-card.picked .mc-icon { color: var(--accent); }
.mode-card strong { font-size: 1.03rem; font-weight: 600; }
.mc-desc { color: var(--muted); font-size: .8rem; line-height: 1.5; }
.mc-scale {
  margin-top: .4rem; font-size: .72rem; font-weight: 600; color: var(--accent);
  background: var(--accent-dim); border-radius: 999px; padding: .12rem .55rem;
}
.hint.center { text-align: center; }

/* 따로따로 — 진행률 대시보드 */
.prog-list { display: flex; flex-direction: column; gap: .45rem;
             max-width: 720px; margin: 0 auto; width: 100%; }
.prog-row {
  display: flex; align-items: center; gap: .7rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: .6rem .9rem;
}
.prog-row.done { border-color: rgba(88,185,138,.35); background: rgba(88,185,138,.09); }
.pr-name { width: 130px; font-weight: 500; }
.pr-bar { flex: 1; height: 9px; border-radius: 999px;
          background: rgba(255,255,255,.1); overflow: hidden; }
.pr-fill { height: 100%; border-radius: 999px;
           background: var(--accent); transition: width .5s var(--ease); }
.pr-num { font-size: .84rem; color: var(--muted); font-variant-numeric: tabular-nums;
          width: 52px; text-align: right; }
.pr-tick { color: var(--ok); display: grid; place-items: center; }

/* 진행 중 진행자 버튼 — 화면 아래에 조용히 붙어 있는다 */
.game-actions {
  display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap;
  margin-top: .9rem; padding-top: .8rem;
  border-top: 1px solid var(--line); width: 100%; max-width: 460px;
}

/* 사다리 가로대가 드러나는 연출 */
.rung { animation: rungIn .3s var(--ease) both; }
@keyframes rungIn { from { opacity: 0; transform: scaleX(.2); } to { opacity: 1; } }
.prize-no.win { background: var(--ok); }
.game-stage.wide { max-width: 1100px; }

/* =====================================================================
   에디터
   ===================================================================== */
.editor-wrap {
  display: grid; grid-template-columns: 268px 1fr;
  flex: 1; min-height: 0; height: calc(100dvh - 57px);
}
.editor-side {
  background: rgba(255,255,255,.014); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.side-scroll { overflow-y: auto; flex: 1; padding: .9rem .75rem; }
.side-head { display: flex; align-items: center; justify-content: space-between;
             padding: 0 .25rem .6rem; }
.qlist { display: flex; flex-direction: column; gap: .4rem; }
.side-add { padding: .75rem; border-top: 1px solid var(--line);
            background: rgba(0,0,0,.2); }
.side-tip { margin: .8rem .25rem 0; opacity: .65; }

.qcard {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: .55rem .5rem; cursor: pointer;
  text-align: left; width: 100%; transition: border-color .14s, background .14s;
}
.qcard:hover { border-color: var(--line-2); background: var(--surface2); }
.qcard.active { border-color: var(--accent); background: var(--accent-dim); }
.qcard.game { border-left: 3px solid var(--accent-2); }
.qnum { font-size: .72rem; color: var(--muted); width: 1.1rem; flex: none;
        font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.qico { flex: none; color: var(--muted); display: grid; place-items: center; }
.qcard.active .qico { color: var(--accent); }
.qtxt { font-size: .86rem; flex: 1; min-width: 0; }

.editor-main {
  display: flex; flex-direction: column; min-height: 0;
  overflow: hidden;
}
.detail-head {
  display: flex; align-items: center; gap: .5rem;
  padding: .8rem 1.5rem; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.02); flex: none;
}
.type-select { width: auto; min-width: 148px; }
.detail-body {
  flex: 1; overflow-y: auto; padding: 1.4rem 1.5rem 3rem;
  display: flex; flex-direction: column; gap: 1.1rem;
  max-width: 780px; width: 100%;
}

.panel { background: var(--surface); border: 1px solid var(--line);
         border-radius: var(--r); padding: 1.1rem; }
.preview { max-height: 170px; border-radius: 12px; object-fit: contain; align-self: start; }

/* 라벨 + 컨트롤 한 덩어리 */
.field { display: flex; flex-direction: column; gap: .35rem; text-align: left; }
.field-label { display: flex; align-items: baseline; justify-content: space-between;
               font-size: .78rem; color: var(--muted); font-weight: 650; }
.field-count { font-size: .72rem; color: var(--muted); opacity: .7;
               font-variant-numeric: tabular-nums; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; align-items: end; }
.prompt-input { font-size: 1.05rem; line-height: 1.5; resize: none; }

/* 보기 */
.choices { display: flex; flex-direction: column; gap: .45rem; }
.choice-row {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface2); border: 1px solid transparent;
  border-radius: var(--r-sm); padding: .32rem;
  transition: border-color .16s, background .16s;
}
.choice-row:hover { border-color: var(--line); }
.choice-row.is-correct { border-color: rgba(88,185,138,.4); background: rgba(88,185,138,.07); }
.choice-row input { background: transparent; border-color: transparent; }
.choice-row input:focus { background: rgba(0,0,0,.3); border-color: var(--muted); }

.dot {
  width: 28px; height: 28px; flex: none; border-radius: 7px;
  display: grid; place-items: center; font-weight: 600; font-size: .8rem; color: #fff;
}
.mark {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  border: 1px solid var(--line-2); background: transparent; cursor: pointer;
  display: grid; place-items: center;
  color: transparent; transition: all .16s;
}
.mark:hover { border-color: var(--ok); color: var(--muted); }
.mark.on { background: var(--ok); border-color: var(--ok); color: #08251a; }

.add-line { align-self: flex-start; }

/* 순서 맞추기 (에디터) */
.order-list { display: flex; flex-direction: column; gap: .45rem; }
.order-row {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: .32rem;
}
.ord-no {
  width: 26px; height: 26px; flex: none; border-radius: 7px;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--muted);
  display: grid; place-items: center; font-size: .75rem; font-weight: 600;
}
.order-row input { background: transparent; border-color: transparent; }
.order-row input:focus { background: rgba(0,0,0,.3); border-color: var(--muted); }

/* O / X */
.tf-row { display: flex; align-items: center; gap: .7rem; }
.tf {
  width: 88px; height: 60px; font-size: 1.6rem; font-weight: 500;
  border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface2); cursor: pointer; transition: all .16s;
}
.tf:hover { background: var(--surface); }
.tf.on { border-color: var(--ok); background: rgba(88,185,138,.14); color: var(--ok); }

/* 저장 상태 표시 */
.save-state {
  font-size: .78rem; font-weight: 650; padding: .25rem .6rem;
  border-radius: 999px; white-space: nowrap; flex: none;
}
.save-state.ok      { color: var(--ok);   background: rgba(88,185,138,.11); }
.save-state.pending { color: var(--accent); background: var(--accent-dim); }
.save-state.error   { color: var(--no);   background: rgba(220,106,94,.12); }

/* =====================================================================
   드래그앤드롭
   ===================================================================== */
.grip {
  flex: none; width: 24px; height: 30px; display: grid; place-items: center;
  color: var(--muted); cursor: grab; border-radius: 6px;
  line-height: 1;
  touch-action: none;                    /* 모바일에서 스크롤과 충돌 방지 */
  transition: color .14s, background .14s;
}
.grip:hover { color: var(--text); background: rgba(255,255,255,.08); }
.grip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.grip.sm { width: 20px; height: 26px; font-size: .9rem; }
.dnd-active .grip { cursor: grabbing; }

.dnd-list { position: relative; }
.dnd-ghost {
  opacity: .96; transform: scale(1.02) rotate(.6deg);
  box-shadow: 0 22px 50px rgba(0,0,0,.55);
  border-radius: 12px; cursor: grabbing;
}
.dnd-placeholder {
  border: 1px dashed var(--accent); border-radius: var(--r-sm);
  background: var(--accent-dim);
}
.dnd-dropped { animation: dropIn .3s var(--ease); }
@keyframes dropIn { from { transform: scale(1.03); } to { transform: none; } }
body.dnd-active { user-select: none; cursor: grabbing; }

/* 참가자 — 끌어서 순서 맞추기 */
.sort-card {
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface2); border: 1px solid var(--line-2);
  border-radius: var(--r); padding: .85rem .8rem; touch-action: none;
  font-weight: 500;
}
.sort-card .grip { margin-left: auto; }

/* =====================================================================
   홈 · 리포트
   ===================================================================== */
.count-badge {
  display: inline-block; margin-left: .5rem; font-size: .78rem; font-weight: 700;
  color: var(--muted); background: rgba(255,255,255,.08);
  border-radius: 999px; padding: .1rem .55rem; vertical-align: middle;
}

.quiz-grid { display: grid; gap: .75rem; margin-top: .9rem;
             grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.quiz-card {
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  display: flex; flex-direction: column; overflow: hidden;
  transition: border-color .16s, background .16s;
}
.quiz-card:hover { border-color: var(--line-2); background: var(--surface2); }
.qc-main {
  background: none; border: 0; text-align: left; cursor: pointer;
  padding: 1.05rem 1.1rem .7rem; display: flex; flex-direction: column; gap: .25rem;
}
.qc-main h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.qc-meta { display: flex; align-items: center; gap: .4rem; margin: 0;
           font-size: .78rem; color: var(--muted); }
.dot-sep { opacity: .5; }
.qc-actions {
  display: flex; align-items: center; gap: .4rem;
  padding: .55rem .7rem .6rem 1.1rem; border-top: 1px solid var(--line);
}
.icon-btn.danger:hover { color: var(--no); border-color: var(--no); }

/* 빈 상태 */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  padding: 3.5rem 1rem; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--r);
  margin-top: .9rem;
}
.empty-icon { color: var(--muted); opacity: .6; margin-bottom: .5rem; }
.empty-title { font-weight: 600; font-size: 1.02rem; margin: 0; }

/* =====================================================================
   소셜 로그인
   ===================================================================== */
.btn.oauth {
  width: 100%; justify-content: flex-start; gap: .75rem;
  padding: .8rem 1rem; font-weight: 650;
}
.oa-icon {
  width: 24px; height: 24px; border-radius: 6px; flex: none;
  display: grid; place-items: center; font-weight: 900; font-size: .95rem;
}
.btn.oauth.google  { background: #fff; color: #1f2430; border-color: #fff; }
.btn.oauth.google .oa-icon  { background: #ea4335; color: #fff; }
.btn.oauth.discord { background: #5865f2; color: #fff; border-color: #5865f2; }
.btn.oauth.discord .oa-icon { background: rgba(255,255,255,.22); }

.more { text-align: left; }
.more summary { cursor: pointer; color: var(--muted); font-size: .85rem;
                padding: .3rem 0; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: '＋ '; }
.more[open] summary::before { content: '－ '; }

/* =====================================================================
   관리자 통계
   ===================================================================== */
.stat-sub { font-size: .7rem; color: var(--muted); margin-top: .1rem; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .04em; }

.tag { display: inline-block; font-size: .7rem; font-weight: 700;
       border-radius: 999px; padding: .1rem .5rem; }
.tag.done { background: rgba(255,255,255,.07); color: var(--muted); font-weight: 550; }
.tag.live { background: var(--accent-dim); color: var(--accent); font-weight: 550; }

.qstat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: .95rem 1.1rem; margin-bottom: .6rem;
}
.qstat-meta { display: flex; gap: .9rem; flex-wrap: wrap; margin: .4rem 0 .6rem;
              font-size: .8rem; color: var(--muted); }
.warn-txt { color: var(--no); font-weight: 700; }

.mini-bars { display: flex; flex-direction: column; gap: .25rem; }
.mb-row { display: flex; align-items: center; gap: .5rem; }
.mb-k { width: 20px; font-size: .75rem; font-weight: 800; color: var(--muted); }
.mb-track { flex: 1; height: 14px; background: rgba(255,255,255,.06);
            border-radius: 4px; overflow: hidden; }
.mb-fill { height: 100%; border-radius: 4px; background: var(--line-2); }
.mb-row.hit .mb-fill { background: var(--ok); }
.mb-n { width: 28px; text-align: right; font-size: .8rem;
        font-variant-numeric: tabular-nums; }

.text-answers { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.ta-chip { background: rgba(255,255,255,.07); border: 1px solid var(--line);
           border-radius: 999px; padding: .2rem .65rem; font-size: .82rem; }
.ta-chip b { color: var(--accent); font-weight: 600; }

/* 진행 타임라인 */
.timeline { list-style: none; padding: 0; margin: 0;
            border-left: 2px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 62px 82px 1fr; gap: .5rem;
               align-items: baseline; padding: .4rem 0 .4rem .9rem;
               position: relative; font-size: .84rem; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: .75rem;
                       width: 8px; height: 8px; border-radius: 50%;
                       background: var(--line-2); }
.tl-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .78rem; }
.tl-kind { font-weight: 700; }
.tl-kind { font-weight: 550; }
.tl-kind.k-player_join { color: var(--ok); }
.tl-kind.k-session_end { color: var(--no); }
.tl-kind.k-begin       { color: var(--accent); }
.tl-actor { color: var(--muted); }
.tl-data { grid-column: 3; }

.sk-row { height: 44px; }

/* 로딩 스켈레톤 */
.sk-wrap { display: grid; gap: .75rem; margin-top: .9rem;
           grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.sk {
  border-radius: var(--r);
  background: linear-gradient(100deg, rgba(255,255,255,.035) 30%,
              rgba(255,255,255,.08) 50%, rgba(255,255,255,.035) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
.sk-card { height: 128px; }
@keyframes shimmer { from { background-position: 140% 0; } to { background-position: -40% 0; } }

.stat-row { display: flex; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
        padding: .85rem 1.25rem; display: flex; flex-direction: column; min-width: 118px; }
.stat .lbl { font-size: .73rem; color: var(--muted); font-weight: 500; }
.stat strong { font-size: 1.55rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.tbl { width: 100%; border-collapse: collapse; margin-bottom: 2rem; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: .6rem .65rem; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 650; font-size: .78rem;
          text-transform: uppercase; letter-spacing: .05em; }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.hard { background: rgba(220,106,94,.08); }

/* =====================================================================
   파티클 · 흔들림
   ===================================================================== */
.fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.fx-layer i {
  position: absolute; border-radius: 2px; opacity: 1;
  animation: confetti 1.5s cubic-bezier(.15, .6, .3, 1) forwards;
}
@keyframes confetti {
  0%   { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 420px)) rotate(var(--rot)); opacity: 0; }
}

.fx-shake { animation: shake .55s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

/* =====================================================================
   토스트 · 모달
   ===================================================================== */
#toast {
  position: fixed; left: 50%; bottom: 2rem; transform: translate(-50%, 2rem);
  background: rgba(27, 27, 30, .97); border: 1px solid var(--line-2);
  backdrop-filter: blur(14px);
  border-radius: var(--r-sm); padding: .72rem 1.15rem; opacity: 0; pointer-events: none;
  transition: all .24s var(--ease); z-index: 100; max-width: 90vw; text-align: center;
  font-weight: 600; box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast.error { border-color: var(--no); }
#toast.ok { border-color: var(--ok); }
#toast { display: flex; align-items: center; gap: .9rem; }
.toast-action {
  background: transparent; border: 0; cursor: pointer; flex: none;
  color: var(--accent); font-weight: 600; font-size: .9rem;
  padding: .15rem .3rem; border-radius: 6px;
}
.toast-action:hover { background: var(--accent-dim); }

.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.68); backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 200; padding: 1rem;
  animation: fadeIn .18s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r); padding: 1.4rem; max-width: 380px; width: 100%;
  box-shadow: var(--shadow); animation: riseIn .28s var(--ease) both;
}
.modal .row { justify-content: flex-end; margin-top: 1.1rem; }

/* =====================================================================
   모바일
   ===================================================================== */
@media (max-width: 780px) {
  .editor-wrap { grid-template-columns: 1fr; }
  .editor-side { max-height: 180px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-list { flex-direction: row; overflow-x: auto; }
  .qcard { min-width: 155px; }
  .editor-main { max-height: none; }
  .lobby { grid-template-columns: 1fr; padding: 1rem; }
  .grid2 { grid-template-columns: 1fr; }
  .bars { height: 32vh; gap: .5rem; }
  .podium { gap: .5rem; }
  .stage { padding: 1rem; }
  .stage-bottom { flex-direction: column-reverse; }
  .stage-bottom .btn.big { width: 100%; margin-left: 0; }
  .result-foot, .final-stats { gap: 1.1rem; }
  .pin-d { font-size: 2rem; width: 38px; }
}

/* =====================================================================
   마감 — 간격 체계 · 포커스 · 자잘한 정렬
   ===================================================================== */
.hint.xs { font-size: .76rem; line-height: 1.55; }
.stack.sm { gap: .45rem; }
.switch.compact { padding: .2rem 0; font-size: .88rem; }
.switch.compact small { color: var(--muted); font-weight: 500; }

/* 키보드 사용자에게만 포커스 링을 보여준다 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
button:focus:not(:focus-visible) { outline: none; }

/* 버튼 안 아이콘·글자 세로 정렬 */
.btn, .icon-btn, .chip, .badge, .pill { display: inline-flex; align-items: center;
                                        justify-content: center; gap: .35rem; }
.btn.big { justify-content: center; }

/* 입력 요소 높이 통일 */
input[type=text], input[type=url], input[type=email], input[type=number], select {
  min-height: 40px;
}
select { appearance: none; padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) center, calc(100% - 12px) center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

/* 스크롤바 */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 99px;
                             border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28);
                                   background-clip: content-box; }

@media (max-width: 780px) {
  .editor-wrap { grid-template-columns: 1fr; height: auto; }
  .editor-side { max-height: 200px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-scroll { padding: .6rem; }
  .qlist { flex-direction: row; }
  .qcard { min-width: 168px; }
  .detail-head { padding: .7rem 1rem; flex-wrap: wrap; }
  .detail-body { padding: 1rem 1rem 3rem; }
  .field-row { grid-template-columns: 1fr; }
  .qc-actions { padding-left: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* =====================================================================
   발표 화면 · 진행자 콘솔
   =====================================================================
   화면이 둘로 갈렸다.
     .present  빔프로젝터용 — 멀리서 읽혀야 하니 전부 크다
     .console  진행자 노트북용 — 정보 밀도가 높아야 하니 촘촘하다
   ===================================================================== */

.present-mode { cursor: none; }              /* 발표 중엔 마우스가 안 보이게 */
.present-mode .toast-wrap { display: none; } /* 토스트도 관객에겐 소음이다 */

.present {
  display: flex; flex-direction: column; gap: 1.4rem;
  min-height: 100vh; padding: 2.2rem clamp(1.5rem, 4vw, 4rem);
  justify-content: center;
}
.present .prompt { font-size: clamp(2rem, 4.4vw, 3.6rem); }
.present .prompt.sm { font-size: clamp(1.4rem, 2.6vw, 2.2rem); }
.present .choice-tile { font-size: clamp(1.1rem, 2vw, 1.7rem); }
.present .stage-top { justify-content: center; }

.p-title {
  font-size: clamp(1.8rem, 4vw, 3.2rem); font-weight: 600;
  text-align: center; letter-spacing: -.02em;
}
.p-label { color: var(--muted); font-size: 1.1rem; letter-spacing: .1em; }

.lobby-present { justify-content: center; }
.p-join {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(1.5rem, 5vw, 5rem); flex-wrap: wrap;
}
.p-join-left { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.p-url { color: var(--muted); font-size: 1.1rem; }
.p-qr { background: #fff; padding: .9rem; border-radius: var(--r); line-height: 0; }

.pin.huge { gap: .5rem; }
.pin.huge .pin-d {
  font-size: clamp(3rem, 8vw, 6rem); min-width: clamp(3.2rem, 8vw, 6rem);
  padding: .3rem .2rem;
}

.p-roster { display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.p-count { font-size: 1.3rem; color: var(--muted); }
.p-count strong { color: var(--text); font-size: 1.7rem; font-weight: 600; }
.player-chips.big { justify-content: center; gap: .5rem; }
.player-chips.big .chip { font-size: 1.15rem; padding: .45rem 1rem; }
.chip.static { cursor: default; }

.board.big li { font-size: clamp(1.1rem, 2.2vw, 1.8rem); padding: .7rem 1.1rem; }
.board.big .rk { font-size: 1.2em; }

/* ---------- 진행자 콘솔 ---------- */
.console {
  display: flex; flex-direction: column; gap: .9rem;
  max-width: 720px; margin: 0 auto; padding: 1.2rem 1rem 2rem;
}
.con-head { display: flex; align-items: center; gap: .5rem; }
.con-prompt { font-size: 1.25rem; font-weight: 700; line-height: 1.35; }
.clock.sm { font-size: 1.9rem; min-width: 2.4ch; }

.badge.live {
  background: var(--accent-dim); border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent); font-weight: 550;
}
.btn.on { border-color: var(--accent); color: var(--accent); }

/* 정답 카드 — 이 창에만 있는 것이라 눈에 띄게 */
.answer-card {
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-radius: var(--r); padding: .9rem 1rem; display: flex;
  flex-direction: column; gap: .5rem;
}
.ac-label {
  font-size: .72rem; letter-spacing: .14em; color: var(--accent);
  font-weight: 600; text-transform: uppercase;
}
.ac-choices { display: flex; flex-direction: column; gap: .3rem; }
.ac-row {
  display: flex; align-items: center; gap: .6rem; padding: .35rem .6rem;
  border-radius: 9px; color: var(--muted); font-size: .95rem;
}
.ac-row.hit {
  background: color-mix(in srgb, var(--ok) 13%, transparent);
  color: var(--text); font-weight: 600;
}
.ac-row .k {
  width: 1.6rem; height: 1.6rem; display: grid; place-items: center;
  border-radius: 5px; background: var(--surface2); border: 1px solid var(--line);
  font-size: .78rem; font-weight: 600;
}
.ac-row .tick { margin-left: auto; color: var(--ok); display: grid; place-items: center; }
.ac-text { font-size: 1.28rem; font-weight: 600; }
.ac-none { color: var(--muted); font-size: .95rem; }
.ac-explain {
  color: var(--muted); font-size: .9rem; line-height: 1.5;
  border-top: 1px dashed var(--line); padding-top: .5rem;
}

.con-meter { display: flex; align-items: center; gap: .8rem; }
.am-bar.wide { flex: 1; height: 10px; }
.con-actions { margin-top: .4rem; }
.con-actions .btn.big { width: 100%; }

/* ---------- 안내 띠 ---------- */
.notice-bar {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  border-radius: var(--r-sm); padding: .75rem 1rem; margin: .8rem 0;
}
.notice-bar p { flex: 1; min-width: 15rem; font-size: .9rem; line-height: 1.5; color: var(--muted); }
.notice-bar strong { color: var(--text); font-weight: 600; }
.notice-bar.subtle {
  border-color: var(--line); background: var(--surface);
}

/* ---------- 공개용 결과 ---------- */
.result-present { justify-content: flex-start; }
.stat-row.center { justify-content: center; }
.section.center { text-align: center; }

.qrate-list { display: flex; flex-direction: column; gap: .45rem; max-width: 880px; margin: 0 auto; width: 100%; }
.qrate {
  display: grid; grid-template-columns: 2rem minmax(6rem, 1fr) minmax(6rem, 2fr) 3.5rem;
  align-items: center; gap: .8rem; font-size: 1.05rem;
}
.qr-no {
  width: 2rem; height: 2rem; display: grid; place-items: center;
  border-radius: 6px; background: var(--surface2); border: 1px solid var(--line);
  font-weight: 600; font-size: .88rem;
}
.qr-track { height: 10px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.qr-fill {
  height: 100%; border-radius: 99px; background: var(--ok);
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}
.qr-fill.hard { background: var(--no); }
.qr-none { color: var(--muted); font-size: .9rem; }
.qr-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

@media (max-width: 700px) {
  .qrate { grid-template-columns: 1.7rem 1fr 3rem; }
  .qr-track { display: none; }
}

/* =====================================================================
   정답 공개 — 3초 안에 읽혀야 한다
   =====================================================================
   전에는 막대 위 작은 ✓ 하나가 정답 표시의 전부였다.
   큰 화면에서 뒷자리 사람은 그걸 못 본다. 그래서 배너를 따로 뒀다.
   ===================================================================== */

.ans-banner {
  display: flex; align-items: center; justify-content: center;
  gap: .85rem; flex-wrap: wrap; margin: .4rem auto 0;
  padding: .8rem 1.5rem; border-radius: var(--r);
  background: color-mix(in srgb, var(--ok) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent);
  animation: ansPop .4s cubic-bezier(.2,1.3,.3,1) both;
}
.ans-banner.none {
  background: var(--card); border: 1px dashed var(--line);
  animation: none;
}
.ab-check {
  width: 2.2rem; height: 2.2rem; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--ok); color: #06241a;
}
.ab-label {
  font-size: .74rem; letter-spacing: .16em; color: var(--ok);
  font-weight: 600; text-transform: uppercase;
}
.ans-banner.none .ab-label { color: var(--muted); }
.ab-text { font-size: clamp(1.35rem, 3.2vw, 2.4rem); font-weight: 600; letter-spacing: -.02em; }
.ans-banner.none strong { color: var(--muted); font-weight: 600; font-size: 1.1rem; }
.present .ab-text { font-size: clamp(1.8rem, 4.6vw, 3.4rem); }

@keyframes ansPop {
  0%   { transform: scale(.82); opacity: 0; }
  60%  { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* 맞힘 / 틀림 한 줄 요약 */
.score-line {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  justify-content: center; margin-top: .5rem; font-size: 1rem;
}
.sl b { font-size: 1.3em; font-weight: 600; }
.sl.ok { color: var(--ok); }
.sl.no { color: var(--muted); }
.sl-bar {
  width: min(280px, 40vw); height: 9px; border-radius: 99px;
  background: color-mix(in srgb, var(--muted) 25%, transparent); overflow: hidden;
}
.sl-fill {
  display: block; height: 100%; border-radius: 99px; background: var(--ok);
  animation: slGrow .7s cubic-bezier(.2,.9,.2,1) both;
}
@keyframes slGrow { from { width: 0 !important; } }
.sl-pct { font-variant-numeric: tabular-nums; font-weight: 600; }

/* 막대 — 정답만 살리고 오답은 죽인다 */
.bar-col.miss { opacity: .5; }
.bar-col.hit  { transform: translateY(-4px); }
.bar-pct {
  font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums;
  margin-top: .15rem;
}
.bar-col.hit .bar-pct { color: var(--ok); font-weight: 600; }

/* 보기 아래 이름들 */
.bar-names {
  display: flex; flex-wrap: wrap; gap: .25rem; justify-content: center;
  margin-top: .4rem; max-width: 100%;
}
.nm-chip {
  font-size: .78rem; padding: .16rem .5rem; border-radius: 99px;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  color: var(--muted); white-space: nowrap;
}
.nm-chip.ok {
  background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok);
}
.nm-chip.first { background: var(--ok); color: #06241a; font-weight: 600; }
.nm-more { font-size: .78rem; color: var(--muted); align-self: center; }

/* 정답자 · 오답자 목록 */
.name-lists { display: flex; flex-direction: column; gap: .5rem; margin-top: .8rem; }
.nl { display: flex; flex-direction: column; gap: .3rem; }
.nl-head { font-size: .8rem; font-weight: 600; color: var(--muted); }
.nl.ok .nl-head { color: var(--ok); }
.nl-chips { display: flex; flex-wrap: wrap; gap: .3rem; }

/* 옵션 설명 */
.switch.with-note { align-items: flex-start; }
.opt-note {
  display: block; font-size: .78rem; color: var(--muted);
  margin-top: .15rem; line-height: 1.45; font-weight: 400;
}

/* =====================================================================
   참가자 결과 — 정답이면 화면이 반응해야 한다
   ===================================================================== */
.play.result { position: relative; overflow: hidden; }
.play.result .flash {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  border-radius: inherit;
}
.play.result.flash-on .flash { animation: flashIn .6s ease-out both; }
.play.result.ok .flash   { box-shadow: inset 0 0 0 3px var(--ok), inset 0 0 80px color-mix(in srgb, var(--ok) 32%, transparent); }
.play.result.no .flash   { box-shadow: inset 0 0 0 3px var(--no), inset 0 0 80px color-mix(in srgb, var(--no) 26%, transparent); }
@keyframes flashIn { 0% { opacity: 1; } 100% { opacity: 0; } }

.right-answer {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .5rem 1rem; border-radius: 12px; margin: .2rem auto 0;
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
}
.ra-label {
  font-size: .7rem; letter-spacing: .14em; font-weight: 600;
  color: var(--ok); text-transform: uppercase;
}
.right-answer strong { font-size: 1.12rem; font-weight: 600; }

.rank-wrap { display: inline-flex; align-items: center; gap: .3rem; }
.rank-up   { color: var(--ok); font-size: .8em; font-weight: 600; animation: rankPop .5s both; }
.rank-down { color: var(--no); font-size: .8em; font-weight: 600; animation: rankPop .5s both; }
@keyframes rankPop { 0% { transform: translateY(6px) scale(.7); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* =====================================================================
   고정 참여 링크 · 방 대기
   ===================================================================== */
.perma {
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: .6rem .8rem; margin-top: .6rem; background: var(--surface);
}
.perma > summary {
  cursor: pointer; font-size: .9rem; font-weight: 600;
  list-style: none; user-select: none;
}
.perma > summary::-webkit-details-marker { display: none; }
.perma > summary::before { content: '▸ '; color: var(--muted); }
.perma[open] > summary::before { content: '▾ '; }
.perma > * + * { margin-top: .5rem; }
.hint.xs { font-size: .74rem; line-height: 1.5; }

.waiting-room {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .7rem; min-height: 70vh; text-align: center; padding: 2rem 1.2rem;
}
.waiting-room h1 { font-size: 1.28rem; font-weight: 600; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   정답 공개 시점 고르기
   ===================================================================== */
.reveal-pick { margin-top: 1rem; }
.rp-label {
  font-size: .82rem; font-weight: 700; color: var(--muted);
  letter-spacing: .06em; margin-bottom: .4rem;
}
.rp-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.rp-btn {
  text-align: left; padding: .75rem .9rem; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  display: flex; flex-direction: column; gap: .25rem;
  transition: border-color .15s, background .15s;
}
.rp-btn:hover { border-color: var(--border-strong, var(--muted)); }
.rp-btn.on {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.rp-btn strong { font-size: .94rem; font-weight: 600; }
.rp-btn.on strong { color: var(--accent); }
.rp-desc { font-size: .76rem; color: var(--muted); line-height: 1.45; }
@media (max-width: 560px) { .rp-row { grid-template-columns: 1fr; } }

/* =====================================================================
   답안지 (참가자)
   ===================================================================== */
.review { padding: 1rem .9rem 3rem; max-width: 620px; margin: 0 auto; }
.rv-head { text-align: center; margin-bottom: 1rem; }
.rv-head h1 { font-size: 1.55rem; font-weight: 600; }
.rv-who { color: var(--muted); font-size: .95rem; }
.rv-sum {
  display: flex; justify-content: center; gap: 1.4rem; flex-wrap: wrap;
  margin-top: .7rem; padding: .75rem; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line);
}
.rv-stat { display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.rv-stat .lbl { font-size: .72rem; color: var(--muted); }
.rv-stat strong { font-size: 1.08rem; font-weight: 600; }

.rv-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; padding: 0; }
.rv-item {
  border: 1px solid var(--line); border-left: 3px solid var(--line-2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: .75rem .9rem;
  background: var(--surface); display: flex; flex-direction: column; gap: .5rem;
}
.rv-item.ok   { border-left-color: var(--ok); }
.rv-item.no   { border-left-color: var(--no); }
.rv-item.none { border-left-color: var(--muted); }

.rv-top { display: flex; align-items: flex-start; gap: .6rem; }
.rv-no {
  flex: none; width: 1.7rem; height: 1.7rem; display: grid; place-items: center;
  border-radius: 5px; background: var(--surface2); border: 1px solid var(--line);
  font-size: .8rem; font-weight: 600;
}
.rv-prompt { flex: 1; font-weight: 550; line-height: 1.45; }
.rv-mark { flex: none; display: grid; place-items: center; }
.rv-item.ok .rv-mark { color: var(--ok); }
.rv-item.no .rv-mark { color: var(--no); }
.rv-mark.none { color: var(--muted); }

.rv-rows { display: flex; flex-direction: column; gap: .3rem; }
.rv-row { display: flex; align-items: baseline; gap: .6rem; font-size: .93rem; }
.rv-lbl {
  flex: none; width: 2.8rem; font-size: .74rem; font-weight: 600;
  color: var(--muted); letter-spacing: .04em;
}
.rv-val { flex: 1; line-height: 1.45; }
.rv-val.empty { color: var(--muted); font-style: italic; }
.rv-row.right .rv-lbl { color: var(--ok); }
.rv-row.right .rv-val { font-weight: 600; }

.rv-explain {
  font-size: .84rem; color: var(--muted); line-height: 1.55;
  border-top: 1px dashed var(--line); padding-top: .45rem;
}
.rv-foot {
  display: flex; gap: .8rem; font-size: .78rem; font-weight: 600;
  color: var(--ok);
}
.rv-foot .muted { color: var(--muted); font-weight: 400; }

/* =====================================================================
   사다리 — 레인 선택
   ===================================================================== */
.lane-pick { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.lane-btn {
  position: relative; min-width: 64px; min-height: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .1rem; padding: .5rem .6rem; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--c, var(--line-2));
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--surface));
  color: var(--text); font-weight: 600; font-size: 1.08rem;
  transition: transform .12s, opacity .15s;
}
.lane-btn:active:not(:disabled) { transform: scale(.94); }
.lane-btn.sm { min-width: 46px; min-height: 46px; font-size: .95rem; border-radius: 11px; }
.ln-no { line-height: 1; }
.ln-owner {
  font-size: .62rem; font-weight: 600; opacity: .85; max-width: 62px;
}
/* 남이 가져간 레인 — 눌러도 안 되는 게 눈에 보여야 한다 */
.lane-btn.taken {
  opacity: .35; cursor: not-allowed;
  border-style: dashed;
}
.lane-btn.mine {
  outline: 2px solid var(--accent); outline-offset: 2px;
  background: color-mix(in srgb, var(--c) 30%, var(--surface));
}
.lane-btn:disabled:not(.taken):not(.mine) { opacity: .5; cursor: not-allowed; }

.host-play {
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  justify-content: center; margin: .6rem 0;
  padding: .6rem .9rem; border-radius: var(--r-sm);
  border: 1px dashed var(--line); background: var(--surface);
}
.host-lane { font-weight: 600; color: var(--accent); }
.host-lane-pick { display: flex; gap: .35rem; flex-wrap: wrap; }

.ladder-wrap.phone { max-width: 100%; }
.ladder-wrap.phone .ladder-svg { max-height: 46vh; }

/* =====================================================================
   문항별 총평 (시상대 · 발표 화면)
   ===================================================================== */
.qsummary {
  margin-top: 1.2rem; padding: .95rem 1.1rem; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface);
  max-width: 760px; width: 100%; margin-left: auto; margin-right: auto;
}
.qs-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .6rem; margin-bottom: .6rem;
}
.qs-head h3 { font-size: 1rem; font-weight: 600; }
.qs-overall { font-size: .9rem; font-weight: 600; color: var(--ok); }
.qs-list { display: flex; flex-direction: column; gap: .3rem; }
.qs-row {
  display: grid; align-items: center; gap: .6rem;
  grid-template-columns: 1.6rem minmax(4rem, 1fr) minmax(4rem, 1.6fr) 3rem 3.2rem;
  font-size: .88rem;
}
.qs-no {
  width: 1.6rem; height: 1.6rem; display: grid; place-items: center;
  border-radius: 5px; background: var(--surface2); border: 1px solid var(--line);
  font-size: .73rem; font-weight: 600;
}
.qs-row.hard .qs-no { background: var(--no); border-color: var(--no); color: #fff; }
.qs-prompt { color: var(--muted); }
.qs-track { height: 8px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.qs-fill {
  height: 100%; border-radius: 99px; background: var(--ok);
  animation: qsGrow .8s cubic-bezier(.2,.9,.2,1) both;
}
.qs-fill.hard { background: var(--no); }
@keyframes qsGrow { from { width: 0 !important; } }
.qs-none { font-size: .78rem; color: var(--muted); }
.qs-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.qs-cnt { text-align: right; font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.qs-notes { margin-top: .7rem; font-size: .84rem; color: var(--muted); line-height: 1.6; }
.qs-notes b { color: var(--text); font-weight: 600; }

.qsummary.big { max-width: 900px; }
.qsummary.big .qs-row { font-size: 1.05rem; grid-template-columns: 2rem minmax(5rem,1fr) minmax(5rem,1.6fr) 3.6rem 3.8rem; }
.qsummary.big .qs-head h3 { font-size: 1.25rem; }

@media (max-width: 620px) {
  .qs-row { grid-template-columns: 1.5rem 1fr 3rem; }
  .qs-track, .qs-cnt { display: none; }
}

/* 고른 모드 강조 */
.mode-card.picked {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.mode-opts { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }

/* =====================================================================
   사다리 진행 연출
   ===================================================================== */
.ladder-now {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  font-size: 1.05rem; min-height: 1.9rem; text-align: center;
}
.ladder-now strong { font-size: 1.22rem; font-weight: 600; }
.ln-turn {
  font-size: .73rem; font-weight: 550; color: var(--muted);
  padding: .1rem .5rem; border-radius: 99px;
  background: var(--surface2); border: 1px solid var(--line);
}
.ladder-live {
  list-style: none; padding: 0; margin: .8rem auto 0; max-width: 460px;
  display: flex; flex-direction: column; gap: .3rem;
}
.ladder-live li {
  display: flex; align-items: center; gap: .5rem; font-size: .92rem;
  padding: .35rem .6rem; border-radius: 9px;
  animation: liveIn .35s cubic-bezier(.2,1.3,.3,1) both;
}
.ladder-live li.hit {
  background: color-mix(in srgb, var(--ok) 13%, transparent);
  font-weight: 600;
}
.ladder-live li.miss { color: var(--muted); }
@keyframes liveIn { from { transform: translateY(-6px); opacity: 0; } }

.lane-pick.host-picking { margin-bottom: .6rem; }

/* 자동으로 다음 문항 — 남은 시간을 막대로 */
.auto-next { display: flex; flex-direction: column; gap: .5rem; width: 100%; }
.an-bar {
  height: 4px; border-radius: 99px; overflow: hidden;
  background: color-mix(in srgb, var(--muted) 25%, transparent);
}
.an-fill {
  display: block; height: 100%; width: 100%; border-radius: 99px;
  background: var(--accent); transform-origin: left;
  animation: anShrink linear forwards;
}
@keyframes anShrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* =====================================================================
   당첨 항목 칩 (게임 설정)
   =====================================================================
   전에는 이 클래스에 스타일이 아예 없었다. 그래서 항목이 다닥다닥 붙고
   삭제 × 가 흰 배경에 흰 글씨로 안 보였다.
   ===================================================================== */
.chip-list {
  display: flex; flex-wrap: wrap; gap: .5rem;
  min-height: 2.4rem; align-items: center;
  padding: .5rem; border-radius: 10px;
  background: color-mix(in srgb, var(--muted) 8%, transparent);
  border: 1px dashed var(--line);
}
.chip-x {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .5rem .35rem .75rem;
  border-radius: 99px; font-size: .88rem; font-weight: 550;
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  color: var(--text);
}
.chip-x .x {
  width: 1.35rem; height: 1.35rem; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  /* 반드시 대비를 준다 — 흰 배경에 흰 × 는 없는 것과 같다 */
  background: color-mix(in srgb, var(--text) 14%, transparent);
  color: var(--text);
  transition: background .15s, transform .1s;
}
.chip-x .x:hover { background: var(--no); color: #fff; }
.chip-x .x:active { transform: scale(.88); }

.game-config { display: flex; flex-direction: column; gap: .7rem; }
.game-config .row.gap { gap: .5rem; }
.game-config input { flex: 1; }

/* =====================================================================
   배점 · 제한시간 직접 입력
   ===================================================================== */
.num-field {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
}
.num-field input[type=number] { width: 6.5rem; }
.num-field input:disabled { opacity: .45; }
.nf-unit { font-size: .85rem; color: var(--muted); }
.nf-none {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .85rem; color: var(--muted); cursor: pointer; margin-left: .3rem;
}
.nf-presets { display: flex; gap: .25rem; margin-left: .2rem; }
.chip-btn {
  padding: .25rem .55rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: transparent;
  color: var(--muted); font-size: .77rem; font-weight: 550;
}
.chip-btn:hover { color: var(--text); border-color: var(--line-2); }
.chip-btn.on {
  border-color: var(--accent); color: var(--accent); background: var(--accent-dim);
}

/* 합계 — 점수를 넣을 때 기준이 되어 준다 */
.side-total {
  display: flex; align-items: baseline; gap: .35rem;
  padding: .45rem .7rem; margin: 0 .6rem .5rem;
  border-radius: 7px; background: var(--accent-dim);
}
.st-label { font-size: .74rem; color: var(--muted); }
.side-total strong {
  font-size: 1.02rem; font-weight: 600; margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.st-unit { font-size: .74rem; color: var(--muted); }

/* =====================================================================
   이미지 — 주소를 붙여넣는다
   ===================================================================== */
.media-box { display: flex; flex-direction: column; gap: .5rem; }
.preview.broken { display: none; }

.close-corner { align-self: flex-end; margin-bottom: -.5rem; }

/* =====================================================================
   세로 리듬 — 간격을 손으로 찍지 않는다
   =====================================================================
   화면마다 margin 을 하나씩 붙이다 보면 어디는 붙고 어디는 뜬다.
   실제로 로비의 "0명 참가 / 입장 마감" 줄이 그랬다.

   규칙은 하나다. **부모가 gap 으로 간격을 정하고, 자식은 margin 을 갖지 않는다.**
   아래는 그 규칙을 어기는 곳들을 되돌리는 정리다.
   ===================================================================== */

/* gap 을 쓰는 상자 안에서는 자식의 바깥 여백을 없앤다 */
.pin-panel > *, .lobby-right > *, .lobby-actions > *,
.present-box > *, .join-card > *, .game-config > *, .stack > * {
  margin-top: 0; margin-bottom: 0;
}
.pin-panel .wide-btn, .lobby-actions .wide-btn { margin-top: 0; }

/* 카드 안쪽 여백을 한 값으로 */
.card { padding: 1.5rem; }
.card.join-card { padding: 1.5rem 1.35rem; gap: 1rem; }
.panel { padding: 1.15rem; }

/* 제목 아래 여백은 제목이 갖지 않는다 — 부모의 gap 이 정한다 */
.stack h1, .stack h2, .stack h3,
.card h1, .card h2, .card h3,
.present-box h3, .lobby-head h3 { margin-bottom: 0; }

/* 본문 단락 — 마지막 줄 뒤에 유령 여백이 남지 않게 */
p:last-child { margin-bottom: 0; }

/* 진행자 콘솔 */
.console { gap: 1rem; padding: 1.25rem 1.15rem 2.5rem; }
.con-head { gap: .65rem; flex-wrap: wrap; }
.con-actions { margin-top: .2rem; }

/* 무대 */
.stage { gap: 1.25rem; padding: 1.6rem 1.5rem 1.35rem; }
.stage-mid { gap: .9rem; width: 100%; }

/* 참가자 화면 */
.play { gap: 1rem; padding: 1rem .9rem 1.2rem; }
.play-prompt { margin: .2rem 0; line-height: 1.45; }

/* 섹션 제목 위아래 */
.section + * { margin-top: 0; }

/* 리스트 · 표의 마지막 항목 아래 여백 제거 */
.board li:last-child, .result-list li:last-child,
.rv-list li:last-child { margin-bottom: 0; }
.tbl { margin-bottom: 0; }

/* 버튼 줄 — 좁은 화면에서 서로 밀지 않게 */
.row.gap { flex-wrap: wrap; }
.row.gap.nowrap { flex-wrap: nowrap; }

/* 좁은 화면 */
@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; gap: 1.1rem; padding: 1.1rem; }
  .present-box { width: calc(100% - 2.2rem); margin-top: 1rem; }
  .lobby-actions { padding-top: .8rem; }
}
@media (max-width: 560px) {
  .card { padding: 1.2rem; }
  .page { padding: 1.25rem 1rem; }
  .lobby-head { flex-wrap: wrap; gap: .5rem; }
  .url-row { gap: .35rem; }
  .url-row .join-url { width: 100%; }
}
