:root {
  --black: #05070d;
  --deep-violet: #23203f;
  --accent-green: #13a538;
  --soft-lavender: #a99be8;
  --graphite: #706f6f;
  --white: #f4f4f4;
  --panel: rgba(10, 10, 12, 0.74);
  --panel-strong: rgba(15, 15, 18, 0.88);
  --line: rgba(244, 244, 244, 0.14);
  --line-strong: rgba(244, 244, 244, 0.28);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
  --max-width: 1320px;
  --header-height: 64px;
  --accent: #13a538;
  --accent-soft: rgba(19, 165, 56, 0.22);
  --accent-wash: rgba(19, 165, 56, 0.1);
  --panel-border: rgba(244, 244, 244, 0.14);
}

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

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

html,
body,
#canvas-layer,
.ui-shell {
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  overflow: hidden;
  font-family: "Space Grotesk", sans-serif;
  color: var(--white);
  background:
    radial-gradient(circle at 14% 18%, var(--accent-soft), transparent 24%),
    radial-gradient(circle at 86% 74%, rgba(143, 245, 191, 0.1), transparent 22%),
    linear-gradient(180deg, #0b0b0d 0%, #070709 100%);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root[data-mode="gate"],
:root[data-mode="singl"] {
  --accent: #13a538;
  --accent-soft: rgba(19, 165, 56, 0.2);
  --accent-wash: rgba(19, 165, 56, 0.12);
}

:root[data-mode="nova"] {
  --accent: #13a538;
  --accent-soft: rgba(19, 165, 56, 0.22);
  --accent-wash: rgba(19, 165, 56, 0.12);
}

.noise-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 100% 5px, 5px 100%;
  opacity: 0.18;
  pointer-events: none;
}

#canvas-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

#canvas-layer,
#canvas-layer .p5-canvas {
  pointer-events: none !important;
}

#canvas-layer canvas,
canvas {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  z-index: 1 !important;
  pointer-events: none !important;
  touch-action: none;
}

#canvas-layer .p5-canvas {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  z-index: 1 !important;
  touch-action: none;
}

.veil {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 45%, transparent 0%, rgba(5, 7, 13, 0.1) 54%, rgba(5, 7, 13, 0.56) 100%),
    linear-gradient(180deg, rgba(5, 7, 13, 0.02), rgba(5, 7, 13, 0.18));
}

.cvh-preloader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgb(5, 7, 13);
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transition:
    opacity 320ms ease,
    visibility 0s linear 0s;
}

.cvh-preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 320ms ease,
    visibility 0s linear 320ms;
}

.cvh-preloader__glyph {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transform: translateY(-2px);
}

.cvh-preloader__ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(244, 244, 244, 0.18);
  border-top-color: rgba(19, 165, 56, 0.92);
  border-right-color: rgba(244, 244, 244, 0.35);
  box-shadow:
    0 0 0 4px rgba(19, 165, 56, 0.04),
    0 0 18px rgba(19, 165, 56, 0.08);
  animation: cvh-preloader-spin 1.35s linear infinite;
}

.cvh-preloader__line {
  width: 84px;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(244, 244, 244, 0.04) 0%,
    rgba(244, 244, 244, 0.7) 32%,
    rgba(19, 165, 56, 0.8) 56%,
    rgba(244, 244, 244, 0.08) 100%
  );
  animation: cvh-preloader-pulse 1.25s ease-in-out infinite;
}

.cvh-preloader__dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgb(244, 244, 244);
  box-shadow: 0 0 10px rgba(19, 165, 56, 0.4);
  animation: cvh-preloader-dot 1.25s ease-in-out infinite;
}

@keyframes cvh-preloader-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes cvh-preloader-pulse {
  0%,
  100% {
    opacity: 0.32;
    transform: scaleX(0.94);
  }

  50% {
    opacity: 0.92;
    transform: scaleX(1.02);
  }
}

@keyframes cvh-preloader-dot {
  0%,
  100% {
    opacity: 0.38;
    transform: scale(0.88);
  }

  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

.ui-shell {
  position: relative;
  z-index: 20;
  min-height: 100svh;
  padding: 0;
}

.topbar,
.effect-player {
  position: relative;
  z-index: 1;
}

.ui-shell {
  pointer-events: none;
}

.topbar,
.effect-player,
.effect-player__button,
.brand-lockup {
  pointer-events: auto;
}

.effect-player__button,
.brand-lockup {
  touch-action: manipulation;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 84px;
  padding:
    max(18px, env(safe-area-inset-top))
    30px
    18px
    30px;
  background: rgba(5, 7, 13, 0.96);
  border-bottom: 1px solid rgba(244, 244, 244, 0.08);
  backdrop-filter: blur(12px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
  color: var(--white);
}

.brand-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.effect-player {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-height: 48px;
  margin-left: auto;
  padding: 4px 4px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--white);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.effect-player__title {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  margin-right: 2px;
  opacity: 1;
  visibility: visible;
  color: rgba(244, 244, 244, 0.86);
  font-family: "Syne", sans-serif;
  font-size: clamp(0.66rem, 0.95vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.effect-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding:
    16px
    30px
    max(16px, env(safe-area-inset-bottom))
    30px;
  border-top: 1px solid rgba(244, 244, 244, 0.08);
  background: rgba(5, 7, 13, 0.94);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.effect-footer__inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.effect-footer__copy {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.effect-footer__text {
  display: inline-block;
  color: rgba(244, 244, 244, 0.7);
  font-size: 0.92rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.effect-footer__copyright {
  flex: 0 0 auto;
  color: rgba(244, 244, 244, 0.45);
  font-family: "Syne", sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
}

.effect-player__button {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: rgba(244, 244, 244, 0.78);
  font: inherit;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.effect-player__button:hover,
.effect-player__button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(244, 244, 244, 0.5);
  background: rgba(244, 244, 244, 0.08);
  color: var(--white);
  box-shadow:
    0 0 0 1px rgba(244, 244, 244, 0.08) inset,
    0 10px 24px rgba(0, 0, 0, 0.18);
}

.effect-player__button span {
  font-size: 1rem;
  line-height: 1;
  transform: translateY(-1px);
}

button {
  appearance: none;
  font-family: inherit;
}

button:focus-visible,
.brand-lockup:focus-visible,
.effect-player__button:focus-visible {
  outline: 1px solid rgba(244, 244, 244, 0.45);
  outline-offset: 3px;
}

.effect-player__button:active {
  transform: translateY(0);
  background: rgba(244, 244, 244, 0.12);
  color: var(--white);
  border-color: rgba(244, 244, 244, 0.64);
  box-shadow: none;
}

@media (min-width: 760px) {
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding:
      max(18px, env(safe-area-inset-top))
      30px
      18px
      30px;
  }

  .brand-lockup {
    flex: 0 1 auto;
    min-width: 0;
  }

  .effect-player {
    flex: 0 0 auto;
    gap: 6px;
    max-width: none;
  }

  .effect-player__title {
    display: inline-flex;
    min-width: 120px;
    max-width: 220px;
    justify-content: center;
    overflow: visible;
    opacity: 1;
    visibility: visible;
    margin-right: 4px;
    font-size: 0.78rem;
  }

  .effect-footer {
    display: flex;
    visibility: visible;
    opacity: 1;
    z-index: 30;
    min-height: 72px;
    background: rgba(5, 7, 13, 0.94);
    padding:
      18px
      30px
      max(18px, env(safe-area-inset-bottom))
      30px;
  }

  .effect-footer__copy {
    display: grid;
    max-width: min(72ch, 100%);
  }

  .effect-footer__text {
    display: block;
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 759px) {
  .topbar {
    padding:
      max(16px, env(safe-area-inset-top))
      20px
      16px
      20px;
  }

  .effect-footer {
    min-height: 66px;
    padding:
      14px
      20px
      max(14px, env(safe-area-inset-bottom))
      20px;
  }

  .effect-footer__inner {
    gap: 14px;
  }

  .effect-footer__copy {
    overflow: hidden;
  }

  .effect-player__title {
    margin-right: 2px;
    font-size: 0.66rem;
    letter-spacing: 0.12em;
  }

  .effect-footer__text {
    width: max-content;
    font-size: 0.86rem;
    animation: cvh-footer-marquee 12s linear infinite;
    will-change: transform;
  }

  .effect-footer__copyright {
    font-size: 0.61rem;
    letter-spacing: 0.18em;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .effect-player__button {
    transition: none;
  }

  .effect-footer__text {
    animation: none;
  }
}

@keyframes cvh-footer-marquee {
  0% {
    transform: translateX(18%);
  }

  100% {
    transform: translateX(-100%);
  }
}
