:root {
  --ink: #14161c;
  --paper: #f6f1e3;
  --paper-dark: #e8e0cc;
  --chalk-green: #183a28;
  --omr-red: #d92638;
  --warn-yellow: #ffd23f;
  --cyan: #22e3ff;
  --emerald: #2ee59d;
  --bg-hud: rgba(18, 22, 26, 0.86);
  --border-hud: rgba(255, 255, 255, 0.16);
  --text: #f4f5f7;
  --muted: #a6b0c0;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #12161c;
  color: var(--text);
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, sans-serif;
}

#game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* ========================================================= */
/* FULLSCREEN FX OVERLAYS                                    */
/* ========================================================= */
.overlay-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#vignette-danger {
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, transparent 45%, rgba(255, 24, 52, 0.72) 100%);
  transition: opacity 0.08s linear;
}

#vignette-warn {
  opacity: 0;
  background: linear-gradient(
    to bottom,
    rgba(255, 176, 32, 0.55) 0%,
    rgba(255, 176, 32, 0.14) 22%,
    transparent 45%
  );
  transition: opacity 0.1s linear;
}

/* Tier 3: AR Smart Glasses HUD */
#ar-glasses-hud {
  border: 2px solid rgba(34, 227, 255, 0.25);
  box-shadow: inset 0 0 90px rgba(34, 227, 255, 0.18);
  z-index: 12;
}

.ar-scanline {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(34, 227, 255, 0.04) 0px,
    rgba(34, 227, 255, 0.04) 1px,
    transparent 2px,
    transparent 5px
  );
}

.ar-tag-top {
  position: absolute;
  top: 112px;
  left: 50%;
  transform: translateX(-50%);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--cyan);
  background: rgba(6, 20, 32, 0.72);
  border: 1px solid rgba(34, 227, 255, 0.55);
  padding: 4px 12px;
  border-radius: 4px;
  text-shadow: 0 0 8px rgba(34, 227, 255, 0.7);
}

.ar-reticle {
  position: absolute;
  left: 48%;
  top: 62%;
  width: 300px;
  height: 165px;
  transform: translate(-50%, -50%);
  border: 2px dashed rgba(34, 227, 255, 0.78);
  border-radius: 10px;
  box-shadow: 0 0 28px rgba(34, 227, 255, 0.30), inset 0 0 24px rgba(34, 227, 255, 0.10);
  animation: arPulse 1.4s ease-in-out infinite;
}

.ar-subtitle {
  position: absolute;
  bottom: 72px;
  right: 22px;
  background: rgba(5, 18, 28, 0.88);
  border: 1px solid rgba(34, 227, 255, 0.55);
  color: #ccf7ff;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 6px;
  max-width: 420px;
  text-align: left;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

@keyframes arPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1.0); opacity: 0.85; }
  50% { transform: translate(-50%, -50%) scale(1.03); opacity: 1.0; }
}

/* ========================================================= */
/* GAME TITLE SCREEN — LIVE 3D CLASSROOM + KOREAN ARCADE UI  */
/* ========================================================= */
.title-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
}

/* Left-side atmospheric gradient ONLY — keeps right 60% of 3D classroom crisp & clear! */
.title-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    96deg,
    rgba(13, 18, 20, 0.90) 0%,
    rgba(16, 24, 22, 0.74) 36%,
    rgba(16, 24, 22, 0.18) 64%,
    rgba(16, 24, 22, 0.04) 100%
  );
  pointer-events: none;
}

.title-scan-vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 110px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

/* Top warning tape banner */
.caution-ribbon {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: var(--warn-yellow);
  color: #141414;
  border-bottom: 2px solid #141414;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  z-index: 5;
}

.ribbon-sep {
  color: var(--omr-red);
}

/* Asymmetric Left Game Menu Column */
.title-left {
  position: relative;
  z-index: 4;
  height: 100%;
  width: min(500px, 92vw);
  padding: 54px 36px 28px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.csat-paper-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.tag-form {
  background: var(--ink);
  color: var(--paper);
  padding: 1px 6px;
  font-size: 11px;
}

/* Bold Kinetic Game Title */
.title-logo-lockup {
  display: flex;
  flex-direction: column;
  line-height: 1.02;
  margin-top: 2px;
}

.logo-sub {
  font-size: 32px;
  font-weight: 900;
  color: var(--paper);
  letter-spacing: -0.02em;
  text-shadow: 3px 3px 0 #111, 0 6px 20px rgba(0, 0, 0, 0.55);
}

.logo-main-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.logo-main {
  font-size: 64px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.04em;
  text-shadow: 5px 5px 0 #111, 0 10px 28px rgba(0, 0, 0, 0.65);
}

.logo-ai {
  display: inline-block;
  font-size: 66px;
  font-weight: 900;
  color: var(--warn-yellow);
  background: var(--ink);
  border: 3px solid var(--warn-yellow);
  box-shadow: 6px 6px 0 var(--omr-red);
  padding: 2px 14px 4px;
  transform: rotate(-3deg);
  letter-spacing: -0.03em;
}

.logo-stamp {
  margin-left: 6px;
  border: 3px solid var(--omr-red);
  color: var(--omr-red);
  background: rgba(246, 241, 227, 0.94);
  font-size: 13px;
  font-weight: 900;
  padding: 4px 7px;
  transform: rotate(9deg);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
  letter-spacing: 0.06em;
}

.title-tagline {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: #e4e8ec;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  font-weight: 600;
}

/* Tactile Arcade Start Button */
.game-play-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  align-self: flex-start;
  cursor: pointer;
  background: var(--warn-yellow);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 13px 26px;
  font-family: inherit;
  text-align: left;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.game-play-btn:hover:not(:disabled) {
  transform: translate(3px, -2px);
  box-shadow: 9px 8px 0 var(--omr-red);
  background: #ffe066;
}

.game-play-btn:active:not(:disabled) {
  transform: translate(4px, 4px);
  box-shadow: 2px 2px 0 var(--ink);
}

.game-play-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.game-play-btn.compact {
  font-size: 16px;
  font-weight: 900;
  padding: 13px 24px;
  gap: 8px;
}

.play-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--omr-red);
  color: #fff;
  border: 2px solid var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.play-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.play-label strong {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.play-label small {
  font-size: 12px;
  font-weight: 700;
  color: #363228;
}

/* CSAT OMR-Style Stage Select List */
.stage-select-block {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 2px;
}

.stage-select-label {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--warn-yellow);
  text-transform: uppercase;
  text-shadow: 1px 1px 0 #000;
}

.stage-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.stage-item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  background: rgba(246, 241, 227, 0.94);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.65);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: transform 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
}

.stage-item:hover {
  transform: translateX(7px);
  background: #ffffff;
  box-shadow: 6px 5px 0 var(--omr-red);
}

.omr-bubble {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--omr-red);
  color: var(--omr-red);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  transition: background 0.1s ease, color 0.1s ease;
}

.stage-item:hover .omr-bubble {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.stage-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stage-info strong {
  font-size: 14px;
  font-weight: 900;
}

.stage-info span {
  font-size: 11.5px;
  color: #464a54;
  font-weight: 600;
}

.stage-tier {
  margin-left: auto;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
  background: var(--chalk-green);
  color: var(--paper);
  padding: 3px 7px;
  border: 1.5px solid var(--ink);
}

.title-keys {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #e4e9ef;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Diegetic Paper Admission Ticket (수험표) pinned at bottom-right */
.title-ticket-card {
  position: absolute;
  right: 34px;
  bottom: 28px;
  z-index: 5;
  width: 295px;
  background: var(--paper);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.45);
  transform: rotate(-1.5deg);
  padding: 10px 13px 12px;
}

.paper-tape {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%) rotate(2deg);
  width: 72px;
  height: 18px;
  background: rgba(255, 245, 200, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.14);
}

.tt-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 5px;
  margin-bottom: 9px;
}

.tt-head span {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.25em;
}

.tt-head small {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 800;
  font-size: 12px;
  color: var(--omr-red);
}

.tt-body {
  display: flex;
  gap: 11px;
  align-items: center;
}

.tt-photo {
  width: 58px;
  height: 70px;
  background: #d7e2ec;
  border: 1.5px solid var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 4px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.tt-silhouette {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #2b3445;
  margin-bottom: 4px;
  box-shadow: 0 22px 0 8px #2b3445;
}

.tt-photo span {
  position: relative;
  z-index: 2;
  font-size: 9.5px;
  font-weight: 800;
  color: #fff;
  background: rgba(20, 22, 28, 0.75);
  padding: 1px 5px;
}

.tt-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  min-width: 0;
}

.tt-fields > div {
  display: flex;
  flex-direction: column;
}

.tt-fields span {
  font-size: 10px;
  color: #636873;
  font-weight: 700;
}

.tt-fields strong {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================================= */
/* IN-GAME ALERTS & HUD                                      */
/* ========================================================= */
#top-cue-banner {
  position: fixed;
  top: 122px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  background: var(--warn-yellow);
  color: var(--ink);
  font-weight: 900;
  font-size: 15px;
  pointer-events: none;
}

#top-cue-banner.danger {
  background: var(--omr-red);
  color: #ffffff;
  animation: shakeBanner 0.16s linear infinite;
}

#top-cue-banner.fake {
  background: #2ee59d;
  color: #082317;
}

@keyframes shakeBanner {
  0% { transform: translateX(-50%) translate(0, 0); }
  25% { transform: translateX(-50%) translate(-2px, 1px); }
  50% { transform: translateX(-50%) translate(2px, -1px); }
  75% { transform: translateX(-50%) translate(-1px, -1px); }
  100% { transform: translateX(-50%) translate(0, 0); }
}

/* RF Detector Warning Banner */
#rf-warning-banner {
  position: fixed;
  top: 174px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  background: #26070d;
  border: 2.5px solid #ff3b4e;
  box-shadow: 5px 5px 0 #000, 0 0 32px rgba(255, 59, 78, 0.55);
  pointer-events: none;
}

.rf-pulse-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff3b4e;
  box-shadow: 0 0 14px #ff3b4e;
  animation: blinkFast 0.35s infinite;
}

.rf-title {
  font-size: 15px;
  font-weight: 900;
  color: #ff7a86;
}

.rf-sub {
  font-size: 12.5px;
  color: #ffd7dc;
}

@keyframes blinkFast {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* Main HUD */
#hud {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.hud-card {
  background: var(--bg-hud);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 11px 15px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
}

.hud-ticket {
  position: absolute;
  top: 16px;
  left: 18px;
  min-width: 245px;
}

.ticket-header {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}

.ticket-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-period {
  font-size: 15px;
  font-weight: 900;
  color: #fff;
}

.badge-device {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink);
  background: var(--warn-yellow);
  padding: 2px 7px;
  border-radius: 3px;
}

.ticket-meta {
  margin-top: 6px;
  font-size: 11.5px;
  color: #c2cde0;
}

/* Top Center: Timer + Suspicion */
.hud-center-top {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 300px;
}

.timer-box {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: var(--bg-hud);
  border: 2px solid rgba(255, 255, 255, 0.18);
  padding: 5px 16px;
  border-radius: 6px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45);
}

.timer-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.timer-value {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.04em;
}

.timer-value.urgent {
  color: #ff4757;
}

.suspicion-wrap {
  width: 100%;
  background: var(--bg-hud);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 7px 12px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
}

.suspicion-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 5px;
}

.suspicion-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.suspicion-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2ee59d 0%, #ffb020 55%, #ff2d46 100%);
  transition: width 0.05s linear;
}

/* Top Right: OMR Progress */
.hud-omr {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 245px;
}

.omr-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.omr-top strong {
  font-size: 20px;
  color: var(--emerald);
  font-family: ui-monospace, Consolas, monospace;
}

.omr-track {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.omr-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1ad19c, #ffd23f);
  transition: width 0.08s linear;
}

.omr-footer {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.mini-btn {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.10);
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  color: #fff;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 13px;
}

.mini-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Bottom Left: AI Live Chat Feed */
.ai-feed {
  position: absolute;
  left: 18px;
  bottom: 58px;
  width: 365px;
  border-color: rgba(34, 227, 255, 0.45);
  background: rgba(10, 16, 24, 0.90);
}

.ai-feed-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--cyan);
  margin-bottom: 8px;
}

.ai-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.ai-dot.error {
  background: #ff3b4e;
  box-shadow: 0 0 10px #ff3b4e;
}

.ai-phase-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(34, 227, 255, 0.16);
  color: #bff6ff;
}

.ai-q {
  font-size: 12px;
  color: #b4c2d8;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 9px;
  border-radius: 4px;
  margin-bottom: 7px;
  line-height: 1.4;
}

.ai-a {
  font-size: 13px;
  color: #effcff;
  line-height: 1.48;
  min-height: 38px;
  font-weight: 500;
}

.ai-glitch {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 4px;
  background: rgba(255, 59, 78, 0.24);
  border: 1.5px solid #ff3b4e;
  color: #ffd3d8;
  font-size: 12.5px;
  animation: blinkFast 0.6s infinite;
}

/* Controls Hint Bar */
.hud-controls-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.ctrl-pill {
  background: rgba(16, 19, 24, 0.82);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  padding: 5px 11px;
  border-radius: 4px;
  font-size: 12px;
  color: #dbe4f3;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  box-shadow: 0 2px 0 #000;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
  color: var(--ink);
}

/* ========================================================= */
/* OFFICIAL CSAT PAPER MODALS (UPGRADE / BUSTED / VICTORY)   */
/* ========================================================= */
.modal-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 15, 20, 0.72);
  padding: 20px;
}

.modal-card {
  width: min(650px, 95vw);
  padding: 28px 32px;
  text-align: center;
}

.paper-doc {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.55);
}

.doc-header {
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 0.06em;
  border-bottom: 2.5px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 6px;
}

.doc-subtitle {
  font-size: 13px;
  color: #555b66;
  font-weight: 700;
  margin-bottom: 18px;
}

.upgrade-showcase {
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: left;
  background: #ffffff;
  border: 2px solid var(--ink);
  padding: 16px 20px;
  margin-bottom: 14px;
}

.upg-icon {
  font-size: 46px;
  flex-shrink: 0;
}

.upg-device-name {
  font-size: 19px;
  font-weight: 900;
  color: var(--chalk-green);
  margin-bottom: 6px;
}

.upg-list {
  margin: 0;
  padding-left: 18px;
  color: #252a34;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.6;
}

.upg-warning {
  background: #fff3cc;
  border: 2px solid #d49400;
  color: #5c3d00;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  margin-bottom: 20px;
  line-height: 1.5;
  text-align: left;
}

.busted-reason {
  font-size: 15.5px;
  font-weight: 800;
  color: #9e1522;
  background: #fdeced;
  border: 2px solid #d92638;
  padding: 14px 16px;
  margin-bottom: 18px;
  line-height: 1.55;
}

.doc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.doc-stats > div {
  background: var(--paper-dark);
  border: 1.5px solid var(--ink);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doc-stats span {
  font-size: 11.5px;
  color: #555;
  font-weight: 700;
}

.doc-stats strong {
  font-size: 14px;
  font-weight: 900;
}

.text-red {
  color: var(--omr-red);
}

.stamp-busted, .stamp-pass {
  position: absolute;
  top: 16px;
  right: 20px;
  border: 4px solid var(--omr-red);
  color: var(--omr-red);
  font-weight: 900;
  font-size: 16px;
  padding: 4px 10px;
  transform: rotate(10deg);
  opacity: 0.9;
}

.stamp-pass {
  border-color: #0e7c55;
  color: #0e7c55;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-secondary {
  appearance: none;
  border: 2.5px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  background: #ffffff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  padding: 12px 20px;
  font-family: inherit;
}

.btn-secondary:hover {
  background: var(--paper-dark);
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
  background: #ffffff;
}

.score-table th, .score-table td {
  border: 1.5px solid var(--ink);
  padding: 10px 8px;
  font-size: 14px;
}

.score-table th {
  background: var(--paper-dark);
  font-weight: 900;
}

.grade-1 {
  color: #0b6e4f;
  font-weight: 900;
  font-size: 16px;
}

.grade-s {
  color: var(--omr-red);
  font-weight: 900;
  font-size: 20px;
}

.vic-comment {
  font-size: 14.5px;
  color: #2f3542;
  font-weight: 700;
  margin-bottom: 22px;
}

@media (max-width: 820px) {
  .title-ticket-card {
    display: none;
  }
  .title-left {
    padding: 48px 20px 20px;
  }
  .logo-main, .logo-ai {
    font-size: 48px;
  }
  .doc-stats {
    grid-template-columns: 1fr;
  }
  .ai-feed {
    width: calc(100vw - 36px);
  }
}

/* ========================================================= */
/* TOUCH / MOBILE HUD                                         */
/* ========================================================= */
.touch-controls {
  display: none;
}

html, body {
  overscroll-behavior: none;
}

#game-canvas {
  touch-action: none;
}

@media (pointer: coarse), (max-width: 820px) {
  .hud-controls-bar {
    display: none;
  }

  .touch-controls {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    display: flex;
    gap: 10px;
    pointer-events: none;
  }

  .touch-btn {
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    border: 2.5px solid var(--ink, #101318);
    border-radius: 10px;
    box-shadow: 4px 4px 0 var(--ink, #101318);
    color: var(--ink, #101318);
    cursor: pointer;
  }

  .touch-btn-cheat {
    flex: 1;
    min-height: 74px;
    background: var(--warn-yellow, #ffd53d);
    font-size: 13px;
    font-weight: 800;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
  }

  .touch-btn-cheat strong {
    font-size: 20px;
    font-weight: 900;
  }

  .touch-btn-cheat.active {
    background: #22e3ff;
    transform: translate(3px, 3px);
    box-shadow: 1px 1px 0 var(--ink, #101318);
  }

  .touch-btn-regen {
    width: 88px;
    min-height: 74px;
    background: #fff;
    font-size: 26px;
    font-weight: 900;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  .touch-btn-regen span {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 800;
  }

  .touch-btn-regen:active {
    transform: translate(3px, 3px);
    box-shadow: 1px 1px 0 var(--ink, #101318);
  }

  /* Top: ticket + OMR side by side, timer/suspicion full-width below */
  .hud-ticket {
    top: calc(8px + env(safe-area-inset-top, 0px));
    left: 8px;
    right: auto;
    min-width: 0;
    width: calc(50% - 12px);
    padding: 7px 9px;
  }
  .ticket-header,
  .ticket-meta {
    display: none;
  }
  .badge-period {
    font-size: 14px;
  }
  .badge-device {
    font-size: 10.5px;
  }

  .hud-omr {
    top: calc(8px + env(safe-area-inset-top, 0px));
    right: 8px;
    width: calc(50% - 12px);
    padding: 7px 9px;
  }
  .omr-top {
    font-size: 12px;
    margin-bottom: 4px;
  }
  .omr-top strong {
    font-size: 17px;
  }
  .omr-footer {
    font-size: 11px;
  }

  .hud-center-top {
    top: calc(102px + env(safe-area-inset-top, 0px));
    width: calc(100% - 16px);
    gap: 5px;
  }
  .timer-box {
    padding: 3px 14px;
  }
  .suspicion-wrap {
    width: 100%;
  }

  #top-cue-banner {
    top: calc(196px + env(safe-area-inset-top, 0px));
    width: calc(100% - 20px);
    max-width: 420px;
    padding: 8px 12px;
    font-size: 13.5px;
    line-height: 1.35;
  }
  #rf-warning-banner {
    top: calc(254px + env(safe-area-inset-top, 0px));
    width: calc(100% - 20px);
    max-width: 420px;
  }

  .ai-feed {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: calc(94px + env(safe-area-inset-bottom, 0px));
    padding: 8px 11px;
    font-size: 12.5px;
  }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  .hud-ticket,
  .hud-omr {
    width: 200px;
  }
  .hud-center-top {
    top: 8px;
    width: 220px;
  }
  #top-cue-banner {
    top: 106px;
  }
  #rf-warning-banner {
    top: 154px;
  }
  .touch-controls {
    left: auto;
    right: 10px;
    width: 340px;
  }
  .touch-btn-cheat,
  .touch-btn-regen {
    min-height: 62px;
  }
  .ai-feed {
    right: auto;
    width: calc(100% - 380px);
    bottom: 10px;
  }
}

/* ?clean=1: hide every UI layer so only the 3D scene shows (used for video capture) */
.clean #hud,
.clean #top-cue-banner,
.clean #rf-warning-banner,
.clean #ar-glasses-hud,
.clean #screen-title,
.clean .modal-screen {
  opacity: 0 !important;
  pointer-events: none !important;
}
