:root {
  --void: #050208;
  --void-mid: #0a0612;
  --glass-bg: rgba(20, 12, 30, 0.45);
  --glass-border: rgba(180, 100, 200, 0.12);
  --glass-border-hover: rgba(220, 120, 255, 0.3);
  --text-main: #e0d4e8;
  --text-muted: #7a6b85;
  --caustic-1: rgba(120, 40, 180, 0.15);
  --caustic-2: rgba(180, 20, 80, 0.1);
  --caustic-3: rgba(40, 60, 160, 0.08);
  --glow: rgba(140, 60, 200, 0.25);

  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  display: flex;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--void);
  color: var(--text-main);
  position: relative;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(ellipse 80vw 60vh at 20% 30%, var(--caustic-1), transparent 60%),
    radial-gradient(ellipse 60vw 50vh at 80% 70%, var(--caustic-2), transparent 55%),
    radial-gradient(ellipse 70vw 40vh at 50% 50%, var(--caustic-3), transparent 50%),
    radial-gradient(ellipse 40vw 30vh at 60% 20%, rgba(100, 30, 150, 0.08), transparent 50%),
    radial-gradient(ellipse 50vw 40vh at 30% 80%, rgba(160, 40, 80, 0.06), transparent 45%);
  filter: blur(80px);
  animation: caustic-drift 20s ease-in-out infinite alternate;
  z-index: 0;
}

body::after {
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  z-index: 1;
}

main {
  width: min(75rem, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 4rem 0 2.5rem;
  text-align: center;
  position: relative;
  z-index: 2;
  animation: breathe 8s ease-in-out infinite;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 600;
  letter-spacing: 0;
  background: linear-gradient(135deg, #e0d4e8 0%, #b894c8 40%, #d4a0b8 70%, #e0d4e8 100%);
  background-size: 200% 200%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 6s ease-in-out infinite;
  position: relative;
}

h1::after {
  content: "";
  position: absolute;
  bottom: -0.55rem;
  left: 50%;
  width: min(18rem, 60%);
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--glass-border-hover), transparent);
  filter: blur(0.5px);
}

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

.search {
  display: block;
  width: min(26rem, 100%);
  margin: 2.35rem auto 0;
}

.search input {
  width: 100%;
  min-height: 3rem;
  padding: 0 1rem;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: rgba(20, 12, 30, 0.35);
  color: var(--text-main);
  font: inherit;
  font-size: 1rem;
  outline: none;
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.search input::placeholder {
  color: var(--text-muted);
}

.search input:focus {
  border-color: var(--glass-border-hover);
  background: rgba(35, 20, 50, 0.5);
  box-shadow: 0 8px 28px rgba(100, 30, 160, 0.16);
}

.command-center {
  display: grid;
  min-height: 100vh;
  align-content: center;
  gap: 2rem;
  padding-top: 2.5rem;
}

.command-panel {
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  width: min(32rem, 100%);
  margin: 0 auto;
}

.command-password {
  display: block;
  width: min(26rem, 100%);
}

.command-password input {
  width: 100%;
  min-height: 3rem;
  padding: 0 1rem;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: rgba(20, 12, 30, 0.35);
  color: var(--text-main);
  font: inherit;
  font-size: 1rem;
  outline: none;
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.command-password input::placeholder {
  color: var(--text-muted);
}

.command-password input:focus {
  border-color: var(--glass-border-hover);
  background: rgba(35, 20, 50, 0.5);
  box-shadow: 0 8px 28px rgba(100, 30, 160, 0.16);
}

.command-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}

.command-actions[hidden] {
  display: none;
}

.command-actions button {
  min-height: 3.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: rgba(20, 12, 30, 0.35);
  color: var(--text-main);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.command-actions button:hover,
.command-actions button:focus-visible {
  border-color: var(--glass-border-hover);
  background: rgba(35, 20, 50, 0.5);
  box-shadow: 0 8px 28px rgba(100, 30, 160, 0.16);
  transform: translateY(-2px);
  outline: none;
}

.back-link {
  justify-self: center;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: rgba(20, 12, 30, 0.35);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.back-link:hover,
.back-link:focus-visible {
  border-color: var(--glass-border-hover);
  background: rgba(35, 20, 50, 0.5);
  box-shadow: 0 8px 28px rgba(100, 30, 160, 0.16);
  outline: none;
}

.services {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 1.25rem;
  width: 100%;
  margin-top: 1.75rem;
}

.service {
  display: flex;
  min-height: 10rem;
  aspect-ratio: 1 / 1;
  padding: 1.55rem 0.95rem;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.95rem;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: var(--glass-bg);
  color: var(--text-main);
  text-decoration: none;
  backdrop-filter: blur(24px) saturate(1.2) brightness(1.05);
  -webkit-backdrop-filter: blur(24px) saturate(1.2) brightness(1.05);
  transition: border-color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
    background 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
    transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  animation: card-enter 0.6s ease-out both;
}

.service[hidden] {
  display: none;
}

.service:nth-child(1) {
  animation-delay: 0.05s;
}

.service:nth-child(2) {
  animation-delay: 0.1s;
}

.service:nth-child(3) {
  animation-delay: 0.15s;
}

.service:nth-child(4) {
  animation-delay: 0.2s;
}

.service:nth-child(5) {
  animation-delay: 0.25s;
}

.service:nth-child(6) {
  animation-delay: 0.3s;
}

.service:nth-child(7) {
  animation-delay: 0.35s;
}

.service:nth-child(8) {
  animation-delay: 0.4s;
}

.service:nth-child(9) {
  animation-delay: 0.45s;
}

.service:nth-child(10) {
  animation-delay: 0.5s;
}

.service:nth-child(11) {
  animation-delay: 0.55s;
}

.service::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.01) 40%,
    transparent 60%
  );
  pointer-events: none;
  z-index: 1;
}

.service::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 20px;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(180, 100, 220, 0.15),
    rgba(200, 80, 120, 0.05),
    rgba(80, 100, 200, 0.1),
    rgba(180, 100, 220, 0.15)
  );
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: edge-shift 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}

.service:hover,
.service:focus-visible {
  border-color: var(--glass-border-hover);
  background: rgba(35, 20, 50, 0.55);
  box-shadow:
    0 12px 40px rgba(100, 30, 160, 0.2),
    0 4px 16px rgba(80, 20, 120, 0.15),
    inset 0 1px 0 rgba(255, 200, 240, 0.08);
  transform: translateY(-6px) scale(1.02);
  outline: none;
}

.service:hover::before,
.service:focus-visible::before {
  background: linear-gradient(
    135deg,
    rgba(200, 140, 255, 0.08) 0%,
    rgba(200, 100, 160, 0.04) 40%,
    transparent 60%
  );
}

.service img,
.service span {
  position: relative;
  z-index: 3;
}

.service img {
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 14px;
  object-fit: contain;
  transition: filter 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
    transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.service:hover img,
.service:focus-visible img {
  filter: saturate(1.2) brightness(1.1);
  transform: scale(1.08);
}

.service span {
  width: 100%;
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.service:hover span,
.service:focus-visible span {
  color: #f0e4f4;
}

.service-static {
  appearance: none;
  cursor: pointer;
  font: inherit;
  animation-delay: 0.55s;
}

.service-static span {
  line-height: 1.2;
}

@keyframes caustic-drift {
  0% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(3vw, -2vh) scale(1.05);
  }

  66% {
    transform: translate(-2vw, 1vh) scale(0.97);
  }

  100% {
    transform: translate(1vw, -1vh) scale(1.02);
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2px);
  }
}

@keyframes shimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

@keyframes edge-shift {
  0%,
  100% {
    background-position: 0% 0%;
  }

  50% {
    background-position: 100% 100%;
  }
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 600px) {
  main {
    width: min(100% - 1.75rem, 75rem);
    padding-top: 3rem;
  }

  h1 {
    font-size: 2rem;
  }

  .services {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
  }

  .service {
    min-height: 0;
    padding: 1.25rem 0.75rem;
  }

  .service img {
    width: 3rem;
    height: 3rem;
  }

  .command-actions {
    grid-template-columns: 1fr;
  }
}

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