/* 더코 — 한국 영화 명대사·명장면 퀴즈
   시네마틱 다크 + 골드/팝콘 감성 · 모바일 390×844 기준 */

:root {
  --bg: #08080d;
  --bg-soft: #101018;
  --panel: rgba(22, 22, 32, 0.86);
  --panel-2: rgba(30, 30, 43, 0.9);
  --line: rgba(232, 200, 122, 0.16);
  --line-strong: rgba(232, 200, 122, 0.38);
  --gold: #e8c87a;
  --gold-deep: #c9a34f;
  --cream: #f6efe2;
  --muted: #9a97a8;
  --muted-2: #6f6c7d;
  --green: #45c98a;
  --red: #ef6a4c;
  --radius: 18px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.9);
  /* 화면 여백 — 홈 무스크롤 계산에도 그대로 쓰인다 */
  /* 상단 안전 여백
     · iOS(WKWebView)·일반 브라우저 : env(safe-area-inset-top) 그대로, 없으면 12px
     · 안드로이드 앱(엣지투엣지 WebView) : env() 가 0 으로 나와 헤더가 상태바 밑으로 올라간다.
       index.html 이 앱 신호(platform/insets)나 WebView UA(; wv))를 보고 넣어 주는
       --app-safe-top(상태바 높이)에 원래의 12px 호흡을 더해 쓴다. */
  --pad-top: max(12px, env(safe-area-inset-top, 0px), calc(var(--app-safe-top, 0px) + 12px));
  --pad-x: 18px;
  --pad-bot: calc(14px + env(safe-area-inset-bottom));
  /* 홈 섹션 사이 여백 — 화면이 낮으면 촘촘하게, 높으면 여유 있게 */
  --home-gap: clamp(9px, 1.5dvh, 15px);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: "Paperlogy", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
    "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -10%, #1b1726 0%, rgba(8, 8, 13, 0) 62%),
    radial-gradient(90% 50% at 100% 100%, #1a1410 0%, rgba(8, 8, 13, 0) 60%),
    var(--bg);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
}
.glow-a { width: 260px; height: 260px; left: -90px; top: -60px; background: rgba(232, 200, 122, 0.14); }
.glow-b { width: 300px; height: 300px; right: -120px; bottom: -80px; background: rgba(196, 92, 60, 0.12); }

#app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: var(--pad-top) var(--pad-x) var(--pad-bot);
}

.screen { display: none; animation: fade 0.28s ease both; }
.screen.active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ───────────── 공통 ───────────── */

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

.primary {
  width: 100%;
  padding: 15px 18px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.2px;
  color: #1a1409;
  background: linear-gradient(180deg, #f3dda4 0%, var(--gold) 45%, var(--gold-deep) 100%);
  box-shadow: 0 10px 26px -12px rgba(232, 200, 122, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.primary:active { transform: scale(0.985); box-shadow: 0 6px 16px -12px rgba(232, 200, 122, 0.8); }

.ghost {
  flex: 1;
  padding: 13px 14px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 600;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}
.ghost:active { background: rgba(255, 255, 255, 0.09); }

.link-btn {
  font-size: 12px;
  color: var(--muted-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 17px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: grid;
  place-items: center;
  flex: none;
}

/* ───────────── 홈 (모바일 한 화면 · 무스크롤) ───────────── */

/* 헤더·본문·푸터를 세로 flex 로 쌓아 100dvh 안에 앉힌다 */
#screen-home.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--pad-top) - var(--pad-bot));
}

.home-head { flex: none; padding: 0 2px; }

.brand { display: flex; align-items: center; gap: 11px; }

.brand-mark {
  width: clamp(42px, 5.6dvh, 52px);
  height: clamp(42px, 5.6dvh, 52px);
  flex: none;
  border-radius: 13px;
  display: grid; place-items: center;
  font-size: 20px;
  background: linear-gradient(160deg, rgba(232, 200, 122, 0.24), rgba(232, 200, 122, 0.04));
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-size: clamp(22px, 3dvh, 27px);
  line-height: 1.12;
  letter-spacing: 1px;
  font-weight: 800;
  background: linear-gradient(180deg, #fff7e2 10%, var(--gold) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: -0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.marquee {
  display: flex;
  gap: 6px;
  margin-top: clamp(8px, 1.3dvh, 12px);
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  justify-content: space-between;
}
.marquee span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(232, 200, 122, 0.5);
  box-shadow: 0 0 8px rgba(232, 200, 122, 0.6);
  animation: bulb 2.4s ease-in-out infinite;
}
.marquee span:nth-child(2n) { animation-delay: 0.35s; background: rgba(255, 247, 226, 0.4); }
.marquee span:nth-child(3n) { animation-delay: 0.8s; }
.marquee span:nth-child(5n) { animation-delay: 1.2s; }
@keyframes bulb { 0%, 100% { opacity: 0.28; } 50% { opacity: 1; } }

.block { margin-top: var(--home-gap); }

.block-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  padding: 0 2px;
}
.block-title span {
  flex: none;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.4px;
}
.block-title em {
  min-width: 0;
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 모드 — 4개 한 줄 칩 */
.modes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.mode {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: clamp(10px, 1.5dvh, 14px) 3px clamp(9px, 1.3dvh, 12px);
  border-radius: 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.mode .mode-emoji {
  font-size: 15px;
  width: clamp(26px, 3.6dvh, 32px);
  height: clamp(26px, 3.6dvh, 32px);
  border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.05);
}
.mode .mode-body { min-width: 0; max-width: 100%; }
.mode .mode-name {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mode .mode-sub {
  display: block;
  margin-top: 1px;
  font-size: 9px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mode .mode-check { display: none; }
.mode[aria-selected="true"] {
  background: linear-gradient(180deg, rgba(232, 200, 122, 0.16), rgba(232, 200, 122, 0.05));
  border-color: var(--line-strong);
  box-shadow: 0 12px 30px -22px rgba(232, 200, 122, 0.9);
}
.mode[aria-selected="true"] .mode-emoji { background: rgba(232, 200, 122, 0.18); }

/* 장르 — 3열 컴팩트 타일 + '전체 랜덤' 시작 버튼 */
.block-genres {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.genres {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(56px, auto);
  gap: 8px;
}

.genre {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(9px, 1.5dvh, 12px) 10px;
  border-radius: 13px;
  text-align: left;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.genre:active { transform: scale(0.98); }
.genre::after {
  content: "";
  position: absolute;
  right: -18px; top: -22px;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 200, 122, 0.16), rgba(232, 200, 122, 0));
  opacity: 0;
  transition: opacity 0.2s ease;
}
.genre:hover::after { opacity: 1; }
.genre .g-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.genre .g-emoji { flex: none; font-size: 15px; line-height: 1; }
.genre .g-name {
  display: block;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.genre .g-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.genre .g-count {
  flex: none;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.genre .g-best {
  min-width: 0;
  color: var(--gold);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}
.genre[data-empty="true"] { opacity: 0.42; }

/* 전체 랜덤 — 홈의 주 시작 버튼 */
.genre-all {
  grid-column: span 3;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: clamp(9px, 1.5dvh, 12px) 12px;
  border-radius: 13px;
  border: 1px solid rgba(232, 200, 122, 0.55);
  background: linear-gradient(180deg, #f3dda4 0%, var(--gold) 48%, var(--gold-deep) 100%);
  box-shadow: 0 10px 24px -18px rgba(232, 200, 122, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  overflow: visible;
}
.genre-all::after { display: none; }
.genre-all .g-emoji { font-size: 17px; }
.genre-all .g-text { flex: 1; min-width: 0; text-align: left; }
.genre-all .g-name {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #1a1409;
}
.genre-all .g-sub {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: rgba(26, 20, 9, 0.62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.genre-all .g-count {
  flex: none;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  color: #1a1409;
  background: rgba(26, 20, 9, 0.12);
  border: 1px solid rgba(26, 20, 9, 0.14);
}
.genre-all .g-arrow {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 9px;
  color: #1a1409;
  background: rgba(26, 20, 9, 0.14);
  border: 1px solid rgba(26, 20, 9, 0.18);
}

.home-foot {
  flex: none;
  margin-top: var(--home-gap);
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.foot-links {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 1px;
}
.home-foot p {
  min-width: 0;
  margin: 0;
  font-size: 10.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-foot .link-btn { flex: none; font-size: 11px; }
.home-foot .foot-link {
  flex: none;
  padding: 3px 0;
  font-size: 10.5px;
  color: var(--muted-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.home-foot .foot-link:active { color: var(--cream); }

/* ───────────── 퀴즈 ───────────── */

#screen-quiz {
  min-height: calc(100dvh - 34px);
  display: none;
  flex-direction: column;
}
#screen-quiz.active { display: flex; }

.quiz-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 0 14px;
}
.progress-wrap { flex: 1; min-width: 0; }
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11.5px;
  margin-bottom: 6px;
}
#q-index { font-weight: 700; color: var(--cream); letter-spacing: 0.3px; }
#q-genre { color: var(--muted-2); }

.progress-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.progress-bar i {
  display: block;
  height: 100%;
  width: 10%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold) 60%, #fff3cf);
  box-shadow: 0 0 12px rgba(232, 200, 122, 0.6);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.combo {
  font-size: 11.5px;
  font-weight: 800;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 52px;
  text-align: center;
  transition: all 0.2s ease;
}
.combo.hot {
  color: #2a1c03;
  background: linear-gradient(180deg, #ffe2a1, #e8a83f);
  border-color: rgba(255, 226, 161, 0.8);
  box-shadow: 0 0 18px -4px rgba(232, 168, 63, 0.7);
}
.combo.pop { animation: pop 0.35s ease; }
@keyframes pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.22) rotate(-3deg); }
  100% { transform: scale(1); }
}

.quiz-body { flex: 1; display: flex; flex-direction: column; gap: 12px; }

.q-card {
  position: relative;
  padding: 18px 16px 16px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(34, 33, 46, 0.92), rgba(20, 20, 29, 0.94));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.q-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 200, 122, 0.55), transparent);
}

.q-type {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--gold);
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(232, 200, 122, 0.1);
  border: 1px solid rgba(232, 200, 122, 0.22);
}

.q-media { margin-top: 15px; }

.q-quote {
  position: relative;
  margin: 0;
  padding: 6px 2px 2px;
  font-size: 20px;
  line-height: 1.55;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: #fdf8ec;
  word-break: keep-all;
}
.q-quote::before {
  content: "“";
  position: absolute;
  left: -2px; top: -14px;
  font-size: 40px;
  line-height: 1;
  color: rgba(232, 200, 122, 0.26);
  font-family: Georgia, serif;
}
.q-quote.long { font-size: 16px; line-height: 1.62; }

.scene {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #0c0c12;
}
.scene img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  filter: saturate(0.98) contrast(1.03);
}
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 10%, rgba(0, 0, 0, 0) 40%, rgba(8, 8, 13, 0.55) 100%);
  pointer-events: none;
}
.scene-tag {
  position: absolute;
  left: 10px; bottom: 9px;
  z-index: 2;
  font-size: 10px;
  letter-spacing: 0.6px;
  color: rgba(246, 239, 226, 0.85);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(8, 8, 13, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
}

.q-ask {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: -0.1px;
}

.hint-row { display: flex; flex-direction: column; gap: 8px; }

.hint-btn {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.14);
}
.hint-btn span {
  color: var(--gold);
  font-weight: 700;
  margin-left: 2px;
}
.hint-btn:disabled { opacity: 0.45; }

.hint-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #e6d7b4;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(232, 200, 122, 0.08);
  border: 1px solid rgba(232, 200, 122, 0.2);
  animation: fade 0.25s ease both;
}

.options { display: flex; flex-direction: column; gap: 9px; }

.option {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 14px 13px;
  border-radius: 14px;
  text-align: left;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: #efe9dc;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.075);
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
  word-break: keep-all;
}
.option:active { transform: scale(0.99); }
.option .badge {
  width: 24px; height: 24px;
  flex: none;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.option .opt-text { flex: 1; }
.option.long { font-size: 12.5px; line-height: 1.5; }
.option.long .badge { width: 21px; height: 21px; font-size: 10px; }

.option.correct {
  border-color: rgba(69, 201, 138, 0.65);
  background: rgba(69, 201, 138, 0.14);
  color: #dcffee;
}
.option.correct .badge {
  background: var(--green);
  border-color: var(--green);
  color: #04210f;
}
.option.wrong {
  border-color: rgba(239, 106, 76, 0.6);
  background: rgba(239, 106, 76, 0.12);
  color: #ffe2da;
}
.option.wrong .badge {
  background: var(--red);
  border-color: var(--red);
  color: #2a0a02;
}
.option.muted { opacity: 0.45; }
.option[disabled] { cursor: default; }

/* ───────────── 해설 레이어 팝업 (가운데 · 5초 자동 넘김) ───────────── */

.reveal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}
.reveal[hidden] { display: none; }

.reveal-veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(82% 62% at 50% 42%, rgba(8, 6, 12, 0.42) 0%, rgba(4, 4, 8, 0.84) 100%);
  -webkit-backdrop-filter: blur(5px) saturate(0.85);
  backdrop-filter: blur(5px) saturate(0.85);
  opacity: 0;
  transition: opacity 0.26s ease;
}
.reveal.show .reveal-veil { opacity: 1; }

.reveal-card {
  position: relative;
  width: 100%;
  max-width: 330px;
  max-height: calc(100dvh - 44px);
  overflow: hidden auto;
  padding: 19px 18px 18px;
  border-radius: 22px;
  background: linear-gradient(168deg, rgba(40, 33, 22, 0.98) 0%, rgba(19, 17, 25, 0.99) 46%, #0b0b10 100%);
  border: 1px solid rgba(232, 200, 122, 0.34);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 28px 70px -22px rgba(0, 0, 0, 0.95),
    0 0 46px -12px rgba(232, 200, 122, 0.28);
  opacity: 0;
  transform: translateY(16px) scale(0.955);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
}
.reveal.show .reveal-card { opacity: 1; transform: none; }

.rv-sheen {
  position: absolute;
  left: -30%;
  right: -30%;
  top: -46%;
  height: 82%;
  pointer-events: none;
  background: radial-gradient(50% 52% at 50% 100%, rgba(232, 200, 122, 0.2), rgba(232, 200, 122, 0) 72%);
}

.rv-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rv-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.4px;
  color: var(--gold);
}
.rv-kicker::before { content: ""; width: 13px; height: 1px; background: var(--gold-deep); }
.rv-auto {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.rv-head {
  position: relative;
  margin-top: 9px;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.24;
  letter-spacing: -0.7px;
}
.rv-head.ok { color: #7ce6b0; text-shadow: 0 0 22px rgba(69, 201, 138, 0.34); }
.rv-head.no { color: #ff9c82; text-shadow: 0 0 22px rgba(239, 106, 76, 0.3); }
.rv-head.time { color: #ffc46b; text-shadow: 0 0 22px rgba(255, 196, 107, 0.3); }

.rv-answer {
  position: relative;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(232, 200, 122, 0.07);
  border: 1px solid rgba(232, 200, 122, 0.18);
}
.rv-film {
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.4px;
  color: var(--gold);
  word-break: keep-all;
}
.rv-meta {
  margin: 4px 0 0;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--muted);
  word-break: keep-all;
}

.rv-text {
  position: relative;
  margin: 11px 0 0;
  font-size: 12.5px;
  line-height: 1.66;
  color: #ded6c6;
  word-break: keep-all;
}

.rv-extra {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}
.rv-extra[hidden] { display: none; }
.rv-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: -0.1px;
  color: #e6d7b4;
  background: rgba(232, 200, 122, 0.1);
  border: 1px solid rgba(232, 200, 122, 0.22);
}
.rv-chip.gain { color: #7ce6b0; background: rgba(69, 201, 138, 0.12); border-color: rgba(69, 201, 138, 0.3); }
.rv-chip.combo { color: #ffd79a; }
.rv-chip.they-ok { color: #7ce6b0; background: rgba(69, 201, 138, 0.12); border-color: rgba(69, 201, 138, 0.28); }
.rv-chip.they-no { color: #ff9c82; background: rgba(239, 106, 76, 0.12); border-color: rgba(239, 106, 76, 0.26); }
.rv-chip.life-lost { color: #ff9c82; }

.rv-next {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-top: 15px;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid rgba(232, 200, 122, 0.5);
  background: linear-gradient(180deg, #f0d79b 0%, #dcb86a 55%, #c9a34f 100%);
  color: #241a05;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.3px;
  box-shadow: 0 10px 24px -13px rgba(232, 200, 122, 0.6);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease;
}
.rv-next:active { transform: scale(0.985); filter: brightness(0.96); }
.rv-next:focus-visible { outline: 2px solid rgba(246, 239, 226, 0.85); outline-offset: 2px; }
.rv-count {
  min-width: 38px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  text-align: center;
  color: #2a1f07;
  background: rgba(36, 26, 5, 0.13);
  font-variant-numeric: tabular-nums;
}

.rv-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(232, 200, 122, 0.13);
}
.rv-progress b {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  transition: width 0.1s linear;
}

@media (prefers-reduced-motion: reduce) {
  .reveal-card, .reveal-veil, .rv-progress b { transition: none; }
}

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

.result-top {
  padding: 16px 0 4px;
  text-align: center;
}

.score-ring {
  width: 132px; height: 132px;
  margin: 6px auto 14px;
  border-radius: 50%;
  display: grid; place-items: center;
  background:
    conic-gradient(var(--gold) calc(var(--pct, 0) * 1%), rgba(255, 255, 255, 0.07) 0);
  position: relative;
  transition: background 0.6s ease;
}
.score-ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 20%, #1c1a25, #0c0c12 70%);
  border: 1px solid rgba(232, 200, 122, 0.2);
}
.score-inner {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.score-inner b {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -2px;
  background: linear-gradient(180deg, #fff8e6, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.score-inner span { font-size: 12px; color: var(--muted); }

.result-grade {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--cream);
}
.result-sub { margin: 7px 0 0; font-size: 12.5px; color: var(--muted); }
.result-best {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--gold);
  min-height: 16px;
}

.result-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 9px; }
.result-actions .row { display: flex; gap: 9px; }

/* ───────────── 결과 공유 카드 ───────────── */

.share-block { margin-top: 18px; }

.share-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 2px 9px;
}
.share-head span {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.4px;
}
.share-head em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted-2);
  text-align: right;
}

.share-card {
  position: relative;
  aspect-ratio: 4 / 5;
  padding: 20px 18px 16px;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--cream);
  background:
    radial-gradient(120% 80% at 82% -10%, rgba(232, 200, 122, 0.17), rgba(232, 200, 122, 0) 58%),
    radial-gradient(90% 60% at 0% 108%, rgba(196, 92, 60, 0.16), rgba(196, 92, 60, 0) 60%),
    linear-gradient(168deg, #1e1b29 0%, #0c0c13 52%, #121018 100%);
  border: 1px solid rgba(232, 200, 122, 0.3);
  box-shadow: 0 22px 46px -26px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  isolation: isolate;
}
.share-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 200, 122, 0.8), transparent);
  z-index: 2;
}
.share-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.7'/%3E%3C/svg%3E");
}
.sc-glow {
  position: absolute;
  width: 180px; height: 180px;
  right: -60px; top: -70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 200, 122, 0.22), rgba(232, 200, 122, 0));
  filter: blur(6px);
  z-index: 0;
}

.sc-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sc-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2.4px;
  color: var(--gold);
}
.sc-brand i {
  width: 18px; height: 13px;
  border-radius: 3px;
  border: 1.4px solid var(--gold);
  position: relative;
  opacity: 0.95;
}
.sc-brand i::after {
  content: "";
  position: absolute;
  left: 4px; top: 3px;
  width: 0; height: 0;
  border-left: 5px solid var(--gold);
  border-top: 3.2px solid transparent;
  border-bottom: 3.2px solid transparent;
}
.sc-mode {
  font-size: 10px;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 54%;
}

.sc-art {
  position: relative;
  z-index: 2;
  margin: auto 0 6px;
  text-align: center;
}
.sc-art span {
  display: block;
  font-size: clamp(30px, 9.4vw, 40px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: rgba(232, 200, 122, 0.16);
}
.sc-art em {
  display: block;
  margin-top: 10px;
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 1.6px;
  color: var(--muted-2);
}

.sc-score {
  position: relative;
  z-index: 2;
  margin-top: 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.sc-score b {
  font-size: clamp(54px, 17vw, 72px);
  line-height: 0.94;
  font-weight: 800;
  letter-spacing: -3px;
  background: linear-gradient(178deg, #fff8e6 6%, #f0d79b 48%, #c9a34f 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 18px rgba(232, 200, 122, 0.22));
}
.sc-score span { font-size: 12px; color: var(--muted); }

.sc-grade {
  position: relative;
  z-index: 2;
  margin: 9px 0 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #fbf4e6;
}
.sc-line {
  position: relative;
  z-index: 2;
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  word-break: keep-all;
}

.sc-stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid rgba(232, 200, 122, 0.16);
}
.sc-stats > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
}
.sc-stats > div:first-child { padding-left: 0; border-left: 0; }
.sc-stats span { font-size: 9.5px; color: var(--muted-2); letter-spacing: 0.2px; }
.sc-stats b { font-size: 13px; font-weight: 700; color: #f2e7d2; }

.sc-foot {
  position: relative;
  z-index: 2;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px dashed rgba(232, 200, 122, 0.2);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.sc-foot span { font-size: 11px; font-weight: 700; color: var(--gold); letter-spacing: -0.2px; }
.sc-foot em { font-style: normal; font-size: 9px; color: var(--muted-2); letter-spacing: 0.2px; }

.share-btns {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.share-btns .primary { padding: 12px 10px; font-size: 13.5px; border-radius: 12px; }
.share-btns .ghost { flex: none; padding: 12px 10px; font-size: 13.5px; border-radius: 12px; }

@keyframes note-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}
.share-note {
  margin: 8px 2px 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--gold);
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(232, 200, 122, 0.08);
  border: 1px solid rgba(232, 200, 122, 0.2);
  animation: note-in 0.2s ease both;
}

.review-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 24px 2px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
}
.review-head em { font-style: normal; font-size: 11.5px; color: var(--muted-2); }

.review { display: flex; flex-direction: column; gap: 9px; }

.review-empty {
  padding: 20px 14px;
  border-radius: 14px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

.review-item {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.review-item summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 13px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: #e9e2d4;
  word-break: keep-all;
}
.review-item summary::-webkit-details-marker { display: none; }
.review-item .rv-no {
  flex: none;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--red);
  background: rgba(239, 106, 76, 0.12);
  border: 1px solid rgba(239, 106, 76, 0.3);
  padding: 3px 6px;
  border-radius: 6px;
}
.review-item .rv-body {
  padding: 0 13px 13px;
  font-size: 12px;
  line-height: 1.6;
  color: #d6cfc1;
}
.review-item .rv-line { color: var(--muted); }
.review-item .rv-answer { color: var(--green); font-weight: 700; margin-top: 6px; }
.review-item .rv-film { color: var(--gold); font-weight: 700; margin-top: 6px; }
.review-item .rv-text { margin-top: 6px; }

/* ───────────── 작은 화면 보정 ───────────── */

@media (max-width: 360px) {
  #app { padding-left: 14px; padding-right: 14px; }
  .q-quote { font-size: 18px; }
  .q-quote.long { font-size: 15px; }
  .option { font-size: 13px; padding: 13px 11px; }
  .brand-text h1 { font-size: 22px; }
  .brand-text p { font-size: 11px; }
  .mode .mode-name { font-size: 10.5px; }
  .genre .g-name { font-size: 11px; }
  .genre .g-meta { font-size: 9px; gap: 4px; }
  .genre-all .g-name { font-size: 12.5px; }
  .home-foot p { font-size: 10px; }
}

@media (min-height: 860px) {
  .q-card { padding: 20px 18px 18px; }
}

/* ═══════════════════════════════════════════════════════════
   멀티플레이 · 서든데스 · 랭킹 (v2)
   ═══════════════════════════════════════════════════════════ */

/* display 를 지정한 요소도 hidden 속성이 항상 이기도록 */
[hidden] { display: none !important; }

/* ───────── 홈: 대결·랭킹 진입 ───────── */

.play-row {
  display: grid;
  grid-template-columns: 1.28fr 1fr;
  gap: 7px;
  margin-top: calc(var(--home-gap) + 1px);
}

.play-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border-radius: 13px;
  text-align: left;
  background: linear-gradient(135deg, rgba(232, 200, 122, 0.14), rgba(232, 200, 122, 0.03) 60%, rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(232, 200, 122, 0.32);
  box-shadow: 0 14px 30px -26px rgba(232, 200, 122, 0.9);
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.play-card:active { transform: scale(0.985); }
.play-card.slim {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}
.play-card .pc-emoji {
  font-size: 15px;
  width: 33px; height: 33px;
  flex: none;
  border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(232, 200, 122, 0.16);
}
.play-card.slim .pc-emoji { background: rgba(255, 255, 255, 0.06); }
.play-card .pc-body { min-width: 0; flex: 1; }
.play-card .pc-name {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.play-card .pc-sub {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.play-card .pc-arrow { font-size: 9px; color: var(--gold); opacity: 0.8; }

/* 4개 모드 한 줄 (크기는 홈 섹션에서) */
.mode.mode-sudden { border-color: rgba(239, 106, 76, 0.22); }
.mode.mode-sudden[aria-selected="true"] {
  background: linear-gradient(180deg, rgba(239, 106, 76, 0.2), rgba(239, 106, 76, 0.06));
  border-color: rgba(239, 106, 76, 0.55);
  box-shadow: 0 12px 30px -22px rgba(239, 106, 76, 0.9);
}
.mode.mode-sudden[aria-selected="true"] .mode-emoji { background: rgba(239, 106, 76, 0.22); }

/* ───────── 서든데스 HUD ───────── */

#screen-quiz.is-sudden .progress-bar { display: none; }
#screen-quiz.is-sudden .progress-meta { margin-bottom: 0; }

.sudden-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -6px 0 12px;
  padding: 9px 12px;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(239, 106, 76, 0.14), rgba(239, 106, 76, 0.05));
  border: 1px solid rgba(239, 106, 76, 0.28);
}
.sudden-bar.tick { animation: tick 0.45s ease; }
@keyframes tick {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
.sudden-bar .lives { font-size: 14px; letter-spacing: 2px; }
.sudden-bar .timer-wrap { flex: 1; display: flex; align-items: center; gap: 9px; }
.timer-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.timer-bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffb27a, #ef6a4c);
  transition: width 0.1s linear;
}
.timer-bar i.danger { background: linear-gradient(90deg, #ff8a6b, #d62f2f); }
.timer-num {
  font-size: 12px;
  font-weight: 800;
  color: #ffb27a;
  min-width: 18px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ───────── 대결 HUD ───────── */

.vs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px 0 12px;
  padding: 8px 12px;
  border-radius: 13px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.vs-bar b { font-size: 15px; font-weight: 800; color: var(--cream); }
.vs-bar .vs-me { color: var(--gold); font-weight: 700; display: flex; align-items: baseline; gap: 4px; }
.vs-bar .vs-sep { font-size: 9px; font-weight: 800; color: var(--muted-2); letter-spacing: 0.5px; }
.vs-bar .vs-them { color: var(--muted); display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.vs-bar .vs-them em { font-style: normal; font-size: 11.5px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-bar .vs-note { margin-left: auto; font-size: 10.5px; color: var(--muted-2); }
.vs-bar .vs-note.live { color: var(--green); }

.q-vs {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.fb-vs {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}
.fb-vs.they-ok { color: #7ce6b0; }
.fb-vs.they-no { color: #ff9c82; }
.fb-vs.lives-left { color: #ffb27a; font-weight: 700; }

/* ───────── 결과: 랭킹 · 도전장 ───────── */

.rank-block {
  margin: 16px 0 0;
  padding: 13px 14px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
}
.rank-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.rank-block-head span { font-size: 12.5px; font-weight: 800; color: var(--gold); }
.rank-block-head em { font-style: normal; font-size: 10.5px; color: var(--muted-2); text-align: right; }
.rank-me-row { display: flex; align-items: center; gap: 8px; }
.rank-chip {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #2a1c03;
  background: linear-gradient(180deg, #f3dda4, var(--gold-deep));
}
.rank-me-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--cream);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-edit {
  margin-left: auto;
  flex: none;
  font-size: 10.5px;
  color: var(--muted-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.rank-rename-form { display: flex; gap: 7px; margin-top: 9px; }
.rank-rename-form input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  outline: none;
}
.rank-rename-form input:focus { border-color: var(--line-strong); }
.rank-save {
  flex: none;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 800;
  color: #2a1c03;
  background: linear-gradient(180deg, #f3dda4, var(--gold-deep));
}

.challenge-block {
  margin: 12px 0 0;
  padding: 13px 14px;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(232, 200, 122, 0.1), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(232, 200, 122, 0.26);
}
.challenge-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: #1a1409;
  background: linear-gradient(180deg, #f3dda4, var(--gold) 50%, var(--gold-deep));
}
.challenge-btn:disabled { opacity: 0.6; }
.challenge-hint { margin: 8px 0 0; font-size: 10.5px; color: var(--muted-2); text-align: center; }
.challenge-link { display: flex; gap: 6px; margin-top: 10px; }
.challenge-link input {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 10px;
  font: inherit;
  font-size: 11px;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
  outline: none;
}
.challenge-link button {
  flex: none;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

/* ───────── 공통 서브 헤더 ───────── */

.sub-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 0 14px;
}
.sub-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--cream);
}

/* ───────── 도전장 도착 ───────── */

.ch-card {
  position: relative;
  margin: 6px 0 0;
  padding: 22px 18px 20px;
  border-radius: 20px;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(170deg, #221d2b 0%, #12111a 60%, #17121a 100%);
  border: 1px solid rgba(232, 200, 122, 0.28);
  box-shadow: var(--shadow);
}
.ch-glow {
  position: absolute;
  top: -70px; right: -40px;
  width: 210px; height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 200, 122, 0.22), rgba(232, 200, 122, 0));
  pointer-events: none;
}
.ch-from {
  position: relative;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.ch-from span { color: var(--gold); font-weight: 800; }
.ch-score {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-top: 6px;
}
.ch-score b {
  font-size: 58px;
  font-weight: 800;
  letter-spacing: -3px;
  background: linear-gradient(180deg, #fff8e6, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.ch-score span { font-size: 15px; color: var(--muted); }
.ch-time { position: relative; margin: 4px 0 0; font-size: 12px; color: var(--muted-2); }
.ch-line {
  position: relative;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed rgba(232, 200, 122, 0.2);
  font-size: 12px;
  color: var(--cream);
}
.ch-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.ch-hint { margin: 10px 0 0; font-size: 11px; color: var(--muted-2); text-align: center; }

/* ───────── 도전장 · 방 결과 (VS) ───────── */

.vs-verdict-wrap { padding: 18px 0 6px; text-align: center; }
.vs-verdict {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1.2px;
  background: linear-gradient(180deg, #fff8e6, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.vs-verdict.win {
  background: linear-gradient(180deg, #fff8e6, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
}
.vs-verdict.lose {
  background: linear-gradient(180deg, #d8d4e2, #8f8a9e);
  -webkit-background-clip: text;
  background-clip: text;
}
.vs-verdict.draw,
.vs-verdict.wait {
  background: linear-gradient(180deg, #e8e2f0, #a29cb4);
  -webkit-background-clip: text;
  background-clip: text;
}
.vs-verdict-sub { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }

.vs-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.vs-card {
  padding: 14px 12px;
  border-radius: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.vs-card.me {
  background: linear-gradient(180deg, rgba(232, 200, 122, 0.14), rgba(232, 200, 122, 0.03));
  border-color: rgba(232, 200, 122, 0.34);
}
.vs-card .vc-who {
  display: block;
  font-size: 11px;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vs-card .vc-score {
  display: block;
  margin-top: 4px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--cream);
}
.vs-card.me .vc-score { color: var(--gold); }
.vs-card .vc-meta { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted-2); }

.vs-rows-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 18px 2px 8px;
}
.vs-rows-head span { font-size: 13px; font-weight: 700; color: var(--gold); }
.vs-rows-head em { font-style: normal; font-size: 11px; color: var(--muted-2); }

.vs-rows { display: flex; flex-direction: column; gap: 5px; }
.vs-row {
  display: grid;
  grid-template-columns: 20px 1fr 26px 26px;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 11.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.vs-row.win { border-color: rgba(69, 201, 138, 0.3); }
.vs-row.lose { border-color: rgba(239, 106, 76, 0.28); }
.vs-row .vr-no { font-size: 10px; color: var(--muted-2); font-weight: 700; }
.vs-row .vr-q {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #d6cfc1;
}
.vs-row .vr-me, .vs-row .vr-them { text-align: center; font-size: 12px; }
.vs-row .vr-them { opacity: 0.8; }

/* ───────── 방 입장 ───────── */

.field { display: block; margin-top: 4px; }
.field span {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: var(--muted-2);
  font-weight: 700;
}
.field input {
  width: 100%;
  padding: 12px 13px;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--line);
  outline: none;
}
.field input:focus { border-color: var(--line-strong); }
.field span em {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: -0.1px;
  color: rgba(154, 151, 168, 0.78);
}
.field input.invalid { border-color: rgba(239, 106, 76, 0.72); }
.field-error {
  margin: 6px 0 0;
  font-size: 11.5px;
  font-weight: 700;
  color: #ff9c82;
}

.room-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 14px 0 12px;
  padding: 4px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.room-tab {
  padding: 9px 8px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted-2);
  transition: all 0.18s ease;
}
.room-tab.active {
  color: #1a1409;
  background: linear-gradient(180deg, #f3dda4, var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 8px 20px -16px rgba(232, 200, 122, 0.9);
}

.room-panel { padding: 4px 0 0; }
.panel-label {
  margin: 12px 2px 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted-2);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.chip.on {
  color: #1a1409;
  background: linear-gradient(180deg, #f3dda4, var(--gold-deep));
  border-color: rgba(232, 200, 122, 0.6);
  font-weight: 800;
}
.room-panel .primary { margin-top: 18px; }

.code-input {
  width: 100%;
  padding: 16px 12px;
  border-radius: 14px;
  text-align: center;
  font: inherit;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 8px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--line-strong);
  outline: none;
  text-indent: 8px;
}
.code-input::placeholder { color: rgba(232, 200, 122, 0.25); letter-spacing: 8px; }

.room-help { margin-top: 20px; }
.room-help p {
  margin: 0 0 7px;
  font-size: 11px;
  line-height: 1.65;
  color: var(--muted-2);
}
.room-help b { color: var(--muted); font-weight: 700; }
.room-help .room-help-note { color: var(--gold); }

/* ───────── 방 로비 ───────── */

.lobby-card {
  padding: 16px;
  border-radius: 18px;
  text-align: center;
  background: linear-gradient(170deg, #201c29, #12111a);
  border: 1px solid rgba(232, 200, 122, 0.24);
}
.lobby-label { margin: 0; font-size: 10.5px; letter-spacing: 1px; color: var(--muted-2); }
.lobby-code {
  margin-top: 4px;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 10px;
  text-indent: 10px;
  background: linear-gradient(180deg, #fff8e6, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lobby-code-btns { display: flex; gap: 7px; margin-top: 10px; }
.lobby-code-btns .ghost { font-size: 11.5px; padding: 9px 10px; }
.lobby-mode { margin: 10px 0 0; font-size: 11px; color: var(--muted-2); }

.lobby-players { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.lobby-player {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.lobby-player.me { border-color: rgba(232, 200, 122, 0.34); background: linear-gradient(180deg, rgba(232, 200, 122, 0.12), rgba(232, 200, 122, 0.02)); }
.lobby-player.empty { border-style: dashed; opacity: 0.7; }
.lobby-player .lp-avatar {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.06);
}
.lobby-player .lp-body { flex: 1; min-width: 0; }
.lobby-player .lp-name {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cream);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lobby-player .lp-tag { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted-2); }
.lobby-player .lp-dot {
  width: 7px; height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(69, 201, 138, 0.6);
}
.lobby-player.empty .lp-dot { background: var(--muted-2); box-shadow: none; }

.lobby-status {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted-2);
  min-height: 17px;
}
.lobby-status.ready { color: var(--gold); }
.lobby-status.warn { color: #ffb27a; }
.lobby-error {
  margin: 7px 0 0;
  text-align: center;
  font-size: 11px;
  color: #ffb27a;
}
.lobby-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

/* ───────── 전체 랭킹 ───────── */

.rank-board { margin-top: 4px; }
.rank-loading { padding: 22px 0; text-align: center; font-size: 12px; color: var(--muted-2); }
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid rgba(255, 255, 255, 0.055);
}
.rank-row.top1 {
  background: linear-gradient(100deg, rgba(232, 200, 122, 0.16), rgba(232, 200, 122, 0.03));
  border-color: rgba(232, 200, 122, 0.4);
}
.rank-row.top2, .rank-row.top3 { border-color: rgba(232, 200, 122, 0.22); }
.rank-row .rr-pos {
  flex: none;
  width: 26px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
}
.rank-row.top1 .rr-pos { font-size: 18px; }
.rank-row .rr-body { flex: 1; min-width: 0; }
.rank-row .rr-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--cream);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-row .rr-meta { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted-2); }
.rank-row .rr-score { flex: none; display: flex; align-items: baseline; gap: 2px; }
.rank-row .rr-score b { font-size: 17px; font-weight: 800; color: var(--gold); }
.rank-row .rr-score span { font-size: 10px; color: var(--muted-2); }
#rank-empty { padding: 24px 0; text-align: center; font-size: 12px; color: var(--muted-2); }

.rank-self {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 13px;
  background: rgba(232, 200, 122, 0.08);
  border: 1px solid rgba(232, 200, 122, 0.26);
  font-size: 12.5px;
  color: var(--cream);
}
.rank-self em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--muted-2); }
.rank-caption { margin: 12px 0 0; text-align: center; font-size: 10.5px; color: var(--muted-2); }

.vs-col-head {
  display: grid;
  grid-template-columns: 20px 1fr 26px 26px;
  gap: 8px;
  padding: 0 12px 5px;
  font-size: 9.5px;
  letter-spacing: 0.2px;
  color: var(--muted-2);
}
.vs-col-head span:nth-child(3),
.vs-col-head span:nth-child(4) { text-align: center; }
.vs-col-head span:last-child { color: rgba(232, 200, 122, 0.65); }

/* ───────── 실시간 방 대결 · 2~4인 확장 ───────── */

.vs-bar .vs-top { display: flex; align-items: center; gap: 8px; width: 100%; }
.vs-bar.is-room {
  display: block;
  padding: 8px 10px;
}
.vs-bar.is-room .vs-top { display: none; }

.vs-room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 10.5px;
  color: var(--muted-2);
}
.vs-timer {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.vs-timer.danger { color: #ff8f6a; }

.vs-players { display: flex; gap: 5px; }
.vs-player {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 4px 5px;
  border-radius: 9px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.vs-player.me {
  border-color: rgba(232, 200, 122, 0.36);
  background: linear-gradient(180deg, rgba(232, 200, 122, 0.14), rgba(232, 200, 122, 0.03));
}
.vs-player.gone { opacity: 0.45; }
.vs-player .vp-name {
  display: block;
  font-size: 9.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vs-player .vp-line { display: block; margin-top: 1px; white-space: nowrap; }
.vs-player .vp-score { font-size: 13px; font-weight: 800; color: var(--cream); }
.vs-player.me .vp-score { color: var(--gold); }
.vs-player .vp-state { margin-left: 3px; font-size: 10px; }

/* 로비 — 4자리를 한 화면에 */
.lobby-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 14px 2px 6px;
  font-size: 11px;
  color: var(--muted-2);
}
.lobby-head b { color: var(--gold); font-size: 12.5px; }
.lobby-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.lobby-player { padding: 9px 10px; gap: 8px; border-radius: 13px; }
.lobby-player .lp-avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 14px; }
.lobby-player .lp-name { font-size: 12px; }
.lobby-player .lp-tag { font-size: 9.5px; margin-top: 1px; }

/* 로비 — 대기실 채팅 */
.lobby-chat {
  margin-top: 10px;
  padding: 9px 10px 10px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.lc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 10.5px;
  color: var(--muted-2);
}
.lc-head > span:first-child { color: var(--muted); font-weight: 700; }
.lc-hint { flex: none; font-size: 9.5px; color: var(--muted-2); }
.lc-hint.full { color: #ffb27a; }
.lc-body { position: relative; }
.lc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 0;
  height: 118px;              /* 메시지가 늘어도 입력창이 움직이지 않도록 고정 */
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.lc-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  max-width: 100%;
}
.lc-msg .lc-nick {
  padding: 0 3px;
  font-size: 9.5px;
  line-height: 1.3;
  color: var(--muted);
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90%;
}
.lc-msg .lc-text {
  max-width: 86%;
  padding: 5px 9px;
  border-radius: 11px 11px 11px 4px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.lc-msg.mine { align-items: flex-end; }
.lc-msg.mine .lc-nick { color: rgba(232, 200, 122, 0.72); opacity: 1; }
.lc-msg.mine .lc-text {
  border-radius: 11px 11px 4px 11px;
  color: #fff6e0;
  background: linear-gradient(180deg, rgba(232, 200, 122, 0.24), rgba(232, 200, 122, 0.11));
  border-color: rgba(232, 200, 122, 0.3);
}
.lc-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 10px;
  text-align: center;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--muted-2);
  pointer-events: none;
}
.lc-form { display: flex; gap: 6px; margin-top: 8px; }
.lc-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 11px;
  font: inherit;
  font-size: 16px;
  line-height: 1.2;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.09);
  -webkit-appearance: none;
  appearance: none;
}
.lc-form input::placeholder { font-size: 12px; color: var(--muted-2); }
.lc-form input:focus { outline: none; border-color: rgba(232, 200, 122, 0.42); }
.lc-form input:disabled { opacity: 0.6; }
.lc-send {
  flex: none;
  min-width: 52px;
  padding: 0 12px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 800;
  color: #1a1409;
  background: linear-gradient(180deg, #f3dda4 0%, var(--gold) 55%, var(--gold-deep) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.lc-send:active { transform: scale(0.97); }
.lc-send:disabled { opacity: 0.35; box-shadow: none; }

/* 방 결과 — 1~4위 순위표 */
.rm-board { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rm-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid rgba(255, 255, 255, 0.055);
}
.rm-row.me {
  border-color: rgba(232, 200, 122, 0.36);
  background: linear-gradient(180deg, rgba(232, 200, 122, 0.12), rgba(232, 200, 122, 0.02));
}
.rm-row.gone { opacity: 0.55; }
.rm-row .rm-pos { width: 22px; flex: none; font-size: 14px; font-weight: 800; text-align: center; }
.rm-row .rm-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cream);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rm-row .rm-correct { flex: none; font-size: 10.5px; color: var(--muted-2); }
.rm-row .rm-score { flex: none; min-width: 42px; text-align: right; }
.rm-row .rm-score b { font-size: 15px; font-weight: 800; color: var(--cream); }
.rm-row.me .rm-score b { color: var(--gold); }
.rm-row .rm-score span { margin-left: 1px; font-size: 9.5px; color: var(--muted-2); }
