* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1025;
  color: #fff;
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
}

#canvas-wrap {
  position: fixed;
  inset: 0;
}

#scene {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- start overlay ---------- */
#start-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #3a1d4d 0%, #1a1025 70%);
}

#start-overlay.hidden {
  display: none;
}

#start-card {
  text-align: center;
  padding: 32px;
}

#start-card h1 {
  font-size: 48px;
  margin: 0 0 8px;
  color: #ff5fa2;
  letter-spacing: 1px;
}

#start-card p {
  margin: 0 0 24px;
  color: #d9c7e8;
  font-size: 16px;
}

#btn-start {
  font-size: 18px;
  font-weight: 600;
  padding: 14px 40px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff5fa2, #ff8a4c);
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 95, 162, 0.4);
}

#btn-start:active {
  transform: scale(0.97);
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
}

#status-pill {
  pointer-events: auto;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  color: #eee;
}

#status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8ef58e;
  transition: background 0.2s;
}

/* "listening" is now the calm, always-on resting state — steady, not alarming. */
#status-pill.listening #status-dot { background: #8ef58e; }
#status-pill.thinking #status-dot { background: #ffd35f; animation: pulse 1s infinite; }
#status-pill.speaking #status-dot { background: #5fb8ff; animation: pulse 1s infinite; }
#status-pill.muted #status-dot { background: #8a8a92; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

#subtitle {
  pointer-events: none;
  align-self: center;
  max-width: 88%;
  text-align: center;
  font-size: 16px;
  line-height: 1.4;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  margin: 0 16px 10px;
  min-height: 1.4em;
}

#controls {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
}

#text-form {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 4px 4px 4px 16px;
}

#text-input {
  flex: 1;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 15px;
  padding: 10px 4px;
  outline: none;
}

#text-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

#btn-send {
  width: 36px;
  height: 36px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: #ff5fa2;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

#btn-mic {
  position: relative;
  width: 54px;
  height: 54px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff5fa2, #ff8a4c);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(255, 95, 162, 0.45);
  transition: opacity 0.2s, background 0.2s;
}

/* Mic is always-on by default (no class = actively listening). */
#btn-mic.paused {
  /* briefly dimmed while Claudy thinks/talks — mic resumes automatically */
  opacity: 0.55;
}

#btn-mic.muted {
  background: #5a5a66;
  box-shadow: none;
  opacity: 0.8;
}

#btn-mic.muted::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 34px;
  background: #fff;
  transform: rotate(45deg);
  border-radius: 2px;
}

#btn-mic:disabled,
#btn-send:disabled {
  opacity: 0.4;
}
