:root {
  --background: 250 45% 98%;
  --foreground: 248 38% 12%;
  --primary: 268 86% 56%;
  --secondary: 190 88% 34%;
  --muted: 252 32% 92%;
  --destructive: 352 78% 52%;
  --border: 250 28% 84%;
  --card: 0 0% 100%;
  --shadow-sm: 0 4px 14px hsl(248 38% 12% / 0.07);
  --shadow-md: 0 14px 34px hsl(248 38% 12% / 0.12);
  --shadow-lg: 0 28px 80px hsl(268 86% 35% / 0.18);
  --transition-fast: 150ms ease;
  --transition-smooth: 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --radius-sm: 0.75rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
}

.dark {
  --background: 248 35% 8%;
  --foreground: 250 45% 96%;
  --primary: 270 95% 68%;
  --secondary: 185 84% 58%;
  --muted: 248 28% 16%;
  --destructive: 352 86% 62%;
  --border: 248 24% 24%;
  --card: 248 32% 12%;
  --shadow-sm: 0 4px 14px hsl(0 0% 0% / 0.22);
  --shadow-md: 0 14px 34px hsl(0 0% 0% / 0.34);
  --shadow-lg: 0 28px 80px hsl(270 95% 40% / 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: hsl(var(--background));
}

body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, hsl(var(--primary) / 0.16), transparent 28rem),
    radial-gradient(circle at 88% 16%, hsl(var(--secondary) / 0.16), transparent 24rem),
    hsl(var(--background));
  color: hsl(var(--foreground));
}

button, select, input {
  font: inherit;
}

select, input, textarea {
  font-size: max(16px, 1rem);
}

.bg-1 {
  background-color: hsl(var(--background));
}

.bg-2 {
  background-color: hsl(var(--card));
}

.bg-3 {
  background-color: hsl(var(--muted) / 0.62);
}

.bg-4 {
  background-color: hsl(var(--primary) / 0.1);
}

.text-primary {
  color: hsl(var(--foreground));
}

.text-secondary {
  color: hsl(var(--foreground) / 0.72);
}

.text-tertiary {
  color: hsl(var(--foreground) / 0.54);
}

.accent {
  color: hsl(var(--primary));
}

.voice-orb {
  width: min(48vw, 12rem);
  height: min(48vw, 12rem);
  border-radius: 999px;
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 35% 30%, hsl(0 0% 100% / 0.9), transparent 18%),
    conic-gradient(from 180deg, hsl(var(--primary)), hsl(var(--secondary)), hsl(316 92% 62%), hsl(var(--primary)));
  box-shadow: var(--shadow-lg);
}

.voice-orb::before,
.voice-orb::after {
  content: "";
  position: absolute;
  inset: -0.9rem;
  border-radius: inherit;
  border: 2px solid hsl(var(--primary) / 0.24);
  opacity: 0.75;
  z-index: -1;
}

.voice-orb::after {
  inset: -1.8rem;
  border-color: hsl(var(--secondary) / 0.2);
}

.voice-orb span {
  width: 58%;
  height: 58%;
  border-radius: inherit;
  display: grid;
  place-items: center;
  background: hsl(var(--card) / 0.86);
  color: hsl(var(--primary));
  font-weight: 950;
  letter-spacing: -0.04em;
  font-size: clamp(1.15rem, 5vw, 2.2rem);
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / 0.55);
}

.voice-orb.is-listening::before {
  animation: pulseRing 1.45s infinite;
}

.voice-orb.is-listening::after {
  animation: pulseRing 1.45s infinite 0.35s;
}

@keyframes pulseRing {
  0% {
    transform: scale(0.96);
    opacity: 0.72;
  }
  70% {
    transform: scale(1.12);
    opacity: 0.12;
  }
  100% {
    transform: scale(1.16);
    opacity: 0;
  }
}

/* --- Siri Bottom Sheet and Waveform Animation --- */

@keyframes siriGlowRotation {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.15);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.siri-glow {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 180px;
  background: radial-gradient(circle, rgba(147, 51, 234, 0.75) 0%, rgba(59, 130, 246, 0.6) 30%, rgba(236, 72, 153, 0.5) 60%, transparent 80%);
  filter: blur(40px);
  border-radius: 50%;
  pointer-events: none;
  animation: siriGlowRotation 6s infinite linear;
  opacity: 0.85;
}

.siri-glow-active {
  animation: siriGlowRotation 4s infinite linear, siriPulse 2s infinite ease-in-out;
}

@keyframes siriPulse {
  0%, 100% {
    opacity: 0.75;
    transform: translateX(-50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.25);
  }
}

.siri-wave-line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 0;
  animation: siriWaveform 3s infinite linear;
}

@keyframes siriWaveform {
  0% {
    stroke-dashoffset: 1000;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* Siri wave-bars */
.siri-wave-bar {
  width: 5px;
  height: 15px;
  background-color: var(--primary);
  border-radius: 99px;
  display: inline-block;
  margin: 0 3px;
  animation: siriWaveBarGrow 1s ease-in-out infinite alternate;
}

.siri-wave-bar:nth-child(2) {
  animation-delay: 0.15s;
  background-color: #3b82f6;
}
.siri-wave-bar:nth-child(3) {
  animation-delay: 0.3s;
  background-color: #ec4899;
}
.siri-wave-bar:nth-child(4) {
  animation-delay: 0.45s;
  background-color: #a855f7;
}
.siri-wave-bar:nth-child(5) {
  animation-delay: 0.6s;
  background-color: #10b981;
}
.siri-wave-bar:nth-child(6) {
  animation-delay: 0.25s;
  background-color: #f59e0b;
}

@keyframes siriWaveBarGrow {
  0% {
    transform: scaleY(0.4);
    height: 12px;
  }
  100% {
    transform: scaleY(2.8);
    height: 38px;
  }
}

/* --- Flutter Device Frame Mockup --- */
.flutter-phone {
  border: 12px solid #1a1a1a;
  border-radius: 42px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45), inset 0 0 4px #000;
  background-color: #0b0c16;
  position: relative;
  overflow: hidden;
  max-width: 380px;
  width: 100%;
  height: 680px;
  margin: 0 auto;
}

/* Flutter dynamic notch */
.flutter-notch {
  width: 140px;
  height: 28px;
  background: #1a1a1a;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flutter-notch::after {
  content: '';
  width: 45px;
  height: 4px;
  background: #2b2b2b;
  border-radius: 99px;
  position: absolute;
  top: 6px;
}

/* Flutter dynamic island status */
.flutter-camera {
  width: 8px;
  height: 8px;
  background: #0d1b2a;
  border-radius: 50%;
  position: absolute;
  right: 24px;
  top: 10px;
}

/* Flutter debug banner */
.flutter-debug-banner {
  position: absolute;
  top: 12px;
  right: -32px;
  width: 100px;
  height: 20px;
  background-color: #f44336;
  color: white;
  font-size: 8px;
  font-weight: 900;
  text-align: center;
  line-height: 20px;
  transform: rotate(45deg);
  z-index: 49;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  pointer-events: none;
}

/* Safe area swipe indicator */
.flutter-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 5px;
  background: rgba(255,255,255,0.4);
  border-radius: 99px;
  z-index: 50;
}

/* Bottom Sheet Sliding Animation */
.siri-panel-enter {
  transform: translateY(100%);
  opacity: 0;
  transition: transform 350ms cubic-bezier(0.16, 1, 0.3, 1), opacity 300ms ease;
}

.siri-panel-active {
  transform: translateY(0);
  opacity: 1;
}

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