* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0b0d12;
  --panel: #151821;
  --accent: #ff6b9d;
  --accent-glow: rgba(255, 107, 157, 0.45);
  --text: #f0f0f5;
  --muted: #9aa0a6;
  --idle: #4a9eff;
  --listen: #00e676;
  --think: #ffca28;
  --speak: #ff6b9d;
  --done: #b388ff;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang HK", "Microsoft JhengHei", sans-serif;
  height: 100dvh;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

#avatar-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

#avatar-background {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 200, 160, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 80%, rgba(255, 107, 157, 0.10) 0%, transparent 40%),
    radial-gradient(ellipse at 25% 80%, rgba(179, 136, 255, 0.08) 0%, transparent 35%),
    linear-gradient(180deg, #14161d 0%, #0b0d12 55%, #08090e 100%);
  z-index: 0;
}

#avatar-ring {
  position: relative;
  z-index: 2;
  width: min(80vmin, 800px);
  height: min(80vmin, 800px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation: avatarBreathe 4s ease-in-out infinite;
}

#avatar-ring.listening {
  transform: scale(1.02);
  box-shadow: 0 0 70px rgba(0, 230, 118, 0.35);
  animation: avatarListenPulse 1s ease-in-out infinite;
}

#avatar-ring.thinking {
  box-shadow: 0 0 70px rgba(255, 202, 40, 0.30);
  animation: avatarThink 1.5s ease-in-out infinite;
}

#avatar-ring.speaking {
  transform: scale(1.03);
  box-shadow:
    0 0 80px var(--accent-glow),
    0 0 140px rgba(255, 107, 157, 0.15);
  animation: avatarSpeakPulse 0.9s ease-in-out infinite;
}

#avatar-ring.done {
  transform: scale(1);
  box-shadow: 0 0 60px rgba(179, 136, 255, 0.25);
}

@keyframes avatarBreathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 50px rgba(255, 107, 157, 0.25); }
  50% { transform: scale(1.015); box-shadow: 0 0 65px rgba(255, 107, 157, 0.32); }
}

@keyframes avatarListenPulse {
  0%, 100% { transform: scale(1.02); box-shadow: 0 0 70px rgba(0, 230, 118, 0.35); }
  50% { transform: scale(1.05); box-shadow: 0 0 95px rgba(0, 230, 118, 0.45); }
}

@keyframes avatarThink {
  0%, 100% { transform: scale(1); box-shadow: 0 0 60px rgba(255, 202, 40, 0.25); }
  50% { transform: scale(1.02); box-shadow: 0 0 80px rgba(255, 202, 40, 0.35); }
}

@keyframes avatarSpeakPulse {
  0%, 100% { transform: scale(1.03); box-shadow: 0 0 80px var(--accent-glow), 0 0 140px rgba(255, 107, 157, 0.12); }
  50% { transform: scale(1.06); box-shadow: 0 0 110px var(--accent-glow), 0 0 180px rgba(255, 107, 157, 0.20); }
}

#avatar-image,
#avatar-video {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  object-fit: cover;
  /* Default object-position is 50% center. Persona overrides via JS
     can shift left (negative %) or right (>50%) to re-frame the
     subject inside the ring. */
  object-position: 50% center;
  border-radius: 50%;
  z-index: 1;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: scale(1);
}

#avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 65% center;
  opacity: 1;
  border-radius: 50%;
}

#avatar-video {
  display: block;
  visibility: hidden;
  object-position: 90% center;
  opacity: 0;
}

#avatar-ring.speaking #avatar-image {
  opacity: 0;
}

#avatar-ring.speaking #avatar-video {
  visibility: visible;
  opacity: 1;
}

/* Listening ripple rings (擴散光環) */
#avatar-listening-rings {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: none;
}
#avatar-ring.listening #avatar-listening-rings {
  display: block;
}
#avatar-listening-rings .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 230, 118, 0.55);
  animation: ringExpand 2.4s ease-out infinite;
  opacity: 0;
}
#avatar-listening-rings .r1 { animation-delay: 0s; }
#avatar-listening-rings .r2 { animation-delay: 0.8s; }
#avatar-listening-rings .r3 { animation-delay: 1.6s; }
@keyframes ringExpand {
  0% { transform: scale(0.85); opacity: 0.8; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* Speaking waveform (底部音波條) */
#avatar-waveform {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 36px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#avatar-ring.speaking #avatar-waveform {
  opacity: 1;
}
#avatar-waveform .bar {
  display: inline-block;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent), #ff9eb7);
  border-radius: 2px;
  animation: wave 0.9s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(255, 107, 157, 0.6);
}
#avatar-waveform .bar:nth-child(1) { animation-delay: 0.0s; }
#avatar-waveform .bar:nth-child(2) { animation-delay: 0.15s; }
#avatar-waveform .bar:nth-child(3) { animation-delay: 0.30s; }
#avatar-waveform .bar:nth-child(4) { animation-delay: 0.45s; }
#avatar-waveform .bar:nth-child(5) { animation-delay: 0.60s; }
@keyframes wave {
  0%, 100% { height: 25%; }
  50% { height: 100%; }
}

/* Floating particles (環境粒子) */
#avatar-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
#avatar-particles .particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: rgba(255, 107, 157, 0.65);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 107, 157, 0.5);
  animation: float 8s ease-in-out infinite;
}
#avatar-particles .p1 { top: 15%; left: 10%; animation-delay: 0s; }
#avatar-particles .p2 { top: 35%; right: 12%; animation-delay: 1.2s; background: rgba(179, 136, 255, 0.65); box-shadow: 0 0 8px rgba(179, 136, 255, 0.5); }
#avatar-particles .p3 { bottom: 25%; left: 18%; animation-delay: 2.4s; background: rgba(255, 200, 160, 0.6); box-shadow: 0 0 8px rgba(255, 200, 160, 0.5); }
#avatar-particles .p4 { top: 60%; right: 8%; animation-delay: 3.6s; }
#avatar-particles .p5 { top: 8%; left: 50%; animation-delay: 4.8s; background: rgba(179, 136, 255, 0.6); box-shadow: 0 0 8px rgba(179, 136, 255, 0.5); }
@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); opacity: 0.6; }
  25% { transform: translateY(-12px) translateX(8px); opacity: 1; }
  50% { transform: translateY(0) translateX(-6px); opacity: 0.6; }
  75% { transform: translateY(12px) translateX(4px); opacity: 0.9; }
}

#status-badge {
  position: relative;
  z-index: 2;
  margin-top: 34px;
  padding: 9px 26px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.2px;
  background: rgba(21, 24, 33, 0.85);
  backdrop-filter: blur(8px);
  color: var(--idle);
  border: 1px solid rgba(255,255,255,0.10);
  transition: all 0.3s ease;
}

#status-badge.listening { color: var(--listen); border-color: rgba(0,230,118,0.35); box-shadow: 0 0 20px rgba(0,230,118,0.20); }
#status-badge.thinking { color: var(--think); border-color: rgba(255,202,40,0.35); box-shadow: 0 0 20px rgba(255,202,40,0.20); }
#status-badge.speaking { color: var(--speak); border-color: rgba(255,107,157,0.35); box-shadow: 0 0 20px rgba(255,107,157,0.20); }
#status-badge.done { color: var(--done); border-color: rgba(179,136,255,0.35); box-shadow: 0 0 20px rgba(179,136,255,0.20); }

#chat-panel {
  width: 420px;
  min-width: 280px;
  max-width: 100%;
  background: var(--panel);
  border-left: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  padding: 16px;
  position: relative;
  box-sizing: border-box;
  overflow-x: hidden;
  /* Fixed width on desktop — let #avatar-container (flex:1) claim most of the screen. */
  flex: 0 0 420px;
  /* min-height:0 lets #messages (flex:1) absorb the remaining vertical space. */
  min-height: 0;
}

#admin-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 20;
}

#admin-controls button {
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.3);
  color: #f0f0f5;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#admin-controls button:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-1px);
}

#restart-server-btn:hover { border-color: #4a9eff; color: #4a9eff; }
#shutdown-server-btn:hover { border-color: #ff5252; color: #ff5252; }

#admin-status { display: none; }

#messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
  padding-right: 4px;
  margin-top: 36px;
}

.message {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
  background: var(--accent);
  color: #1a050a;
  border-bottom-right-radius: 6px;
}

.message.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.06);
  border-bottom-left-radius: 6px;
}

#subtitle-panel#subtitle-panel#assistant-caption.speaking {
  color: var(--speak);
}

#controls {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: flex-end;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  /* Don't let the input area shrink so the messages area can claim all leftover height. */
  flex-shrink: 0;
}

#controls > button {
  flex-shrink: 0;
}

/* Button wrapper for icon + label */
.control-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.control-btn-wrap button {
  margin: 0;
}
.control-label {
  font-size: 9px;
  color: var(--muted, rgba(255,255,255,0.5));
  white-space: nowrap;
  letter-spacing: 0.3px;
  user-select: none;
}

#voice-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#voice-toggle:hover, #voice-toggle.active {
  background: var(--accent);
  color: #1a050a;
  transform: scale(1.05);
}

/* Conversation mode (📞) toggle */
#conversation-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
#conversation-toggle:hover {
  background: rgba(255,107,157,0.25);
  border-color: var(--accent);
  transform: scale(1.05);
}
#conversation-toggle.active {
  background: var(--accent);
  color: #1a050a;
  border-color: var(--accent);
  animation: conversationPulse 1.5s ease-in-out infinite;
}
@keyframes conversationPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 157, 0.7); }
  50% { box-shadow: 0 0 0 12px rgba(255, 107, 157, 0); }
}

/* Conversation mode status badge colors */
.listening_continuous {
  background: linear-gradient(135deg, var(--idle), var(--accent)) !important;
  animation: continuousListen 2s ease-in-out infinite;
}
@keyframes continuousListen {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.interrupted {
  background: linear-gradient(135deg, #ff5722, #ff9800) !important;
}

/* Message action bar */
#message-actions {
  display: flex;
  justify-content: flex-end;
  padding: 4px 0;
  flex-shrink: 0;
}
#clear-history-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-dim, rgba(255,255,255,0.6));
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
#clear-history-btn:hover {
  border-color: var(--accent, #ff6b9d);
  color: var(--accent, #ff6b9d);
}

#mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#mic-btn:hover, #mic-btn.active {
  background: var(--accent);
  color: #1a050a;
  transform: scale(1.05);
}

#text-input {
  flex: 1 1 0;
  min-width: 80px;
  height: 40px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  padding: 0 16px;
  font-size: 14px;
  outline: none;
}

#text-input:focus { border-color: var(--accent); }

#send-btn {
  flex-shrink: 0;
  height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  border: none;
  background: var(--accent);
  color: #1a050a;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

#send-btn:hover { transform: scale(1.03); }

#model-selector,
#persona-selector,
#vad-tuner {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

#model-selector select,
#persona-selector select {
  background: rgba(0,0,0,0.25);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 6px 12px;
  outline: none;
}

#model-selector select:focus,
#persona-selector select:focus { border-color: var(--accent); }

#vad-threshold {
  flex: 1;
  accent-color: var(--accent);
}

#vad-calibrate {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}

/* Hide all legacy CSS-drawn avatar elements */
#avatar-face, #clothing-hint, #hair-back, #hair-front-left, #hair-front-right,
.eye, .eyelash, .eyebrow, #nose, .blush, #mouth,
#shoulder-left, #shoulder-right, #cardigan-left, #cardigan-right {
  display: none !important;
}

/* === Persona Wizard === */
#persona-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

#persona-wizard-toggle {
  padding: 4px 10px;
  background: var(--panel);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}
#persona-wizard-toggle:hover {
  background: var(--accent);
  color: #fff;
}
#persona-wizard-toggle.active {
  background: var(--accent);
  color: #fff;
}

#persona-wizard-panel {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
  margin: 8px 0;
  padding: 14px 16px;
  max-height: 380px;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(255, 107, 157, 0.18);
  animation: slideDown 0.25s ease-out;
}
#persona-wizard-panel[hidden] {
  display: none;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2a2f3a;
}
.wizard-header h3 {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
}
#persona-wizard-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 6px;
}
#persona-wizard-close:hover {
  color: var(--text);
}

.wizard-body label {
  display: block;
  margin-bottom: 10px;
}
.wizard-body label > span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.wizard-body label small {
  display: block;
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
}
.wizard-body input[type="text"],
.wizard-body select {
  width: 100%;
  padding: 6px 8px;
  background: #0f1117;
  border: 1px solid #2a2f3a;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}
.wizard-body input[type="text"]:focus,
.wizard-body select:focus {
  outline: none;
  border-color: var(--accent);
}
.wizard-body input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.wizard-body .slider-label > span > span {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
}

.wizard-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #2a2f3a;
}
.btn-primary, .btn-secondary {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.btn-primary:hover {
  filter: brightness(1.15);
}
.btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid #2a2f3a;
}
.btn-secondary:hover {
  background: #2a2f3a;
  color: var(--text);
}

/* WebSocket status indicator */
.ws-status {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-family: sans-serif;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.9);
  pointer-events: none;
  user-select: none;
  transition: background 0.2s ease;
}
.ws-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #888;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}
.ws-status--unknown { opacity: 0.7; }
.ws-status--unknown .ws-status-dot { background: #888; }
.ws-status--connected { background: rgba(34, 139, 34, 0.6); }
.ws-status--connected .ws-status-dot { background: #4dff4d; box-shadow: 0 0 6px #4dff4d; }
.ws-status--disconnected { background: rgba(178, 34, 34, 0.7); }
.ws-status--disconnected .ws-status-dot { background: #ff5252; box-shadow: 0 0 6px #ff5252; }


/* ============================================================
   Mobile responsive layout (≤ 768px portrait phones)
   - Stack avatar on top (compact), chat panel below (fills remaining).
   - No tabs — both panels visible simultaneously.
   ============================================================ */

/* Tab bar — hidden everywhere now (kept in HTML for future use) */
#mobile-tabs {
  display: none !important;
}

@media (max-width: 768px) {
  /* Vertical column layout: avatar on top, chat fills the rest */
  #app {
    flex-direction: column;
    height: 100dvh; /* dynamic viewport height — handles mobile browser chrome */
    width: 100vw;
    overflow: hidden;
  }

  /* Avatar band fills enough of the upper screen to show the full circle.
       Use a generous min-height so the ring fits without being cropped at
       the top by browser chrome / status bar. */
            #avatar-container {
              flex: 0 0 auto;
              width: 100%;
              height: 38vh;
              min-height: 380px;
              max-height: 460px;
              border-bottom: 1px solid rgba(255,255,255,0.06);
              overflow: hidden;
              justify-content: flex-start;
              padding-top: 24px;
              box-sizing: border-box;
              position: relative;
            }

          /* IDLE badge: pinned to bottom-right of avatar band */
          #status-badge {
            position: absolute;
            right: 12px;
            bottom: 12px;
            margin-top: 0;
            padding: 4px 14px;
            font-size: 11px;
            letter-spacing: 1.2px;
            z-index: 5;
          }

  /* Chat panel takes the remaining vertical space */
  #chat-panel {
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    border-left: none;
    padding: 12px;
    overflow: hidden;
  }

  /* Avatar ring: scaled up so the face is the clear focal point. */
              #avatar-ring {
                width: min(36vh, 360px);
                height: min(36vh, 360px);
                aspect-ratio: 1 / 1;
                flex-shrink: 0;
                margin-left: auto;
                margin-right: auto;
              }

  /* Tighter messages container on mobile */
  #messages {
    margin-top: 8px;
    padding-right: 0;
    gap: 8px;
  }

  /* Larger touch targets for input buttons */
  #controls > button {
    min-width: 44px;
    min-height: 44px;
  }

  /* Compact admin buttons so they don't crowd the avatar */
  #admin-controls {
    top: 8px;
    right: 8px;
  }
  #admin-controls > button {
    padding: 4px 8px;
    font-size: 11px;
  }

  /* Persona selector fits narrow screens */
    #persona-selector select,
    #voice {
      font-size: 13px;
      padding: 6px 10px;
    }

    /* Mobile-only: pin WS indicator inside the avatar band (left) so it
           visually mirrors the IDLE badge (right) and doesn't float into the
           chat area. Positioned to mirror IDLE's effective edge (~14px
           inside the right edge given its 14px horizontal padding). *//* Subtitle panel — keep compact */

    /* Mobile WS indicator: float at the top of the chat panel so it
       doesn't overlap the input row / send button / VAD tuner, which
       all sit at the bottom of the chat panel on phones. */
    .ws-status {
      position: absolute;
      top: 12px;
      left: 12px;
      bottom: auto;
      z-index: 1001;
    }

    /* Mobile send button: lock its width so it stays visible even when
       the input row gets crowded. 44px tall matches the mobile touch
       target guideline. */
    #send-btn {
      flex: 0 0 auto;
      height: 44px;
      min-width: 64px;
      padding: 0 14px;
      font-size: 13px;
    }

    /* Mobile text input: drop the desktop min-width so 3 voice buttons
       + input + send button all fit on narrow screens without the send
       button being pushed off the edge. */
    #text-input {
      min-width: 0;
      flex: 1 1 auto;
      height: 44px;
    }

  /* Persona wizard modal — full screen on mobile */
  #persona-wizard-modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
  }
}

/* Very small phones (≤ 380px) — extra tightening */
@media (max-width: 380px) {
  #avatar-container {
    height: 34vh;
    min-height: 280px;
  }
  #avatar-ring {
    width: min(32vh, 300px);
    height: min(32vh, 300px);
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
  }
}
