:root {
  color-scheme: dark;
  --ink: #edf5ff;
  --muted: rgb(213 231 255 / 70%);
  --glass: rgb(8 17 38 / 58%);
  --line: rgb(190 220 255 / 24%);
  --focus: #b9ddff;
  --safe-right: max(20px, env(safe-area-inset-right));
  --safe-bottom: max(20px, env(safe-area-inset-bottom));
}

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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #060b1e;
}

body {
  position: fixed;
  inset: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  content: "";
  background:
    radial-gradient(circle at 70% 18%, rgb(78 112 166 / 13%), transparent 30%),
    linear-gradient(180deg, #101c3a 0%, #070d21 54%, #030712 100%);
}

.layer {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  contain: strict;
}

.sky {
  z-index: 1;
}

.stage {
  z-index: 2;
}

.fab {
  position: fixed;
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  z-index: 10;
  width: 64px;
  height: 64px;
  padding: 0;
  overflow: visible;
  color: var(--ink);
  cursor: pointer;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 16px 42px rgb(0 3 14 / 34%);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  backdrop-filter: blur(16px) saturate(125%);
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.fab:hover {
  background: rgb(11 24 52 / 68%);
  border-color: rgb(202 229 255 / 38%);
  transform: translateY(-1px);
}

.fab:active {
  transform: scale(0.96);
}

.fab:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.fab-viz {
  position: absolute;
  inset: -14px;
  display: block;
  width: calc(100% + 28px);
  height: calc(100% + 28px);
  pointer-events: none;
}

.fab-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 21px;
  height: 21px;
  color: currentColor;
  transform: translate(-50%, -50%);
  transition: opacity 150ms ease, transform 180ms ease;
}

.icon-pause,
.fab[aria-pressed="true"] .icon-play {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
}

.fab[aria-pressed="true"] .icon-pause {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.toast {
  position: fixed;
  right: calc(var(--safe-right) + 76px);
  bottom: calc(var(--safe-bottom) + 12px);
  z-index: 11;
  max-width: min(320px, calc(100vw - 120px));
  margin: 0;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
  pointer-events: none;
  background: rgb(5 12 29 / 72%);
  border: 1px solid rgb(186 219 255 / 14%);
  border-radius: 10px;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 180ms ease, transform 180ms ease;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

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

.fallback-message {
  position: fixed;
  inset: auto 20px 24px;
  z-index: 20;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 640px), (pointer: coarse) {
  :root {
    --safe-right: max(16px, env(safe-area-inset-right));
    --safe-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .fab {
    width: 58px;
    height: 58px;
  }

  .fab-icon {
    width: 19px;
    height: 19px;
  }

  .toast {
    right: calc(var(--safe-right) + 68px);
    bottom: calc(var(--safe-bottom) + 9px);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .fab,
  .toast {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: #0a1430;
  }
}

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