/* ai.css — chronal link visuals:
   .ai-*        console voice / process lines
   .amiga-win   Workbench-1.3-dressed floating windows (imagery)
   #trace-*     network-origin triangulation theatre                */

/* =========== console voice =========== */
.ai-voice {
  display: block;
  padding: 2px 0;
  line-height: 1.55;
  white-space: pre-wrap;
}
.ai-voice.s0 { color: #9ad8ff; }                 /* cold diagnostics */
.ai-voice.s1 { color: #cfe6d8; }                 /* drift: one wrong line among right ones */
.ai-voice.s1::first-letter { color: #ffb257; }
.ai-voice.s2 { color: #eef4ee; font-style: italic; } /* entangled conversation */
.ai-voice .leak { color: #ffb257; }
.ai-voice .ai-cursor { display: inline-block; color: #62d88f; animation: ai-blink 0.8s steps(1) infinite; margin-left: 2px; }
@keyframes ai-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.ai-whisper { color: #6f8f83; font-size: 0.92em; }
.ai-whisper.ai-bad, .ai-bad { color: #ff7a6e; }
.ai-hex { color: #ffb257; }
.ai-leak { color: #8fd8ff; letter-spacing: 0.06em; }
.ai-exec { color: #7fd8a0; }

.ai-proc { color: #5f7f8f; }
.ai-proc .ai-hex { color: #4f9f8f; }
.ai-proc .ai-spin, .ai-proc .ai-bar { color: #4f9f8f; }
.ai-proc .ai-ms { color: #3f6f7f; }
.ai-proc-done .ai-ok { color: #62d88f; }
.ai-proc-err { color: #a05050; }

/* =========== red alert / intrusion =========== */
body.redmode {
  --term-bg: #0a0103;
  --txt: #ff7d6e;
  --green: #ff5f52;
  --amber: #ff9e6e;
  --cyan: #ff8f83;
  --magenta: #ff6b8f;
  --red: #ffd2cc;
  --muted: #a05a52;
}
body.redmode #terminal { text-shadow: 0 0 3px rgba(255, 60, 40, 0.45); }
#red-veil {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 400;
  opacity: 0;
  transition: opacity 1.2s ease;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(120, 10, 5, 0.28) 100%),
    repeating-linear-gradient(0deg, rgba(255, 40, 20, 0.03) 0 2px, transparent 2px 4px);
}
body.redmode #red-veil { opacity: 1; }

#intrusion-badge {
  position: fixed;
  top: 14px; right: 18px;
  z-index: 410;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid #ff4a3a;
  background: rgba(20, 2, 2, 0.85);
  font-family: 'JetBrains Mono', 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #ff6a5a;
  box-shadow: 0 0 18px rgba(255, 50, 30, 0.25);
  pointer-events: none;
}
#intrusion-badge.on { display: inline-flex; animation: ib-shake 0.7s ease-in-out infinite; }
#intrusion-badge .ib-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ff4a3a;
  box-shadow: 0 0 10px #ff4a3a;
  animation: ib-blink 0.9s steps(1) infinite;
}
#intrusion-badge.verified {
  border-color: #3cffa0; color: #62d88f;
  box-shadow: 0 0 18px rgba(60, 255, 160, 0.25);
  animation: none;
}
#intrusion-badge.verified .ib-dot { background: #3cffa0; box-shadow: 0 0 10px #3cffa0; animation: none; }
#intrusion-badge.guest {
  border-color: #ffb257; color: #ffb257;
  box-shadow: 0 0 18px rgba(255, 178, 87, 0.2);
  animation: none;
}
#intrusion-badge.guest .ib-dot { background: #ffb257; box-shadow: 0 0 10px #ffb257; animation: none; }
@keyframes ib-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0.15; } }
@keyframes ib-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-1px); }
  75% { transform: translateX(1px); }
}

/* =========== Workbench 1.3 windows =========== */
.amiga-win {
  position: fixed;
  background: #b0b0b0;
  border: 2px solid #000;
  box-shadow:
    inset 2px 2px 0 #fff, inset -2px -2px 0 #6f6f6f,
    8px 10px 0 rgba(0, 0, 0, 0.45);
  min-width: 280px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  font-family: 'Topaz-8', 'JetBrains Mono', 'Share Tech Mono', monospace;
  color: #000;
  user-select: none;
}
.amiga-win.active .amiga-titlebar { background: #0055aa; color: #fff; }
.amiga-win:not(.active) .amiga-titlebar { background: #d8d8d8; color: #333; }

.amiga-titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-bottom: 2px solid #000;
  cursor: move;
  flex: 0 0 auto;
}
.amiga-title {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.amiga-gadget {
  width: 22px; height: 18px;
  background: #fff;
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0 #cfcfcf;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.amiga-gadget:hover { background: #ffe9c9; }
.amiga-gadget:active { background: #ff8800; }
.amiga-close i { width: 8px; height: 8px; background: #0055aa; display: block; }
.amiga-depth i {
  width: 7px; height: 7px; border: 1px solid #0055aa; display: block; background: #fff;
}
.amiga-depth i:first-child { margin-right: -3px; margin-bottom: -2px; }
.amiga-depth { gap: 0; }
.amiga-depth i:last-child { background: #0055aa; }

.amiga-body {
  flex: 1;
  background: #fff;
  border: 2px solid #000;
  margin: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.amiga-image { display: flex; flex-direction: column; height: 100%; background: #9a9a9a; }
.amiga-image img {
  flex: 1;
  width: 100%;
  object-fit: contain;
  background: #fff;
  min-height: 0;
  image-rendering: auto;
}
.amiga-caption {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #ff8800;
  color: #000;
  font-size: 11px;
  padding: 3px 6px;
  border-top: 2px solid #000;
  white-space: nowrap;
  overflow: hidden;
}
.amiga-resize {
  position: absolute;
  right: 2px; bottom: 2px;
  width: 18px; height: 16px;
  cursor: nwse-resize;
  display: flex; align-items: flex-end; justify-content: flex-end; gap: 1px;
  padding: 2px;
}
.amiga-resize i { width: 3px; background: #000; display: block; height: 8px; margin-left: 1px; }
.amiga-resize i:nth-child(1) { height: 4px; }
.amiga-resize i:nth-child(2) { height: 6px; }
.amiga-resize i:nth-child(3) { height: 8px; }

/* =========== triangulation theatre =========== */
#trace-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #04070b;
  font-family: 'JetBrains Mono', 'Share Tech Mono', monospace;
  color: #9adfc0;
  cursor: pointer;
  overflow: hidden;
}
#trace-crt {
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.25) 0 2px, transparent 2px 4px);
  z-index: 60;
}
#trace-grid { position: absolute; inset: 0; z-index: 1; }
#trace-map {
  position: absolute; inset: 0;
  z-index: 2;
  opacity: 0;
  transition: opacity 1.2s ease;
  filter: saturate(0.7) brightness(0.9);
}
#trace-map.on { opacity: 0.85; }
/* night-ops dress: OSM light tiles inverted into a dark recon map */
#trace-map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(190deg) brightness(0.82) contrast(1.05) saturate(0.55);
}
#trace-map .leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.6);
  color: #5f8f7f;
  font-size: 9px;
}
#trace-map .leaflet-control-attribution a { color: #6faf9f; }
#trace-readout div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tr-node-tip {
  background: rgba(4, 8, 12, 0.9) !important;
  border: 1px solid #ff8c3c !important;
  color: #ffb257 !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 10px !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

#trace-head {
  position: absolute;
  top: 18px; left: 0; right: 0;
  text-align: center;
  z-index: 70;
  letter-spacing: 0.35em;
  font-size: 13px;
  color: #6fd8a8;
  text-shadow: 0 0 12px rgba(60, 255, 160, 0.35);
}
#trace-head .tr-hex { color: #ffb257; margin-right: 10px; }

#trace-readout {
  position: absolute;
  top: 52px; right: 22px;
  width: 420px;
  max-height: 44vh;
  overflow: hidden;
  z-index: 70;
  font-size: 11px;
  line-height: 1.5;
  color: #4f8f7f;
  text-align: left;
  background: linear-gradient(180deg, rgba(4, 10, 8, 0.75), rgba(4, 10, 8, 0.0));
  padding: 8px 10px;
}
#trace-readout .tr-strong { color: #9adfc0; font-weight: 700; }
#trace-readout .tr-green { color: #62d88f; }
#trace-readout .tr-dim { color: #3f6f5f; }

#trace-status {
  position: absolute;
  bottom: 46px; left: 0; right: 0;
  text-align: center;
  z-index: 70;
  letter-spacing: 0.22em;
  font-size: 12px;
  color: #ffb257;
}
#trace-hint {
  position: absolute;
  bottom: 18px; left: 0; right: 0;
  text-align: center;
  z-index: 70;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #3f6f5f;
  animation: tr-blink 1.6s infinite;
}
@keyframes tr-blink { 0%, 60% { opacity: 1; } 61%, 100% { opacity: 0.25; } }

/* reticle */
#trace-reticle {
  position: absolute;
  width: 0; height: 0;
  z-index: 65;
  transform: translate(-50%, -50%);
}
#trace-reticle.hidden { display: none; }
.tr-ring {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(60, 255, 160, 0.75);
  border-radius: 50%;
  animation: tr-pulse 2.2s ease-out infinite;
}
.tr-ring.r1 { width: 46px; height: 46px; }
.tr-ring.r2 { width: 46px; height: 46px; animation-delay: 0.7s; }
.tr-ring.r3 { width: 46px; height: 46px; animation-delay: 1.4s; }
@keyframes tr-pulse {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0.95; }
  100% { transform: translate(-50%, -50%) scale(3.2); opacity: 0; }
}
.tr-cross { position: absolute; left: -14px; top: -1px; width: 28px; height: 2px; background: #3cffa0; box-shadow: 0 0 8px rgba(60, 255, 160, 0.9); }
.tr-cross::after {
  content: '';
  position: absolute; left: 13px; top: -13px;
  width: 2px; height: 28px; background: #3cffa0; box-shadow: 0 0 8px rgba(60, 255, 160, 0.9);
}
.tr-brackets { position: absolute; width: 26px; height: 26px; border: 2px solid #ffb257; }
.tr-brackets.tl { left: -40px; top: -40px; border-right: none; border-bottom: none; }
.tr-brackets.tr { right: -40px; top: -40px; border-left: none; border-bottom: none; }
.tr-brackets.bl { left: -40px; bottom: -40px; border-right: none; border-top: none; }
.tr-brackets.br { right: -40px; bottom: -40px; border-left: none; border-top: none; }
.tr-label {
  position: absolute;
  top: 44px; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  color: #3cffa0;
  letter-spacing: 0.18em;
  font-size: 12px;
  text-shadow: 0 0 10px rgba(60, 255, 160, 0.7);
}
