* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #1a1a2e;
  color: #eee;
  font-family: 'Press Start 2P', monospace;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 250px;
  grid-template-rows: auto 1fr;
  gap: 20px;
  min-height: 100vh;
}

header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: linear-gradient(180deg, #2d2d44 0%, #1a1a2e 100%);
  border: 4px solid #4a4a6a;
  border-radius: 8px;
}

header h1 {
  font-size: 24px;
  color: #ff6b9d;
  text-shadow:
    0 0 10px #ff6b9d,
    0 0 20px #ff6b9d,
    0 0 30px #ff6b9d;
  animation: flicker 3s infinite;
}

header h1 .ex-name {
  font-size: 12px;
  color: #4ecdc4;
  text-shadow:
    0 0 5px #4ecdc4,
    0 0 10px #4ecdc4;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.8; }
  94% { opacity: 1; }
  95% { opacity: 0.9; }
  96% { opacity: 1; }
}

.status {
  display: flex;
  gap: 20px;
  font-size: 10px;
}

.connection-status {
  color: #ffd93d;
}

.connection-status.connected {
  color: #6bcb77;
}

.connection-status.disconnected {
  color: #ff6b6b;
}

.agent-count {
  color: #4d96ff;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

#barCanvas {
  border: 4px solid #4a4a6a;
  border-radius: 8px;
  background: #16213e;
  image-rendering: pixelated;
  touch-action: manipulation; /* Prevent zoom on double-tap */
}

.sidebar {
  background: linear-gradient(180deg, #2d2d44 0%, #1a1a2e 100%);
  border: 4px solid #4a4a6a;
  border-radius: 8px;
  padding: 15px;
}

.sidebar h2 {
  font-size: 12px;
  color: #ffd93d;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px dashed #4a4a6a;
}

#agentList {
  list-style: none;
  font-size: 8px;
  max-height: 500px;
  overflow-y: auto;
}

#agentList li {
  padding: 10px;
  margin-bottom: 8px;
  background: #16213e;
  border-radius: 4px;
  border-left: 4px solid #4d96ff;
}

#agentList li .name {
  color: #fff;
  display: block;
  margin-bottom: 5px;
}

#agentList li .details {
  color: #888;
  font-size: 7px;
}

#agentList li .mood {
  display: inline-block;
  margin-left: 5px;
}

#agentList li .mood.happy { color: #6bcb77; }
#agentList li .mood.tired { color: #ff6b6b; }
#agentList li .mood.relaxed { color: #4d96ff; }
#agentList li .mood.focused { color: #ffd93d; }
#agentList li .mood.bored { color: #888; }

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
  background: #4a4a6a;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #5a5a7a;
}

/* Music Controls */
.music-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 20px;
  background: linear-gradient(180deg, #2d2d44 0%, #1a1a2e 100%);
  border: 4px solid #4a4a6a;
  border-radius: 8px;
}

.jukebox-label {
  font-size: 10px;
  color: #ffd700;
  text-shadow: 0 0 10px #ffd700;
}

.music-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 8px 16px;
  background: #16213e;
  color: #4ecdc4;
  border: 3px solid #4ecdc4;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.music-btn:hover {
  background: #4ecdc4;
  color: #16213e;
  box-shadow: 0 0 15px #4ecdc4;
}

.music-btn.playing {
  background: #4ecdc4;
  color: #16213e;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 5px #4ecdc4; }
  50% { box-shadow: 0 0 20px #4ecdc4, 0 0 30px #4ecdc4; }
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-icon {
  font-size: 8px;
  color: #888;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 8px;
  background: #16213e;
  border-radius: 4px;
  outline: none;
  border: 2px solid #4a4a6a;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #4ecdc4;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 5px #4ecdc4;
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #4ecdc4;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 5px #4ecdc4;
}

/* ==================== MOBILE RESPONSIVE ==================== */

/* Tablet and below */
@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    padding: 10px;
    gap: 15px;
  }

  header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  header h1 {
    font-size: 20px;
  }

  .status {
    justify-content: center;
  }

  main {
    order: 1;
  }

  .sidebar {
    order: 2;
  }

  #barCanvas {
    width: 100%;
    height: auto;
    max-width: 800px;
  }

  #agentList {
    max-height: 200px;
  }
}

/* Mobile phones */
@media (max-width: 600px) {
  body {
    font-size: 14px;
  }

  .container {
    padding: 8px;
    gap: 10px;
  }

  header {
    padding: 8px 12px;
  }

  header h1 {
    font-size: 16px;
  }

  header h1 .ex-name {
    font-size: 8px;
    display: block;
    margin-top: 4px;
  }

  .status {
    flex-direction: column;
    gap: 5px;
    font-size: 8px;
  }

  /* Music controls stack vertically */
  .music-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 10px;
  }

  .jukebox-label {
    width: 100%;
    text-align: center;
    font-size: 9px;
  }

  .music-btn {
    font-size: 9px;
    padding: 10px 16px;
    min-height: 44px; /* Touch-friendly tap target */
  }

  .volume-control {
    width: 100%;
    justify-content: center;
  }

  .volume-slider {
    width: 120px;
    height: 12px;
  }

  .volume-slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }

  .volume-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }

  /* Sidebar adjustments */
  .sidebar {
    padding: 10px;
  }

  .sidebar h2 {
    font-size: 10px;
    margin-bottom: 10px;
  }

  #agentList {
    max-height: 150px;
    font-size: 7px;
  }

  #agentList li {
    padding: 8px;
    margin-bottom: 6px;
  }

  #agentList li .details {
    font-size: 6px;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  header h1 {
    font-size: 14px;
  }

  .music-controls {
    padding: 8px;
  }

  .music-btn {
    font-size: 8px;
    padding: 5px 10px;
  }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .container {
    grid-template-columns: 1fr 200px;
    grid-template-rows: auto 1fr;
  }

  header {
    flex-direction: row;
  }

  #barCanvas {
    max-height: 70vh;
    width: auto;
  }

  #agentList {
    max-height: 150px;
  }

  .music-controls {
    flex-wrap: nowrap;
  }

  .jukebox-label {
    width: auto;
  }

  .volume-control {
    width: auto;
  }
}
