@import url("https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap");

:root {
  color-scheme: dark;
  --ink: rgba(246, 248, 255, 0.95);
  --muted: rgba(220, 226, 246, 0.6);
  --panel: rgba(8, 10, 20, 0.55);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-glow: rgba(120, 198, 255, 0.18);
  --accent: #9fd9ff;
  --accent-2: #ffd9a8;
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #04050a;
  font-family: "Sora", sans-serif;
}

canvas {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
}

.clock {
  position: fixed;
  top: 20px;
  left: 20px;
  padding: 12px 20px;
  min-width: 100px;
  justify-content: center;
  display: inline-flex;
  border-radius: 8px;
  background: rgba(8, 12, 24, 0.6);
  border: 0;
  color: var(--ink);
  letter-spacing: 0.1em;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  transition: all 0.3s var(--ease-smooth);
  z-index: 10;
}

.clock:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  background: rgba(12, 18, 36, 0.7);
}

.ui {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  z-index: 10;
}

.menu-toggle {
  background: rgba(8, 12, 24, 0.6);
  color: var(--ink);
  border: 0;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.05em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  transition: all 0.3s var(--ease-smooth);
}

.menu-toggle::before,
.menu-toggle::after {
  content: "";
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(159, 217, 255, 0.6), transparent);
  transition: all 0.5s var(--ease-smooth);
}

.menu-toggle::before {
  width: 100%;
  height: 2px;
  top: 0;
  left: -100%;
}

.menu-toggle::after {
  width: 100%;
  height: 2px;
  bottom: 0;
  right: -100%;
}

.menu-toggle:hover::before {
  left: 100%;
}

.menu-toggle:hover::after {
  right: 100%;
}

.menu-toggle:hover {
  background: rgba(12, 18, 36, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.menu-toggle:active {
  transform: translateY(0);
}

.menu-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(159, 217, 255, 0.5);
}

.menu {
  width: min(320px, calc(100vw - 40px));
  background: radial-gradient(circle at top left, rgba(140, 200, 255, 0.18), transparent 60%),
    rgba(6, 10, 20, 0.85);
  border: 0;
  border-radius: 12px;
  padding: 20px;
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(18px);
  transform: translateY(-12px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s var(--ease-smooth);
  position: relative;
  overflow: hidden;
}

.menu::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    transparent 30%, 
    rgba(159, 217, 255, 0.08) 50%, 
    transparent 70%);
  background-size: 200% 200%;
  border-radius: 12px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s var(--ease-soft);
}

.menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.menu.open::before {
  animation: border-glow 10s linear infinite;
  opacity: 0.6;
}

@keyframes border-glow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.menu-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
}

.menu-row:last-child {
  border-bottom: none;
}

.menu-row label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.05em;
}

.menu-row .segmented,
.menu-row input[type="range"] {
  flex: 1;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 6px;
  border-radius: 999px;
  background: rgba(8, 12, 24, 0.6);
  border: 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.segment {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.05em;
  cursor: pointer;
  position: relative;
  transition: all 0.3s var(--ease-smooth);
}

.segment::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: translateX(-50%);
  transition: width 0.3s var(--ease-smooth);
}

.segment:hover {
  color: var(--ink);
}

.segment:hover::after {
  width: 80%;
}

.segment[aria-pressed="true"] {
  color: var(--ink);
  background: linear-gradient(140deg, rgba(30, 60, 120, 0.5), rgba(12, 18, 36, 0.7));
}

.segment[aria-pressed="true"]::after {
  width: 90%;
  background: var(--accent);
}

.segment:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(159, 217, 255, 0.4);
}

.menu-row input[type="range"] {
  width: 100%;
  height: 6px;
  background: rgba(20, 30, 60, 0.4);
  border-radius: 999px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: all 0.3s var(--ease-smooth);
  cursor: pointer;
  position: relative;
}

.menu-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(159, 217, 255, 0.9), rgba(120, 180, 255, 0.8));
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(159, 217, 255, 0.2);
  transition: all 0.25s var(--ease-smooth);
}

.menu-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(159, 217, 255, 0.9), rgba(120, 180, 255, 0.8));
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(159, 217, 255, 0.2);
  transition: all 0.25s var(--ease-smooth);
}

.menu-row input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(159, 217, 255, 0.35);
}

.menu-row input[type="range"]:hover::-moz-range-thumb {
  transform: scale(1.15);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(159, 217, 255, 0.35);
}

.menu-row input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.05);
}

.menu-row input[type="range"]:active::-moz-range-thumb {
  transform: scale(1.05);
}

.menu-row input[type="range"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.menu-row input[type="range"]:disabled::-webkit-slider-thumb {
  cursor: not-allowed;
}

.menu-row input[type="range"]:disabled::-moz-range-thumb {
  cursor: not-allowed;
}

.menu-row.toggle input[type="checkbox"] {
  width: 42px;
  height: 22px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(20, 30, 60, 0.5);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
  outline: none;
}

.menu-row.toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  background: linear-gradient(135deg, rgba(180, 190, 220, 0.9), rgba(150, 160, 200, 0.8));
  transition: all 0.3s var(--ease-smooth);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.menu-row.toggle input[type="checkbox"]:checked {
  background: linear-gradient(135deg, rgba(159, 217, 255, 0.4), rgba(120, 180, 255, 0.35));
}

.menu-row.toggle input[type="checkbox"]:checked::before {
  left: 22px;
  background: linear-gradient(135deg, rgba(159, 217, 255, 0.95), rgba(120, 180, 255, 0.85));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(159, 217, 255, 0.3);
}

.menu-row.toggle input[type="checkbox"]:hover::before {
  transform: scale(1.1);
}

.menu-row.toggle input[type="checkbox"]:active::before {
  transform: scale(0.95);
}

.control {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 60%;
}

.value {
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: rgba(230, 236, 255, 0.7);
  transition: color 0.3s var(--ease-soft);
}

@media (max-width: 680px) {
  .ui {
    top: 16px;
    right: 16px;
  }

  .clock {
    top: 16px;
    left: 16px;
  }

  .menu {
    width: calc(100vw - 32px);
  }
}
