/* ===== BASE ===== */
* { font-family: 'Sarabun', sans-serif; box-sizing: border-box; }
.font-prompt { font-family: 'Prompt', sans-serif; }
body { background: #0a0f1a; overflow: hidden; height: 100vh; margin: 0; }

/* Scrollbar global */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: rgba(99,179,237,0.3); border-radius: 2px; }

/* ===== HEADER ===== */
.main-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  height: 44px;
  background: linear-gradient(90deg, rgba(8,20,40,0.92), rgba(12,28,56,0.88));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(99,179,237,0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

/* ===== OFFICE STAGE ===== */
#stageWrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0e1a;
}
#officeStage {
  position: absolute;
  inset: 0;
}
#stageBg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  pointer-events: none;
  z-index: 0;
}
#officeStage::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(5,10,20,0.15) 0%, rgba(5,10,20,0.05) 100%);
  pointer-events: none;
  z-index: 1;
}

/* ===== AGENT ON MAP ===== */
.agent-on-map {
  position: absolute;
  z-index: 10;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Sprite wrapper */
.sprite-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: idleBob 4s ease-in-out infinite;
  transform-origin: bottom center;
}
.sprite-wrap .sprite-img {
  display: block;
  width: auto;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.9));
  transition: filter 0.3s ease, transform 0.3s ease;
  image-rendering: pixelated;
  transform-origin: bottom center;
}

/* Hover — wave + glow */
.agent-on-map:hover .sprite-wrap { animation: wave 0.7s ease-in-out infinite; }
.agent-on-map:hover .sprite-img {
  transform: scale(1.08);
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.9)) drop-shadow(0 0 20px rgba(255,220,100,0.8));
  animation: hoverGlow 1s ease-in-out infinite;
}
.agent-on-map:hover .agent-name-tag {
  background: rgba(180,140,30,0.95);
  border-color: rgba(255,220,100,0.8);
  color: #fff8dc;
  transform: scale(1.05);
}

/* Active */
.agent-on-map.active .sprite-img {
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.9)) drop-shadow(0 0 22px rgba(99,179,237,0.85));
}
.agent-on-map.active .agent-name-tag {
  background: rgba(49,130,206,0.92);
  border-color: rgba(99,179,237,0.8);
  color: white;
}

/* Name tag */
.agent-name-tag {
  margin-top: 3px;
  background: rgba(10,15,30,0.82);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 600;
  color: #e2e8f0;
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;
}
.agent-on-map .agent-name-tag::after {
  content: ' ⚙';
  opacity: 0;
  font-size: 9px;
  transition: opacity 0.2s;
}
.agent-on-map:hover .agent-name-tag::after { opacity: 0.6; }

/* Status dot */
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(10,15,30,0.9);
  animation: statusPulse 2s ease-in-out infinite;
  display: inline-block;
}
.status-dot.working { background: #48bb78; }
.status-dot.thinking { background: #f6ad55; }
.status-dot.idle { background: #718096; animation: none; }

/* Mouth / lip-sync */
.mouth-dot {
  position: absolute;
  bottom: 22%;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 2px;
  background: rgba(255,180,120,0.85);
  border-radius: 3px;
  transition: height 0.05s;
  pointer-events: none;
  z-index: 3;
}
.mouth-dot.talking { animation: lipOpen 0.18s ease-in-out infinite; }

/* Ring pulse */
.ring-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(99,179,237,0.7);
  animation: ringPulse 1.5s ease-out infinite;
  pointer-events: none;
}

/* Activity label */
.activity-label {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8,15,30,0.88);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 2px 7px;
  font-size: 9px;
  color: rgba(200,220,255,0.9);
  white-space: nowrap;
  backdrop-filter: blur(4px);
  pointer-events: none;
}
