@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;700&family=Space+Grotesk:wght@300;400;600&display=swap');

:root {
  --ink: #070a12;
  --paper: #f7f3ec;
  --steel: #c7d0dc;
  --accent: #00d1c2;
  --accent-warm: #ffb23e;
  --accent-hot: #ff5c5c;
  --panel: rgba(10, 13, 22, 0.72);
  --panel-edge: rgba(255, 255, 255, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--ink);
  color: var(--paper);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  min-height: 100vh;
  width: 100vw;
  overflow: hidden;
  cursor: default;
}

.backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 18% 25%, rgba(255, 178, 62, 0.18), transparent 55%),
    radial-gradient(circle at 80% 70%, rgba(0, 209, 194, 0.22), transparent 60%),
    radial-gradient(circle at 50% 50%, #121628 0%, #070a12 100%);
  z-index: -2;
}

.backdrop::before,
.backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.backdrop::before {
  background-image:
    linear-gradient(120deg, rgba(255, 255, 255, 0.06), transparent 35%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 48px
    );
  opacity: 0.35;
}

.backdrop::after {
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.03) 0,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 6px
  );
  mix-blend-mode: screen;
  opacity: 0.15;
}

.layout {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 40px;
  padding: 60px 6vw 80px;
}

.brand {
  display: flex;
  justify-content: center;
}

.brand-title {
  font-family: "Fraunces", "Space Grotesk", serif;
  font-size: clamp(2.5rem, 4vw, 4rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(247, 243, 236, 0.8);
}

.visual-stage {
  display: flex;
  align-items: center;
  justify-content: center;
}

.visualizer-container {
  position: relative;
  width: min(760px, 88vw);
  height: min(760px, 88vw);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(12, 16, 28, 0.85), rgba(8, 10, 18, 0.55));
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.5),
    0 0 60px rgba(0, 209, 194, 0.15);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.visualizer-container.is-connected {
  border-color: rgba(0, 209, 194, 0.4);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 100px rgba(0, 209, 194, 0.2);
}

.visualizer-container:hover {
  transform: translateY(-2px);
  box-shadow:
    0 35px 90px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(0, 209, 194, 0.2);
}

.visualizer-container:active {
  transform: translateY(1px);
}

.visualizer-container.is-disabled {
  cursor: wait;
  opacity: 0.7;
}

#visualizer {
  width: 100%;
  height: 100%;
}

.status-hint {
  position: absolute;
  bottom: 18px;
  right: 22px;
  font-size: 0.75rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(247, 243, 236, 0.6);
  pointer-events: none;
}

.error-msg-toast {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 92, 92, 0.95);
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: 50px;
  font-size: 0.9rem;
  display: none;
  z-index: 100;
  box-shadow: 0 12px 40px rgba(255, 92, 92, 0.35);
  backdrop-filter: blur(10px);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.server-url {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  padding: 10px 14px;
  width: min(340px, 80vw);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(8, 10, 18, 0.8);
  color: var(--paper);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.server-url::placeholder {
  color: rgba(247, 243, 236, 0.55);
}

.server-url:focus-visible {
  outline: 2px solid rgba(0, 209, 194, 0.8);
  outline-offset: 2px;
}

.logout-button {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1000;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(8, 10, 18, 0.8);
  color: var(--paper);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.logout-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.logout-button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

@media (max-width: 900px) {
  .layout {
    padding: 40px 6vw 50px;
  }
}

@media (max-width: 600px) {
  .layout {
    gap: 20px;
    padding: 32px 6vw 40px;
  }

  .visualizer-container {
    height: min(380px, 75vw);
  }

  .status-hint {
    bottom: 14px;
    right: 18px;
    font-size: 0.7rem;
  }
}

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

.visualizer-container:focus-visible {
  outline: 2px solid rgba(0, 209, 194, 0.8);
  outline-offset: 6px;
}
