:root {
  --bg: #f4f6f8;
  --bg-accent: #e8eef2;
  --surface: #ffffff;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --primary: #0f5c5c;
  --primary-hover: #0d4a4a;
  --primary-soft: rgba(15, 92, 92, 0.08);
  --danger: #b91c1c;
  --danger-hover: #991b1b;
  --danger-soft: rgba(185, 28, 28, 0.08);
  --success: #0f5c5c;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 24px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.1);
  --radius: 16px;
  --radius-lg: 24px;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  font-family: var(--font-sans);
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(15, 92, 92, 0.06), transparent),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  filter: blur(60px);
}

body::before {
  width: 320px;
  height: 320px;
  background: rgba(15, 92, 92, 0.12);
  top: -80px;
  right: -60px;
  animation: drift-a 18s ease-in-out infinite;
}

body::after {
  width: 280px;
  height: 280px;
  background: rgba(15, 92, 92, 0.08);
  bottom: -60px;
  left: -40px;
  animation: drift-b 22s ease-in-out infinite;
}

@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 20px) scale(1.08); }
}

@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(24px, -16px) scale(1.05); }
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  position: relative;
  z-index: 2;
}

.panel {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px 32px;
  box-shadow: var(--shadow-md);
  text-align: center;
  animation: panel-in 0.7s var(--ease-out) both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.assistant {
  margin-bottom: 28px;
}

.assistant-ring {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  border: 1px solid rgba(15, 92, 92, 0.12);
  animation: float 4s ease-in-out infinite, fade-in 0.8s var(--ease-out) 0.15s both;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.assistant-ring.live {
  animation: float-live 3s ease-in-out infinite, pulse-ring 2.4s ease-in-out infinite;
}

@keyframes float-live {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.02); }
}

@keyframes pulse-ring {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(15, 92, 92, 0.25);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(15, 92, 92, 0);
  }
}

.voice-bars {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.voice-bars span {
  display: block;
  width: 3px;
  height: 6px;
  border-radius: 2px;
  background: var(--primary);
  transform-origin: bottom;
}

.assistant-ring.live .voice-bars {
  opacity: 1;
}

.assistant-ring.live .voice-bars span {
  animation: voice-bar 0.9s ease-in-out infinite;
}

.assistant-ring.live .voice-bars span:nth-child(1) { animation-delay: 0s; }
.assistant-ring.live .voice-bars span:nth-child(2) { animation-delay: 0.12s; }
.assistant-ring.live .voice-bars span:nth-child(3) { animation-delay: 0.24s; }
.assistant-ring.live .voice-bars span:nth-child(4) { animation-delay: 0.12s; }
.assistant-ring.live .voice-bars span:nth-child(5) { animation-delay: 0.18s; }

@keyframes voice-bar {
  0%, 100% { height: 6px; opacity: 0.5; }
  50% { height: 16px; opacity: 1; }
}

.assistant-avatar {
  width: 48px;
  height: 48px;
  color: var(--primary);
  transition: transform 0.4s var(--ease-out);
}

.assistant-ring.live .assistant-avatar {
  animation: avatar-breathe 2s ease-in-out infinite;
}

@keyframes avatar-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.assistant-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.assistant-name {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 4px;
  animation: fade-in 0.8s var(--ease-out) 0.25s both;
}

.assistant-role {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  font-weight: 400;
  animation: fade-in 0.8s var(--ease-out) 0.35s both;
}

.status-block {
  margin-bottom: 28px;
  min-height: 52px;
  animation: fade-in 0.8s var(--ease-out) 0.45s both;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.status-dot.active {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(15, 92, 92, 0.15);
  animation: dot-pulse 1.8s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.status {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  transition: color 0.3s ease, opacity 0.3s ease;
}

.status.active {
  color: var(--primary);
}

.status.error {
  color: var(--danger);
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 6px;
  min-height: 1.25em;
  letter-spacing: 0.04em;
  animation: timer-in 0.3s var(--ease-out);
}

@keyframes timer-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fade-in 0.8s var(--ease-out) 0.55s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  width: 100%;
  padding: 14px 24px;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.12) 50%,
    transparent 60%
  );
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}

.btn-primary:hover:not(:disabled)::after {
  transform: translateX(120%);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.controls {
  display: none;
  gap: 10px;
}

.controls.visible {
  display: flex;
  animation: controls-in 0.45s var(--ease-out) both;
}

@keyframes controls-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-secondary,
.btn-danger {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
  border-color: #cbd5e1;
}

.btn-secondary.muted {
  opacity: 0.55;
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.2);
  background: var(--danger-soft);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 1;
}

.backdrop.show {
  opacity: 1;
  pointer-events: all;
}

.footer {
  margin-top: 24px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  word-break: break-all;
  max-width: 400px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 440px) {
  .panel {
    padding: 40px 24px 24px;
  }

  .assistant-name {
    font-size: 1.5rem;
  }
}
