:root {
  --bg: #0f1115;
  --panel: #171a21;
  --text: #eef0f4;
  --muted: #9aa2b1;
  --accent: #4f8cff;
  --danger: #ff5566;
  --ok: #33d17a;
  --warn: #ffb020;
  --border: #262b36;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom) 16px;
}

.header {
  padding: 16px 0 10px;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.status-dot.connecting { background: var(--warn); }
.status-dot.connected { background: var(--ok); }
.status-dot.error { background: var(--danger); }

.transcript-wrap {
  flex: 1;
  min-height: 0;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  display: flex;
}

.transcript {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-hint {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  margin-top: 24px;
}

.bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.bubble.jean {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.bubble.nex {
  align-self: flex-start;
  background: #232733;
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.bubble.system {
  align-self: center;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.mic-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0 10px;
}

.mic-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.mic-dot.listening {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(51, 209, 122, 0.6);
  animation: pulse 1.3s infinite;
}

.mic-dot.speaking {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(79, 140, 255, 0.6);
  animation: pulse 1.3s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(51, 209, 122, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(51, 209, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(51, 209, 122, 0); }
}

.error-banner {
  background: rgba(255, 85, 102, 0.12);
  border: 1px solid var(--danger);
  color: #ffb3ba;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 10px;
}

.controls {
  display: flex;
  gap: 10px;
  padding-bottom: 10px;
}

.btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.text-input-row {
  display: flex;
  gap: 8px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.text-input-row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
}

.text-input-row input:disabled {
  opacity: 0.5;
}

.text-input-row button {
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  background: #232733;
  color: var(--text);
  font-weight: 600;
}

.text-input-row button:disabled {
  opacity: 0.5;
}
