:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0; padding: 16px; font-family: "Segoe UI", Tahoma, sans-serif;
  background: #0d1127; color: #f2f2f2; text-align: center;
}
header h1 { margin: 4px 0; letter-spacing: 2px; color: #ffd43b; }
#status { color: #9fb2ff; margin: 4px 0 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.tab {
  background: #131836; color: #f2f2f2; border: 1px solid #2b3160;
  border-radius: 999px; padding: 8px 14px; font-size: 15px; cursor: pointer;
}
.tab.active { background: #ffd43b; color: #131836; font-weight: 700; }
#mic-wrap { padding: 18px 0; }
#mic-btn {
  width: 150px; height: 150px; border-radius: 50%; border: none;
  font-size: 58px; background: #1d2450; color: #fff; cursor: pointer;
  box-shadow: 0 0 0 0 rgba(255, 212, 59, .55);
}
#mic-btn.recording { background: #b3261e; animation: pulse 1.1s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 80, 80, .55); }
  70% { box-shadow: 0 0 0 26px rgba(255, 80, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 80, 80, 0); }
}
#mic-hint { color: #c9cdea; }
.bubble {
  text-align: right; border-radius: 14px; padding: 10px 14px; margin: 10px auto;
  max-width: 560px; white-space: pre-wrap; line-height: 1.6;
}
.bubble.user { background: #1d2450; }
.bubble.bot { background: #14331f; }
video { width: 100%; max-width: 560px; border-radius: 14px; background: #000; }
.row { display: flex; gap: 8px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.row button, #cam-q {
  background: #131836; color: #f2f2f2; border: 1px solid #2b3160;
  border-radius: 10px; padding: 10px 14px; font-size: 15px;
}
.row button:disabled { opacity: .45; }
#cam-q { width: 100%; max-width: 560px; }
.note { color: #c9cdea; max-width: 560px; margin: 0 auto 12px; line-height: 1.7; }
audio { width: 100%; max-width: 560px; margin-top: 10px; }

/* --- live voice panel (2.2) --- */
#live-wrap { padding: 18px 0 6px; }
#live-btn {
  width: 150px; height: 150px; border-radius: 50%; border: none;
  font-size: 58px; background: #1d2450; color: #fff; cursor: pointer;
  box-shadow: 0 0 0 0 rgba(56, 239, 125, .45);
}
#live-btn.recording { background: #14532d; animation: pulse 1.1s infinite; }
#live-state { color: #c9cdea; line-height: 1.7; }
#live-timer { color: #ffd43b; font-size: 18px; font-weight: 700; margin: 4px 0; }
#live-controls button {
  background: #131836; color: #f2f2f2; border: 1px solid #2b3160;
  border-radius: 10px; padding: 10px 14px; font-size: 15px; cursor: pointer;
}
#live-end { border-color: #b3261e !important; }
#live-log .bubble[data-kind="note"] {
  background: #2b2140; text-align: center;
}

/* --- 💬 text chat tab (2.3) --- */
#panel-chat { display: flex; flex-direction: column; }
#chat-log {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 52vh; overflow-y: auto; padding: 4px 2px 10px;
}
.msg {
  text-align: right; border-radius: 14px; padding: 9px 13px; margin: 4px 0;
  max-width: 85%; white-space: pre-wrap; line-height: 1.6; word-break: break-word;
}
.msg.user { background: #1d2450; align-self: flex-end; }
.msg.bot { background: #14331f; align-self: flex-start; }
#chat-typing { color: #9fb2ff; font-style: italic; }
.tts-btn {
  margin-top: 8px; background: #0d2b18; color: #7dffb0;
  border: 1px solid #2b6b45; border-radius: 999px;
  padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.tts-btn:disabled { opacity: .5; }
#chat-bar {
  display: flex; gap: 8px; align-items: center;
  position: sticky; bottom: 0; background: #0d1127; padding: 10px 0 2px;
}
#chat-input {
  flex: 1; background: #131836; color: #f2f2f2; border: 1px solid #2b3160;
  border-radius: 999px; padding: 12px 16px; font-size: 16px;
}
#chat-attach, #chat-send {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid #2b3160;
  background: #131836; color: #f2f2f2; font-size: 20px; cursor: pointer;
  flex: none;
}
#chat-send { background: #ffd43b; color: #131836; font-weight: 700; }
#chat-attach:disabled, #chat-send:disabled { opacity: .45; }
#chat-player { margin: 8px auto 0; }
