/* =========================================================
   JAGA MALAM — Nightmare Edition (Desktop + Fullscreen Mobile)
   ========================================================= */

:root {
  --bg-void: #030407;
  --panel-bg: rgba(10, 13, 20, 0.88);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #edf2fa;
  --dim: #8a97b0;
  --red: #ef4444;
  --green: #22c55e;
  --cyan: #38bdf8;
  --amber: #f59e0b;
  --phone-bg: #07090e;
  --surface: #121620;
  --surface-2: #1a2130;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html, body {
  height: 100%;
  background: var(--bg-void);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* =========================================================
   DARK BEDROOM BACKDROP + LIGHTNING + WINDOW SILHOUETTE
   ========================================================= */
.room-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 45%, #111623 0%, #05060a 60%, #010204 100%);
}

.lightning-flash {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: radial-gradient(circle at 78% 22%, rgba(205, 228, 255, 0.85), rgba(90, 135, 200, 0.25) 55%, transparent 100%);
  opacity: 0;
  transition: opacity 0.08s;
}
.lightning-flash.strike { opacity: 1; }

.bedroom-window {
  position: absolute;
  right: 4%;
  top: 8%;
  width: 240px;
  height: 320px;
  border: 6px solid #0b0e14;
  background: rgba(15, 25, 42, 0.25);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  opacity: 0.22;
  overflow: hidden;
  transition: opacity 0.12s;
}
.bedroom-window.lit { opacity: 0.92; background: rgba(140, 185, 240, 0.32); }
.win-pane { border: 2px solid rgba(255, 255, 255, 0.05); }

.window-shadow-fig {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 220px;
  background: radial-gradient(ellipse at 50% 22%, #020305 34%, transparent 36%),
              radial-gradient(ellipse at 50% 95%, #020305 56%, transparent 58%);
  filter: blur(1px);
}
.window-shadow-fig::before,
.window-shadow-fig::after {
  content: "";
  position: absolute;
  top: 44px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f8fafc;
  box-shadow: 0 0 8px #ef4444;
}
.window-shadow-fig::before { left: 40px; }
.window-shadow-fig::after { right: 40px; }

.bedroom-door-fx {
  position: absolute;
  left: 3%;
  top: 12%;
  width: 180px;
  height: 440px;
  border: 5px solid #0d0f15;
  background: linear-gradient(180deg, #090b10, #050608);
  opacity: 0.4;
}
.bedroom-door-fx.banging {
  animation: doorBang 0.14s linear infinite;
  border-color: rgba(239, 68, 68, 0.55);
  opacity: 0.9;
}
@keyframes doorBang {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(7px) rotate(0.6deg); }
  75% { transform: translateX(-5px) rotate(-0.5deg); }
}
.door-knob {
  position: absolute;
  right: 16px;
  top: 52%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #272e3d;
}
.door-crack {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(239, 68, 68, 0.25);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.35);
}

.room-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 25%, rgba(0, 0, 0, 0.88) 100%);
}
.room-blackout-layer { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.93); z-index: 2; }
.room-danger-pulse {
  position: absolute;
  inset: 0;
  z-index: 3;
  box-shadow: inset 0 0 140px rgba(220, 38, 38, 0.62);
  animation: dangerPulse 0.75s ease-in-out infinite alternate;
}
@keyframes dangerPulse { from { opacity: 0.3; } to { opacity: 1; } }

.rain-fx {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image: repeating-linear-gradient(108deg, transparent 0 14px, rgba(180, 210, 255, 0.25) 14px 15px);
  animation: rainFall 0.42s linear infinite;
}
@keyframes rainFall { from { background-position: 0 0; } to { background-position: -30px 90px; } }

/* Jumpscare Layer */
.jumpscare-layer {
  position: fixed;
  inset: 0;
  z-index: 350;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.jumpscare-layer img {
  width: 100vw;
  height: 100dvh;
  object-fit: cover;
  filter: contrast(1.48) brightness(1.1);
  animation: scareViolent 0.07s linear infinite;
}
@keyframes scareViolent {
  0% { transform: scale(1.1) translate(-14px, -10px) rotate(-1.6deg); }
  25% { transform: scale(1.24) translate(16px, 12px) rotate(2deg); }
  50% { transform: scale(1.16) translate(-12px, 14px) rotate(-1.2deg); }
  75% { transform: scale(1.28) translate(12px, -14px) rotate(1.6deg); }
  100% { transform: scale(1.12) translate(0, 0); }
}
.jumpscare-flash {
  position: absolute;
  inset: 0;
  background: rgba(239, 68, 68, 0.38);
  mix-blend-mode: overlay;
  animation: flashStrobe 0.09s steps(2) infinite;
}
@keyframes flashStrobe { 0% { opacity: 0.08; } 50% { opacity: 0.92; } 100% { opacity: 0.08; } }
.jumpscare-caption {
  position: absolute;
  bottom: 10%;
  font-family: var(--mono);
  font-size: clamp(20px, 5vw, 30px);
  font-weight: 900;
  letter-spacing: 6px;
  color: #ef4444;
  text-shadow: 0 0 24px #000, 0 0 18px #ef4444;
  text-align: center;
  padding: 0 16px;
}

/* Title Overlay */
.title-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: radial-gradient(circle at 50% 25%, rgba(32, 9, 14, 0.94), rgba(3, 4, 7, 0.99));
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.title-card {
  width: 100%;
  max-width: 650px;
  background: rgba(11, 14, 22, 0.96);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 22px;
  padding: 24px 22px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.9), 0 0 55px rgba(153, 27, 27, 0.22);
  text-align: center;
}
.title-warn {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.game-logo { font-size: clamp(32px, 7vw, 46px); font-weight: 900; letter-spacing: 4px; line-height: 1; }
.game-logo span { color: var(--red); margin-left: 8px; text-shadow: 0 0 28px rgba(239, 68, 68, 0.6); }
.game-tagline { margin: 12px auto 18px; max-width: 550px; font-size: 13px; line-height: 1.55; color: var(--dim); }
.selector-label { font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: var(--dim); margin-bottom: 8px; text-align: left; }

.night-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.night-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 9px 6px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.night-chip:hover { background: rgba(255, 255, 255, 0.1); }
.night-chip.selected { background: rgba(220, 38, 38, 0.26); border-color: var(--red); box-shadow: 0 0 18px rgba(239, 68, 68, 0.28); }
.night-chip strong { display: block; font-size: 12px; }
.night-chip small { display: block; font-size: 9.5px; color: var(--dim); margin-top: 2px; }

.custom-night-box {
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  text-align: left;
}
.slider-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; font-size: 12px; }
.slider-row input { width: 52%; accent-color: var(--red); }

.title-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.start-btn {
  flex: 1 1 200px;
  padding: 13px 18px;
  border-radius: 14px;
  border: 1px solid rgba(248, 113, 113, 0.5);
  background: linear-gradient(135deg, #dc2626, #881337);
  color: #fff;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 1.4px;
  cursor: pointer;
}
.start-btn:hover { box-shadow: 0 10px 28px rgba(220, 38, 38, 0.45); }
.ghost-btn {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.ghost-btn:hover { background: rgba(255, 255, 255, 0.12); }

.title-stats-row {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
  color: var(--dim);
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.title-stats-row strong { color: var(--text); }

/* =========================================================
   DESKTOP 3-COLUMN WORKSPACE
   ========================================================= */
.workspace {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  max-width: 1350px;
  margin: 0 auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 300px minmax(365px, 405px) 320px;
  gap: 22px;
  align-items: center;
  justify-content: center;
}

.desk-panel { display: flex; flex-direction: column; gap: 14px; }
.panel-box {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 16px;
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}
.panel-tag { font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: var(--red); margin-bottom: 8px; }
.hud-night-title { font-size: 23px; font-weight: 900; }
.hud-night-sub { font-size: 12px; color: var(--dim); margin-top: 2px; }
.clock-progress-wrap {
  margin: 12px 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 12px;
  text-align: center;
}
.clock-big { font-family: var(--mono); font-size: 34px; font-weight: 800; letter-spacing: 3px; }
.progress-track { margin-top: 7px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #ef4444, #f59e0b); transition: width 0.3s linear; }

.status-meters { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.meter-row { display: flex; justify-content: space-between; align-items: center; }
.meter-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.09); overflow: hidden; margin-bottom: 3px; }
.meter-fill { height: 100%; transition: width 0.25s; }
.meter-fill.green { background: #22c55e; }
.meter-fill.amber { background: #f59e0b; }
.meter-fill.red { background: #ef4444; }
.state-open { color: var(--amber); }
.state-locked { color: #4ade80; }
.state-ok { color: #38bdf8; }
.state-err { color: var(--red); }

.quick-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.q-btn {
  padding: 9px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.q-btn:hover { background: rgba(255, 255, 255, 0.12); }
.q-btn.danger { border-color: rgba(239, 68, 68, 0.38); color: #fecaca; }
.shortcut-hint { margin-top: 10px; font-size: 11px; line-height: 1.5; color: var(--dim); }
.shortcut-hint code { background: rgba(255, 255, 255, 0.1); padding: 1px 5px; border-radius: 4px; color: #fff; font-family: var(--mono); }

.sensor-box { display: flex; flex-direction: column; height: 400px; }
.sensor-desc { font-size: 11px; color: var(--dim); margin-bottom: 9px; }
.sound-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding-right: 4px; }
.log-entry { font-size: 11.5px; line-height: 1.45; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border-left: 3px solid var(--cyan); }
.log-entry.dim { color: var(--dim); border-left-color: #475569; }
.log-entry.warn { background: rgba(245, 158, 11, 0.13); border-left-color: var(--amber); color: #fde68a; }
.log-entry.danger { background: rgba(220, 38, 38, 0.2); border-left-color: var(--red); color: #fecaca; font-weight: 600; }

.threat-brief { display: flex; flex-direction: column; gap: 7px; font-size: 11.5px; line-height: 1.4; color: #d6dfee; }
.threat-pill { background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; padding: 7px 9px; }
.threat-pill strong { display: block; color: #fca5a5; margin-bottom: 2px; }

/* =========================================================
   SMARTPHONE HARDWARE FRAME (DESKTOP)
   ========================================================= */
.phone-stage { display: flex; flex-direction: column; align-items: center; width: 100%; }
.phone-device {
  position: relative;
  width: 392px;
  height: 775px;
  max-height: calc(100dvh - 28px);
  border-radius: 48px;
  background: linear-gradient(145deg, #2b3140, #10131a 50%, #202532);
  padding: 11px;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.88), 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.phone-device.shake { animation: shakePhone 0.34s ease-in-out; }
@keyframes shakePhone {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-1deg); }
  45% { transform: translateX(8px) rotate(1deg); }
  70% { transform: translateX(-4px); }
}

.hw-btn { position: absolute; background: #202530; border-radius: 3px; }
.hw-vol-1 { width: 4px; height: 44px; left: -3px; top: 138px; }
.hw-vol-2 { width: 4px; height: 44px; left: -3px; top: 194px; }
.hw-power { width: 5px; height: 68px; right: -4px; top: 168px; cursor: pointer; background: #3b4458; }
.hw-power:hover { background: #ef4444; }

.phone-bezel { width: 100%; height: 100%; border-radius: 38px; background: #000; padding: 3px; overflow: hidden; }
.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 35px;
  background: var(--phone-bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
}

.crt-lines {
  position: absolute;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 3px);
}
.phone-glitch { position: absolute; inset: 0; z-index: 85; pointer-events: none; opacity: 0; }
.phone-screen.glitching .phone-glitch {
  opacity: 1;
  background:
    repeating-linear-gradient(0deg, rgba(239, 68, 68, 0.28) 0 3px, transparent 3px 9px),
    repeating-linear-gradient(90deg, rgba(56, 189, 248, 0.18) 0 4px, transparent 4px 14px);
  animation: glAnim 0.2s steps(3) infinite;
}
@keyframes glAnim {
  0% { transform: translate(-4px, 0); clip-path: inset(8% 0 58% 0); }
  50% { transform: translate(5px, 2px); clip-path: inset(48% 0 18% 0); }
  100% { transform: translate(-2px, -2px); clip-path: inset(20% 0 40% 0); }
}

/* Status Bar + Dynamic Watcher Notch */
.status-bar {
  position: relative;
  z-index: 65;
  min-height: 40px;
  padding: env(safe-area-inset-top, 0px) 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  background: rgba(6, 8, 13, 0.85);
  flex-shrink: 0;
}
.sb-left, .sb-right { display: flex; align-items: center; gap: 6px; z-index: 2; }
.sb-net { font-size: 9.5px; opacity: 0.78; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-net.hijacked { color: var(--red); opacity: 1; }
.sb-mcb-mini { font-size: 10px; color: #fbbf24; }
.sb-mcb-mini.danger { color: #f87171; animation: pulseP 0.6s infinite alternate; }

.notch {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 7px);
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 23px;
  border-radius: 99px;
  background: #020305;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 0 9px;
  transition: width 0.25s, background 0.25s, box-shadow 0.25s;
}
.notch.watcher-active {
  width: 112px;
  background: #3a080e;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.85);
}
.notch-alert-txt { font-size: 9px; font-weight: 900; color: #fca5a5; letter-spacing: 1px; margin-right: auto; }
.notch-cam { width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #38bdf8, #0f172a 70%); }
.notch.watcher-active .notch-cam {
  background: #ef4444;
  box-shadow: 0 0 12px #ef4444;
  animation: pulseP 0.45s infinite alternate;
}

.batt-shell { width: 20px; height: 10px; border: 1.5px solid rgba(255, 255, 255, 0.8); border-radius: 3px; padding: 1px; }
.batt-fill { height: 100%; background: #4ade80; transition: width 0.3s; }
.batt-fill.low { background: var(--amber); }
.batt-fill.crit { background: var(--red); }

/* Live Sensory Ticker (Always visible inside phone — awesome for mobile!) */
.live-ticker {
  position: relative;
  z-index: 64;
  height: 30px;
  padding: 0 10px;
  background: rgba(14, 18, 28, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
}
.ticker-text {
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.ticker-text.warn { color: #fde68a; font-weight: 600; }
.ticker-text.danger { color: #fca5a5; font-weight: 700; }
.ticker-tools { display: flex; gap: 4px; flex-shrink: 0; }
.tk-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  border-radius: 6px;
  width: 24px;
  height: 22px;
  font-size: 11px;
  cursor: pointer;
}

/* Watcher Banner */
.watcher-banner {
  position: relative;
  z-index: 66;
  background: linear-gradient(90deg, #7f1d1d, #450a0a);
  border-bottom: 1px solid #ef4444;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  animation: pulseP 0.65s infinite alternate;
  flex-shrink: 0;
}
.wb-left { display: flex; align-items: center; gap: 8px; }
.wb-dot { color: #ef4444; font-size: 16px; }
.wb-left strong { display: block; font-size: 10.5px; color: #fff; }
.wb-left small { display: block; font-size: 9.5px; color: #fecaca; }
.wb-btn {
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid #fca5a5;
  background: #dc2626;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

/* Push Banner */
.push-banner {
  position: absolute;
  top: 74px;
  left: 10px;
  right: 10px;
  z-index: 75;
  background: rgba(18, 22, 32, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 15px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.78);
  animation: slideBanner 0.25s ease;
}
.push-banner.danger { background: rgba(45, 9, 14, 0.98); border-color: rgba(239, 68, 68, 0.65); }
@keyframes slideBanner { from { transform: translateY(-16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.push-icon { width: 32px; height: 32px; border-radius: 9px; background: rgba(255, 255, 255, 0.08); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.push-body { flex: 1; min-width: 0; }
.push-head { display: flex; justify-content: space-between; font-size: 11.5px; margin-bottom: 2px; }
.push-head span { font-size: 10px; color: var(--dim); }
.push-body p { font-size: 12px; color: #e2e8f0; line-height: 1.35; }

/* OS Views (sit cleanly between top bar & bottom quick-nav!) */
.os-view {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Home Screen */
.home-wallpaper { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; filter: brightness(0.62); transition: filter 0.3s; }
.home-wallpaper.corrupt { filter: brightness(0.35) contrast(1.8) hue-rotate(320deg); }
.home-shade {
  position: relative;
  z-index: 2;
  flex: 1;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, rgba(4, 6, 10, 0.42), rgba(4, 6, 10, 0.8));
  overflow-y: auto;
}
.home-top-widget {
  background: rgba(12, 16, 24, 0.84);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 13px;
  margin-bottom: 20px;
}
.hw-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.hw-brand { font-size: 10px; font-weight: 800; letter-spacing: 1.2px; color: var(--cyan); }
.hw-pill { font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 99px; }
.hw-pill.ok { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.hw-pill.danger { background: rgba(239, 68, 68, 0.3); color: #fecaca; animation: pulseP 0.65s infinite alternate; }
@keyframes pulseP { from { opacity: 0.6; } to { opacity: 1; } }
.hw-summary { font-size: 14px; font-weight: 700; }
.hw-sub { font-size: 11px; color: var(--dim); margin-top: 3px; }

.app-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 12px; }
.app-btn { background: none; border: none; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.app-ico {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55);
  transition: transform 0.12s;
}
.app-btn:active .app-ico { transform: scale(0.93); }
.app-lbl { font-size: 11.5px; font-weight: 600; text-shadow: 0 1px 5px #000; }
.app-lbl.cursed { color: #f87171; font-weight: 800; }

.ico-cctv { background: linear-gradient(145deg, #0f766e, #115e59); }
.ico-lock { background: linear-gradient(145deg, #b91c1c, #7f1d1d); }
.ico-lights { background: linear-gradient(145deg, #d97706, #92400e); }
.ico-chat { background: linear-gradient(145deg, #16a34a, #15803d); }
.ico-wifi { background: linear-gradient(145deg, #2563eb, #1e40af); }
.ico-guide { background: linear-gradient(145deg, #475569, #334155); }

.app-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 99px;
  background: #ef4444;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #080a0f;
}

/* App View */
.app-view { background: var(--phone-bg); }
.app-topbar {
  height: 44px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.app-back { background: none; border: none; color: var(--cyan); font-size: 13px; font-weight: 700; cursor: pointer; }
.app-title { font-size: 13.5px; font-weight: 800; }
.app-right { font-size: 11px; color: var(--dim); min-width: 56px; text-align: right; }
.app-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

/* Persistent Quick-Switch Navigation Bar (Fast Panic Controls!) */
.quick-nav {
  position: relative;
  z-index: 68;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: rgba(12, 16, 24, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
}
.qn-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 2px;
  border-radius: 8px;
  cursor: pointer;
}
.qn-btn span { font-size: 17px; line-height: 1.1; }
.qn-btn small { font-size: 9.5px; font-weight: 700; }
.qn-btn.active { color: #fff; background: rgba(255, 255, 255, 0.1); }
.qn-btn.power { color: #fca5a5; }
.qn-btn.power.urgent { background: rgba(220, 38, 38, 0.35); color: #fff; animation: pulseP 0.5s infinite alternate; }
.qdot {
  position: absolute;
  top: 2px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

/* =========================================================
   CCTV LIVE + MOTION BOX + MINI-SCARE FLASH
   ========================================================= */
.cctv-wrap { padding: 10px; display: flex; flex-direction: column; gap: 9px; height: 100%; }
.cctv-monitor {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  background: #020403;
  border: 1px solid rgba(74, 222, 128, 0.38);
}
.cctv-feed-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter 0.18s; }
.cctv-feed-img.lit { filter: brightness(1.68) contrast(1.1) sepia(0.28) saturate(1.2); }
.cctv-feed-img.blackout { filter: brightness(0.05) contrast(1.5); }
.cctv-feed-img.chroma { filter: contrast(1.35) saturate(1.4) drop-shadow(-3px 0 rgba(239, 68, 68, 0.7)) drop-shadow(3px 0 rgba(56, 189, 248, 0.6)); }

.cctv-motion-box {
  position: absolute;
  top: 20%;
  left: 30%;
  width: 40%;
  height: 60%;
  border: 2px solid #ef4444;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.65);
  z-index: 4;
  pointer-events: none;
  animation: motionBox 0.5s steps(2) infinite;
}
.cctv-motion-box::before {
  content: "MOTION DETECTED";
  position: absolute;
  top: -17px;
  left: -2px;
  background: #ef4444;
  color: #fff;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
}
@keyframes motionBox { 0% { opacity: 0.95; transform: translate(0, 0); } 50% { opacity: 0.45; transform: translate(2px, -2px); } }

.cctv-static-overlay {
  position: absolute;
  inset: 0;
  background:
    repeating-radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.25) 0 1px, rgba(0, 0, 0, 0.8) 1px 3px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.15) 0 2px, rgba(0, 0, 0, 0.85) 2px 5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  z-index: 6;
  animation: staticJitter 0.13s steps(2) infinite;
}
@keyframes staticJitter { 0% { background-position: 0 0; } 100% { background-position: 18px 24px; } }

.cctv-hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10.5px;
  color: #bbf7d0;
  text-shadow: 0 1px 4px #000;
}
.cctv-hud-top, .cctv-hud-bot { display: flex; justify-content: space-between; align-items: center; }
.rec-dot { color: #ef4444; animation: pulseP 0.8s infinite alternate; font-weight: 800; }

.cam-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.cam-btn {
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cam-btn.active { border-color: #4ade80; background: rgba(22, 163, 74, 0.22); color: #dcfce7; }
.cam-btn.alert { border-color: var(--red); animation: pulseP 0.55s infinite alternate; }
.cam-btn.full { grid-column: span 2; }

.cctv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }
.action-btn {
  padding: 11px 9px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--surface-2);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.action-btn.primary { background: linear-gradient(135deg, #dc2626, #991b1b); border-color: rgba(248, 113, 113, 0.45); }
.action-btn.amber { background: linear-gradient(135deg, #d97706, #92400e); border-color: rgba(251, 191, 36, 0.45); }
.action-btn.cyan { background: linear-gradient(135deg, #0284c7, #0369a1); border-color: rgba(56, 189, 248, 0.45); }
.action-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Cards / Controls */
.card-stack { padding: 11px; display: flex; flex-direction: column; gap: 9px; }
.ctrl-card { background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 13px; padding: 12px; }
.ctrl-card.critical { border-color: rgba(239, 68, 68, 0.55); background: rgba(45, 11, 15, 0.58); }
.ctrl-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.ctrl-card-head strong { font-size: 13px; }
.ctrl-card p { font-size: 11.5px; color: var(--dim); line-height: 1.45; margin-bottom: 9px; }

.toggle-btn {
  width: 100%;
  padding: 11px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.toggle-btn.on { background: #15803d; border-color: #4ade80; }
.toggle-btn.danger-on { background: #b91c1c; border-color: #fca5a5; }
.toggle-btn.light-on { background: #b45309; border-color: #fde68a; }

/* Chat App */
.chat-feed { flex: 1; padding: 11px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; }
.chat-bubble {
  max-width: 92%;
  padding: 10px 11px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.45;
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.chat-bubble.mimic { background: #2d0d14; border-color: rgba(239, 68, 68, 0.45); }
.cb-sender { font-size: 10.5px; font-weight: 800; color: var(--cyan); margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }
.chat-bubble.mimic .cb-sender { color: #fca5a5; }
.vn-btn {
  margin-top: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: none;
  background: rgba(56, 189, 248, 0.22);
  color: #e0f2fe;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.trap-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }

/* Sleep / Screen-Off Overlay */
.sleep-overlay {
  position: absolute;
  inset: 0;
  z-index: 90;
  background: #010102;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
}
.sleep-breath-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(220, 38, 38, 0.16), transparent 65%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.sleep-breath-glow.active { opacity: 1; animation: dangerPulse 1.1s ease-in-out infinite alternate; }
.sleep-clock { font-family: var(--mono); font-size: 46px; font-weight: 200; color: rgba(255, 255, 255, 0.18); margin-bottom: 14px; }
.sleep-status { font-size: 12.5px; color: rgba(255, 255, 255, 0.42); line-height: 1.5; max-width: 260px; margin-bottom: 18px; }
.sleep-bar-wrap { width: 220px; margin-bottom: 20px; }
.sleep-bar-label { font-size: 11px; color: #fca5a5; margin-bottom: 6px; }
.wake-btn {
  position: relative;
  z-index: 2;
  padding: 12px 20px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

/* Call & Charging Overlays */
.call-overlay {
  position: absolute;
  inset: 0;
  z-index: 88;
  background: radial-gradient(circle at 50% 25%, #300a10, #050609 75%);
  padding: 58px 20px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
}
.call-tag { font-size: 10px; letter-spacing: 1.4px; color: #fca5a5; }
.call-avatar {
  width: 80px; height: 80px; margin: 16px auto 12px; border-radius: 50%;
  background: rgba(239, 68, 68, 0.22); border: 2px solid var(--red);
  display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 900;
}
.call-live-box { width: 100%; }
.wave-bars { display: flex; justify-content: center; gap: 5px; height: 32px; align-items: center; margin-bottom: 10px; }
.wave-bars span { width: 4px; height: 14px; background: var(--red); border-radius: 99px; animation: wb 0.55s ease-in-out infinite alternate; }
.wave-bars span:nth-child(2n) { animation-delay: 0.15s; height: 28px; }
@keyframes wb { from { transform: scaleY(0.3); } to { transform: scaleY(1.2); } }
.call-caption { background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(239, 68, 68, 0.35); border-radius: 12px; padding: 12px; font-size: 12px; color: #fee2e2; font-style: italic; }
.call-btns { display: flex; gap: 50px; }
.c-btn {
  width: 66px; height: 66px; border-radius: 50%; border: none; color: #fff; font-size: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
}
.c-btn small { font-size: 10px; }
.c-btn.green { background: #16a34a; }
.c-btn.red { background: #dc2626; }

.charging-overlay {
  position: absolute;
  inset: 0;
  z-index: 86;
  background: rgba(3, 5, 8, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 26px;
}
.charge-ring {
  width: 84px; height: 84px; border-radius: 50%; border: 3px solid #22c55e;
  display: flex; align-items: center; justify-content: center; font-size: 36px; margin-bottom: 12px;
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.35);
}
.charge-pct { font-family: var(--mono); font-size: 34px; font-weight: 800; color: #86efac; }
.charge-note { font-size: 12px; color: var(--dim); line-height: 1.55; margin: 10px 0 18px; }
.charge-stop-btn {
  padding: 12px 20px; border-radius: 12px; border: 1px solid rgba(239, 68, 68, 0.5);
  background: rgba(185, 28, 28, 0.35); color: #fecaca; font-weight: 700; cursor: pointer;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: rgba(2, 3, 7, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 540px;
  max-height: 86dvh;
  background: #10141f;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head { padding: 15px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { font-size: 16px; }
.modal-close { background: none; border: none; color: var(--dim); font-size: 18px; cursor: pointer; }
.modal-body { padding: 16px 18px; overflow-y: auto; font-size: 13px; line-height: 1.6; color: #dbe4f2; }
.modal-footer { padding: 13px 18px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; justify-content: flex-end; gap: 10px; }

.lore-entry {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 3px solid var(--red);
  border-radius: 12px;
  padding: 11px 12px;
  margin-bottom: 9px;
}
.lore-entry.locked { opacity: 0.45; border-left-color: #475569; }
.lore-entry strong { display: block; font-size: 12.5px; color: #fca5a5; margin-bottom: 4px; }

/* =========================================================
   MOBILE NATIVE FULL-SCREEN EXPERIENCE (<= 768px)
   ========================================================= */
@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; padding: 10px; }
  .desk-panel, .bedroom-window, .bedroom-door-fx { display: none; }
}

@media (max-width: 768px) {
  .workspace {
    padding: 0;
    min-height: 100dvh;
    height: 100dvh;
    align-items: stretch;
  }
  .phone-stage { height: 100dvh; }
  .phone-device {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 0;
    background: #000;
    box-shadow: none;
  }
  .hw-btn { display: none; }
  .phone-bezel { border-radius: 0; padding: 0; }
  .phone-screen { border-radius: 0; }
  .night-grid { grid-template-columns: repeat(2, 1fr); }
  .title-card { padding: 20px 16px; border-radius: 18px; }
}
