/* ============================================================
   공룡 대탈출 (DINO ESCAPE) — 3D 추격전 국어 퀴즈
   · 모바일 가로(844×344 / 390) · 세로(390×844)에서 잘림 없이
   · 모든 오버레이는 '위에서 시작 + 남는 공간만 가운데'(align-items:flex-start + margin:auto)
   ============================================================ */

:root {
  --font: 'Pretendard', 'Pretendard Variable', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
    'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  --mono: 'SF Mono', 'DIN Alternate', ui-monospace, 'Menlo', monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  --amber: #ffb44c;
  --amber-soft: #ffd48a;
  --lime: #9ef07a;
  --teal: #5fe0c8;
  --red: #ff5a48;
  --red-deep: #c9202a;
  --ink: #f2f8f2;
  --muted: #93a89a;
  --line: rgba(150, 220, 170, 0.17);
  --line-strong: rgba(160, 240, 190, 0.4);
  --card: linear-gradient(180deg, rgba(9, 20, 16, 0.84), rgba(5, 12, 10, 0.9));

  /* 터치 「점프」 버튼 높이 — 하단 HUD 줄이 이 위로 비켜 앉는다(좌우 버튼은 없음) */
  --tp-h: clamp(64px, 17vw, 80px);
  --tp-gap: 16px;
  --tp-lift: 0px;
}

/* 터치 기기: 조작판이 차지하는 높이(점프 버튼 + 아래 여백 12px + 간격)만큼 HUD·토스트를 들어올린다 */
body.touch-device {
  --tp-lift: calc(var(--tp-h) + 12px + var(--tp-gap));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #050b09;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  /* 두 손가락으로 벌려 화면을 확대하면 HUD가 화면 밖으로 밀려 잘려 보인다 —
     게임 화면에서는 확대·두 손가락 스크롤을 막는다(안내 패널의 세로 스크롤은 아래에서 허용). */
    /* V33(2026-11-27) — none → manipulation. 구버전 삼성인터넷에서 body 전체 touch-action: none 이
     버튼·입력란의 탭(click)까지 삼켜 터치가 안 먹히는 증상이 있었다.
     두 번 탭 확대는 계속 막히고, 확대 제스처는 캔버스·조이스틱(touch-action: none)과
     두 손가락·gesture* 차단이 맡는다. */
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

/* 스크롤되는 안내 패널만 세로 스크롤을 허용한다 */
.panel, .panel * , .howto-grid, .quiz-choices, #quizChoices, .result-panel { touch-action: pan-y; }

#app { position: fixed; inset: 0; overflow: hidden; }

canvas#dino-chase {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  filter: saturate(1.08) contrast(1.06) brightness(1.02);
}

/* ---------------- 화면 효과 ---------------- */
#vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background:
    radial-gradient(120% 80% at 50% 42%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.34) 78%, rgba(0, 0, 0, 0.6) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0) 26%, rgba(0, 0, 0, 0) 62%, rgba(0, 0, 0, 0.4));
}

#speedFx {
  position: absolute; inset: 0; pointer-events: none; z-index: 3; opacity: 0;
  background:
    radial-gradient(ellipse 60% 60% at 50% 50%, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0.05) 55%, rgba(255, 255, 255, 0) 62%),
    repeating-conic-gradient(from 0deg at 50% 46%, rgba(255, 235, 200, 0.11) 0deg 0.4deg, rgba(255, 255, 255, 0) 0.4deg 6deg);
  transition: opacity 0.22s linear;
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(ellipse 62% 70% at 50% 48%, transparent 40%, black 76%);
  mask-image: radial-gradient(ellipse 62% 70% at 50% 48%, transparent 40%, black 76%);
}

#flash {
  position: absolute; inset: 0; pointer-events: none; z-index: 6; opacity: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 240, 200, 0.85), rgba(255, 180, 70, 0.35) 60%, rgba(255, 140, 40, 0) 100%);
  mix-blend-mode: screen;
}

#damage {
  position: absolute; inset: 0; pointer-events: none; z-index: 5; opacity: 0;
  background: radial-gradient(ellipse 80% 70% at 50% 55%, rgba(255, 40, 30, 0) 42%, rgba(210, 20, 20, 0.42) 100%);
  transition: opacity 0.4s ease-out;
}

/* 티렉스에게 물린 순간 — 화면 가장자리 붉은 피격 비네트 + 발톱 자국 */
#hitFx {
  position: absolute; inset: 0; pointer-events: none; z-index: 7; opacity: 0;
}
#hitFx::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 78% 72% at 50% 52%, rgba(255, 60, 30, 0) 38%, rgba(214, 22, 12, 0.55) 78%, rgba(126, 4, 4, 0.92) 100%),
    linear-gradient(180deg, rgba(190, 16, 8, 0.4), rgba(0, 0, 0, 0) 26%, rgba(0, 0, 0, 0) 70%, rgba(190, 16, 8, 0.42));
}
#hitFx::after {
  content: ''; position: absolute; inset: -12% -6%;
  background:
    linear-gradient(104deg, transparent 30%, rgba(255, 236, 210, 0.9) 30.5%, rgba(255, 96, 52, 0.55) 31.6%, transparent 32.6%),
    linear-gradient(104deg, transparent 36.5%, rgba(255, 236, 210, 0.85) 37%, rgba(255, 88, 46, 0.5) 38.1%, transparent 39.1%),
    linear-gradient(104deg, transparent 43%, rgba(255, 240, 220, 0.8) 43.5%, rgba(255, 80, 40, 0.45) 44.6%, transparent 45.6%);
  filter: blur(1px) drop-shadow(0 0 12px rgba(255, 70, 30, 0.9));
  opacity: 0;
}
#hitFx.on { animation: hitFlash 0.62s cubic-bezier(0.2, 0.9, 0.2, 1) forwards; }
#hitFx.on::after { animation: clawSlash 0.62s cubic-bezier(0.2, 0.9, 0.2, 1) forwards; }
@keyframes hitFlash {
  0% { opacity: 0; }
  9% { opacity: 1; }
  46% { opacity: 0.68; }
  100% { opacity: 0; }
}
@keyframes clawSlash {
  0% { opacity: 0; transform: translate(-14px, 10px) scale(1.25); }
  14% { opacity: 0.95; transform: translate(0, 0) scale(1); }
  55% { opacity: 0.34; }
  100% { opacity: 0; transform: translate(6px, -6px) scale(1.04); }
}

/* ---------------- 공통 UI ---------------- */
.hidden { display: none !important; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(24, 46, 36, 0.94), rgba(12, 26, 20, 0.94));
  color: #e6f6ea;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  -webkit-user-select: none;
  user-select: none;
}
.btn:hover { border-color: rgba(200, 255, 220, 0.6); box-shadow: 0 0 22px rgba(80, 220, 140, 0.22); }
.btn:active { transform: translateY(1px) scale(0.995); }
.btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; transform: none; }

.btn.primary {
  background: linear-gradient(180deg, #ffc45e, #f0932a 62%, #d97a15);
  color: #26180a;
  border-color: rgba(255, 230, 190, 0.75);
  text-shadow: none;
  box-shadow: 0 8px 26px rgba(240, 150, 40, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn.primary:hover { box-shadow: 0 10px 32px rgba(255, 170, 60, 0.48); }

.btn.big { padding: 15px 46px; font-size: clamp(16px, 2.6vw, 19px); border-radius: 14px; letter-spacing: 0.1em; }
.btn.small { padding: 8px 13px; font-size: 12.5px; border-radius: 9px; }
/* V22 — 타이틀의 「이어서 하기」: 게임 시작보다 한 단계 낮춰 눈에 띄게 */
.btn.resume {
  margin-top: 9px;
  padding: 10px 22px;
  font-size: 14px;
  color: #ffe6a8;
  border-color: rgba(255, 210, 122, 0.55);
  background: linear-gradient(180deg, rgba(64, 48, 16, 0.85), rgba(26, 19, 6, 0.92));
}
.btn.resume:hover { border-color: #ffd27a; box-shadow: 0 0 20px rgba(255, 210, 122, 0.26); }
.btn.resume.hidden { display: none; }
.btn.ghost { background: rgba(12, 22, 18, 0.6); border-color: rgba(160, 200, 175, 0.24); color: #b9cfc1; }
.btn.icon { min-width: 40px; padding: 9px 10px; font-size: 13px; border-radius: 10px; }
.btn.icon.bgm { font-size: 11px; font-weight: 800; letter-spacing: 0.04em; }
.btn.icon[aria-pressed="false"] { opacity: 0.55; }

/* ---------------- 전체화면 토글 (옵션 버튼 바로 옆) ---------------- */
.btn.fs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
/* HUD 아이콘 버튼은 옆 버튼들과 높이를 맞춘다 */
.btn.icon.fs { line-height: 1.05; }
/* 전체화면 버튼의 '꺼짐'은 소리 버튼과 달리 흐리게 하지 않는다 */
.btn.icon.fs[aria-pressed="false"] { opacity: 0.95; }
.btn .fs-ico { font-size: 1.05em; line-height: 1; opacity: 0.92; }
.btn.fs .fs-txt { letter-spacing: 0.02em; }
.btn.fs[aria-pressed="true"] {
  border-color: rgba(170, 245, 195, 0.72);
  color: #eafff1;
  background: linear-gradient(180deg, rgba(34, 92, 62, 0.94), rgba(12, 34, 23, 0.96));
  box-shadow: 0 0 18px rgba(110, 240, 160, 0.34);
}
kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

/* ---------------- HUD ---------------- */
#hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  --hud-pb: calc(12px + var(--safe-bottom));
  padding: calc(10px + var(--safe-top)) calc(12px + var(--safe-right)) calc(var(--hud-pb) + var(--tp-lift)) calc(12px + var(--safe-left));
  pointer-events: none;
}
#hud button { pointer-events: auto; }

.hud-top {
  display: grid;
  gap: 9px;
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr) minmax(0, 1fr);
  grid-template-areas: 'stage gap score';
  width: 100%;
  max-width: min(1180px, 100%);
  margin: 0 auto;
}

.hud-card {
  position: relative;
  padding: 9px 12px 10px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}
.stage-block { grid-area: stage; }
.gap-block { grid-area: gap; }
.score-block { grid-area: score; }

.row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

.label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

.stage-badge { font-family: var(--mono); color: var(--amber-soft); font-size: 12px; letter-spacing: 0.02em; }
.stage-badge b { font-size: 15px; color: #fff; }
.stage-badge i { font-style: normal; opacity: 0.55; }
.stage-name {
  margin: 2px 0 6px;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ecfbf0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sub { margin-top: 4px; font-size: 10px; color: var(--muted); font-family: var(--mono); letter-spacing: 0.02em; }

.bar {
  position: relative;
  height: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}
.bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, #4fd99a, #b6ff79);
  box-shadow: 0 0 12px rgba(120, 240, 150, 0.5);
  transition: width 0.18s linear;
}
.bar.thin { height: 5px; }

/* 공룡 거리 게이지 */
.gap-block { text-align: center; overflow: hidden; }
.gap-state {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 2px 7px;
  border-radius: 999px;
  color: #0d2417;
  background: linear-gradient(180deg, #b8ffa6, #6fe08a);
}
.gap-block.warn .gap-state { background: linear-gradient(180deg, #ffd76a, #ffab3d); color: #2a1a04; }
.gap-block.danger .gap-state { background: linear-gradient(180deg, #ff8a76, #e5322b); color: #fff; animation: statePulse 0.85s ease-in-out infinite; }
@keyframes statePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.gap-value { display: flex; align-items: baseline; justify-content: center; gap: 3px; margin: 1px 0 3px; line-height: 1; }
.gap-value b {
  font-family: var(--mono);
  font-size: clamp(24px, 4.6vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(140, 255, 180, 0.35);
}
.gap-value span { font-size: 11px; font-weight: 800; color: var(--muted); }
.gap-block.warn .gap-value b { color: #ffd980; text-shadow: 0 0 20px rgba(255, 190, 80, 0.5); }
.gap-block.danger .gap-value b { color: #ff8b7a; text-shadow: 0 0 22px rgba(255, 80, 60, 0.65); }

.bar.gap-bar { height: 7px; }
.gap-bar i { background: linear-gradient(90deg, #6ef0a5, #d6ff8a); }
.gap-block.warn .gap-bar i { background: linear-gradient(90deg, #ffc857, #ffe6a1); }
.gap-block.danger .gap-bar i { background: linear-gradient(90deg, #ff5b45, #ffa07a); }

.gap-track {
  position: relative;
  margin-top: 3px;
  height: 12px;
  font-size: 10px;
  line-height: 12px;
  opacity: 0.75;
}
.gap-track .gt-j { position: absolute; left: 0; transition: left 0.2s linear; }
.gap-track .gt-d { position: absolute; right: 0; }

.score-block { text-align: right; }
.mult {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--amber-soft);
  letter-spacing: 0.02em;
}
.value.big {
  font-family: var(--mono);
  font-size: clamp(19px, 3.4vw, 25px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.15;
}
.parts-line { display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin-top: 3px; }
.parts-line .label { display: inline; }
.parts-line b { font-family: var(--mono); font-size: 13px; color: var(--lime); }
.parts-line .lvl {
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(158, 240, 122, 0.16);
  border: 1px solid rgba(158, 240, 122, 0.34);
  color: #d8ffc8;
}

/* 목숨(내구도) — 티라노가 12m 안으로 붙으면 깎인다.
   주행 시야를 가리지 않도록 상단 가운데 카드 아래에 두는 작은 알약형 게이지(폭 212px 이하) */
.hp-strip {
  grid-column: 1 / -1;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(212px, 42%);
  padding: 3px 11px 4px;
  border-radius: 999px;
  background: rgba(6, 18, 13, 0.58);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.hp-k { flex: none; font-size: 10px; line-height: 1; letter-spacing: 0; }
.hp-bar { flex: 1 1 auto; height: 5px; }
.hp-bar i { background: linear-gradient(90deg, #38d6a0, #9bffb0); box-shadow: 0 0 10px rgba(80, 230, 170, 0.45); }
.hp-v {
  flex: none;
  min-width: 34px;
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  color: #9cf0c0;
  font-variant-numeric: tabular-nums;
}
.hp-strip.warn .hp-v { color: #ffd98a; }
.hp-strip.warn .hp-bar i { background: linear-gradient(90deg, #ffb545, #ffe08f); box-shadow: 0 0 12px rgba(255, 190, 80, 0.55); }
.hp-strip.danger .hp-v { color: #ff9b8d; }
.hp-strip.danger .hp-bar i { background: linear-gradient(90deg, #ff4438, #ff8f6b); box-shadow: 0 0 12px rgba(255, 80, 60, 0.6); }
.hp-strip.hit { animation: hpHit 0.32s ease-out; }
@keyframes hpHit {
  0% { transform: translateX(-2px); }
  30% { transform: translateX(2px); }
  60% { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}
.stat.wide { grid-column: 1 / -1; }

.hud-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}
.speed-block {
  min-width: 128px;
  max-width: 210px;
  padding: 7px 11px 8px;
  border-radius: 11px;
  background: var(--card);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}
.speed-num { font-family: var(--mono); font-size: 15px; color: #fff; font-variant-numeric: tabular-nums; }
.speed-num i { font-style: normal; font-size: 9px; color: var(--muted); margin-left: 2px; }
.bar.speed i { background: linear-gradient(90deg, #63d8ff, #b7f0ff); box-shadow: 0 0 12px rgba(90, 200, 255, 0.5); }

.turbo-badge {
  align-self: flex-end;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #2a1200;
  background: linear-gradient(180deg, #ffe08a, #ffa32e);
  box-shadow: 0 0 26px rgba(255, 170, 50, 0.7);
  animation: turboPulse 0.6s ease-in-out infinite;
}
@keyframes turboPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.hud-actions { display: flex; gap: 6px; align-items: center; }

.warn-banner {
  position: absolute;
  left: 50%;
  top: 21%;
  transform: translateX(-50%);
  padding: 6px 18px;
  border-radius: 999px;
  font-size: clamp(12px, 2.4vw, 15px);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #fff;
  background: rgba(180, 20, 16, 0.62);
  border: 1px solid rgba(255, 140, 120, 0.65);
  box-shadow: 0 0 34px rgba(255, 60, 40, 0.5);
  animation: warnFlash 1s ease-in-out infinite;
  white-space: nowrap;
  pointer-events: none;
}
@keyframes warnFlash { 0%, 100% { opacity: 0.95; } 50% { opacity: 0.45; } }

.combo-pop {
  position: absolute;
  left: 50%;
  top: 33%;
  transform: translate(-50%, 6px);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--amber-soft);
  text-shadow: 0 0 18px rgba(255, 180, 70, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.combo-pop.show { opacity: 1; transform: translate(-50%, -6px); }

/* 아이템 획득 배지 — 화면 중앙 상단에 짧게 띄운다 */
.item-badge {
  position: absolute;
  left: 50%;
  top: 15%;
  transform: translate(-50%, -8px) scale(0.9);
  padding: 9px 20px;
  border-radius: 999px;
  font-size: clamp(13px, 2.6vw, 18px);
  font-weight: 900;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: #0d1410;
  background: linear-gradient(180deg, #fff, var(--item-color, #ffd54a));
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 34px var(--item-color, #ffd54a), 0 8px 22px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.item-badge.on { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* 방어막 유지 칩 */
/* 티렉스 감속(보상) 중 공룡 거리 카드의 상태 알약 */
.gap-state.slow {
  background: linear-gradient(180deg, #c8f7d4, #35d98a);
  color: #04281a;
  letter-spacing: 0.04em;
}

.turbo-badge.shield-chip {
  color: #1a0730;
  background: linear-gradient(180deg, #e6c9ff, #a86bff);
  box-shadow: 0 0 26px rgba(170, 110, 255, 0.75);
  animation: turboPulse 0.9s ease-in-out infinite;
}

/* 방어막이 막은 순간의 피격 텍스트 */
.atk-text.blocked {
  background: linear-gradient(180deg, rgba(126, 60, 216, 0.94), rgba(62, 22, 120, 0.88));
  border-color: rgba(214, 178, 255, 0.85);
  box-shadow: 0 0 44px rgba(170, 110, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 0 20px rgba(200, 150, 255, 0.95), 0 2px 8px rgba(0, 0, 0, 0.75);
}

/* 티렉스 공격 피격 텍스트 — 목숨이 깎인 순간 화면 가운데에 선명하게 */
.atk-text {
  position: absolute;
  left: 50%;
  top: 41%;
  transform: translate(-50%, -50%) scale(0.8);
  padding: 10px 24px;
  border-radius: 14px;
  font-size: clamp(17px, 4.4vw, 30px);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: #fff;
  white-space: nowrap;
  background: linear-gradient(180deg, rgba(186, 16, 10, 0.92), rgba(96, 6, 4, 0.84));
  border: 1px solid rgba(255, 156, 126, 0.8);
  box-shadow: 0 0 44px rgba(255, 60, 24, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  text-shadow: 0 0 20px rgba(255, 120, 70, 0.95), 0 2px 8px rgba(0, 0, 0, 0.75);
  opacity: 0;
  pointer-events: none;
}
.atk-text.on { animation: atkPop 1.05s cubic-bezier(0.2, 0.9, 0.2, 1) forwards; }
@keyframes atkPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.66) rotate(-4deg); }
  11% { opacity: 1; transform: translate(-50%, -50%) scale(1.14) rotate(-1.5deg); }
  28% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  74% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.05); }
}

.toast {
  position: absolute;
  left: 50%;
  --toast-b: calc(86px + var(--safe-bottom));
  bottom: var(--toast-b);
  transform: translate(-50%, 10px);
  padding: 9px 17px;
  border-radius: 999px;
  background: rgba(8, 20, 14, 0.94);
  border: 1px solid var(--line-strong);
  color: #e2ffec;
  font-size: 12.5px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: 0 0 26px rgba(40, 160, 100, 0.26);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* 터치 기기: 토스트도 조작판 위로 — 하단 HUD 줄 위에 겹치지 않게 */
body.touch-device .toast { bottom: calc(var(--toast-b) + var(--tp-lift)); }

.banner {
  position: absolute;
  left: 0; right: 0;
  top: 30%;
  text-align: center;
  font-size: clamp(26px, 6.4vw, 50px);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #f4fff6;
  text-shadow: 0 0 30px rgba(120, 255, 170, 0.6), 0 0 70px rgba(255, 190, 80, 0.35);
  opacity: 0;
  pointer-events: none;
}
.banner.show { animation: bannerPop 1.9s cubic-bezier(0.2, 0.9, 0.2, 1) forwards; }
@keyframes bannerPop {
  0% { opacity: 0; transform: translateY(16px) scale(0.95); letter-spacing: 0.3em; }
  16% { opacity: 1; transform: translateY(0) scale(1); letter-spacing: 0.06em; }
  74% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-12px) scale(1.02); }
}

/* ---------------- 모바일 터치 조작 ---------------- */
.touchpad {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 9;
  display: flex;
  align-items: flex-end;
  /* 좌우 버튼은 없앴다 — 남은 「점프」 버튼만 오른쪽 아래에 둔다 */
  justify-content: flex-end;
  padding: 0 calc(14px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(14px + var(--safe-left));
  pointer-events: none;
}
.tbtn {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(58px, 16vw, 74px);
  height: clamp(52px, 13vw, 64px);
  border-radius: 16px;
  border: 1px solid rgba(190, 255, 210, 0.3);
  background: linear-gradient(180deg, rgba(18, 38, 28, 0.72), rgba(8, 18, 13, 0.78));
  color: #dfffe9;
  font-family: inherit;
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}
.tbtn:active, .tbtn.on {
  background: linear-gradient(180deg, rgba(255, 190, 90, 0.85), rgba(220, 130, 30, 0.85));
  color: #2a1704;
  border-color: rgba(255, 235, 190, 0.8);
}
.tbtn.jump {
  width: clamp(74px, 21vw, 96px);
  height: clamp(64px, 17vw, 80px);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 200, 100, 0.92), rgba(224, 135, 32, 0.92));
  color: #2a1704;
  border-color: rgba(255, 240, 200, 0.85);
  box-shadow: 0 8px 26px rgba(230, 140, 30, 0.42), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  gap: 0;
}
.tbtn.jump .jp-icon { font-size: 24px; line-height: 1; }
.tbtn.jump .jp-label { font-size: 10.5px; letter-spacing: 0.14em; margin-top: 1px; }

/* ---------------- 오버레이 공통 ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(18px + var(--safe-top)) calc(16px + var(--safe-right)) calc(18px + var(--safe-bottom)) calc(16px + var(--safe-left));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse at 50% 38%, rgba(8, 26, 18, 0.5), rgba(2, 7, 5, 0.88) 68%, rgba(1, 4, 3, 0.95));
  animation: fadeIn 0.24s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.panel {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin: auto;
  padding: clamp(18px, 3.4vw, 28px);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(12, 26, 20, 0.97), rgba(6, 14, 10, 0.98));
  border: 1px solid rgba(150, 230, 175, 0.2);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: panelIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.panel.narrow { max-width: 430px; text-align: center; }
.panel.wide { max-width: 620px; text-align: center; }

.panel-title { margin: 0 0 8px; font-size: clamp(21px, 4.6vw, 27px); letter-spacing: -0.01em; }
.panel-sub { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }

/* ---------------- 타이틀 ---------------- */
.title-screen {
  align-items: flex-start;
  background: linear-gradient(180deg, rgba(2, 8, 5, 0.88) 0%, rgba(2, 8, 5, 0.5) 30%, rgba(2, 8, 5, 0.34) 50%, rgba(2, 8, 5, 0.8) 88%, rgba(2, 8, 5, 0.92) 100%);
}

.title-screen .title-inner {
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}
.title-inner {
  width: 100%;
  max-width: 760px;
  margin: auto 0;
  padding: clamp(10px, 2.4vw, 26px) 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--lime);
  opacity: 0.9;
}

.dino-title {
  margin: 0;
  font-size: clamp(40px, 11vw, 82px);
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: -0.035em;
  color: #fff9ea;
  text-shadow: 0 4px 0 rgba(120, 60, 10, 0.35), 0 0 34px rgba(255, 180, 70, 0.45), 0 14px 44px rgba(0, 0, 0, 0.6);
}
.dino-title span {
  background: linear-gradient(180deg, #ffe6a6 10%, #ffb13d 55%, #e07812 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 160, 50, 0.55));
}
.title-en {
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: clamp(10px, 2vw, 13px);
  font-weight: 700;
  letter-spacing: 0.52em;
  color: #b7d9c3;
  opacity: 0.75;
}
.sub {
  margin: 12px auto 18px;
  max-width: 34em;
  font-size: clamp(12.5px, 2.4vw, 15px);
  line-height: 1.7;
  color: #a9c6b2;
}
.sub b { color: #ffe0a4; }

.settings {
  width: min(430px, 100%);
  margin: 0 auto 16px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 20, 14, 0.66);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
/* 조작법·옵션·전체화면 버튼을 시작 버튼 아래 한 줄에 나란히 */
.title-actions { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.title-actions .btn.small { padding: 9px 16px; font-size: 13px; }
.setting-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.setting-label { font-size: 11.5px; font-weight: 800; letter-spacing: 0.1em; color: var(--muted); }
.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(160, 220, 180, 0.14);
}
.segmented button {
  padding: 7px 15px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a9c4b2;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.segmented button.active {
  background: linear-gradient(180deg, #ffd07a, #e89a2c);
  color: #2a1804;
  box-shadow: 0 4px 14px rgba(230, 150, 40, 0.35);
}
.diff-hint { margin: 0; font-size: 10.5px; line-height: 1.5; color: #8ba796; text-align: center; }

/* ---------------- 학번 · 이름 (입력값은 메모리에만 — 저장하지 않는다) ---------------- */
.student-box {
  width: min(430px, 100%);
  margin: 0 auto 10px;
  padding: 9px 14px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 190, 90, 0.34);
  background: rgba(8, 20, 14, 0.78);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.student-fields { display: flex; gap: 8px; }
.student-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 0; text-align: left; }
.student-field.id { flex: 0 0 42%; }
.student-input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(160, 220, 180, 0.24);
  background: rgba(2, 8, 5, 0.88);
  color: #fff8e6;
  font-family: inherit;
  /* 16px 미만이면 모바일·태블릿에서 포커스할 때 화면이 저절로 확대된다 */
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.student-input::placeholder { color: #6d8677; font-weight: 600; letter-spacing: 0; }
.student-input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255, 180, 76, 0.2); background: rgba(4, 12, 8, 0.96); }
.student-field.id .student-input { font-family: var(--mono); letter-spacing: 0.04em; }
.student-alert { margin: 0; font-size: 11.5px; font-weight: 800; line-height: 1.4; color: #ffc4b8; text-align: center; }

.stage-list { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin: 0 0 16px; }
.stage-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #cfe6d6;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(160, 220, 180, 0.16);
  white-space: nowrap;
}
.stage-chip b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px; height: 17px;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 9.5px;
  color: #07140c;
  background: var(--lime);
}
.stage-chip.s2 b { background: #a8d8ff; }
.stage-chip.s3 b { background: #ffb066; }
.stage-chip.s4 b { background: #ff8464; }

.status { margin: 8px 0 0; font-size: 11px; color: #86a292; letter-spacing: 0.02em; }
.status:empty { display: none; }
.status.best { color: var(--amber-soft); }
.result-hint {
  margin: 14px 0 2px;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

/* 결과 화면 「다시 시작」 — 중간에 잡혔을 때(CAUGHT!)만 보인다 */
.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 0;
}
.result-actions .btn.big { padding: 13px 44px; }
.result-actions + .result-hint { margin-top: 10px; }

/* ---------------- 조작법 (타이틀 다음 화면) ---------------- */
.howto-panel { max-width: 700px; }
.howto-panel .panel-sub { margin-bottom: 14px; }
.howto-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  text-align: left;
}
.howto-block {
  padding: 11px 13px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(150, 225, 175, 0.14);
}
.howto-block.wide { grid-column: 1 / -1; }
.howto-block h3 {
  margin: 0 0 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--lime);
  text-transform: uppercase;
}
.howto-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.howto-list li {
  position: relative;
  padding-left: 13px;
  font-size: 12px;
  line-height: 1.55;
  color: #9db8a6;
}
.howto-list li::before {
  content: '';
  position: absolute;
  left: 1px;
  top: 0.62em;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}
.howto-list b { color: #ffe2ad; }
.howto-panel .stage-list { margin: 2px 0 0; justify-content: flex-start; }
.howto-panel .panel-actions { margin-top: 16px; }

/* ---------------- 스테이지 카드 ---------------- */
.stage-card {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, rgba(6, 18, 12, 0.72), rgba(2, 6, 4, 0.9));
  animation: stageCardIn 0.4s ease-out;
}
@keyframes stageCardIn { from { opacity: 0; } to { opacity: 1; } }
.sc-en {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(10px, 2vw, 13px);
  font-weight: 700;
  letter-spacing: 0.42em;
  color: var(--lime);
  opacity: 0.85;
}
.sc-num {
  font-family: var(--mono);
  font-size: clamp(56px, 15vh, 118px);
  line-height: 1;
  font-weight: 900;
  color: transparent;
  -webkit-text-stroke: 2px rgba(180, 255, 200, 0.7);
  text-shadow: 0 0 44px rgba(90, 240, 140, 0.35);
}
.sc-name {
  margin: 2px 0 0;
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #f6fff8;
  text-shadow: 0 0 30px rgba(120, 255, 160, 0.35);
}
.sc-desc { margin: 6px 0 0; font-size: clamp(11.5px, 2.2vw, 14px); color: #a9c6b2; }

/* ---------------- 퀴즈 ---------------- */
.quiz-panel {
  max-width: 660px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.tag {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #10240f;
  background: linear-gradient(180deg, #d8ff9e, #8fe35a);
  box-shadow: 0 0 18px rgba(140, 240, 90, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62%;
}
.quiz-reason { font-size: 11.5px; color: var(--muted); letter-spacing: 0.04em; white-space: nowrap; }
/* V23 — 재출제 문제 표시(↻ 배지)는 없앴다: 퀴즈 창은 문제·보기·해설만 */
.quiz-gap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  margin-bottom: 9px;
  border-radius: 9px;
  border: 1px solid rgba(140, 230, 170, 0.18);
  background: rgba(120, 240, 160, 0.06);
  font-size: 11.5px;
  color: #9cbca8;
}
.quiz-gap b { font-family: var(--mono); font-size: 13.5px; color: #d8ffe2; }
.quiz-gap.close { border-color: rgba(255, 110, 90, 0.45); background: rgba(255, 70, 50, 0.12); }
.quiz-gap.close b { color: #ff9d8c; }

#quizQuestion {
  margin: 0 0 11px;
  font-size: clamp(18px, 2.9vw, 22px);
  line-height: 1.42;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #f4fff7;
  word-break: keep-all;
  overflow-wrap: anywhere;
  /* 문제 지문의 줄바꿈을 그대로 살린다 — 10번처럼 설명을 다음 줄에 따로 두는 문제용 */
  white-space: pre-line;
}

/* 오클릭 방지 경계 — 0.8초 */
.quiz-guard { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.quiz-guard .qg-track {
  flex: 1 1 auto;
  height: 3px;
  border-radius: 3px;
  background: rgba(150, 230, 175, 0.16);
  overflow: hidden;
}
.quiz-guard .qg-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #6ff0a0, #ffe08a);
  box-shadow: 0 0 12px rgba(150, 250, 170, 0.7);
}
.quiz-guard .qg-label {
  flex: 0 0 auto;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: rgba(200, 240, 210, 0.72);
}
#quiz.locked .quiz-guard .qg-label { color: #ffe3a6; }

.choices { display: grid; grid-template-columns: 1fr; gap: 7px; }
#quiz.locked .choice { opacity: 0.42; filter: saturate(0.5); cursor: default; }
/* 잠금이 풀린 뒤에는 안내 막대를 감춘다 — 오답 재선택 중에도 남지 않게 */
#quiz.released .quiz-guard { display: none; }

.choice {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 52px;
  padding: 12px 15px;
  border-radius: 12px;
  border: 1px solid rgba(150, 225, 175, 0.2);
  background: rgba(255, 255, 255, 0.045);
  color: #e9fbf0;
  font-family: inherit;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.choice:hover:not(:disabled) { background: rgba(150, 240, 180, 0.11); border-color: rgba(180, 255, 205, 0.5); }
.choice .key {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px; height: 25px;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 800;
  color: #cdebd6;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.choice .txt { flex: 1 1 auto; }
.choice:disabled { cursor: default; }
.choice.correct {
  background: rgba(90, 235, 130, 0.2);
  border-color: rgba(150, 255, 180, 0.85);
  box-shadow: 0 0 22px rgba(90, 235, 130, 0.28);
}
.choice.correct .key { background: #74f09a; color: #08240f; border-color: #b6ffcb; }
.choice.wrong {
  background: rgba(255, 85, 65, 0.18);
  border-color: rgba(255, 140, 120, 0.8);
}
.choice.wrong .key { background: #ff7259; color: #2a0a05; border-color: #ffc0b2; }
.choice.dim { opacity: 0.4; }

/* OX 문제(보기 2개) — 보기를 좌우로 나란히 두고 O·X를 크게 보여 준다 */
#quizChoices.choices.two { grid-template-columns: 1fr 1fr; gap: 9px; }
#quizChoices.choices.two .choice { justify-content: center; min-height: 62px; text-align: center; }
#quizChoices.choices.two .choice .txt { flex: 0 1 auto; }
#quizChoices.ox .choice .txt { font-size: 30px; font-weight: 900; line-height: 1.15; letter-spacing: 0.06em; }
#quizChoices.ox .choice.correct .txt { color: #d6ffe2; }
#quizChoices.ox .choice.wrong .txt { color: #ffd9d1; }

#quiz.guard-hit .quiz-panel { animation: guardShake 0.3s ease; }
@keyframes guardShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.feedback { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(150, 225, 175, 0.16); }
.fb-title { font-size: 15.5px; font-weight: 900; margin-bottom: 6px; letter-spacing: 0.01em; }
.fb-title.ok { color: #9dffb8; }
.fb-title.no { color: #ff9d8c; }
.feedback p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.55;
  color: #b6d2c1;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.feedback .btn { width: 100%; }
/* 해설이 없을 때(V35) — 빈 해설 문단을 감춰 빈 박스·여백이 남지 않게 한다 */
.feedback.no-exp p { display: none; }

/* ---------------- 일시정지 / 옵션 ---------------- */
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.mini-stat {
  padding: 9px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(150, 225, 175, 0.14);
}
.mini-stat span { display: block; font-size: 9.5px; letter-spacing: 0.08em; color: var(--muted); }
.mini-stat b { display: block; margin-top: 3px; font-family: var(--mono); font-size: 14px; color: #fff; }

.opt-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 0; }
.opt-row {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(150, 225, 175, 0.12);
}
.opt-label { font-size: 12px; color: #c8dccd; text-align: left; }
.opt-val { font-family: var(--mono); font-size: 11.5px; color: var(--amber-soft); width: 24px; text-align: right; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe1a2, #f0a53a);
  border: 1px solid rgba(255, 250, 230, 0.85);
  box-shadow: 0 0 10px rgba(255, 180, 70, 0.6);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #f5b34a;
  border: 1px solid rgba(255, 250, 230, 0.85);
}
.toggle {
  padding: 6px 13px;
  border-radius: 9px;
  border: 1px solid rgba(160, 220, 180, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: #b8d2c1;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  justify-self: end;
}
.toggle.on {
  background: linear-gradient(180deg, #b6f08a, #6fd150);
  color: #10300c;
  border-color: rgba(220, 255, 200, 0.8);
}

/* ---------------- 엔딩 스토리 ----------------
   탈출 성공 직후, 점수 카드 앞에 짧은 이야기 3컷이 먼저 나온다.
   아래쪽 대화 상자만 덮고 위쪽은 3D 장면(헬기·착륙장)이 그대로 보인다. */
#ending {
  position: fixed;
  inset: 0;
  z-index: 26;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: fadeIn 0.3s ease-out;
}
.ending-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 10, 7, 0.24) 0%, rgba(4, 10, 7, 0.46) 40%, rgba(2, 6, 4, 0.9) 100%);
}
.ending-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0 calc(10px + var(--safe-right)) calc(14px + var(--safe-bottom)) calc(10px + var(--safe-left));
}
.ending-box {
  width: min(720px, 96vw);
  display: flex;
  align-items: flex-start;
  gap: clamp(9px, 1.6vmin, 16px);
  padding: clamp(11px, 1.8vmin, 18px) clamp(12px, 2vmin, 20px);
  background: linear-gradient(180deg, rgba(12, 28, 20, 0.96), rgba(5, 13, 9, 0.98));
  border: 1px solid rgba(150, 230, 175, 0.4);
  border-radius: 16px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.ending-box.in { animation: endingIn 0.24s ease-out; }
@keyframes endingIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ending-portrait {
  flex: 0 0 auto;
  width: clamp(40px, 6.4vmin, 68px);
  height: clamp(40px, 6.4vmin, 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(22px, 4vmin, 38px);
  line-height: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(255, 226, 150, 0.28), rgba(40, 90, 60, 0.25) 70%);
  border: 1px solid rgba(255, 214, 120, 0.45);
  box-shadow: 0 0 22px rgba(120, 220, 150, 0.22) inset;
}
.ending-copy { flex: 1 1 auto; min-width: 0; text-align: left; }
.ending-scene {
  margin: 0 0 4px;
  font-size: clamp(11.5px, 1.8vmin, 15px);
  font-weight: 800;
  color: var(--amber-soft);
  letter-spacing: 0.02em;
}
.ending-line {
  margin: 0;
  font-size: clamp(15px, 2.6vmin, 21px);
  line-height: 1.45;
  color: var(--ink);
  word-break: keep-all;
  text-wrap: pretty;
}
.ending-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: clamp(7px, 1.2vmin, 12px);
}
.ending-dots { display: flex; gap: 5px; align-items: center; }
.ending-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(190, 225, 200, 0.3); }
.ending-dots i.on { background: var(--amber-soft); box-shadow: 0 0 8px rgba(255, 226, 150, 0.75); }
.ending-next {
  padding: 7px 15px;
  border-radius: 999px;
  cursor: pointer;
  font: 800 13px/1 var(--font);
  color: #10230f;
  background: linear-gradient(100deg, #b6f08a, var(--amber-soft));
  border: 0;
  box-shadow: 0 6px 18px rgba(255, 190, 90, 0.28);
}
.ending-next:active { transform: translateY(1px); }
.ending-tap {
  margin: 0;
  font-size: clamp(10px, 1.5vmin, 12px);
  color: rgba(200, 226, 208, 0.62);
}

/* ---------------- 결과 ---------------- */
.result-panel { overflow: visible; }
.result-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 60% 40% at 50% 30%, rgba(255, 190, 90, 0.16), rgba(0, 0, 0, 0) 70%);
}
.result-title {
  margin: 0 0 8px;
  font-size: clamp(26px, 5.6vw, 40px);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: transparent;
  background: linear-gradient(180deg, #fffdf3 8%, #ffe0a1 55%, #f5a63a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 26px rgba(255, 175, 70, 0.45));
}
.result-title.caught {
  /* background 축약형은 background-clip을 초기화하므로 clip을 다시 지정해야 글자가 보인다 */
  background: linear-gradient(180deg, #fff2f0 8%, #ffb0a5 55%, #e5342a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(255, 70, 50, 0.42));
}
.result-title.escape { animation: titleGlow 2.4s ease-in-out infinite; }
@keyframes titleGlow { 0%, 100% { filter: drop-shadow(0 0 22px rgba(255, 175, 70, 0.4)); } 50% { filter: drop-shadow(0 0 36px rgba(255, 200, 100, 0.72)); } }

/* 결과 카드 — 입력한 학번·이름을 가장 크게 */
.result-student {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 10px;
}
.result-student .rs-id { font-family: var(--mono); font-size: clamp(15px, 3.4vw, 20px); font-weight: 800; letter-spacing: 0.03em; color: #b9e6c8; }
.result-student .rs-sep { font-weight: 800; color: rgba(200, 226, 208, 0.5); }
.result-student .rs-name { font-size: clamp(24px, 5.6vw, 34px); font-weight: 900; letter-spacing: -0.01em; color: #fff6da; text-shadow: 0 0 24px rgba(255, 180, 70, 0.5); }
.result-student.caught-name .rs-name { color: #ffe8e2; text-shadow: 0 0 24px rgba(255, 90, 72, 0.42); }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 16px 0 4px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 11px 11px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(150, 225, 175, 0.14);
  text-align: left;
}
.stat-label { font-size: 9.5px; letter-spacing: 0.09em; color: var(--muted); }
.stat b { font-family: var(--mono); font-size: clamp(14px, 3.2vw, 18px); font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.stat.hi b { color: #ffe3a6; }

/* ---------------- 반응형 ---------------- */
@media (max-width: 900px) {
  .hud-card { padding: 8px 10px 9px; border-radius: 12px; }
  .gap-value b { font-size: clamp(21px, 4.4vw, 30px); }
  .stage-name { font-size: 13px; }
}

@media (max-width: 620px) {
  #hud {
    --hud-pb: calc(10px + var(--safe-bottom));
    padding: calc(8px + var(--safe-top)) calc(12px + var(--safe-right)) calc(var(--hud-pb) + var(--tp-lift)) calc(12px + var(--safe-left));
  }
  .hud-top { gap: 7px; }
  .hud-card { padding: 7px 9px 8px; }
  .label { font-size: 9px; letter-spacing: 0.1em; }
  .value.big { font-size: 19px; }
  .stage-name { font-size: 12px; margin: 1px 0 5px; }
  .stage-badge b { font-size: 13px; }
  .gap-value b { font-size: 24px; }
  .sub { font-size: 9px; }
  .gap-track { height: 11px; font-size: 9px; line-height: 11px; }
  .hp-v { font-size: 11px; }
  .speed-block { min-width: 108px; padding: 6px 9px 7px; }
  .hud-actions { gap: 5px; }
  .btn.icon { min-width: 36px; padding: 8px 8px; font-size: 12px; }
  .btn.icon.bgm { min-width: 42px; padding: 8px 7px; font-size: 10px; }
  /* 좁은 화면에서는 HUD 전체화면 버튼을 아이콘만 남긴다 */
  .btn.icon.fs { min-width: 36px; padding: 8px 8px; }
  .btn.icon.fs .fs-txt { display: none; }
  .title-actions { gap: 6px; margin-top: 10px; }
  .title-actions .btn.small { padding: 8px 12px; font-size: 12px; }
  #btnFullscreenTitle.btn.small { padding: 8px 11px; font-size: 12px; }
  .howto-grid { gap: 8px; }
  .howto-block { padding: 9px 10px 10px; }
  .howto-list li { font-size: 11.5px; }
  .panel { border-radius: 16px; }
  .choice { padding: 12px 14px; font-size: 16px; }
  #quizQuestion { font-size: 19px; }
  .toast { font-size: 11.5px; padding: 7px 13px; }
  .warn-banner { top: 24%; }
  .stat-grid { gap: 7px; }
  .stat { padding: 9px 10px; }
  .student-box { padding: 8px 11px 9px; }
  .student-input { padding: 8px 10px; }
  .howto-list li { font-size: 11px; }
}

/* 세로 모드 — HUD는 2줄(스테이지·점수 / 공룡 거리 전체 폭) */
@media (max-width: 560px) and (orientation: portrait) {
  /* 조작법 화면 — 좁은 세로 화면에서는 안내를 한 줄로 길게 펴 읽기 쉽게 */
  .howto-grid { grid-template-columns: minmax(0, 1fr); }
  .howto-block.wide { grid-column: auto; }
  .hud-top {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: 'stage score' 'gap gap';
  }
  .gap-block { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 10px; text-align: left; }
  .gap-block .row { grid-column: 1 / -1; }
  .gap-value { justify-content: flex-start; margin: 0; }
  .gap-value b { font-size: 23px; }
  .bar.gap-bar { height: 8px; }
  .gap-track { display: none; }
  .score-block { text-align: right; }
}

/* 가로 모드 · 낮은 화면 — 모든 패널이 스크롤 없이 한눈에 */
@media (max-height: 560px) and (orientation: landscape) {
  #hud {
    --hud-pb: calc(8px + var(--safe-bottom));
    /* 화면 둥근 모서리·노처에 상단 카드가 물리지 않도록 좌우 여백을 넉넉히 둔다 */
    padding: calc(6px + var(--safe-top)) calc(14px + var(--safe-right)) calc(var(--hud-pb) + var(--tp-lift)) calc(14px + var(--safe-left));
  }
  .hud-top { max-width: 100%; gap: 7px; }
  .hud-card { padding: 4px 8px 5px; border-radius: 9px; }
  .label { font-size: 8px; letter-spacing: 0.06em; }
  .stage-name { font-size: 11px; margin: 0 0 2px; }
  .sub { margin-top: 1px; font-size: 8px; }
  .value.big { font-size: 16px; }
  .gap-value { margin: 0; }
  .gap-value b { font-size: 19px; }
  .gap-value span { font-size: 8.5px; }
  .gap-track { display: none; }
  .bar { height: 6px; }
  .bar.thin { height: 4px; }
  .parts-line { margin-top: 0; }
  .hp-strip { width: min(184px, 44%); padding: 2px 9px 3px; gap: 5px; border-radius: 999px; }
  .hp-k { font-size: 9px; }
  .hp-v { font-size: 10px; min-width: 30px; }
  .hp-bar { height: 4px; }
  .speed-block { min-width: 88px; max-width: 140px; padding: 3px 7px 4px; }
  .speed-num { font-size: 11px; }
  .hud-actions { gap: 4px; }
  .btn.icon { min-width: 33px; padding: 6px 7px; font-size: 11px; border-radius: 9px; }
  .btn.icon.bgm { min-width: 38px; font-size: 9.5px; }
  .btn.icon.fs { min-width: 33px; padding: 6px 7px; }
  .warn-banner { top: 30%; font-size: 12px; padding: 4px 14px; }
  .toast { --toast-b: calc(74px + var(--safe-bottom)); bottom: var(--toast-b); font-size: 11px; padding: 6px 12px; }
  .banner { top: 26%; }
  .atk-text { top: 52%; padding: 7px 18px; font-size: clamp(15px, 3.4vw, 22px); border-radius: 11px; }
  .item-badge { top: 10%; padding: 5px 14px; font-size: clamp(11px, 2.6vw, 14px); }

  .title-inner { padding: 4px 0; }
  /* .eyebrow는 결과 화면(ESCAPE REPORT / CAUGHT!)에서도 쓰인다 */
  .eyebrow { font-size: 9px; margin-bottom: 3px; letter-spacing: 0.3em; }
  .dino-title { font-size: clamp(26px, 7.6vh, 44px); }
  .title-en { display: none; }
  .sub { margin: 5px auto 8px; font-size: 11px; line-height: 1.5; }
  .sub .br-desk { display: none; }
  /* 학번·이름 — 낮은 가로 화면에서는 한 줄로 눕힌다(16px는 그대로 유지) */
  .student-box { width: auto; max-width: 100%; margin: 0 auto 6px; padding: 5px 12px 6px; gap: 4px; }
  .student-fields { gap: 10px; }
  .student-field, .student-field.id { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 6px; }
  .student-field .setting-label { font-size: 10px; white-space: nowrap; }
  .student-input { width: 132px; padding: 5px 9px; }
  .student-alert { font-size: 10.5px; }
  .result-student { margin: 0 0 4px; gap: 6px; }
  .result-student .rs-id { font-size: 13px; }
  .result-student .rs-sep { font-size: 13px; }
  .result-student .rs-name { font-size: 20px; }
  .settings {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    width: auto;
    max-width: 100%;
    margin: 0 auto 8px;
    padding: 7px 12px;
  }
  .setting-row { gap: 8px; }
  .setting-label { font-size: 10px; }
  .title-actions { gap: 6px; margin-top: 8px; }
  .title-actions .btn.small { padding: 6px 12px; font-size: 11.5px; }
  .setting-actions { gap: 6px; }
  #btnFullscreenTitle.btn.small { padding: 6px 10px; font-size: 11px; }
  .segmented button { padding: 5px 11px; font-size: 11px; }
  .diff-hint { display: none; }
  .stage-list { margin-bottom: 8px; gap: 5px; }
  .stage-chip { font-size: 10px; padding: 3px 8px 3px 4px; }
  .stage-chip b { width: 15px; height: 15px; font-size: 8.5px; }
  .btn.big { padding: 10px 34px; font-size: 15px; }
  /* V22 — 낮은 화면에서도 「이어서 하기」가 한 줄에 작게 들어가게 */
  .btn.resume { margin-top: 4px; padding: 6px 16px; font-size: 12px; }
  /* 조작법 화면 — 낮은 가로 화면에서도 네 칸이 한눈에 들어오게 압축하고,
     그래도 모자라면 가운데 안내만 스크롤되며 「← 돌아가기」는 늘 보이게 한다. */
  .panel.howto-panel {
    padding: 7px 12px 8px;
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 36px - var(--safe-top) - var(--safe-bottom));
    overflow: hidden;
  }
  .panel.howto-panel .panel-title { font-size: 16px; margin: 0 0 5px; }
  .howto-panel .panel-sub { display: none; }
  .howto-grid { gap: 5px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
  .howto-block { padding: 6px 8px 7px; border-radius: 9px; }
  .howto-block h3 { margin-bottom: 3px; font-size: 8.5px; }
  .howto-list { gap: 1px; }
  .howto-list li { font-size: 10px; line-height: 1.35; }
  .howto-panel .stage-list { margin-top: 1px; }
  .panel.howto-panel .panel-actions { margin-top: 6px; flex: 0 0 auto; }
  .panel.howto-panel .panel-actions .btn { padding: 5px 20px; font-size: 12px; }
  .result-actions { margin-top: 10px; gap: 8px; }
  .result-actions .btn.big { padding: 9px 30px; font-size: 14px; }
  .result-actions + .result-hint { margin-top: 7px; }
  .status { font-size: 9.5px; margin-top: 4px; }

  .panel { padding: 12px 16px; max-height: calc(100dvh - 36px - var(--safe-top) - var(--safe-bottom)); overflow-y: auto; }
  .panel-title { font-size: 19px; margin-bottom: 5px; }
  .panel-sub { font-size: 11.5px; margin-bottom: 9px; line-height: 1.5; }
  .stat-row { margin-top: 9px; }
  .mini-stat { padding: 6px; }
  .mini-stat b { font-size: 12px; }
  .panel-actions { margin-top: 11px; gap: 7px; }
  .btn { padding: 8px 14px; font-size: 12px; }

  .opt-list { gap: 5px; margin-top: 8px; }
  .opt-row { padding: 5px 9px; grid-template-columns: 1fr 120px auto; }
  .opt-label { font-size: 11px; }
  .toggle { padding: 5px 10px; font-size: 10.5px; }

  .stat-grid { gap: 5px; margin: 6px 0 2px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat { padding: 4px 8px; }
  .stat-label { font-size: 8px; }
  .stat b { font-size: 11.5px; }
  .result-title { font-size: clamp(18px, 5vh, 24px); margin-bottom: 6px; }
  /* 결과 카드 「다시 시작」 줄 — 낮은 화면에서도 카드가 화면 밖으로 나가지 않게 */
  .result-actions { margin-top: 6px; }
  .result-actions .btn.big { padding: 8px 32px; font-size: 14px; }
  .result-actions + .result-hint { margin-top: 4px; }
  .result-hint { font-size: 10.5px; margin-top: 5px; }

  /* 엔딩 스토리 — 낮은 가로 화면에서도 카드가 화면 안에 들어오게 압축 */
  .ending-stage { gap: 4px; padding: 0 calc(8px + var(--safe-right)) calc(7px + var(--safe-bottom)) calc(8px + var(--safe-left)); }
  .ending-box { width: min(820px, 98vw); padding: 8px 12px; border-radius: 13px; gap: 10px; }
  .ending-portrait { width: 40px; height: 40px; font-size: 23px; }
  .ending-scene { font-size: 11.5px; margin-bottom: 2px; }
  .ending-line { font-size: 16px; line-height: 1.38; }
  .ending-foot { margin-top: 5px; }
  .ending-next { padding: 6px 12px; font-size: 12px; }
  .ending-tap { font-size: 10px; }
}

/* 아주 낮은 가로 화면(높이 380px 이하) — 조작법 네 칸이 스크롤 없이 한눈에 */
@media (max-height: 380px) and (orientation: landscape) {
  .panel.howto-panel { padding: 6px 11px 7px; }
  .panel.howto-panel .panel-title { font-size: 15px; margin: 0 0 3px; }
  .howto-grid { gap: 4px; }
  .howto-block { padding: 5px 7px 5px; }
  .howto-block h3 { margin-bottom: 2px; font-size: 8px; }
  .howto-list { gap: 0; }
  .howto-list li { font-size: 9.5px; line-height: 1.3; }
  .howto-panel .stage-list { margin-top: 0; }
  .panel.howto-panel .panel-actions { margin-top: 4px; }
  .panel.howto-panel .panel-actions .btn { padding: 4px 18px; font-size: 11.5px; }
  /* 엔딩 스토리 — 344px 높이에서도 잘림·스크롤 없이 */
  .ending-stage { padding-bottom: calc(5px + var(--safe-bottom)); }
  .ending-box { padding: 7px 11px; }
  .ending-portrait { width: 34px; height: 34px; font-size: 20px; }
  .ending-scene { font-size: 10.5px; }
  .ending-line { font-size: 14.5px; line-height: 1.36; }
  .ending-next { padding: 4px 11px; font-size: 11px; }
  .ending-tap { font-size: 9.5px; }
}

/* 퀴즈 — 낮은 화면(가로모드)에서는 문제·보기 4개·해설이 스크롤 없이 들어오게 2×2
   세로로 긴 목록 대신 보기를 2×2로 놓아 가로 폭을 살리고, 남는 세로 공간을 글자 크기와
   보기 여백에 모두 쓴다. 문제 19px · 보기 16px · 해설 15px · 제목 14.5px (우주전쟁 V16과 같은 선) */
@media (max-height: 540px) {
  #quiz {
    align-items: center;
    padding: calc(4px + var(--safe-top)) calc(8px + var(--safe-right)) calc(4px + var(--safe-bottom)) calc(8px + var(--safe-left));
  }
  #quiz .quiz-panel {
    max-width: 812px;
    max-height: calc(100dvh - 8px - var(--safe-top) - var(--safe-bottom));
    padding: 7px 15px 9px;
    border-radius: 13px;
  }
  .quiz-head { margin-bottom: 5px; gap: 9px; }
  .tag { padding: 2px 10px; font-size: 11px; }
  .quiz-reason { font-size: 10.5px; }
  .quiz-gap { margin-bottom: 5px; padding: 3px 9px; font-size: 10.5px; }
  .quiz-gap b { font-size: 12.5px; }
  #quizQuestion {
    margin: 0 0 6px;
    font-size: 21px;
    line-height: 1.34;
    max-height: 2.75em;
    overflow-y: auto;
  }
  .quiz-guard { margin: 0 0 6px; gap: 8px; }
  .quiz-guard .qg-track { height: 2px; }
  .quiz-guard .qg-label { font-size: 9px; letter-spacing: 0.06em; }
  #quizChoices.choices { grid-template-columns: 1fr 1fr; gap: 7px; }
  /* OX — 좁은 가로 화면에서는 O·X를 한 줄에 나란히, 글자는 조금 줄인다 */
  #quizChoices.choices.two { gap: 7px; }
  #quizChoices.choices.two .choice { min-height: 0; }
  #quizChoices.ox .choice .txt { font-size: 22px; }
  #quiz .choice { min-height: 0; padding: 10px 12px; gap: 9px; border-radius: 9px; font-size: 17px; line-height: 1.3; }
  #quiz .choice .key { width: 23px; height: 23px; border-radius: 7px; font-size: 12px; }
  .feedback { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: center; margin-top: 6px; padding-top: 6px; }
  .fb-title { grid-column: 1 / -1; margin-bottom: 1px; font-size: 15px; line-height: 1.25; }
  .feedback p { grid-column: 1; margin: 0; font-size: 15.5px; line-height: 1.38; max-height: 2.9em; overflow-y: auto; }
  .feedback .btn { grid-column: 2; width: auto; min-width: 138px; padding: 8px 13px; font-size: 13px; }
  /* 해설이 없으면 두 칸을 다 쓰는 한 줄로 — 빈 칸이 남지 않는다 */
  .feedback.no-exp .btn { grid-column: 1 / -1; width: 100%; }
}

@media (hover: none) {
  .btn:hover { box-shadow: none; }
  .choice:hover:not(:disabled) { background: rgba(255, 255, 255, 0.045); border-color: rgba(150, 225, 175, 0.2); }
}

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

/* ============================================================
   저사양 모바일(q-low) — 준비 중 합성 비용이 큰 장식만 끈다
   · 캔버스 CSS 필터: 매 프레임 화면 전체를 한 번 더 처리해야 해서 가장 비싸다
   · backdrop-filter: 유리처럼 뒤를 흐리는 효과 — WebGL 캔버스 위에서는 매 프레임
     다시 계산되므로 저사양 폰에서 끊김의 큰 원인이 된다(같은 색의 반투명 배경으로 대체)
   · mix-blend-mode: 화면 전체 합성 단계가 하나 더 늘어난다
   레이아웃·글자 크기·버튼 위치는 그대로라 터치 겹침 검증에 영향이 없다.
   ============================================================ */
html.q-low canvas#dino-chase { filter: none; }
html.q-low .hud-card,
html.q-low .hp-strip,
html.q-low .speed-block,
html.q-low .tbtn,
html.q-low .panel,
html.q-low .options-panel {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html.q-low .hud-card { background: linear-gradient(180deg, rgba(9, 20, 16, 0.93), rgba(5, 12, 10, 0.96)); }
html.q-low .hp-strip { background: rgba(6, 18, 13, 0.9); }
html.q-low .speed-block { background: linear-gradient(180deg, rgba(9, 20, 16, 0.93), rgba(5, 12, 10, 0.96)); }
html.q-low .tbtn { background: linear-gradient(180deg, rgba(18, 38, 28, 0.94), rgba(8, 18, 13, 0.96)); }
/* 점프 버튼은 하나뿐인 터치 버튼이라 저화질(폰)에서도 눈에 띄게 주황색을 남긴다(블러만 뺀다) */
html.q-low .tbtn.jump { background: linear-gradient(180deg, rgba(255, 200, 100, 0.95), rgba(224, 135, 32, 0.95)); }
html.q-low #speedFx { mix-blend-mode: normal; }
html.q-low .result-title.escape { animation: none; }

/* ============================================================
   보이는 화면(visualViewport)에 HUD·패널 고정
   · 폰에서 두 손가락으로 확대했거나 브라우저가 글자를 키운 상태에서도
     상단 카드·목숨 바·퀴즈 카드가 화면 밖으로 밀려 잘리지 않는다.
   · 확대하지 않은 평소에는 --vv-x/--vv-y = 0, --vv-w/--vv-h = 화면 크기라
     기존 위치·크기와 완전히 같다.
   ============================================================ */
.overlay, #hud, #ending {
  left: var(--vv-x, 0px);
  top: var(--vv-y, 0px);
  right: auto;
  bottom: auto;
  width: var(--vv-w, 100%);
  height: var(--vv-h, 100%);
}
.touchpad {
  left: var(--vv-x, 0px);
  right: auto;
  width: var(--vv-w, 100%);
  bottom: auto;
  top: calc(var(--vv-y, 0px) + var(--vv-h, 100%));
  transform: translateY(-100%);
}

/* ==========================================================================
   [TB-CSS-BLOCK] 모바일 꾹누르기·드래그 차단 (2026-11-22)
   · 조이스틱·버튼을 꾹 누를 때 생기는 텍스트 선택(파란 하이라이트)을 없앤다
   · iOS 길게 누르기 메뉴(-webkit-touch-callout)와 이미지 끌기를 막는다
   · 문서 전체 overscroll(당겨서 새로고침·바운스)과 확대 제스처를 막는다
   · 스크롤이 필요한 모달은 위쪽 .overlay / .panel 규칙의 touch-action: pan-y 유지
   ========================================================================== */
*,
*::before,
*::after {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  overscroll-behavior: none;
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
    /* V33(2026-11-27) — none → manipulation. 구버전 삼성인터넷에서 body 전체 touch-action: none 이
     버튼·입력란의 탭(click)까지 삼켜 터치가 안 먹히는 증상이 있었다.
     두 번 탭 확대는 계속 막히고, 확대 제스처는 캔버스·조이스틱(touch-action: none)과
     두 손가락·gesture* 차단이 맡는다. */
  touch-action: manipulation;
  -ms-touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* 게임 표면(캔버스)과 조이스틱은 손가락 제스처를 브라우저에 넘기지 않는다 */
#scene,
canvas,
#joy,
#joyKnob,
.joy,
.joy-base,
.joy-knob {
  touch-action: none;
  -ms-touch-action: none;
  -webkit-user-drag: none;
}

/* 입력 요소(볼륨 슬라이더·글자 입력)는 손가락 드래그가 살아 있어야 조작된다 */
input,
textarea,
select,
[contenteditable="true"] {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}
