:root {
  --bg: #0b0f19;
  --bg-elev: #121729;
  --accent: #4dd9ff;
  --accent-2: #7a5cff;
  --text: #eef2ff;
  --text-dim: #8b93b0;
  --danger: #ff5470;
  --bubble-user: #1b2340;
  --bubble-bot: #16213a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(1200px 800px at 50% -10%, #16213e 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  overflow: hidden;
}

.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  max-width: 720px;
  margin: 0 auto;
}

.app__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  font-size: 18px;
  letter-spacing: 0.35em;
  font-weight: 600;
  margin: 0;
  color: var(--accent);
}

.brand__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: 0 0 0 rgba(77, 217, 255, 0);
  transition: background 0.2s, box-shadow 0.2s;
}

.brand__dot.listening {
  background: var(--accent);
  box-shadow: 0 0 12px 3px rgba(77, 217, 255, 0.6);
  animation: pulse-dot 1.2s infinite;
}

.brand__dot.speaking {
  background: var(--accent-2);
  box-shadow: 0 0 12px 3px rgba(122, 92, 255, 0.6);
}

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

.btn {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.orb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 0 16px;
}

.orb {
  --size: 132px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
  color: var(--bg);
  background: radial-gradient(circle at 35% 30%, #6be9ff, var(--accent) 45%, var(--accent-2) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 10px 40px -8px rgba(77, 217, 255, 0.55);
  transition: transform 0.15s ease;
}

.orb:active {
  transform: scale(0.96);
}

.orb__icon {
  width: 42px;
  height: 42px;
  color: #071018;
}

.orb.listening {
  animation: breathe 1.4s ease-in-out infinite;
}

.orb.listening::before,
.orb.listening::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(77, 217, 255, 0.55);
  animation: ripple 1.6s ease-out infinite;
}

.orb.listening::after {
  animation-delay: 0.5s;
}

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 40px -8px rgba(77,217,255,0.55); }
  50% { box-shadow: 0 0 0 1px rgba(255,255,255,0.14), 0 10px 60px -4px rgba(77,217,255,0.85); }
}

@keyframes ripple {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

.orb.speaking {
  background: radial-gradient(circle at 35% 30%, #cbb8ff, var(--accent-2) 45%, #4128a8 100%);
}

.hint {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0;
  text-align: center;
  min-height: 1.2em;
}

.conversation {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 12px;
  -webkit-overflow-scrolling: touch;
}

.bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.4;
  font-size: 15px;
  animation: rise 0.18s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.bubble--bot {
  align-self: flex-start;
  background: var(--bubble-bot);
  border: 1px solid rgba(77, 217, 255, 0.15);
  border-bottom-left-radius: 4px;
}

.bubble--interim {
  opacity: 0.55;
  font-style: italic;
}

.text-input {
  display: flex;
  gap: 8px;
  background: var(--bg-elev);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 6px 6px 6px 16px;
}

.text-input input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
}

.text-input input::placeholder {
  color: var(--text-dim);
}

.text-input button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #071018;
  font-size: 16px;
  cursor: pointer;
}

.conversation::-webkit-scrollbar {
  width: 6px;
}

.conversation::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}
