:root {
  --bg: #02020a;
  --panel: rgba(12, 14, 30, 0.5);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f7f7ff;
  --muted: rgba(227, 233, 255, 0.7);
  --error: #ffb0cf;
  --accent-blue: rgba(88, 189, 255, 0.9);
  --accent-purple: rgba(120, 92, 255, 0.9);
  --accent-pink: rgba(255, 92, 205, 0.88);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 16%, rgba(104, 72, 255, 0.14), transparent 30%),
    radial-gradient(circle at 82% 20%, rgba(0, 150, 255, 0.08), transparent 34%),
    radial-gradient(circle at 50% 50%, rgba(16, 18, 42, 0.42), transparent 42%),
    var(--bg);
}

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

body::before {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.035), transparent 38%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.02), transparent 36%, rgba(255, 255, 255, 0.015));
  mix-blend-mode: screen;
  opacity: 0.46;
}

body::after {
  background: radial-gradient(circle at 50% 50%, transparent 52%, rgba(0, 0, 0, 0.42) 100%);
  opacity: 0.92;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
  background: #02020a;
}

.app-shell:fullscreen {
  width: 100vw;
  height: 100vh;
}

#visualizer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.launch-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  transition:
    opacity 720ms ease,
    visibility 720ms ease,
    transform 720ms ease;
}

.launch-panel {
  width: min(31rem, calc(100vw - 2.5rem));
  padding: 1.4rem 1.35rem 1.25rem;
  border: 1px solid var(--panel-border);
  border-radius: 1.75rem;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
    linear-gradient(150deg, rgba(92, 58, 255, 0.24), rgba(0, 141, 255, 0.12) 56%, rgba(255, 77, 201, 0.16));
  box-shadow:
    0 26px 90px rgba(22, 15, 58, 0.6),
    0 0 52px rgba(85, 56, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(18px);
}

.start-button,
.fullscreen-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  font: inherit;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 220ms ease,
    opacity 320ms ease,
    box-shadow 260ms ease,
    background-color 260ms ease,
    border-color 260ms ease;
}

.start-button {
  position: relative;
  width: 100%;
  min-height: 3.65rem;
  padding: 1rem 1.45rem;
  border-radius: 999px;
  font-size: 0.96rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)),
    linear-gradient(140deg, rgba(104, 70, 255, 0.28), rgba(0, 153, 255, 0.2) 54%, rgba(255, 66, 201, 0.22));
  box-shadow:
    0 24px 74px rgba(28, 19, 78, 0.54),
    0 0 42px rgba(82, 52, 255, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.start-button::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 60%);
  pointer-events: none;
}

.start-button:hover,
.fullscreen-button:hover {
  transform: translateY(-2px);
}

.start-button:hover {
  box-shadow:
    0 32px 92px rgba(31, 19, 90, 0.66),
    0 0 58px rgba(82, 52, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.start-button:active,
.fullscreen-button:active {
  transform: translateY(1px) scale(0.99);
}

.start-button:focus-visible,
.fullscreen-button:focus-visible {
  outline: 2px solid rgba(152, 201, 255, 0.96);
  outline-offset: 4px;
}

.start-button:disabled {
  cursor: wait;
}

.helper-text,
.status-text {
  margin: 0;
  min-height: 1.3rem;
  line-height: 1.55;
}

.helper-text {
  margin-top: 0.95rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.status-text {
  margin-top: 0.4rem;
  font-size: 0.88rem;
  color: rgba(229, 236, 255, 0.74);
  transition: opacity 220ms ease, color 220ms ease;
}

.status-text:empty {
  opacity: 0;
}

.status-text[data-tone="error"] {
  color: var(--error);
}

.status-text[data-tone="info"] {
  color: rgba(182, 220, 255, 0.9);
}

body.is-running .launch-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.98);
}

.fullscreen-button {
  position: absolute;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 3;
  padding: 0.8rem 1.05rem;
  border-radius: 999px;
  font-size: 0.74rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)),
    rgba(8, 10, 22, 0.68);
  box-shadow:
    0 14px 34px rgba(5, 8, 20, 0.4),
    0 0 28px rgba(74, 50, 214, 0.1);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

body.show-fullscreen-cta .fullscreen-button {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

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

@media (max-width: 640px) {
  .launch-panel {
    width: min(100%, calc(100vw - 1.5rem));
    padding: 1.2rem 1rem 1.08rem;
    border-radius: 1.5rem;
  }

  .start-button {
    min-height: 3.35rem;
    padding-inline: 1.1rem;
    font-size: 0.88rem;
    letter-spacing: 0.12em;
  }

  .helper-text {
    font-size: 0.88rem;
  }

  .fullscreen-button {
    right: 0.8rem;
    bottom: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .launch-overlay,
  .start-button,
  .fullscreen-button,
  .status-text {
    transition-duration: 0ms;
  }
}
