html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
}

.circle-wrap {
  position: relative;
  width: 240px;
  height: 240px;
}

.status-circle {
  width: 240px;
  height: 240px;
  border-radius: 999px;
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.10) inset,
    0 18px 60px rgba(0, 0, 0, 0.7);
  transform: scale(1);
  transition:
    background 320ms ease,
    box-shadow 360ms ease,
    transform 140ms ease;
}

.status-ring {
  position: absolute;
  inset: -8px;
  border-radius: 999px;
  border: 8px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  transition:
    border-color 320ms ease,
    box-shadow 420ms ease,
    opacity 220ms ease;
}

@keyframes pulseUser {
  0% {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 18px rgba(245, 158, 11, 0.08);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 34px rgba(245, 158, 11, 0.34);
  }
  100% {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 18px rgba(245, 158, 11, 0.08);
  }
}

@keyframes pulseAgent {
  0% {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 20px rgba(34, 197, 94, 0.18);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 58px rgba(34, 197, 94, 0.78);
  }
  100% {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 20px rgba(34, 197, 94, 0.18);
  }
}

/* Mode + speaking classes controlled by main.js */
.mode-listening #status-ring {
  border-color: rgba(59, 130, 246, 0.70) !important;
}

.mode-detecting #status-ring {
  border-color: rgba(245, 158, 11, 0.80) !important;
}

.mode-wakeword #status-ring {
  border-color: rgba(34, 197, 94, 0.95) !important;
}

.mode-agent-connecting #status-ring {
  border-color: rgba(168, 85, 247, 0.85) !important;
}

.mode-agent-connected #status-ring {
  border-color: rgba(34, 197, 94, 0.95) !important;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 54px rgba(34, 197, 94, 0.55) !important;
}

.user-speaking #status-ring {
  animation: pulseUser 720ms ease-in-out infinite;
}

.agent-speaking #status-ring {
  animation: pulseAgent 520ms ease-in-out infinite;
}

.status-text {
  font-size: 13px;
  letter-spacing: 0.15px;
  opacity: 0.65;
  color: rgba(255, 255, 255, 0.72);
}

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

.settings-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.10) inset,
    0 18px 60px rgba(0, 0, 0, 0.65);
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
  opacity: 0.65;
}

.settings-toggle:hover {
  opacity: 0.95;
  background: rgba(255, 255, 255, 0.14);
}

.settings-toggle:active {
  transform: scale(0.98);
}

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 16px;
}

.panel-overlay[hidden] {
  display: none !important;
}

.panel-card {
  width: 420px;
  max-width: calc(100vw - 32px);
  border-radius: 16px;
  background: rgba(16, 16, 16, 0.92);
  backdrop-filter: blur(10px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.10) inset,
    0 20px 80px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-tabs {
  display: flex;
  gap: 6px;
}

.tab {
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.tab.active {
  background: rgba(80, 170, 255, 0.28);
}

.panel-close {
  border: none;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.panel-body {
  padding: 12px 12px 14px 12px;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.panel-row .k {
  opacity: 0.7;
}

.panel-row .v {
  opacity: 0.95;
  text-align: right;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-section {
  margin-top: 12px;
}

.panel-section-title {
  font-size: 12px;
  opacity: 0.75;
  margin-bottom: 8px;
}

.panel-pre {
  font-size: 12px;
  line-height: 1.35;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px;
  min-height: 64px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.panel-textarea {
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  outline: none;
  resize: vertical;
}

.panel-help {
  font-size: 11px;
  opacity: 0.65;
  margin-top: 6px;
}

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

.panel-range {
  width: 100%;
}

.panel-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  opacity: 0.9;
  min-width: 56px;
  text-align: right;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  cursor: pointer;
  transition: transform 100ms ease, background 120ms ease, opacity 120ms ease;
  opacity: 0.78;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.btn:hover {
  opacity: 0.95;
}

.btn.primary {
  background: rgba(80, 170, 255, 0.18);
}

.btn.primary:hover {
  background: rgba(80, 170, 255, 0.26);
}

.btn.danger {
  background: rgba(255, 80, 80, 0.16);
}

.btn.danger:hover {
  background: rgba(255, 80, 80, 0.24);
}

.meta {
  margin-top: 6px;
  width: 320px;
  max-width: 90vw;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  padding: 12px 14px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  opacity: 0.9;
  padding: 4px 0;
}

.meta-row .label {
  opacity: 0.7;
}

.debug {
  width: 90vw;
  max-width: 720px;
  white-space: pre-wrap;
  font-size: 12px;
  opacity: 0.8;
}
