:root {
  --bg: #0d0d1e;
  --bg-2: #14142b;
  --surface: #1a1a35;
  --surface-2: #1f1f3a;
  --border: rgba(138, 138, 170, 0.14);
  --border-strong: rgba(138, 138, 170, 0.26);
  --text: #e6e6f0;
  --text-strong: #ffffff;
  --muted: #8a8aaa;
  --muted-2: #5d5d80;
  --cyan: #00d4ff;
  --magenta: #d6336c;
  --violet: #8b5cf6;
  --success: #4ade80;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; overscroll-behavior: none; }
html { height: 100%; }
body {
  background:
    radial-gradient(800px 600px at 50% -10%, rgba(0, 212, 255, 0.10), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, rgba(214, 51, 108, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, 'Inter', system-ui, sans-serif;
  font-feature-settings: 'tnum' 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  /* Use dynamic viewport height so Safari's collapsing UI doesn't break layout */
  height: 100dvh;
  min-height: 100dvh;
}
@supports not (height: 100dvh) {
  body { height: 100vh; min-height: 100vh; }
}

button { font-family: inherit; color: inherit; cursor: pointer; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }

/* ── Top bar ── */
.topbar {
  display: grid;
  grid-template-columns: 44px 1fr 60px;
  align-items: center;
  padding: 12px 16px;
  height: 60px;
  position: relative;
  z-index: 4;
}
.iconbtn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  display: grid; place-items: center;
  padding: 0;
}
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn:active { background: rgba(0, 212, 255, 0.10); color: var(--cyan); }
.iconbtn .icon-muted { display: none; }
.iconbtn[aria-pressed="true"] { background: rgba(214, 51, 108, 0.18); border-color: rgba(214, 51, 108, 0.40); color: #ffb4c8; }
.iconbtn[aria-pressed="true"] .icon-volume { display: none; }
.iconbtn[aria-pressed="true"] .icon-muted { display: block; }

.brand {
  display: flex; align-items: center; gap: 8px;
  justify-content: center;
}
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: conic-gradient(from 90deg, var(--cyan), var(--violet), var(--magenta), var(--cyan));
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.55);
}
.brand-name {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.05em;
  background: linear-gradient(90deg, var(--cyan), #fff 55%, var(--magenta));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1;
}

.provider-btn { width: auto; padding: 0 10px; border-radius: 999px; }
.provider-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--cyan);
}

/* ── Connection chip ── */
.conn-chip {
  display: flex; align-items: center; gap: 6px;
  align-self: center;
  margin: 0 auto;
  padding: 4px 12px 4px 10px;
  background: rgba(31, 31, 58, 0.6);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  backdrop-filter: blur(8px);
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted-2);
}
.dot.online { background: var(--success); box-shadow: 0 0 8px rgba(74, 222, 128, 0.6); }
.dot.busy { background: var(--magenta); box-shadow: 0 0 8px rgba(214, 51, 108, 0.6); }
.dot.error { background: #ef4444; }

/* ── Stage: orb absolute-positioned at center of viewport. Log floats on top, display sits below orb. ── */
.stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 16px 0;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

.orb-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(86vw, 380px, 42dvh);
  aspect-ratio: 1.5 / 1;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.4s ease;
}
/* Fade orb when there are messages — let the chat be the focus */
body.has-messages .orb-stage {
  opacity: 0.18;
}
.orb-stage canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

.display {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: 0;
  padding: 12px 0 4px;
  flex-shrink: 0;
}
.display-status {
  margin: 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: clamp(20px, 6vw, 28px);
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-strong);
  line-height: 1;
  /* Fade upward — text dissolves at top, solid at bottom */
  -webkit-mask-image: linear-gradient(to top, #000 35%, rgba(0,0,0,0.6) 75%, transparent 100%);
  mask-image: linear-gradient(to top, #000 35%, rgba(0,0,0,0.6) 75%, transparent 100%);
}
.display-status .dots span { display: inline-block; animation: blink 1.4s infinite both; }
.display-status .dots span:nth-child(2) { animation-delay: 0.2s; }
.display-status .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40%           { opacity: 1; }
}
.display-sub {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

/* ── Log: relative, floats over the absolute orb behind ── */
.log {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 2px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  user-select: text;
  -webkit-user-select: text;
  /* Fade at both edges — messages dissolve as they scroll past top/bottom */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 8%, #000 92%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 8%, #000 92%, transparent 100%);
}
.bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid var(--border);
  animation: bubble-in 0.22s ease;
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.bubble.user {
  align-self: flex-end;
  background: rgba(0, 212, 255, 0.10);
  border-color: rgba(0, 212, 255, 0.38);
}
.bubble.ai {
  align-self: flex-start;
  background: rgba(31, 31, 58, 0.75);
}
.bubble.system {
  align-self: center;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.bubble.error {
  align-self: stretch;
  background: rgba(214, 51, 108, 0.10);
  border-color: rgba(214, 51, 108, 0.35);
  color: #ffb4c8;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

/* ── Mic area: symmetric layout with raised bottom padding to lift the button ── */
.mic-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 16px 72px;
  flex-shrink: 0;
  z-index: 2;
}
body[data-mode="text"] .mic-area { display: none; }

.mic-waveform { height: 26px; }
.mic-hint { font-size: 11px; height: 14px; letter-spacing: 0.08em; }
.mic-waveform {
  width: 100%;
  max-width: 320px;
  height: 36px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.mic-area.recording .mic-waveform { opacity: 1; }
.mic-hint {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: lowercase;
  height: 14px;
}
.mic-area.recording .mic-hint { color: var(--magenta); }
.mic-area.cancel .mic-hint { color: #ff7e9e; }

.mic-btn {
  width: clamp(68px, 18vw, 84px);
  height: clamp(68px, 18vw, 84px);
  border-radius: 50%;
  background: rgba(20, 20, 43, 0.95);
  border: 1px solid rgba(0, 212, 255, 0.45);
  color: var(--cyan);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(0, 212, 255, 0.20),
    0 0 28px rgba(0, 212, 255, 0.18),
    0 12px 28px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  touch-action: none;
}
.mic-btn svg { width: 30px; height: 30px; }
.mic-btn:active { transform: scale(0.95); }
.mic-area.recording .mic-btn {
  background: rgba(214, 51, 108, 0.22);
  border-color: var(--magenta);
  color: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(214, 51, 108, 0.45),
    0 0 38px rgba(214, 51, 108, 0.40),
    0 12px 28px rgba(0, 0, 0, 0.5);
}
.mic-area.cancel .mic-btn {
  background: rgba(214, 51, 108, 0.32);
  transform: translateY(-6px) scale(0.92);
}

.text-toggle {
  position: absolute;
  right: 18%;
  bottom: 78px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(31, 31, 58, 0.7);
  border: 1px solid var(--border);
  color: var(--muted);
  display: grid; place-items: center;
  backdrop-filter: blur(14px);
  transition: all 0.18s ease;
}
.text-toggle svg { width: 18px; height: 18px; }
.text-toggle:active { transform: scale(0.94); color: var(--cyan); }

/* ── Composer (text mode) — hidden by default, shown only via data-mode ── */
.composer {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: rgba(13, 13, 30, 0.95);
  backdrop-filter: blur(14px);
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 6;
}
body[data-mode="text"] .composer { display: flex; }
.composer input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--text);
  font-size: 16px;
  padding: 10px 16px;
  outline: none;
}
.composer input:focus { border-color: var(--cyan); }
.send-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  background: rgba(0, 212, 255, 0.15);
  color: var(--cyan);
  font-weight: 700;
  font-size: 18px;
}

/* ── Drawer ── */
.drawer {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: min(86vw, 360px);
  background: var(--bg);
  border-right: 1px solid var(--border-strong);
  z-index: 20;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
.drawer.open { transform: translateX(0); }
#settings-drawer {
  left: auto; right: 0;
  border-right: none;
  border-left: 1px solid var(--border-strong);
  transform: translateX(100%);
}
#settings-drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h2 {
  margin: 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.new-session-btn {
  margin: 14px 16px 8px;
  padding: 14px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px dashed rgba(0, 212, 255, 0.4);
  border-radius: 14px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
}
.new-session-btn .plus {
  display: grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0, 212, 255, 0.15);
  font-size: 16px;
  line-height: 1;
}

.sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 16px;
  display: flex; flex-direction: column; gap: 10px;
}

.m-session {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
}
.m-session.active { border-color: rgba(0, 212, 255, 0.45); box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.25); }
.m-session-head {
  display: flex; align-items: center; justify-content: space-between;
}
.m-session-time {
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  color: var(--muted); text-transform: uppercase;
}
.m-session-live {
  font-size: 9px; font-weight: 700; letter-spacing: 0.16em;
  padding: 2px 6px; border-radius: 999px;
  background: rgba(74, 222, 128, 0.10);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.35);
}
.m-session-preview {
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.m-session-meta {
  display: flex; justify-content: space-between;
  font-size: 10px; letter-spacing: 0.10em; color: var(--muted);
}
.m-session-meta .msgs { color: var(--cyan); font-weight: 600; }

.settings-link {
  display: flex; align-items: center; gap: 10px;
  margin: 0 16px 16px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 13px;
}
.settings-link svg { width: 18px; height: 18px; }

/* ── Settings drawer body ── */
.settings-section {
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}
.setting-label {
  font-size: 13px;
  color: var(--text);
}
.setting-segment {
  display: inline-flex;
  background: var(--bg-2);
  border-radius: 999px;
  padding: 3px;
  gap: 0;
}
.setting-segment .seg {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px; font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}
.setting-segment .seg.active {
  background: rgba(0, 212, 255, 0.18);
  color: var(--text-strong);
}
.setting-select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
}

.setting-toggle { position: relative; width: 44px; height: 26px; }
.setting-toggle input { opacity: 0; width: 0; height: 0; }
.setting-toggle .track {
  position: absolute; inset: 0;
  background: rgba(138, 138, 170, 0.2);
  border-radius: 999px;
  transition: background 0.2s;
}
.setting-toggle .knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.setting-toggle input:checked + .track {
  background: rgba(0, 212, 255, 0.55);
}
.setting-toggle input:checked + .track .knob {
  transform: translateX(18px);
}

.settings-info {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.kv {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.k {
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  color: var(--cyan);
  text-transform: uppercase;
}
.v {
  font-size: 12px;
  color: var(--text-strong);
  text-align: right;
  word-break: break-all;
  max-width: 70%;
}

/* ── Drawer scrim ── */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 15;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.drawer-scrim.visible {
  opacity: 1;
}

/* ── QR Scanner overlay ── */
.scanner-overlay[hidden] { display: none !important; }
.scanner-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}
.scanner-overlay video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.scanner-frame {
  position: relative;
  width: min(72vw, 280px);
  height: min(72vw, 280px);
  border: 2px solid var(--cyan);
  border-radius: 24px;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.6),
    0 0 24px rgba(0, 212, 255, 0.4);
  z-index: 1;
}
.scanner-frame::before,
.scanner-frame::after,
.scanner-frame > span {
  /* corner brackets */
  content: none;
}
.scanner-hint {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 2;
  color: #fff;
  max-width: 86%;
}
.scanner-hint h2 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: 22px;
  margin: 0 0 6px;
}
.scanner-hint p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}
.scanner-cancel {
  position: absolute;
  top: calc(20px + var(--safe-top));
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  z-index: 3;
  backdrop-filter: blur(10px);
}

/* ── Pair CTA (shown before scanner) ── */
.pair-cta[hidden] { display: none !important; }
.pair-cta {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 80;
  background:
    radial-gradient(800px 600px at 50% 20%, rgba(0, 212, 255, 0.18), transparent 60%),
    radial-gradient(800px 600px at 50% 80%, rgba(214, 51, 108, 0.18), transparent 60%),
    var(--bg);
  display: grid;
  place-items: center;
  padding: 24px 20px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
}
.pair-cta-content {
  text-align: center;
  max-width: 360px;
  width: 100%;
}
.pair-cta-orb {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid rgba(0, 212, 255, 0.4);
  margin: 0 auto 28px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 212, 255, 0.18), transparent 70%);
  box-shadow: 0 0 36px rgba(0, 212, 255, 0.25);
  animation: pair-orb-pulse 3s ease-in-out infinite;
}
.pair-cta-orb-inner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: conic-gradient(from 90deg, var(--cyan), var(--violet), var(--magenta), var(--cyan));
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.7);
}
@keyframes pair-orb-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 36px rgba(0, 212, 255, 0.25); }
  50%      { transform: scale(1.04); box-shadow: 0 0 56px rgba(0, 212, 255, 0.40); }
}
.pair-cta h1 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: 0.01em;
  color: var(--text-strong);
  margin: 0 0 8px;
}
.pair-cta p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 28px;
}
.cta-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(214, 51, 108, 0.12));
  border: 1px solid rgba(0, 212, 255, 0.5);
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s ease;
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.15);
}
.cta-primary:active { transform: scale(0.98); }
.pair-cta-or {
  margin: 24px 0 12px;
  color: var(--muted-2);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.pair-cta-manual {
  display: flex;
  gap: 8px;
  width: 100%;
}
.pair-cta-manual input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-strong);
  font-size: 16px;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.1em;
  padding: 12px 14px;
  text-align: center;
  text-transform: uppercase;
  outline: none;
}
.pair-cta-manual input:focus {
  border-color: var(--cyan);
}
.cta-secondary {
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(0, 212, 255, 0.12);
  border: 1px solid rgba(0, 212, 255, 0.35);
  color: var(--cyan);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.cta-secondary:active { transform: scale(0.96); }

/* ── Responsive: very short screens (iPhone SE / mini portrait) ── */
@media (max-height: 700px) {
  .topbar { height: 52px; padding: 8px 14px; }
  .brand-name { font-size: 18px; }
  .conn-chip { font-size: 10px; padding: 3px 10px 3px 8px; }
  .display-status { font-size: 22px; }
  .display-sub { font-size: 10px; margin-top: 4px; }
  .orb-stage { width: min(100%, 360px, 42dvh); }
  .stage { padding: 2px 14px 0; }
  .mic-area { padding: 4px 16px 8px; gap: 4px; }
  .mic-waveform { height: 22px; }
  .text-toggle { right: 16px; bottom: 26px; width: 36px; height: 36px; }
}

@media (max-height: 580px) {
  .display { display: none; }  /* drop display text on very short screens */
  .orb-stage { width: min(100%, 320px, 38dvh); }
  .mic-btn { width: 60px; height: 60px; }
  .mic-btn svg { width: 24px; height: 24px; }
}

/* ── Responsive: narrow screens ── */
@media (max-width: 360px) {
  .topbar { grid-template-columns: 40px 1fr 56px; padding: 10px 12px; }
  .iconbtn { width: 34px; height: 34px; }
  .iconbtn svg { width: 16px; height: 16px; }
  .brand-name { font-size: 18px; }
  .provider-btn { padding: 0 8px; }
  .provider-pill { font-size: 9px; }
  .bubble { font-size: 13px; padding: 8px 12px; }
}

/* ───── Approval popup (sticky alert from webhook) ───── */
.approval-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center,
    rgba(8, 8, 18, 0.85) 0%,
    rgba(8, 8, 18, 0.96) 70%,
    rgba(8, 8, 18, 1.0) 100%);
  backdrop-filter: blur(28px) saturate(1.1);
  -webkit-backdrop-filter: blur(28px) saturate(1.1);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 24px;
  padding-top: env(safe-area-inset-top, 24px);
  padding-bottom: env(safe-area-inset-bottom, 24px);
  animation: approval-fade-in 0.3s ease;
}
.approval-overlay[hidden] { display: none; }
@keyframes approval-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.approval-modal {
  background: linear-gradient(180deg, rgba(20, 20, 38, 0.98), rgba(13, 13, 30, 0.98));
  border: 2px solid rgba(0, 212, 255, 0.4);
  border-radius: 22px;
  padding: 32px 28px;
  width: 100%;
  max-width: 460px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.7),
    0 0 100px rgba(0, 212, 255, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: approval-modal-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes approval-modal-in {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.approval-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(90deg, #00d4ff 0%, #ffffff 50%, #d6336c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 14px rgba(0, 212, 255, 0.25));
}
.approval-message {
  color: rgba(240, 240, 248, 0.95);
  line-height: 1.5;
  font-size: 16px;
  white-space: pre-wrap;
  max-height: 40vh;
  overflow-y: auto;
  padding: 18px 20px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 14px;
  border: 1px solid rgba(0, 212, 255, 0.15);
  text-align: center;
}
.approval-actions {
  display: flex;
  gap: 12px;
  justify-content: stretch;
}
.approval-btn {
  flex: 1;
  padding: 16px 20px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.approval-btn.approve {
  background: linear-gradient(90deg, #4ade80, #22c55e);
  color: #0d1a0d;
}
.approval-btn.reject {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(230, 230, 240, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Claude Code auth banner on iPhone */
.auth-banner {
  position: fixed;
  top: env(safe-area-inset-top, 0);
  left: 0;
  right: 0;
  z-index: 8000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(214, 51, 108, 0.25), rgba(0, 212, 255, 0.18));
  border-bottom: 1px solid rgba(255, 200, 100, 0.35);
  color: #ffe7a5;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.auth-banner[hidden] { display: none; }
.auth-banner svg { color: #ffd166; flex-shrink: 0; }
.auth-banner span { flex: 1; }
#auth-banner-close {
  background: transparent;
  border: none;
  color: rgba(255, 231, 165, 0.5);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
  -webkit-tap-highlight-color: transparent;
}
