/* ============================================================================
 * Clark Cluster BCP 3D Command — User-Friendly Game UI (Android, iOS & Desktop)
 * 3D World Always Front-and-Center • Slim Bottom Game Dock • Big Clear Actions
 * ============================================================================ */
:root {
  --navy: #1B365D;
  --navy-deep: #091426;
  --panel: rgba(11, 22, 42, 0.92);
  --gold: #F59E0B;
  --gold-dark: #D97706;
  --emerald: #10B981;
  --danger: #EF4444;
  --blue: #38BDF8;
  --ink: #F8FAFC;
  --muted: #CBD5E1;
  --line: rgba(148, 163, 184, 0.24);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--navy-deep);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

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

/* ---- FULLSCREEN LIVE 3D CANVAS ---- */
#stageWrap {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #163053 0%, #091426 100%);
}

#sceneCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#sceneCanvas:active { cursor: grabbing; }

#labelsLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}

/* ---- 2ND VIEW: PIXAR-3D CINEMATIC SCENE LAYER ---- */
#pixarLayer {
  position: fixed;
  inset: 0;
  z-index: 12;
  background: #071120;
  overflow: hidden;
  pointer-events: none;
}
#pixarImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform-origin: center;
  animation: pixarKenBurns 18s ease-in-out infinite alternate;
  filter: contrast(1.04) saturate(1.08);
  transition: filter 0.4s ease;
}
#pixarLayer.fx-alert #pixarImg {
  filter: contrast(1.12) saturate(1.22) brightness(0.94);
}
#pixarLayer.fx-shake #pixarImg {
  animation: pixarShake 0.45s ease-in-out 2, pixarKenBurns 18s ease-in-out infinite alternate;
}
#pixarVignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7,17,32,0.52) 0%, rgba(7,17,32,0.06) 28%, rgba(7,17,32,0.12) 66%, rgba(7,17,32,0.72) 100%);
}
#pixarTag {
  position: absolute;
  left: calc(14px + var(--safe-left));
  bottom: calc(18px + var(--safe-bottom));
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(11, 22, 42, 0.85);
  border: 1.5px solid rgba(245, 158, 11, 0.65);
  color: #FEF3C7;
  font-size: 11.5px;
  font-weight: 800;
  backdrop-filter: blur(8px);
}
#pixarCallout {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
  animation: calloutPop 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#pixarCallout.ok { background: linear-gradient(135deg, #10B981, #047857); }
#pixarCallout.warn { background: linear-gradient(135deg, #EF4444, #991B1B); }
#pixarCallout.info { background: linear-gradient(135deg, #F59E0B, #B45309); color: #091426; }

@keyframes pixarKenBurns {
  0% { transform: scale(1.0) translate(0%, 0%); }
  100% { transform: scale(1.09) translate(-1.5%, -1.2%); }
}
@keyframes pixarShake {
  0%, 100% { transform: scale(1.05) translate(0, 0); }
  20% { transform: scale(1.05) translate(-10px, 6px); }
  40% { transform: scale(1.05) translate(10px, -6px); }
  60% { transform: scale(1.05) translate(-8px, -4px); }
  80% { transform: scale(1.05) translate(8px, 4px); }
}

/* ---- FULLSCREEN BACKGROUND CRISIS FX OVERLAY (NEVER BLOCKS CLICKS!) ---- */
#fxOverlay {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
}
#fxCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#fxStrobe {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
}
#fxStrobe.strobe-emergency {
  opacity: 1;
  animation: strobeRedBlue 1.15s infinite;
}
#fxStrobe.strobe-emergency.intense {
  animation: strobeRedBlueIntense 0.45s infinite;
}
#fxStrobe.strobe-fire {
  opacity: 1;
  animation: strobeFireGlow 1.3s infinite;
}
#fxStrobe.strobe-water {
  opacity: 1;
  animation: strobeWaterStorm 2.1s infinite;
}
#fxStrobe.strobe-quake {
  opacity: 1;
  animation: strobeQuakeAmber 1.4s infinite;
}

@keyframes strobeRedBlue {
  0%, 100% { box-shadow: inset 0 0 95px rgba(239, 68, 68, 0.48), inset 0 0 28px rgba(239, 68, 68, 0.35); }
  50% { box-shadow: inset 0 0 95px rgba(59, 130, 246, 0.48), inset 0 0 28px rgba(59, 130, 246, 0.35); }
}
@keyframes strobeRedBlueIntense {
  0%, 100% { box-shadow: inset 0 0 135px rgba(239, 68, 68, 0.78), inset 0 0 42px rgba(239, 68, 68, 0.55); }
  50% { box-shadow: inset 0 0 135px rgba(59, 130, 246, 0.78), inset 0 0 42px rgba(59, 130, 246, 0.55); }
}
@keyframes strobeFireGlow {
  0%, 100% { box-shadow: inset 0 0 110px rgba(239, 68, 68, 0.46), inset 0 -45px 90px rgba(249, 115, 22, 0.45); }
  50% { box-shadow: inset 0 0 80px rgba(245, 158, 11, 0.38), inset 0 -25px 65px rgba(239, 68, 68, 0.32); }
}
@keyframes strobeWaterStorm {
  0%, 100% { box-shadow: inset 0 0 100px rgba(14, 165, 233, 0.38); }
  50% { box-shadow: inset 0 0 125px rgba(56, 189, 248, 0.52); }
}
@keyframes strobeQuakeAmber {
  0%, 100% { box-shadow: inset 0 0 95px rgba(245, 158, 11, 0.44); }
  50% { box-shadow: inset 0 0 120px rgba(239, 68, 68, 0.48); }
}

#fxFlash {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
#fxFlash.flash-explosion.active {
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.96) 0%, rgba(251, 146, 60, 0.88) 42%, rgba(220, 38, 38, 0.65) 100%);
  animation: fxFlashPop 0.65s ease-out forwards;
}
#fxFlash.flash-water.active {
  background: radial-gradient(circle at 50% 45%, rgba(186, 230, 253, 0.62) 0%, rgba(14, 165, 233, 0.35) 60%, transparent 100%);
  animation: fxFlashPop 0.5s ease-out forwards;
}
@keyframes fxFlashPop {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Viewport Shaking (Works on BOTH 3D Map & Pixar-3D View!) */
#stageWrap.fx-shake-soft, #pixarLayer.fx-shake-soft {
  animation: stageShakeSoft 0.14s linear 6;
}
#stageWrap.fx-shake-hard, #pixarLayer.fx-shake-hard {
  animation: stageShakeHard 0.11s linear 10;
}
@keyframes stageShakeSoft {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-6px, 4px); }
  50% { transform: translate(6px, -4px); }
  75% { transform: translate(-4px, -3px); }
}
@keyframes stageShakeHard {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-14px, 8px) rotate(-0.6deg); }
  40% { transform: translate(14px, -9px) rotate(0.6deg); }
  60% { transform: translate(-11px, -6px) rotate(-0.4deg); }
  80% { transform: translate(11px, 7px) rotate(0.4deg); }
}

/* Shouting & Screaming Crisis Speech Bubbles */
#fxShoutLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.fx-shout-bubble {
  position: absolute;
  padding: 7px 13px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  border: 2px solid #fff;
  animation: shoutFloat 2.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.fx-shout-bubble.is-shout {
  background: linear-gradient(135deg, #F59E0B, #B45309);
  color: #091426;
}
.fx-shout-bubble.is-scream {
  background: linear-gradient(135deg, #EF4444, #991B1B);
  color: #FFFFFF;
  font-size: 14.5px;
}
@keyframes shoutFloat {
  0% { opacity: 0; transform: scale(0.55) translateY(14px); }
  14% { opacity: 1; transform: scale(1.06) translateY(0px); }
  78% { opacity: 0.96; transform: scale(1) translateY(-16px); }
  100% { opacity: 0; transform: scale(0.92) translateY(-34px); }
}

/* Toggleable Live Background FX Trigger Strip */
#fxBar {
  position: fixed;
  top: calc(54px + var(--safe-top));
  right: calc(12px + var(--safe-right));
  z-index: 46;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  max-width: min(560px, calc(100% - 24px));
  padding: 6px 8px;
  border-radius: 13px;
  background: rgba(9, 20, 38, 0.94);
  border: 1.5px solid rgba(245, 158, 11, 0.52);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(10px);
}
.fx-chip {
  min-height: 32px;
  padding: 4px 9px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: #F8FAFC;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}
.fx-chip:hover, .fx-chip:active {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.25);
}
.fx-chip.on {
  border-color: #22C55E;
  background: rgba(16, 185, 129, 0.25);
  color: #A7F3D0;
}

/* Guide Card Play Row */
.codex-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.btn-card-play {
  flex: none;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #FBBF24, #D97706);
  color: #091426;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}
.btn-card-play:hover { filter: brightness(1.08); }

/* ---- 3D FLOATING SITE PINS ---- */
.map-pin {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  min-height: 30px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: rgba(11, 22, 42, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #F8FAFC;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.42);
  transition: opacity 0.2s, border-color 0.2s, background 0.2s;
  will-change: transform;
}
.map-pin:hover, .map-pin:active {
  border-color: var(--gold);
  background: rgba(27, 54, 93, 0.96);
}
.pin-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  flex: none;
}
.pin-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  display: none;
}
.pin-badge:not(:empty) { display: inline-block; }

.map-pin.is-hazard {
  border-color: #EF4444;
  background: rgba(127, 29, 29, 0.94);
  animation: pulseRed 1.2s infinite;
}
.map-pin.is-hazard .pin-dot { background: #FCA5A5; }
.map-pin.is-hazard .pin-badge { background: #EF4444; color: #fff; }

.map-pin.is-target {
  border-color: #22C55E;
  background: rgba(6, 78, 59, 0.98);
  animation: pulseGreen 0.95s infinite;
  font-size: 12.5px;
  padding: 7px 12px;
  z-index: 10;
}
.map-pin.is-target .pin-dot { background: #4ADE80; }
.map-pin.is-target .pin-badge { background: #22C55E; color: #052E16; }

.map-pin.is-secured {
  border-color: #10B981;
  background: rgba(15, 42, 40, 0.92);
}
.map-pin.is-secured .pin-dot { background: #34D399; }
.map-pin.is-secured .pin-badge { background: #059669; color: #fff; }

@keyframes pulseRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}
@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.85); }
  50% { box-shadow: 0 0 0 14px rgba(34, 197, 94, 0); }
}

/* ---- 3D FLOATING ACTION CALLOUT BUBBLES ---- */
.callout-bubble {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 16;
  pointer-events: none;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.52);
  border: 2px solid #fff;
  animation: calloutPop 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.callout-bubble.ok {
  background: linear-gradient(135deg, #10B981, #047857);
  color: #FFFFFF;
}
.callout-bubble.warn {
  background: linear-gradient(135deg, #EF4444, #991B1B);
  color: #FFFFFF;
}
.callout-bubble.info {
  background: linear-gradient(135deg, #F59E0B, #B45309);
  color: #091426;
}
@keyframes calloutPop {
  from { opacity: 0; scale: 0.65; }
  to { opacity: 1; scale: 1; }
}

/* Live Scenario Ticker Strip above Bottom Dock */
#liveSceneBanner {
  position: fixed;
  top: calc(96px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(9, 20, 38, 0.86);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #E0F2FE;
  font-size: 11.5px;
  font-weight: 700;
  max-width: calc(100% - 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
#liveSceneBanner.alert {
  border-color: rgba(239, 68, 68, 0.8);
  background: rgba(127, 29, 29, 0.9);
  color: #FEE2E2;
}
#liveSceneBanner.good {
  border-color: rgba(16, 185, 129, 0.8);
  background: rgba(6, 78, 59, 0.92);
  color: #D1FAE5;
}

/* ---- SIMPLE, CLEAN TOP BAR ---- */
#topBar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 48;
  padding: calc(8px + var(--safe-top)) calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: linear-gradient(180deg, rgba(9, 20, 38, 0.88) 0%, rgba(9, 20, 38, 0.45) 75%, transparent 100%);
  pointer-events: none;
}
#topBar > * { pointer-events: auto; }

.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}
.brand-btn:hover { border-color: var(--gold); }
.brand-shield {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--navy-deep);
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 900;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 40px;
  min-width: 40px;
  padding: 0 11px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.pill-btn:hover, .pill-btn:active { border-color: var(--gold); }
.pill-btn.on {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.22);
  color: #FDE68A;
}

/* ---- CLEAN IN-GAME STATUS STRIP (BELOW TOP BAR) ---- */
#gameHud {
  position: fixed;
  top: calc(56px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 28;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(11, 22, 42, 0.9);
  border: 1px solid rgba(245, 158, 11, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12.5px;
  font-weight: 800;
  max-width: calc(100% - 20px);
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.step-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.step-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}
.step-dot.done { background: var(--emerald); }
.step-dot.active { background: var(--gold); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35); }
.hud-sep { color: rgba(255, 255, 255, 0.28); }
.readiness-chip {
  color: #6EE7B7;
}
.readiness-chip.low { color: #FCA5A5; }
.timer-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #BAE6FD;
  font-variant-numeric: tabular-nums;
}
.timer-chip.warn {
  background: rgba(245, 158, 11, 0.25);
  border-color: #F59E0B;
  color: #FDE68A;
}
.timer-chip.urgent {
  background: rgba(239, 68, 68, 0.35);
  border-color: #EF4444;
  color: #FEE2E2;
  animation: pulseRed 0.7s infinite;
}
.rescue-chip {
  color: #93C5FD;
  font-size: 11.5px;
  font-weight: 800;
}
.rescue-chip.good { color: #6EE7B7; }
.rescue-chip.bad { color: #FCA5A5; }

/* Home Timed Drill & Classroom Room Strip */
.home-mode-row {
  display: flex;
  gap: 7px;
  margin-bottom: 9px;
}
.mode-pill {
  flex: none;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.mode-pill.on {
  border-color: #22C55E;
  background: rgba(16, 185, 129, 0.22);
  color: #A7F3D0;
}
.room-mini-input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 6px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(15, 29, 54, 0.96);
  color: #FEF3C7;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  outline: none;
}
.room-mini-input:focus { border-color: var(--gold); }
.home-sub-6 {
  grid-template-columns: repeat(3, 1fr);
}

/* Interactive Emergency Radio & Phone Dialer Keypad */
#dialerBox {
  margin-top: 4px;
  padding: 9px;
  border-radius: 12px;
  background: rgba(7, 15, 30, 0.92);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
}
.dialer-lcd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #041A12;
  border: 1.5px solid #10B981;
  margin-bottom: 8px;
  font-family: ui-monospace, Consolas, monospace;
}
.dialer-badge {
  font-size: 10.5px;
  font-weight: 800;
  color: #6EE7B7;
  letter-spacing: 0.04em;
}
.dialer-digits {
  font-size: 20px;
  font-weight: 900;
  color: #4ADE80;
  letter-spacing: 0.22em;
}
.dialer-bksp {
  min-height: 30px;
  min-width: 34px;
  border-radius: 7px;
  border: 1px solid rgba(110, 231, 183, 0.4);
  background: rgba(16, 185, 129, 0.16);
  color: #A7F3D0;
  font-size: 14px;
  cursor: pointer;
}
.dialer-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.dial-key {
  min-height: 40px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.08s, background 0.12s;
}
.dial-key:hover { border-color: var(--gold); background: rgba(27, 54, 93, 0.85); }
.dial-key:active { transform: scale(0.95); }
.dial-clr { font-size: 12px; color: #FCA5A5; border-color: rgba(239, 68, 68, 0.45); }
.dial-call {
  font-size: 12.5px;
  background: linear-gradient(135deg, #22C55E, #059669);
  border-color: #34D399;
  color: #fff;
}

/* My Dept Mandatory Progress Strip */
#deptProgressBar {
  padding: 9px 12px;
  border-radius: 11px;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.45);
  margin-bottom: 10px;
  font-size: 12px;
  color: #FEF3C7;
}
.dept-bar-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 6px;
}
.dept-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #FBBF24, #10B981);
  transition: width 0.3s ease;
}

/* Live Trainer / Classroom Scoreboard Modal */
.class-controls {
  display: grid;
  gap: 8px;
  margin-bottom: 11px;
}
.class-row {
  display: flex;
  gap: 8px;
}
.class-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.class-status {
  font-size: 11.5px;
  color: #BAE6FD;
  padding: 6px 10px;
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.class-dept-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.cd-bar {
  padding: 6px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  font-size: 11px;
}
.class-board-wrap {
  max-height: 36dvh;
  overflow: auto;
  border-radius: 11px;
  border: 1px solid var(--line);
}
.class-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.class-table th, .class-table td {
  padding: 7px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}
.class-table th {
  position: sticky;
  top: 0;
  background: #132544;
  color: #FDE68A;
  font-size: 11px;
  text-transform: uppercase;
}
.class-table tr:nth-child(even) td { background: rgba(255, 255, 255, 0.025); }

/* ---- TALKING PIXAR-3D IMT PORTRAIT & RADIO WAVEFORM ---- */
#imtPortraitRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 7px;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(27, 54, 93, 0.72), rgba(11, 22, 42, 0.88));
  border: 1px solid rgba(245, 158, 11, 0.48);
}
#imtPortraitImg {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  flex: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.imt-caller-meta { flex: 1; min-width: 0; }
.imt-caller-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.imt-caller-top b { font-size: 12px; color: #FFFFFF; white-space: nowrap; }
.imt-local-tag {
  font-size: 9.5px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.25);
  color: #FDE68A;
  border: 1px solid rgba(245, 158, 11, 0.5);
}
.imt-caller-role { font-size: 10.5px; color: #93C5FD; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-wave {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
  padding: 0 3px;
}
.radio-wave span {
  width: 3px;
  height: 5px;
  border-radius: 2px;
  background: #4ADE80;
  opacity: 0.4;
  transition: height 0.15s;
}
.radio-wave.active span {
  opacity: 1;
  animation: radioBar 0.55s ease-in-out infinite alternate;
}
.radio-wave.active span:nth-child(2) { animation-delay: 0.1s; }
.radio-wave.active span:nth-child(3) { animation-delay: 0.2s; }
.radio-wave.active span:nth-child(4) { animation-delay: 0.3s; }
.radio-wave.active span:nth-child(5) { animation-delay: 0.15s; }
@keyframes radioBar {
  0% { height: 4px; background: #22C55E; }
  100% { height: 17px; background: #FBBF24; }
}
.imt-replay-btn {
  min-width: 30px;
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 13px;
  flex: none;
}
.imt-replay-btn:hover { border-color: var(--gold); background: rgba(245, 158, 11, 0.22); }

/* ---- HANDS-ON INTERACTIVE CRISIS MINI-GAMES (P.A.S.S. / GENSET / MANUAL OR) ---- */
.mg-card {
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(7, 15, 30, 0.94);
  border: 1.5px solid rgba(245, 158, 11, 0.55);
}
.mg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 900;
  color: #BAE6FD;
  margin-bottom: 6px;
}
.mg-status {
  font-size: 11.5px;
  color: #E2E8F0;
  line-height: 1.32;
  margin-bottom: 7px;
}
.mg-flame-bar, .mg-load-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-bottom: 6px;
}
.mg-flame-fill {
  height: 100%;
  background: linear-gradient(90deg, #FACC15, #F97316, #EF4444);
  transition: width 0.25s ease;
}
.mg-flame-visual {
  text-align: center;
  font-size: 24px;
  margin-bottom: 4px;
  letter-spacing: 0.12em;
}
.mg-pass-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.mg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}
.mg-btn b { font-size: 14px; color: #FDE68A; }
.mg-btn span { font-size: 11px; color: #E2E8F0; font-weight: 700; }
.mg-btn:hover { border-color: var(--gold); background: rgba(27, 54, 93, 0.8); }
.mg-btn.done { border-color: #10B981; background: rgba(16, 185, 129, 0.25); }
.mg-btn.err { border-color: #EF4444; background: rgba(239, 68, 68, 0.3); }

.mg-load-fill {
  height: 100%;
  background: linear-gradient(90deg, #22C55E, #10B981);
  transition: width 0.2s ease, background 0.2s ease;
}
.mg-load-fill.over { background: linear-gradient(90deg, #F97316, #EF4444); }
.mg-breaker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}
.mg-breaker {
  text-align: left;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1.5px solid rgba(148, 163, 184, 0.3);
  background: rgba(30, 41, 59, 0.72);
  cursor: pointer;
}
.mg-breaker.on {
  border-color: #22C55E;
  background: rgba(16, 185, 129, 0.22);
}
.mg-breaker .b-name { display: block; font-size: 11px; font-weight: 800; color: #F8FAFC; }
.mg-breaker .b-meta { display: block; font-size: 10px; color: #94A3B8; margin-top: 2px; }
.mg-breaker.on .b-meta b { color: #6EE7B7; }

.mg-or-list { display: grid; gap: 5px; max-height: 215px; overflow-y: auto; }
.mg-or-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  text-align: left;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 11.5px;
  cursor: pointer;
}
.mg-or-row .or-tag { font-size: 10px; color: #93C5FD; margin-top: 1px; }
.mg-or-row .or-flag { font-size: 10px; font-weight: 800; color: #94A3B8; white-space: nowrap; }
.mg-or-row.flagged { border-color: #EF4444; background: rgba(239, 68, 68, 0.22); }
.mg-or-row.flagged .or-flag { color: #FCA5A5; }

/* ---- 3D EXPLORER WEATHER, BLACKOUT & SURPRISE CRISIS BAR ---- */
.weather-sandbox-bar {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 4px;
  border-radius: 13px;
  background: rgba(11, 22, 42, 0.94);
  border: 1px solid rgba(245, 158, 11, 0.45);
  backdrop-filter: blur(10px);
}
.wx-btn {
  flex: none;
  min-height: 34px;
  padding: 5px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: #F8FAFC;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}
.wx-btn.active { border-color: var(--gold); background: rgba(245, 158, 11, 0.24); color: #FEF3C7; }
.wx-btn.wx-genset { border-color: rgba(34, 197, 94, 0.55); color: #86EFAC; }
.wx-btn.wx-surprise {
  border-color: rgba(239, 68, 68, 0.7);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.35), rgba(185, 28, 28, 0.45));
  color: #FEE2E2;
}

/* ---- WELCOME HOME CARD (FLOATS CLEANLY AT BOTTOM SO 3D WORLD SHINES!) ---- */
#homeDock {
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(620px, calc(100% - 20px));
  max-height: calc(100dvh - 76px - var(--safe-top) - var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 35;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(11, 22, 42, 0.92);
  border: 1.5px solid rgba(245, 158, 11, 0.42);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.logo-ribbon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #FFFFFF;
  margin-bottom: 10px;
}
.logo-ribbon img { height: 22px; width: auto; max-width: 92px; object-fit: contain; }
.logo-ribbon img.round { height: 24px; width: 24px; border-radius: 50%; }

.home-title {
  margin: 0;
  font-size: clamp(18px, 4vw, 23px);
  font-weight: 900;
  text-align: center;
  letter-spacing: -0.02em;
}
.home-sub {
  margin: 3px 0 10px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.how-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.how-step {
  padding: 7px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  color: #E2E8F0;
}
.how-step b { display: block; color: var(--gold); font-size: 12px; margin-bottom: 1px; }

.name-input, .dept-select {
  width: 100%;
  min-height: 42px;
  padding: 8px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(15, 29, 54, 0.96);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  outline: none;
  margin-bottom: 8px;
}
.name-input:focus, .dept-select:focus { border-color: var(--gold); }

/* Point-and-Click Toolbelt in Free 3D Map Mode */
.toolbelt {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 4px;
  border-radius: 14px;
  background: rgba(11, 22, 42, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.4);
  backdrop-filter: blur(10px);
}
.tool-btn {
  flex: none;
  min-height: 36px;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}
.tool-btn.active {
  border-color: #38BDF8;
  background: rgba(56, 189, 248, 0.22);
  color: #E0F2FE;
}

.mini-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94A3B8;
  margin: 0 0 6px;
}

.role-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
}
.role-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.role-pill.active {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.22);
  color: #FEF3C7;
}

/* 4-Property Area Selector (Hotel, The Crib, Golf & Restaurants) */
.area-pills {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-bottom: 6px;
}
.area-pills-modal {
  margin-bottom: 10px;
}
.area-pill {
  min-height: 38px;
  padding: 5px 6px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: #E2E8F0;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  transition: border-color 0.14s, background 0.14s;
}
.area-pill:hover { border-color: #38BDF8; background: rgba(56, 189, 248, 0.16); }
.area-pill.active {
  border-color: #38BDF8;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.35), rgba(27, 54, 93, 0.92));
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.28);
}
.area-info-strip {
  padding: 6px 10px;
  border-radius: 9px;
  background: rgba(14, 165, 233, 0.13);
  border-left: 3px solid #38BDF8;
  color: #BAE6FD;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.32;
  margin-bottom: 9px;
}
@media (max-width: 640px) {
  .area-pills {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .area-pill { flex: none; padding: 6px 10px; }
}

/* BIG CLEAR PRIMARY PLAY BUTTON */
.btn-play-big {
  width: 100%;
  min-height: 52px;
  padding: 12px 18px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #FBBF24 0%, #D97706 100%);
  color: #091426;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(245, 158, 11, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s, filter 0.15s;
}
.btn-play-big:hover { filter: brightness(1.06); }
.btn-play-big:active { transform: scale(0.98); }

.home-sub-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 9px;
}
.btn-soft {
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: #F1F5F9;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.btn-soft:hover, .btn-soft:active { border-color: var(--gold); background: rgba(27, 54, 93, 0.7); }

/* ---- SLIM COMPACT GAMEPLAY DOCK (NEVER BLOCKS 3D ACTION!) ---- */
#playDock {
  position: fixed;
  right: calc(14px + var(--safe-right));
  bottom: calc(14px + var(--safe-bottom));
  left: auto;
  transform: none;
  width: min(355px, calc(100% - 20px));
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 32;
  padding: 11px 13px;
  border-radius: 16px;
  background: rgba(11, 22, 42, 0.91);
  border: 1.5px solid rgba(245, 158, 11, 0.5);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: width 0.22s ease, padding 0.2s ease;
}
#playDock.map-mode {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 20px));
  background: rgba(6, 44, 34, 0.93);
  border: 2px solid #22C55E;
  padding: 10px 14px;
}
/* Auto-collapsed "Watch the 3D Action!" compact bar right after answering! */
#playDock.watching-action {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 20px));
  padding: 9px 13px;
  max-height: none;
}
#playDock.watching-action .dock-question,
#playDock.watching-action .tip-strip,
#playDock.watching-action .choice-list,
#playDock.watching-action #dialerBox,
#playDock.watching-action #minigameBox {
  display: none !important;
}
#playDock.watching-action .fb-banner {
  margin-top: 2px;
  padding: 8px 11px;
  font-size: 12.5px;
}
#playDock.watching-action .dock-actions {
  margin-top: 8px;
}
#playDock.minimized .dock-question,
#playDock.minimized .tip-strip,
#playDock.minimized .choice-list,
#playDock.minimized #dialerBox,
#playDock.minimized #minigameBox,
#playDock.minimized #imtPortraitRow,
#playDock.minimized .fb-banner,
#playDock.minimized .dock-actions {
  display: none !important;
}
#playDock.minimized {
  width: auto;
  padding: 8px 12px;
}

.dock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 5px;
}
.stage-tag {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
}
#playDock.map-mode .stage-tag { color: #4ADE80; }

.dock-question {
  margin: 0 0 7px;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.32;
  color: #FFFFFF;
}

.tip-strip {
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.13);
  border-left: 3px solid var(--gold);
  font-size: 11.5px;
  color: #FDE68A;
  margin-bottom: 7px;
  line-height: 1.32;
}

.choice-list {
  display: grid;
  gap: 6px;
}
.choice-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  min-height: 44px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, transform 0.1s;
}
.choice-btn:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(27, 54, 93, 0.72);
}
.choice-btn:active:not(:disabled) { transform: scale(0.99); }
.choice-btn .c-head {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  color: #FFFFFF;
}
.choice-btn .c-sub {
  display: block;
  font-size: 11px;
  color: #CBD5E1;
  margin-top: 2px;
  line-height: 1.3;
}
.choice-btn.correct {
  border-color: #10B981;
  background: rgba(16, 185, 129, 0.22);
}
.choice-btn.wrong {
  border-color: #EF4444;
  background: rgba(239, 68, 68, 0.22);
}
.choice-btn:disabled { cursor: default; }

.fb-banner {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 13px;
  line-height: 1.4;
}
.fb-banner.ok {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.55);
  color: #D1FAE5;
}
.fb-banner.bad {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.55);
  color: #FEE2E2;
}

.dock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}
.btn-gold { background: linear-gradient(135deg, #FBBF24, #D97706); color: #091426; }
.btn-green { background: linear-gradient(135deg, #22C55E, #059669); color: #fff; }
.btn-ghost { background: rgba(255, 255, 255, 0.08); border-color: var(--line); color: #F8FAFC; }

/* ---- FREE 3D EXPLORER: 1-TAP SITE JUMP BAR + SITE SHEET ---- */
#exploreDock {
  position: fixed;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(680px, calc(100% - 20px));
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
#exploreDock > * { pointer-events: auto; }

.site-jump-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px;
}
.jump-pill {
  flex: none;
  min-height: 38px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: rgba(11, 22, 42, 0.9);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.jump-pill.active {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.24);
  color: #FEF3C7;
}

.site-card {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(11, 22, 42, 0.94);
  border: 1.5px solid var(--gold);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  max-height: 40dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#toolContextHint {
  padding: 6px 12px;
  border-radius: 11px;
  background: rgba(11, 22, 42, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #E0F2FE;
  font-size: 11.5px;
  line-height: 1.35;
  backdrop-filter: blur(8px);
}
#toolContextHint b { color: #FDE68A; }
.site-sub {
  font-size: 11px;
  color: #93C5FD;
  font-weight: 700;
}
.site-kv {
  margin: 4px 0;
  font-size: 11.8px;
  line-height: 1.38;
  color: #E2E8F0;
}
.site-kv b { color: #FCD34D; }
.site-quick-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}
.site-card-pill {
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.65);
  background: rgba(245, 158, 11, 0.16);
  color: #FEF3C7;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}
.site-card-pill:hover, .site-card-pill:active {
  background: linear-gradient(135deg, #FBBF24, #D97706);
  color: #091426;
}

/* ---- CLEAN MODALS (ALL 6 MISSIONS / GUIDE & CODEX / AAR / PHONE QR) ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) calc(12px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(12px + var(--safe-left));
  background: rgba(5, 12, 24, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-sheet {
  width: min(680px, 100%);
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px;
  border-radius: 18px;
  background: #0D1B33;
  border: 1.5px solid rgba(148, 163, 184, 0.3);
  box-shadow: 0 24px 68px rgba(0, 0, 0, 0.72);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.modal-head h2 { margin: 0; font-size: 18px; }

.mission-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 9px;
  max-height: 62dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.m-item {
  text-align: left;
  padding: 12px 13px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}
.m-item:hover { border-color: var(--gold); background: rgba(27, 54, 93, 0.6); }
.m-item h4 { margin: 4px 0 3px; font-size: 14.5px; color: #fff; }
.m-item p { margin: 0; font-size: 12px; color: #CBD5E1; line-height: 1.35; }
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.chip-gold { background: rgba(245, 158, 11, 0.22); color: #FDE68A; }
.chip-green { background: rgba(16, 185, 129, 0.22); color: #6EE7B7; }
.chip-red { background: rgba(239, 68, 68, 0.22); color: #FCA5A5; }

/* Guide / Codex Tabs */
.tab-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.tab-btn {
  flex: none;
  min-height: 36px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.tab-btn.active { background: var(--gold); color: #091426; border-color: var(--gold); }

.codex-list { display: grid; gap: 8px; max-height: 54dvh; overflow-y: auto; }
.codex-item {
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.42;
}
.codex-item h5 { margin: 0 0 4px; font-size: 13.5px; color: #FDE68A; }

/* AAR */
.grade-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(27, 54, 93, 0.9), rgba(15, 118, 110, 0.45));
  border: 1px solid rgba(245, 158, 11, 0.5);
  margin-bottom: 12px;
}
.grade-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FBBF24, #D97706);
  color: #091426;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 900;
  flex: none;
}
.pillar-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.p-mini {
  padding: 7px 6px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
  font-size: 11px;
}
.p-mini b { display: block; font-size: 15px; color: #FDE68A; }

.aar-log { display: grid; gap: 6px; max-height: 190px; overflow-y: auto; margin-bottom: 12px; }
.aar-row {
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--emerald);
  font-size: 12px;
}
.aar-row.miss { border-left-color: var(--danger); }

/* QR */
.qr-box {
  display: grid;
  place-items: center;
  padding: 14px;
  border-radius: 14px;
  background: #fff;
  width: fit-content;
  margin: 10px auto;
}
.qr-url {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  text-align: center;
  color: #BAE6FD;
  word-break: break-all;
}

/* Printable Docs: Certificate / Master HR Transcript / A4 BOH QR Poster */
#printCertificate, #printTranscript, #printPoster { display: none; }
@media print {
  body * { visibility: hidden !important; }
  body.print-mode-cert #printCertificate, body.print-mode-cert #printCertificate *,
  body:not(.print-mode-transcript):not(.print-mode-poster) #printCertificate,
  body:not(.print-mode-transcript):not(.print-mode-poster) #printCertificate * {
    visibility: visible !important;
  }
  body.print-mode-cert #printCertificate,
  body:not(.print-mode-transcript):not(.print-mode-poster) #printCertificate {
    display: block !important;
    position: fixed;
    inset: 0;
    background: #fff !important;
    color: #0F172A !important;
    padding: 36px;
    border: 10px double #1B365D;
  }
  body.print-mode-transcript #printTranscript, body.print-mode-transcript #printTranscript * {
    visibility: visible !important;
  }
  body.print-mode-transcript #printTranscript {
    display: block !important;
    position: fixed;
    inset: 0;
    background: #fff !important;
    color: #0F172A !important;
    padding: 24px 28px;
  }
  body.print-mode-transcript #printTranscript td {
    padding: 6px 7px;
    border-bottom: 1px solid #E2E8F0;
  }
  body.print-mode-poster #printPoster, body.print-mode-poster #printPoster * {
    visibility: visible !important;
  }
  body.print-mode-poster #printPoster {
    display: block !important;
    position: fixed;
    inset: 0;
    background: #fff !important;
    color: #0F172A !important;
    padding: 20px;
    border: 8px solid #1B365D;
  }
}

/* Home Kiosk Row + AED & Room Sweep Mini-Games */
.name-kiosk-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}
.kiosk-btn {
  flex: none;
  min-height: 42px;
  padding: 6px 10px;
  border-radius: 11px;
  border: 1px solid rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.16);
  color: #FEF3C7;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.kiosk-btn:hover { background: rgba(245, 158, 11, 0.28); }
.kiosk-switch { border-color: rgba(56, 189, 248, 0.55); background: rgba(56, 189, 248, 0.14); color: #BAE6FD; }
.kiosk-panel {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}
.mg-aed-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.mg-aed-fill {
  height: 100%;
  background: linear-gradient(90deg, #EF4444, #F59E0B, #22C55E);
  transition: width 0.25s ease;
}
.mg-room-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px; }
.mg-room {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 5px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}
.mg-room b { font-size: 12px; color: #FFFFFF; }
.mg-room span { font-size: 10px; color: #BAE6FD; font-weight: 800; margin-top: 2px; }
.mg-room.hot { border-color: #EF4444; background: rgba(239, 68, 68, 0.22); }
.mg-room.hot span { color: #FCA5A5; }
.mg-room.sel { border-color: #FBBF24; box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.4); }
.mg-room.cleared { border-color: #10B981; background: rgba(16, 185, 129, 0.22); opacity: 0.9; }
.mg-room.cleared span { color: #6EE7B7; }
.mg-room-action {
  padding: 8px;
  border-radius: 9px;
  background: rgba(15, 29, 54, 0.96);
  border: 1px solid var(--gold);
}

/* ---- MOBILE PORTRAIT TWEAKS ---- */
@media (max-width: 640px) {
  #topBar { padding: calc(6px + var(--safe-top)) 8px 6px 8px; }
  .brand-btn { padding: 4px 8px; font-size: 11.5px; min-height: 38px; }
  .pill-btn { padding: 0 8px; min-width: 36px; min-height: 38px; font-size: 12px; }
  .pill-btn span.txt { display: none; }
  #gameHud { top: calc(50px + var(--safe-top)); font-size: 11.5px; padding: 5px 11px; gap: 7px; }
  #homeDock { padding: 13px 14px; width: calc(100% - 16px); }
  .home-sub-actions { grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
  .btn-soft { font-size: 11px; padding: 7px 5px; }
  #playDock {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    padding: 9px 11px;
    width: calc(100% - 14px);
    max-height: 41dvh;
  }
  .dock-question { font-size: 13px; margin-bottom: 5px; }
  .choice-btn { padding: 7px 9px; min-height: 40px; }
  .choice-btn .c-head { font-size: 12px; }
  .choice-btn .c-sub { font-size: 10.5px; }
  .map-pin { font-size: 10px; padding: 4px 7px; }
}
