/* เมนู รปภ (2026-10-14): ป้อมยามกะดึกเฝ้าจอ CCTV ของทุก process. Scoped to #guard. */
#guard {
  --g-night: #1b1e2e;
  --g-wall: #252a40;
  --g-bezel: #cfc6ae;
  --g-bezel-dark: #8f8670;
  --g-glass: #0c1d15;
  --g-ok: #8dffb5;
  --g-warn: #ffb000;
  --g-down: #ff4b3e;
  --g-desk: #8a5a32;
  --g-ink: #141414;
  --g-osd: 'VT323', 'Itim', monospace;
}
#guard [hidden] { display: none !important; }
#guard .guard-room {
  position: relative;
  background: var(--g-night);
  border: 4px solid var(--g-ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--g-ink);
  padding: 22px 22px 0;
  overflow: hidden;
  color: #e9e6dc;
  font-family: 'Itim', system-ui, sans-serif;
}
#guard .guard-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
#guard .guard-head h2 { margin: 0; font-family: 'Lilita One', 'Itim', sans-serif; font-size: clamp(1.7rem, 3.4vw, 2.4rem); color: #fff3c4; letter-spacing: .01em; line-height: 1.05; }
#guard .guard-head p { margin: 4px 0 0; color: #b9b5c9; font-size: 1rem; }
#guard .guard-clock { font-family: var(--g-osd); font-size: 1.6rem; color: var(--g-ok); }

/* CCTV wall */
#guard .cctv-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; padding: 14px; background: var(--g-wall); border: 3px solid var(--g-ink); border-radius: 12px; }
#guard .cam {
  position: relative; background: var(--g-bezel); border: 3px solid var(--g-ink); border-radius: 14px; padding: 10px 10px 8px;
  box-shadow: inset 0 -5px 0 var(--g-bezel-dark), 3px 3px 0 var(--g-ink);
}
#guard .cam-screen {
  position: relative; min-height: 150px; border: 3px solid var(--g-ink); border-radius: 22px / 16px; background: var(--g-glass);
  padding: 10px 12px; overflow: hidden; color: var(--cam-color, var(--g-ok));
  box-shadow: inset 0 0 26px rgba(0, 0, 0, .75);
}
#guard .cam-screen::after { /* scanlines */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .05) 0 1px, transparent 1px 3px);
}
#guard .cam[data-state="OK"] { --cam-color: var(--g-ok); }
#guard .cam[data-state="WARN"] { --cam-color: var(--g-warn); }
#guard .cam[data-state="DOWN"] { --cam-color: var(--g-down); }
#guard .cam[data-state="WARN"] .cam-screen { box-shadow: inset 0 0 26px rgba(0, 0, 0, .75), inset 0 0 0 2px var(--g-warn); }
#guard .cam-osd { display: flex; justify-content: space-between; font-family: var(--g-osd); font-size: 1.15rem; line-height: 1; opacity: .9; }
#guard .cam-rec::before { content: "●"; color: var(--g-down); margin-right: 4px; animation: guard-rec 1.2s steps(2, start) infinite; }
#guard .cam-status { margin: 14px 0 6px; font-family: 'Lilita One', 'Itim', sans-serif; font-size: 1.9rem; line-height: 1; text-shadow: 0 0 10px currentColor; }
#guard .cam-facts { margin: 0; padding: 0; list-style: none; font-size: .95rem; line-height: 1.35; color: #d8f5e2; }
#guard .cam[data-state="WARN"] .cam-facts, #guard .cam[data-state="DOWN"] .cam-facts { color: #fbe9d4; }
#guard .cam-facts .why { color: var(--cam-color); }
#guard .cam-label { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: 7px; color: var(--g-ink); }
#guard .cam-label strong { font-family: 'Lilita One', 'Itim', sans-serif; font-size: 1.05rem; }
#guard .cam-label small { font-size: .85rem; color: #4d4637; }
#guard .cam-led { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--g-ink); background: var(--cam-color); flex: none; align-self: center; }
#guard .cam[data-state="DOWN"] .cam-screen::before { /* no-signal static */
  content: ""; position: absolute; inset: 0; opacity: .32; pointer-events: none;
  background: repeating-radial-gradient(circle at 17% 32%, #fff 0 1px, transparent 1px 3px), repeating-radial-gradient(circle at 71% 63%, #999 0 1px, transparent 1px 4px);
  animation: guard-static .25s steps(3) infinite;
}

/* Desk and guard */
#guard .guard-desk { position: relative; display: grid; grid-template-columns: minmax(150px, 220px) 1fr; align-items: end; gap: 6px 20px; margin-top: 18px; padding: 0 6px; }
#guard .guard-desk::after { content: ""; position: absolute; left: -22px; right: -22px; bottom: 0; height: 34px; background: var(--g-desk); border-top: 4px solid var(--g-ink); z-index: 0; }
#guard .guard-figure { position: relative; z-index: 1; width: 100%; max-width: 220px; }
#guard .guard-figure svg { display: block; width: 100%; height: auto; }
#guard .guard-bubble {
  position: relative; z-index: 1; align-self: center; margin-bottom: 46px; max-width: 62ch; background: #fff8e6; color: var(--g-ink);
  border: 3px solid var(--g-ink); border-radius: 18px; padding: 12px 16px; box-shadow: 4px 4px 0 var(--g-ink); font-size: 1.12rem; line-height: 1.45;
}
#guard .guard-bubble::before { content: ""; position: absolute; left: -16px; bottom: 18px; border: 9px solid transparent; border-right: 14px solid var(--g-ink); }
#guard .guard-bubble small { display: block; margin-top: 4px; color: #5a5348; font-size: .9rem; }
#guard .guard-error { margin: 0 0 12px; padding: 10px 14px; border: 3px solid var(--g-ink); border-radius: 12px; background: var(--g-warn); color: var(--g-ink); }

/* guard poses: the SVG has one group per pose */
#guard .guard-figure [data-pose] { display: none; }
#guard .guard-figure[data-pose="OK"] [data-pose="OK"],
#guard .guard-figure[data-pose="WARN"] [data-pose="WARN"],
#guard .guard-figure[data-pose="DOWN"] [data-pose="DOWN"] { display: inline; }
#guard .guard-steam { animation: guard-steam 3s ease-in-out infinite; transform-origin: center bottom; }

@keyframes guard-rec { to { visibility: hidden; } }
@keyframes guard-static { 33% { transform: translate(2px, -1px); } 66% { transform: translate(-1px, 2px); } }
@keyframes guard-steam { 0%, 100% { opacity: .2; transform: translateY(2px); } 50% { opacity: .8; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  #guard .cam-rec::before, #guard .cam[data-state="DOWN"] .cam-screen::before, #guard .guard-steam { animation: none; }
}
@media (max-width: 640px) {
  #guard .guard-room { padding: 14px 12px 0; }
  #guard .cctv-wall { grid-template-columns: 1fr; padding: 10px; }
  #guard .guard-desk { grid-template-columns: 110px 1fr; }
  #guard .guard-bubble { margin-bottom: 40px; font-size: 1rem; }
}
