* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: #eef1ff;
  background: #0a0f1f;
  overflow: auto;
}

body::before {
  content: "";
  position: fixed;
  inset: -40%;
  background: radial-gradient(
      circle at 20% 20%,
      rgba(68, 90, 180, 0.45),
      transparent 45%
    ),
    radial-gradient(
      circle at 80% 30%,
      rgba(30, 140, 120, 0.35),
      transparent 48%
    ),
    radial-gradient(
      circle at 50% 80%,
      rgba(120, 50, 160, 0.35),
      transparent 50%
    );
  animation: drift 42s ease-in-out infinite alternate;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 26, 0.6);
  backdrop-filter: blur(12px);
  z-index: -1;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 16px;
  width: 100%;
  margin: 0 auto;
  max-width: 1280px;
}

.app {
  display: flex;
  min-height: 100vh;
}

.splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020204;
  z-index: 5;
  opacity: 1;
  transition: opacity 2.2s ease;
}

.splash.hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-card {
  width: 100%;
  height: 100%;
  background: transparent;
  border-radius: 0;
  padding: clamp(36px, 6vw, 96px);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1s ease, transform 6s ease;
}

.splash.show-message .splash-card {
  opacity: 1;
  transform: translateY(0);
}

.splash-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.splash-text {
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.7;
  color: rgba(230, 234, 248, 0.75);
  max-width: 720px;
}

.splash-button {
  align-self: center;
  padding: 14px 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #eef1ff;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.55);
  transition: transform 0.5s ease, box-shadow 0.5s ease,
    background 0.5s ease;
}

.splash-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.6);
}

.title {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  font-size: 16px;
  color: #b7bdd4;
}

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  position: relative;
}

.reset-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #eef1ff;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mic-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid transparent;
  --mic-fill: rgba(24, 48, 90, 0.85);
  background-color: var(--mic-fill);
  color: #ffffff;
  font-size: 0;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(12, 24, 60, 0.45);
  transition: transform 0.2s ease, box-shadow 0.4s ease,
    background 0.6s ease;
  --mic-level: 0;
  position: relative;
  overflow: visible;
}

.floating-mic {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 4;
}

.content {
  width: 100%;
  display: flex;
  gap: 32px;
  align-items: stretch;
  justify-content: center;
  margin-top: auto;
  padding-bottom: 24px;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  flex: 0 0 360px;
}

.mic-button:active {
  transform: scale(0.98);
}

.mic-button.listening {
  --mic-fill: rgba(22, 120, 92, calc(0.4 + var(--mic-level) * 0.5));
  box-shadow: 0 18px 40px rgba(10, 60, 50, calc(0.2 + var(--mic-level) * 0.55));
}

.mic-button::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(120, 220, 190, calc(0.05 + var(--mic-level) * 0.25)) 0%,
    rgba(80, 190, 150, calc(0.03 + var(--mic-level) * 0.2)) 45%,
    transparent 70%
  );
  filter: blur(12px);
  opacity: calc(0.2 + var(--mic-level) * 0.8);
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: -1;
}

.mic-button.pressed {
  --mic-fill: rgba(52, 140, 105, 0.9);
  box-shadow: 0 16px 34px rgba(16, 70, 54, 0.4);
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.input-row--chat {
  margin-top: 8px;
}

.text-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 18, 40, 0.6);
  color: #eef1ff;
  font-size: 15px;
  resize: none;
  line-height: 1.5;
  max-height: 180px;
  overflow-y: hidden;
}

.text-input::placeholder {
  color: rgba(230, 234, 248, 0.45);
}

.send-button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(59, 108, 240, 0.22);
  color: #eef1ff;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
}

.icon-button {
  width: 46px;
  height: 46px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.panel {
  width: 100%;
  background: rgba(12, 18, 40, 0.82);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 20px 50px rgba(4, 8, 20, 0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.status {
  font-size: 14px;
  color: #9aa3c2;
}

.result {
  font-size: 16px;
  line-height: 1.5;
  min-height: 48px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 900px) {
  .content {
    flex-direction: column;
    align-items: center;
  }

  .controls {
    width: 100%;
    flex: 0 0 auto;
  }

  .messages {
    max-height: none;
  }

  .floating-mic {
    top: 14px;
    right: 14px;
  }
}

.message {
  display: flex;
}

.message.user {
  justify-content: flex-end;
}

.message.assistant {
  justify-content: flex-start;
}

.message-content {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
}

.message-content ol {
  margin: 8px 0 8px 18px;
  padding: 0;
}

.message-content li {
  margin: 4px 0;
}

.message.user .message-content {
  background: rgba(59, 108, 240, 0.35);
  border: 1px solid rgba(59, 108, 240, 0.5);
}

.message.assistant .message-content {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

@keyframes drift {
  0% {
    transform: translate3d(-2%, -1%, 0) scale(1);
  }
  50% {
    transform: translate3d(2%, 3%, 0) scale(1.04);
  }
  100% {
    transform: translate3d(4%, -2%, 0) scale(1.06);
  }
}

