/* Mr.Smith — Xiaohongshu / WPS-embed style digital human */
:root {
  --bg: #0a1020;
  --glass: rgba(18, 28, 48, 0.55);
  --glass-strong: rgba(16, 24, 42, 0.78);
  --glass-border: rgba(255, 255, 255, 0.16);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent2: #818cf8;
  --purple: #7c3aed;
  --purple2: #a78bfa;
  --teacher: #67e8f9;
  --student: #c4b5fd;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 20px;
  --bubble-font: 0.95rem;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

.app[data-font="sm"] { --bubble-font: 0.82rem; }
.app[data-font="md"] { --bubble-font: 0.95rem; }
.app[data-font="lg"] { --bubble-font: 1.12rem; }
.app[data-font="xl"] { --bubble-font: 1.32rem; }

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.app {
  position: relative;
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
}

/* ---- Classroom / PPT backdrop ---- */
.classroom-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(99, 102, 241, 0.22), transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 90%, rgba(124, 58, 237, 0.16), transparent 55%),
    linear-gradient(180deg, #101a30 0%, #0a1020 55%, #070c16 100%);
}
.classroom-bg .board {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 6%;
  height: 42%;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(30, 58, 48, 0.55), rgba(15, 35, 28, 0.4));
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.25);
  opacity: 0.55;
}
.classroom-bg .board::after {
  content: "English Class · Mr.Smith";
  position: absolute;
  left: 24px;
  top: 18px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: rgba(167, 243, 208, 0.35);
  font-weight: 600;
}
.classroom-bg .board-glow {
  position: absolute;
  left: 20%;
  right: 20%;
  top: 38%;
  height: 80px;
  background: radial-gradient(ellipse, rgba(99, 102, 241, 0.25), transparent 70%);
  filter: blur(20px);
}
.classroom-bg .desk-line {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 28%;
  background: linear-gradient(180deg, transparent, rgba(15, 23, 42, 0.65));
}

/* ---- Full-bleed avatar ---- */
video.avatar-full {
  background: #0b1020;
}

/* Dual-video lip-sync: toggle visibility instead of swapping src */
.avatar-full.is-hidden {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
}
.avatar-full.avatar-idle,
.avatar-full.avatar-talk {
  z-index: 1;
}
.avatar-full.avatar-talk:not(.is-hidden) {
  z-index: 2;
}

/* Motion comes from the idle video; skip CSS bob on desktop & mobile */
.avatar-stage .avatar-full {
  animation: none !important;
}
.app[data-screen="chat"] .avatar-full,
.app[data-screen="chat"] .avatar-stage.talking .avatar-full,
.avatar-stage.talking .avatar-full {
  animation: none !important;
}
@media (max-width: 720px) {
  .app[data-screen="chat"] .avatar-full,
  .avatar-stage.talking .avatar-full {
    animation: none !important;
  }
}

.avatar-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.avatar-full {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center center;
  user-select: none;
  -webkit-user-drag: none;
  filter: none;
  animation: none;
  transition: filter 0.3s ease, transform 0.3s ease;
}
.avatar-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(8, 12, 24, 0.15) 0%,
    transparent 35%,
    transparent 55%,
    rgba(8, 12, 24, 0.55) 100%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
}
.app[data-screen="chat"] .avatar-veil { opacity: 1; }
.app[data-screen="chat"] .avatar-full {
  transform: none;
  height: 100%;
}
@media (max-width: 720px) {
  .app[data-screen="chat"] .avatar-full {
    transform: none;
    height: 100%;
    opacity: 1;
  }
}

.speak-glow {
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: 55%;
  height: 40%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(99, 102, 241, 0.35), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s;
  filter: blur(18px);
}
.avatar-stage.talking .speak-glow { opacity: 1; animation: glow-pulse 0.7s ease-in-out infinite; }
.avatar-stage.talking .avatar-full,
.app[data-screen="chat"] .avatar-stage.talking .avatar-full {
  animation: none !important;
  filter: brightness(1.05);
}

@keyframes idle-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.app[data-screen="chat"] .avatar-full {
  animation: none;
}
@keyframes idle-bob-chat {
  0%, 100% { transform: translateX(-8%) translateY(0); }
  50% { transform: translateX(-8%) translateY(-5px); }
}
@media (max-width: 720px) {
  .app[data-screen="chat"] .avatar-full {
    animation: idle-bob 4s ease-in-out infinite;
  }
  .avatar-stage.talking .avatar-full {
    animation: talk-bob 0.4s ease-in-out infinite;
  }
}
@keyframes talk-bob {
  0%, 100% { transform: translateX(-8%) translateY(0) scale(1); }
  50% { transform: translateX(-8%) translateY(-3px) scale(1.012); }
}
@media (max-width: 720px) {
  @keyframes talk-bob {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.012); }
  }
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ---- Glass utility ---- */
.glass-panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--shadow);
}

.glass-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.glass-icon:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(129, 140, 248, 0.5);
}
.glass-icon:active { transform: scale(0.95); }

/* ---- Top chrome ---- */
.chrome-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  pointer-events: none;
}
.chrome-top > * { pointer-events: auto; }

.brand-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
  flex-shrink: 0;
  transition: background 0.25s, box-shadow 0.25s;
}
.status-dot.listening { background: var(--danger); box-shadow: 0 0 12px var(--danger); animation: pulse 1s infinite; }
.status-dot.speaking { background: var(--accent2); box-shadow: 0 0 12px var(--accent2); animation: pulse 0.8s infinite; }
.status-dot.thinking { background: var(--warn); box-shadow: 0 0 12px var(--warn); animation: pulse 1.2s infinite; }
.status-dot.error { background: var(--danger); box-shadow: none; }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.65; }
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: 0.92rem; }
.brand-copy span { font-size: 0.68rem; color: var(--muted); }
.chrome-actions { display: flex; gap: 8px; }

/* ---- Screens ---- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}
.screen > * { pointer-events: auto; }
.screen[hidden] { display: none !important; }

/* HOME */
.screen-home {
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px 36px;
  gap: 18px;
}
.home-nameplate {
  text-align: center;
  margin-bottom: 4px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}
.home-nameplate h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.home-nameplate p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.home-actions {
  justify-content: center;

  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  width: 100%;
  max-width: 480px;
}
.cta {
  flex: 1 1 180px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.cta:hover { transform: translateY(-2px); filter: brightness(1.08); }
.cta:active { transform: scale(0.98); }
.cta-ico { display: grid; place-items: center; }
.cta-call {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 55%, #5b21b6 100%);
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.45);
}
.cta-chat {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.cta-answer {
  width: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  margin-top: 8px;
}
.home-hint {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(148, 163, 184, 0.8);
  text-align: center;
}

/* RING */
.screen-ring {
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}
.ring-card {
  width: min(340px, 90vw);
  border-radius: 28px;
  padding: 28px 24px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.ring-avatar {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(167, 139, 250, 0.55);
}
.ring-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.ring-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(167, 139, 250, 0.6);
  animation: ring 1.4s infinite;
}
@keyframes ring {
  0% { transform: scale(0.95); opacity: 1; }
  100% { transform: scale(1.35); opacity: 0; }
}
.ring-meta strong { display: block; font-size: 1.2rem; }
.ring-meta span { color: var(--muted); font-size: 0.88rem; }
.ring-waves {
  display: flex;
  gap: 6px;
  height: 28px;
  align-items: flex-end;
}
.ring-waves i {
  display: block;
  width: 5px;
  border-radius: 3px;
  background: var(--purple2);
  animation: wave 0.9s ease-in-out infinite;
}
.ring-waves i:nth-child(1) { height: 10px; animation-delay: 0s; }
.ring-waves i:nth-child(2) { height: 20px; animation-delay: 0.15s; }
.ring-waves i:nth-child(3) { height: 14px; animation-delay: 0.3s; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.5); opacity: 0.6; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* CHAT */
.screen-chat {
  pointer-events: none;
}
.screen-chat > * { pointer-events: auto; }

.chat-float {
  position: absolute;
  top: 68px;
  right: 16px;
  bottom: 150px;
  width: min(420px, 48vw);
  max-width: calc(100% - 32px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 4px 8px;
  scroll-behavior: smooth;
  mask-image: linear-gradient(180deg, transparent 0%, #000 8%, #000 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 8%, #000 92%, transparent 100%);
}
@media (max-width: 720px) {
  .chat-float {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 168px;
    top: 62px;
  }
}

.bubble {
  max-width: 100%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: var(--bubble-font);
  line-height: 1.5;
  animation: fadeIn 0.28s ease;
  word-break: break-word;
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.bubble.teacher {
  align-self: flex-start;
  background: rgba(15, 40, 70, 0.62);
  border-color: rgba(103, 232, 249, 0.22);
  border-bottom-left-radius: 6px;
}
.bubble.student {
  align-self: flex-end;
  background: rgba(55, 30, 90, 0.62);
  border-color: rgba(196, 181, 253, 0.28);
  border-bottom-right-radius: 6px;
}
.bubble .who {
  display: block;
  font-size: 0.68em;
  font-weight: 650;
  margin-bottom: 4px;
  opacity: 0.8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bubble.teacher .who { color: var(--teacher); }
.bubble.student .who { color: var(--student); }
.bubble.system {
  align-self: center;
  background: rgba(15, 23, 42, 0.5);
  color: var(--muted);
  font-size: 0.78rem;
  padding: 8px 14px;
  border-style: dashed;
}

/* Evaluation card */
.eval-card {
  align-self: stretch;
  background: linear-gradient(145deg, rgba(30, 27, 60, 0.78), rgba(15, 35, 55, 0.72));
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 20px;
  padding: 16px 18px 14px;
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  animation: fadeIn 0.3s ease;
}
.eval-card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fde68a;
}
.eval-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.88rem;
}
.eval-row:last-of-type { border-bottom: none; }
.eval-row .label { color: var(--muted); min-width: 4.5em; }
.eval-row .stars { letter-spacing: 1px; color: #fbbf24; font-size: 1rem; }
.eval-row .score { font-weight: 700; color: #fef3c7; min-width: 2.5em; text-align: right; }
.eval-feedback {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.88rem;
  line-height: 1.45;
  color: #e2e8f0;
}

/* Chips */
.chips-float {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 108px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  z-index: 15;
}
@media (max-width: 720px) {
  .chips-float { bottom: 126px; }
}
.chip {
  border: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent2); background: rgba(99, 102, 241, 0.25); }
.chip:active { transform: scale(0.97); }
.chip-eval {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fcd34d;
}

/* Bottom dock */
.dock {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 20;
  width: min(720px, calc(100% - 24px));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
}
.dock-mic {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(129, 140, 248, 0.45);
  background: linear-gradient(145deg, #4f46e5, #6366f1);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.45);
  transition: transform 0.15s, background 0.15s;
}
.dock-mic:hover { transform: scale(1.06); }
.dock-mic.active {
  background: linear-gradient(145deg, #b91c1c, #ef4444);
  border-color: rgba(248, 113, 113, 0.55);
  animation: mic-pulse 1.2s infinite;
}
.dock-mic .mic-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
}
.dock-mic.active .mic-ring {
  border-color: rgba(248, 113, 113, 0.55);
  animation: ring 1.2s infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

.dock-modes {
  display: flex;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.dock-modes::-webkit-scrollbar { display: none; }
.mode-btn {
  flex: 1 0 auto;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.62rem;
  line-height: 1.1;
  transition: color 0.15s, background 0.15s;
}
.mode-btn .mode-ico { font-size: 0.95rem; }
.mode-btn:hover { color: var(--text); }
.mode-btn.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.35);
}
@media (max-width: 520px) {
  .mode-btn span:not(.mode-ico) { display: none; }
  .mode-btn { padding: 8px; }
}

.dock-center {
  flex-shrink: 0;
  min-width: 130px;
  height: 42px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.4);
  white-space: nowrap;
  transition: filter 0.15s, transform 0.1s;
}
.dock-center:hover { filter: brightness(1.08); }
.dock-center:active { transform: scale(0.97); }
.dock-center.listening {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}
@media (max-width: 520px) {
  .dock-center { min-width: 0; padding: 0 12px; font-size: 0.72rem; }
}

.dock-home {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.4);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1rem;
}
.dock-home:hover { color: var(--text); border-color: var(--accent2); }

/* Text composer */
.text-composer {
  position: absolute;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  z-index: 19;
  width: min(560px, calc(100% - 24px));
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 18px;
  align-items: center;
}
.text-composer[hidden] { display: none !important; }
.text-composer input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 0 10px;
  font-size: 0.95rem;
  outline: none;
}
.text-composer input::placeholder { color: #64748b; }
.send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
  flex-shrink: 0;
}
.send-btn:hover { background: #4f46e5; }

/* Toast */
.toast {
  position: absolute;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  z-index: 40;
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  font-size: 0.85rem;
  color: var(--text);
  max-width: min(420px, 90vw);
  text-align: center;
  box-shadow: var(--shadow);
  animation: fadeIn 0.25s ease;
}
.toast[hidden] { display: none !important; }

/* Settings modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 16px;
  backdrop-filter: blur(6px);
}
.modal-backdrop[hidden] { display: none !important; }

.modal {
  width: min(480px, 100%);
  max-height: min(88dvh, 720px);
  border-radius: 22px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--glass-strong);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-scroll {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 2px;
  min-height: 0;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--muted);
}
.field span, .field legend {
  color: #cbd5e1;
  font-weight: 600;
  font-size: 0.82rem;
}
.field em {
  font-style: normal;
  color: var(--accent2);
  font-weight: 700;
  margin-left: 6px;
}
.field-hint { color: #64748b; font-size: 0.72rem; }
.field input[type="url"],
.field input[type="password"],
.field input[type="text"],
.field select,
.field textarea {
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(8, 12, 24, 0.65);
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
}
.field textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.45;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.field input[type="range"] {
  width: 100%;
  accent-color: var(--accent2);
}
.font-size-field {
  border: none;
  margin: 0;
  padding: 0;
}
.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.seg-btn {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(8, 12, 24, 0.5);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
}
.seg-btn.active {
  background: rgba(99, 102, 241, 0.4);
  color: #fff;
  border-color: rgba(129, 140, 248, 0.55);
}
.api-block {
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.18);
}
.api-block summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 8px;
}
.api-block .hint {
  margin: 0 0 10px;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}
.api-block .field { margin-bottom: 8px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.btn {
  height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  cursor: pointer;
  font-size: 0.9rem;
}
.btn.primary {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  border-color: transparent;
}
.btn.ghost { background: transparent; color: var(--muted); }
.cfg-status {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ok);
  min-height: 1.2em;
}

@media (prefers-reduced-motion: reduce) {
  .avatar-full, .speak-glow, .status-dot, .dock-mic, .bubble, .ring-pulse, .ring-waves i {
    animation: none !important;
  }
}

.home-actions .cta-chat { min-width: 220px; }
