:root {
  --bg-deep: #0b1020;
  --bg-soft: #1a2a52;
  --text-main: #f2f6ff;
  --text-dim: #b8c6e5;
  --accent: #6aa4ff;
  --accent-2: #7d6bff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text-main);
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg-deep);
}

.screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}

.bg-layer {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(106, 164, 255, 0.4), transparent 38%),
    radial-gradient(circle at 80% 30%, rgba(125, 107, 255, 0.35), transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(63, 179, 255, 0.2), transparent 35%),
    linear-gradient(140deg, #050910 0%, #101936 45%, #1c1b44 100%);
  transform: scale(1.05);
  opacity: 0.95;
}

.initial-art {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.6s ease;
}

.screen.has-art .initial-art {
  opacity: 0;
}

.initial-title {
  position: relative;
  font-size: clamp(4.2rem, 18vw, 13rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: transparent;
  background:
    linear-gradient(
      108deg,
      #ff4f9e 0%,
      #ff8a4f 12%,
      #ffd74f 24%,
      #8cff5a 36%,
      #4fffe2 48%,
      #4fb4ff 62%,
      #8a6bff 76%,
      #d86bff 88%,
      #ff4f9e 100%
    )
    0 0 / 360% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  animation: title-neon-flow 3.8s linear infinite;
}

.initial-title::after {
  content: none;
  position: absolute;
  inset: 0;
  color: transparent;
  -webkit-text-stroke: 0;
  filter: none;
}

.initial-glow {
  position: absolute;
  width: min(72vw, 880px);
  height: min(72vw, 880px);
  border-radius: 50%;
  background: none;
  filter: none;
  opacity: 0;
  animation: initial-bloom 3.6s ease-in-out infinite;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--art-url, none);
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.8s ease;
  z-index: -1;
}

.screen.has-art::before {
  opacity: 1;
}

.screen.has-art .bg-layer {
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 0, 0, 0.1), transparent 38%),
    radial-gradient(circle at 80% 30%, rgba(0, 0, 0, 0.15), transparent 40%),
    linear-gradient(180deg, rgba(6, 8, 15, 0.2), rgba(6, 8, 15, 0.45));
}

.screen.processing::before {
  animation: art-breath 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.screen.processing .bg-layer {
  animation: layer-breath 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.screen.processing::after {
  animation: frame-energy 1.8s ease-in-out infinite;
}

.hud-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 1;
  transition: opacity 0.25s ease;
}

.hud-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(116, 186, 255, 0.14) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(116, 186, 255, 0.14) 1px, transparent 1px) 0 0 / 44px 44px;
  opacity: 0.2;
  transform: perspective(780px) rotateX(14deg) scale(1.15);
}

.screen.processing .hud-layer {
  opacity: 1;
}

.screen.processing .hud-layer::before {
  animation: hud-grid-drift 4.8s linear infinite;
}

.screen::after {
  content: "";
  position: absolute;
  inset: 1.5rem;
  border: 1px solid rgba(185, 212, 255, 0.2);
  border-radius: 18px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.logo-trigger {
  position: absolute;
  right: 2rem;
  bottom: 1.7rem;
  z-index: 3;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  background: transparent;
  border: none;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
}

.logo {
  font-size: clamp(1.2rem, 2.6vw, 1.8rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  background:
    linear-gradient(
      110deg,
      #ff6aa8 0%,
      #ffb86c 14%,
      #ffe56b 28%,
      #6dffb3 42%,
      #68d9ff 58%,
      #7da3ff 74%,
      #c78dff 88%,
      #ff6aa8 100%
    )
    0 0 / 240% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 0 14px rgba(255, 146, 196, 0.28),
    0 0 22px rgba(122, 184, 255, 0.24);
  opacity: 0.88;
  animation: saypic-rainbow-flow 5.2s linear infinite;
}

.logo-trigger:hover .logo {
  filter: brightness(1.08);
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.16);
  transform: translateY(-0.15rem);
}

.rec-dot.idle {
  background: #31d56b;
}

.rec-dot.recording {
  background: #ff4747;
  box-shadow: 0 0 12px rgba(255, 71, 71, 0.9);
}

.logo-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.82;
}

.status {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  margin: 0;
  min-height: 1rem;
  color: rgba(236, 244, 255, 0.84);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  z-index: 2;
}

.wave-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 260px;
  height: 260px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.wave-overlay.active {
  opacity: 1;
  filter: drop-shadow(0 0 30px rgba(116, 171, 255, 0.4));
}

.screen.preview-bump::before {
  transition: opacity 0.24s ease, filter 0.24s ease;
  filter: brightness(1.08) saturate(1.14);
}

.wave {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  border: 2px solid rgba(135, 182, 255, 0.38);
  transform: translate(-50%, -50%) scale(0.45);
  opacity: 0;
}

.wave-overlay.active .wave {
  animation: wave-rise 1.55s cubic-bezier(0.2, 0.65, 0.2, 1) infinite;
}

.wave-overlay.active .w2 {
  animation-delay: 0.45s;
}

.wave-overlay.active .w3 {
  animation-delay: 0.9s;
}

.soundprint {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 190px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.soundprint span {
  width: 4px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(158, 232, 255, 0.96),
    rgba(101, 158, 255, 0.9)
  );
  box-shadow: 0 0 12px rgba(99, 178, 255, 0.55);
  transform-origin: center;
}

.wave-overlay.active .soundprint {
  opacity: 1;
}

.wave-overlay.active .soundprint span {
  animation: soundprint 0.88s ease-in-out infinite;
}

.wave-overlay.active .soundprint span:nth-child(1) {
  animation-delay: 0.05s;
}
.wave-overlay.active .soundprint span:nth-child(2) {
  animation-delay: 0.12s;
}
.wave-overlay.active .soundprint span:nth-child(3) {
  animation-delay: 0.2s;
}
.wave-overlay.active .soundprint span:nth-child(4) {
  animation-delay: 0.28s;
}
.wave-overlay.active .soundprint span:nth-child(5) {
  animation-delay: 0.36s;
}
.wave-overlay.active .soundprint span:nth-child(6) {
  animation-delay: 0.44s;
}
.wave-overlay.active .soundprint span:nth-child(7) {
  animation-delay: 0.5s;
}
.wave-overlay.active .soundprint span:nth-child(8) {
  animation-delay: 0.58s;
}
.wave-overlay.active .soundprint span:nth-child(9) {
  animation-delay: 0.66s;
}
.wave-overlay.active .soundprint span:nth-child(10) {
  animation-delay: 0.72s;
}
.wave-overlay.active .soundprint span:nth-child(11) {
  animation-delay: 0.8s;
}
.wave-overlay.active .soundprint span:nth-child(12) {
  animation-delay: 0.88s;
}

@keyframes wave-rise {
  0% {
    width: 36px;
    height: 36px;
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.42);
    border-color: rgba(129, 182, 255, 0.95);
  }
  100% {
    width: 260px;
    height: 260px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.16);
    border-color: rgba(129, 182, 255, 0.12);
  }
}

@keyframes soundprint {
  0% {
    height: 12px;
    opacity: 0.65;
  }
  50% {
    height: 58px;
    opacity: 1;
  }
  100% {
    height: 12px;
    opacity: 0.65;
  }
}

@keyframes hud-grid-drift {
  0% {
    transform: perspective(780px) rotateX(14deg) translateY(0) scale(1.15);
    opacity: 0.16;
  }
  50% {
    transform: perspective(780px) rotateX(14deg) translateY(-16px) scale(1.17);
    opacity: 0.34;
  }
  100% {
    transform: perspective(780px) rotateX(14deg) translateY(-32px) scale(1.2);
    opacity: 0.16;
  }
}

@keyframes art-breath {
  0% {
    transform: scale(1);
    filter: saturate(1) brightness(1) contrast(1);
  }
  50% {
    transform: scale(1.05);
    filter: saturate(1.34) brightness(1.16) contrast(1.08) hue-rotate(-8deg);
  }
  100% {
    transform: scale(1);
    filter: saturate(1) brightness(1) contrast(1);
  }
}

@keyframes layer-breath {
  0% {
    opacity: 0.88;
    transform: scale(1.02);
    filter: blur(0px);
  }
  50% {
    opacity: 0.62;
    transform: scale(1.08);
    filter: blur(1.5px);
  }
  100% {
    opacity: 0.88;
    transform: scale(1.02);
    filter: blur(0px);
  }
}

@keyframes frame-energy {
  0% {
    border-color: rgba(185, 212, 255, 0.16);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.03),
      0 0 0 0 rgba(79, 149, 255, 0);
  }
  50% {
    border-color: rgba(125, 194, 255, 0.48);
    box-shadow:
      inset 0 0 0 1px rgba(176, 224, 255, 0.24),
      0 0 34px 4px rgba(79, 149, 255, 0.3),
      0 0 0 6px rgba(86, 171, 255, 0.14);
  }
  100% {
    border-color: rgba(185, 212, 255, 0.16);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.03),
      0 0 0 0 rgba(79, 149, 255, 0);
  }
}

@keyframes title-neon-flow {
  0% {
    background-position: 0% 50%;
    filter: brightness(1.02) saturate(1.1) hue-rotate(0deg);
  }
  50% {
    background-position: 100% 50%;
    filter: brightness(1.18) saturate(1.35) hue-rotate(14deg);
  }
  100% {
    background-position: 0% 50%;
    filter: brightness(1.02) saturate(1.1) hue-rotate(0deg);
  }
}

@keyframes saypic-rainbow-flow {
  0% {
    background-position: 0% 50%;
    filter: brightness(1) saturate(1);
  }
  50% {
    background-position: 100% 50%;
    filter: brightness(1.1) saturate(1.18);
  }
  100% {
    background-position: 0% 50%;
    filter: brightness(1) saturate(1);
  }
}

@keyframes initial-bloom {
  0% {
    transform: scale(0.96);
    opacity: 0.62;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(0.96);
    opacity: 0.62;
  }
}
