:root {
  --bg-primary: #0e0f13;
  --accent: #2dd4a8;
  --warn: #f5a623;
  --danger: #e5484d;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --glass-bg: rgba(14, 15, 19, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
}

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

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-primary);
  color: #e8e9ec;
}

#orb-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1;
  display: block;
  cursor: pointer;
}

/* ---------- Status pill (top-left) ---------- */

.status-pill {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: calc(env(safe-area-inset-left, 0px) + 14px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 7px 12px 7px 10px;
  border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: #c7c9d1;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5a5d68;
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.status-pill[data-state="listening"] .status-dot {
  background: var(--warn);
  box-shadow: 0 0 8px rgba(245, 166, 35, 0.8);
}

.status-pill[data-state="processing"] .status-dot {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(45, 212, 168, 0.8);
  animation: pulse 1s ease-in-out infinite;
}

.status-pill[data-state="speaking"] .status-dot {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(45, 212, 168, 0.8);
}

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

/* ---------- Action chip stack (top-right) ---------- */

.chip-stack {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(72vw, 320px);
}

.chip {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(20, 30, 40, 0.72);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(calc(100% + 16px));
  opacity: 0;
  transition: transform 0.34s var(--ease), opacity 0.28s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chip.visible { opacity: 1; transform: translateX(0); }

.chip[data-state="calling"] { color: #9fe6cc; }
.chip[data-state="success"] { color: #b7f5db; border-color: rgba(45, 212, 168, 0.35); }
.chip[data-state="error"] { color: #ffb4b7; border-color: rgba(229, 72, 77, 0.4); }

.chip[data-state="confirm"] {
  color: #ffe3b0;
  border-color: rgba(245, 166, 35, 0.45);
  white-space: normal;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  pointer-events: auto;
}

.chip-spinner {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
  flex: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

.chip-confirm-actions {
  display: flex;
  gap: 8px;
}

.chip-confirm-actions button {
  flex: 1;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font-size: 12px;
  font-weight: 600;
}

.chip-confirm-actions button.confirm-yes {
  background: rgba(245, 166, 35, 0.22);
  border-color: rgba(245, 166, 35, 0.5);
}

/* ---------- Transcript subtitle (bottom) ---------- */

.transcript-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 64px);
  z-index: 5;
  display: flex;
  justify-content: center;
  padding: 0 24px;
  pointer-events: none;
}

.transcript {
  max-width: 480px;
  text-align: center;
  font-size: 15px;
  line-height: 1.5;
  color: #dfe1e6;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  min-height: 1.5em;
}

/* ---------- Tap hint (bottom) ---------- */

.tap-hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  z-index: 5;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b6e78;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.tap-hint.hidden { opacity: 0; }

/* ---------- Pairing overlay (first launch / cross-context fallback) ---------- */

.pairing-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(14, 15, 19, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 0.3s ease;
}

.pairing-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.pairing-card {
  width: 100%;
  max-width: 320px;
  padding: 20px;
  border-radius: 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  text-align: center;
}

.pairing-card p {
  margin: 0 0 14px;
  font-size: 13px;
  color: #c7c9d1;
  line-height: 1.5;
}

.pairing-card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: #e8e9ec;
  font-size: 14px;
  text-align: center;
}

.pairing-card input::placeholder { color: #6b6e78; }

.pairing-card button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(45, 212, 168, 0.5);
  background: rgba(45, 212, 168, 0.18);
  color: #b7f5db;
  font-size: 14px;
  font-weight: 600;
}
