:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", sans-serif;
  --bg-top: #07101d;
  --bg-bottom: #020307;
  --text: rgba(246, 249, 255, 0.95);
  --muted: rgba(210, 222, 245, 0.7);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --accent-rgb: 188 214 255;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 18%, rgba(82, 123, 198, 0.22), transparent 26%),
    radial-gradient(circle at 78% 24%, rgba(146, 122, 214, 0.1), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(64, 98, 158, 0.18), transparent 30%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.04) 0%,
      rgba(255, 255, 255, 0) 30%,
      rgba(255, 255, 255, 0.02) 60%,
      rgba(255, 255, 255, 0) 100%
    );
  pointer-events: none;
  opacity: 0.9;
}

[hidden] {
  display: none !important;
}

.app-shell {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding:
    max(18px, env(safe-area-inset-top))
    20px
    max(24px, env(safe-area-inset-bottom))
    20px;
}

.background {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: -2;
}

.ambient {
  position: absolute;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.46;
  mix-blend-mode: screen;
  animation: hazeDrift 18s ease-in-out infinite alternate;
}

.ambient-one {
  width: 17rem;
  height: 17rem;
  top: 12%;
  left: -2rem;
  background: rgba(88, 131, 213, 0.4);
}

.ambient-two {
  width: 14rem;
  height: 14rem;
  top: 18%;
  right: -3rem;
  background: rgba(155, 129, 225, 0.18);
  animation-duration: 21s;
}

.ambient-three {
  width: 18rem;
  height: 18rem;
  bottom: -5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(111, 154, 233, 0.22);
  animation-duration: 24s;
}

.vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, rgba(0, 0, 0, 0) 42%, rgba(0, 0, 0, 0.34) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.28) 100%);
}

.topbar {
  display: flex;
  justify-content: flex-end;
}

.status-pill {
  padding: 0.72rem 0.96rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 10px 30px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.stage {
  display: grid;
  place-items: center;
}

.orb-panel {
  width: min(100%, 26rem);
  display: grid;
  justify-items: center;
  gap: 1.1rem;
  text-align: center;
}

.orb-wrap {
  position: relative;
  width: min(72vw, 17rem);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  animation: orbFloat 7.5s ease-in-out infinite;
}

.orb-shadow {
  position: absolute;
  inset: auto 12% 4%;
  height: 15%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.36), rgba(0, 0, 0, 0) 72%);
  filter: blur(24px);
  opacity: 0.6;
}

.orb {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  isolation: isolate;
  transform: translateZ(0);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.orb:hover {
  transform: scale(1.018);
}

.orb:active {
  transform: scale(0.988);
}

.orb:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.24),
    0 0 0 10px rgba(var(--accent-rgb), 0.14);
}

.orb::before {
  content: "";
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  background:
    conic-gradient(
      from 200deg,
      rgba(255, 255, 255, 0) 0deg,
      rgba(255, 255, 255, 0.18) 34deg,
      rgba(255, 255, 255, 0.03) 90deg,
      rgba(255, 255, 255, 0) 170deg,
      rgba(var(--accent-rgb), 0.18) 250deg,
      rgba(255, 255, 255, 0) 360deg
    );
  filter: blur(18px);
  opacity: 0.45;
  animation: sheenTurn 13s linear infinite;
}

.orb-core,
.orb-ring,
.orb-reflection,
.orb-ripple {
  position: absolute;
  border-radius: 50%;
}

.orb-core {
  inset: 8%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.08) 18%, rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at 68% 76%, rgba(176, 228, 255, 0.18), rgba(176, 228, 255, 0) 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.32) 0%, rgba(199, 224, 255, 0.16) 18%, rgba(29, 39, 61, 0.44) 52%, rgba(184, 222, 255, 0.14) 76%, rgba(255, 255, 255, 0.26) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -28px 34px rgba(6, 10, 18, 0.38),
    0 12px 34px rgba(0, 0, 0, 0.32),
    0 0 54px rgba(var(--accent-rgb), 0.16);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.orb-ring {
  inset: 0;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.18), rgba(9, 14, 24, 0.04) 58%, rgba(0, 0, 0, 0) 72%);
  box-shadow:
    inset 0 0 26px rgba(255, 255, 255, 0.08),
    0 0 72px rgba(var(--accent-rgb), 0.2);
}

.orb-reflection {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.04));
  mix-blend-mode: screen;
  transform: rotate(-26deg);
  animation: reflectionDrift 9s ease-in-out infinite alternate;
}

.reflection-large {
  width: 31%;
  height: 18%;
  top: 18%;
  left: 19%;
  filter: blur(1px);
  opacity: 0.54;
}

.reflection-small {
  width: 16%;
  height: 10%;
  top: 39%;
  right: 21%;
  opacity: 0.28;
  animation-duration: 7.2s;
}

.orb-ripple {
  inset: 3%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0;
  transform: scale(0.92);
}

.orb.is-activated {
  animation: orbPulse 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.orb.is-activated .orb-ripple {
  animation: orbRipple 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.reveal {
  min-height: 1.5rem;
  opacity: 0;
  transform: translateY(0.8rem);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.message {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(248, 250, 255, 0.92);
}

.action-bar {
  display: flex;
  justify-content: center;
  padding-top: 0.75rem;
}

.send-button {
  min-width: min(100%, 18rem);
  padding: 1rem 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(var(--accent-rgb), 0.14)),
    rgba(255, 255, 255, 0.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 18px 40px rgba(0, 0, 0, 0.28),
    0 0 48px rgba(var(--accent-rgb), 0.14);
  backdrop-filter: blur(18px) saturate(155%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(1rem);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s ease,
    border-color 0.35s ease;
}

.send-button.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.send-button:hover,
.send-button:focus-visible {
  border-color: var(--line-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 20px 44px rgba(0, 0, 0, 0.34),
    0 0 60px rgba(var(--accent-rgb), 0.18);
}

.send-button:focus-visible {
  outline: none;
}

.send-button:active {
  transform: translateY(0.08rem) scale(0.992);
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.82;
}

body.is-preview .status-pill {
  color: rgba(229, 236, 251, 0.82);
}

body.is-telegram .status-pill {
  color: rgba(215, 236, 255, 0.86);
  border-color: rgba(var(--accent-rgb), 0.22);
}

@keyframes hazeDrift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(0.9rem, -1rem, 0) scale(1.08);
  }
}

@keyframes orbFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -0.7rem, 0);
  }
}

@keyframes sheenTurn {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes reflectionDrift {
  from {
    transform: rotate(-28deg) translate3d(0, 0, 0);
  }
  to {
    transform: rotate(-20deg) translate3d(0.12rem, -0.2rem, 0);
  }
}

@keyframes orbPulse {
  0% {
    transform: scale(1);
  }
  26% {
    transform: scale(0.975);
  }
  62% {
    transform: scale(1.045);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes orbRipple {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  30% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: scale(1.14);
  }
}

@media (max-width: 25rem) {
  .app-shell {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .status-pill {
    font-size: 0.68rem;
  }

  .message {
    font-size: 0.96rem;
  }

  .send-button {
    width: 100%;
  }
}

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