:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --text: #e7ecf1;
  --muted: #8b9aab;
  --accent: #3d9cf5;
  --danger: #e85d5d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

.hint code {
  background: var(--surface);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.85em;
}

.session-field {
  margin-bottom: 1rem;
}

.session-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.session-field .req {
  color: var(--muted);
  font-weight: 400;
}

.session-field input[type="text"] {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #334155;
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

.mic-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex-wrap: wrap;
}

.mic-refresh-btn {
  flex-shrink: 0;
  align-self: center;
  white-space: nowrap;
  color: var(--text) !important;
  background: var(--surface) !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.875rem !important;
  border-radius: 6px !important;
}

.mic-row select {
  flex: 1;
  min-width: 10rem;
  max-width: 100%;
}

.session-field select {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #334155;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
}

.session-field .mic-row select {
  width: auto;
  flex: 1 1 12rem;
}

.session-field select option {
  background: var(--surface);
  color: var(--text);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

button {
  cursor: pointer;
  border: 1px solid #334155;
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: transparent;
  color: #041018;
  font-weight: 600;
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
}

.chat-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

textarea {
  width: 100%;
  resize: vertical;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0c1118;
  color: var(--text);
  font: inherit;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}

.log {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid #2a3544;
  min-height: 6rem;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.log .entry {
  margin-bottom: 0.85rem;
}

.log .entry:last-child {
  margin-bottom: 0;
}

.log .role {
  font-weight: 600;
  color: var(--accent);
}

.log .err {
  color: var(--danger);
}

.panels {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 640px) {
  .panels {
    grid-template-columns: 1fr 1fr;
  }
}

.panel {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid #2a3544;
}

.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mono {
  font-family: ui-monospace, monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 2.5rem;
}

.partial {
  color: var(--muted);
}

.final {
  color: var(--text);
}

.hint.small {
  font-size: 0.8rem;
  margin-top: 1.5rem;
}

.avatar-panel {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid #2a3544;
}

.avatar-panel.hidden {
  display: none;
}

.avatar-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.remote-media {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  min-height: 120px;
}

.remote-media video {
  width: 100%;
  display: block;
  vertical-align: top;
}

.remote-media audio {
  display: none;
}

.log-panel {
  margin: 1rem 0 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid #2a3544;
}

.log-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.log-panel-head h2 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-ghost {
  cursor: pointer;
  border: 1px solid #334155;
  background: transparent;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--muted);
}

.session-log {
  margin: 0;
  max-height: 11rem;
  overflow-y: auto;
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.4;
  background: #0c1118;
  border-radius: 6px;
  border: 1px solid #2a3544;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c8d4e0;
}

.session-log .log-line--warn {
  color: #e8c56d;
}

.session-log .log-line--error {
  color: var(--danger);
}

.log-hint {
  margin: 0.5rem 0 0;
}
