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

body {
  background: #000;
  color: #fff;
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

#ptt {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #111;
  color: #fff;
  font-size: 1.5rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  user-select: none;
}

/* Disabled state (before WS connects, and during non-idle states) */
#ptt:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- FSM visual states via body[data-state] ---- */

/* idle: white border (default, already set above) */
body[data-state="idle"] #ptt {
  border-color: #fff;
  background: #111;
}

/* recording: red border + pulse animation */
body[data-state="recording"] #ptt {
  border-color: #e44;
  background: #1a0000;
  animation: pulse 0.9s ease-in-out infinite;
}

/* processing: grey background, not-allowed cursor */
body[data-state="processing"] #ptt {
  border-color: #555;
  background: #222;
  cursor: not-allowed;
}

/* speaking: blue border, static */
body[data-state="speaking"] #ptt {
  border-color: #49f;
  background: #00081a;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(238, 68, 68, 0.6); }
  70%  { box-shadow: 0 0 0 14px rgba(238, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(238, 68, 68, 0); }
}

/* ---- State label ---- */

#state {
  font-size: 0.9rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- Transcript ---- */

#transcript {
  color: #ccc;
  max-width: 480px;
  text-align: center;
  font-size: 1rem;
  line-height: 1.5;
  min-height: 2em;
}

/* ---- Error ---- */

#error {
  color: #e55;
  min-height: 1.5em;
  max-width: 480px;
  text-align: center;
  font-size: 0.9rem;
}

#error:empty {
  display: none;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
  #ptt {
    width: 140px;
    height: 140px;
    font-size: 1.3rem;
  }
}
