/* style.css */
:root {
  color-scheme: dark;
  --bg: #070a17;
  --field-bg: #070a17;
  --panel: rgba(14, 18, 42, 0.69);
  --panel-deep: rgba(8, 11, 28, 0.56);
  --panel-edge: rgba(214, 222, 255, 0.15);
  --panel-highlight: rgba(255, 255, 255, 0.09);
  --text: #f7f7ff;
  --muted: #aab0d0;
  --soft: #858cab;
  --accent: #a894ff;
  --accent-strong: #ddd6ff;
  --button: rgba(255, 255, 255, 0.075);
  --button-hover: rgba(255, 255, 255, 0.14);
  --shadow: 0 22px 65px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --panel: rgba(247, 248, 255, 0.72);
    --panel-deep: rgba(237, 240, 255, 0.58);
    --panel-edge: rgba(43, 51, 94, 0.16);
    --panel-highlight: rgba(255, 255, 255, 0.72);
    --text: #171a34;
    --muted: #4e5579;
    --soft: #71799e;
    --accent: #6652df;
    --accent-strong: #4f36d0;
    --button: rgba(45, 51, 107, 0.075);
    --button-hover: rgba(45, 51, 107, 0.14);
    --shadow: 0 22px 65px rgba(22, 27, 68, 0.16);
  }
}

body[data-theme="dark"] {
  color-scheme: dark;
  --panel: rgba(14, 18, 42, 0.69);
  --panel-deep: rgba(8, 11, 28, 0.56);
  --panel-edge: rgba(214, 222, 255, 0.15);
  --panel-highlight: rgba(255, 255, 255, 0.09);
  --text: #f7f7ff;
  --muted: #aab0d0;
  --soft: #858cab;
  --accent: #a894ff;
  --accent-strong: #ddd6ff;
  --button: rgba(255, 255, 255, 0.075);
  --button-hover: rgba(255, 255, 255, 0.14);
}

body[data-theme="light"] {
  color-scheme: light;
  --panel: rgba(247, 248, 255, 0.72);
  --panel-deep: rgba(237, 240, 255, 0.58);
  --panel-edge: rgba(43, 51, 94, 0.16);
  --panel-highlight: rgba(255, 255, 255, 0.72);
  --text: #171a34;
  --muted: #4e5579;
  --soft: #71799e;
  --accent: #6652df;
  --accent-strong: #4f36d0;
  --button: rgba(45, 51, 107, 0.075);
  --button-hover: rgba(45, 51, 107, 0.14);
  --shadow: 0 22px 65px rgba(22, 27, 68, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
  background: var(--field-bg);
  transition: background 500ms ease;
}

#field {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.atmosphere {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  width: 52vmax;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(52px);
  opacity: 0.18;
  mix-blend-mode: screen;
  will-change: transform;
}

.orb-one {
  top: -34vmax;
  left: -18vmax;
  background: #5b47ff;
  animation: drift-one 18s ease-in-out infinite alternate;
}

.orb-two {
  right: -28vmax;
  bottom: -36vmax;
  background: #00d8d4;
  animation: drift-two 22s ease-in-out infinite alternate;
}

.orb-three {
  top: 27%;
  left: 39%;
  width: 29vmax;
  opacity: 0.1;
  background: #e277ff;
  filter: blur(70px);
  animation: drift-three 15s ease-in-out infinite alternate;
}

.noise {
  position: absolute;
  inset: 0;
  opacity: 0.13;
  background-image: radial-gradient(rgba(255, 255, 255, 0.45) 0.45px, transparent 0.75px);
  background-size: 5px 5px;
  mix-blend-mode: soft-light;
}

.vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 4, 13, 0.24), transparent 26%, transparent 70%, rgba(2, 4, 13, 0.34)),
    radial-gradient(circle at center, transparent 38%, rgba(0, 0, 0, 0.24) 100%);
}

.topbar,
.intro,
.gesture-hint,
.control-dock {
  position: absolute;
  z-index: 2;
}

.topbar {
  top: 0;
  left: 0;
  width: 100%;
  padding: max(18px, env(safe-area-inset-top)) 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(225, 221, 255, 0.13);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12), 0 8px 18px rgba(0, 0, 0, 0.12);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  position: absolute;
  width: 7px;
  height: 7px;
  content: "";
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 16px var(--accent);
}

.brand-mark::before {
  transform: translate(-9px, 6px);
  opacity: 0.7;
}

.brand-mark::after {
  transform: translate(9px, 4px);
  opacity: 0.88;
}

.brand-mark span:nth-child(1) {
  transform: translateY(-8px);
  background: #73edff;
}

.brand-mark span:nth-child(2) {
  transform: translate(-1px, 9px);
  background: #ff9fdf;
}

.brand-mark span:nth-child(3) {
  width: 27px;
  height: 27px;
  background: transparent;
  border: 1px solid rgba(202, 198, 255, 0.35);
  box-shadow: none;
}

.eyebrow,
h1,
.intro p,
.control-heading span,
.control-heading strong {
  margin: 0;
}

.eyebrow {
  color: var(--soft);
  font-size: 0.57rem;
  font-weight: 760;
  letter-spacing: 0.16em;
}

h1 {
  margin-top: 2px;
  font-size: 1.1rem;
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  place-items: center;
  background: linear-gradient(145deg, var(--panel-highlight), var(--panel));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 7px 22px rgba(0, 0, 0, 0.14);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(16px) saturate(135%);
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

#audioBtn svg {
  fill: currentColor;
  stroke: none;
}

.icon-btn.active {
  border-color: rgba(205, 193, 255, 0.38);
  background: linear-gradient(145deg, rgba(171, 145, 255, 0.34), rgba(93, 91, 225, 0.22));
  color: var(--accent-strong);
}

.intro {
  top: 132px;
  left: 18px;
  max-width: min(370px, calc(100% - 36px));
  padding: 16px 17px;
  border: 1px solid var(--panel-edge);
  border-radius: 19px;
  background: linear-gradient(135deg, var(--panel), var(--panel-deep));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.09), var(--shadow);
  backdrop-filter: blur(18px) saturate(135%);
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 0.62rem;
  font-weight: 780;
  letter-spacing: 0.14em;
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7af0e1;
  box-shadow: 0 0 0 0 rgba(122, 240, 225, 0.6);
  animation: pulse 2.2s ease-out infinite;
}

.intro p {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.52;
}

.gesture-hint {
  top: 47%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(242, 244, 255, 0.82);
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.82);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 700ms ease, transform 700ms ease;
}

.gesture-hint.hidden {
  opacity: 0;
  transform: translate(-50%, calc(-50% - 11px));
}

.hint-line {
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor);
  opacity: 0.58;
}

.hint-line:last-child {
  transform: scaleX(-1);
}

.control-dock {
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 10px;
  padding: 12px 14px 14px;
  border: 1px solid var(--panel-edge);
  border-radius: 25px;
  background: linear-gradient(145deg, var(--panel), var(--panel-deep));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), var(--shadow);
  backdrop-filter: blur(24px) saturate(145%);
}

.dock-handle {
  width: 37px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--panel-edge), transparent);
}

.control-row {
  display: grid;
  grid-template-columns: minmax(104px, 0.9fr) minmax(0, 1.45fr);
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.control-heading {
  min-width: 0;
}

.control-heading span,
.intensity-row label span {
  display: block;
  color: var(--soft);
  font-size: 0.6rem;
  font-weight: 740;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.control-heading strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 0.81rem;
  font-weight: 720;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.17);
  box-shadow: inset 0 1px rgba(0, 0, 0, 0.18);
}

.mode-btn {
  min-height: 40px;
  padding: 0 5px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 690;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.mode-btn.active {
  background: linear-gradient(145deg, rgba(191, 177, 255, 0.24), rgba(123, 105, 237, 0.15));
  box-shadow: inset 0 0 0 1px rgba(220, 213, 255, 0.15), 0 3px 10px rgba(0, 0, 0, 0.12);
  color: var(--accent-strong);
}

.palette-row {
  border-top: 1px solid var(--panel-edge);
}

.palette-picker {
  display: flex;
  justify-content: space-between;
  gap: 9px;
}

.swatch {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.25), 0 5px 15px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.swatch::after {
  position: absolute;
  inset: 5px;
  border: 1px solid transparent;
  border-radius: inherit;
  content: "";
}

.swatch.active {
  border-color: rgba(255, 255, 255, 0.68);
  box-shadow: 0 0 0 2px var(--accent-strong), 0 8px 22px rgba(0, 0, 0, 0.35);
  transform: translateY(-2px) scale(1.07);
}

.swatch.active::after {
  border-color: rgba(255, 255, 255, 0.82);
}

.cosmic {
  background: conic-gradient(from 30deg, #ff93e0, #7953ff, #34d7ff, #c883ff, #ff93e0);
}

.lagoon {
  background: conic-gradient(from 45deg, #71f5db, #2baaff, #6be8ff, #17a875, #71f5db);
}

.ember {
  background: conic-gradient(from 10deg, #ffe17b, #ff7338, #e83678, #ff9f4b, #ffe17b);
}

.prism {
  background: conic-gradient(from 10deg, #4df3e5, #778aff, #f184ff, #ffb764, #4df3e5);
}

.intensity-row {
  padding: 10px 0 8px;
  border-top: 1px solid var(--panel-edge);
}

.intensity-row label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 9px;
}

.intensity-row output {
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 720;
}

input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(255, 255, 255, 0.14));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -7px;
  appearance: none;
  border: 3px solid var(--accent-strong);
  border-radius: 50%;
  background: #25204d;
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.42);
}

input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(255, 255, 255, 0.14));
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 3px solid var(--accent-strong);
  border-radius: 50%;
  background: #25204d;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1.18fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.action-btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 8px;
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  background: var(--button);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 720;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.action-btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.action-btn.primary {
  border-color: rgba(207, 194, 255, 0.4);
  background: linear-gradient(135deg, rgba(156, 119, 255, 0.62), rgba(71, 96, 233, 0.48));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 8px 20px rgba(88, 72, 190, 0.25);
  color: #fff;
}

.action-btn.active {
  border-color: rgba(206, 194, 255, 0.35);
  background: rgba(166, 143, 255, 0.2);
  color: var(--accent-strong);
}

.icon-btn:hover,
.action-btn:hover,
.mode-btn:hover {
  background: var(--button-hover);
}

.action-btn.primary:hover {
  background: linear-gradient(135deg, rgba(172, 137, 255, 0.72), rgba(83, 108, 242, 0.58));
}

.icon-btn:active,
.action-btn:active,
.swatch:active {
  transform: scale(0.96);
}

.mode-btn:active {
  transform: scale(0.97);
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #8ddfff;
  outline-offset: 3px;
}

.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;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 7px rgba(122, 240, 225, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(122, 240, 225, 0);
  }
}

@keyframes drift-one {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(12vmax, 9vmax, 0) scale(1.16);
  }
}

@keyframes drift-two {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(-10vmax, -8vmax, 0) scale(1.18);
  }
}

@keyframes drift-three {
  from {
    transform: translate3d(-6vmax, -3vmax, 0) scale(0.9);
  }

  to {
    transform: translate3d(8vmax, 6vmax, 0) scale(1.18);
  }
}

@media (min-width: 720px) {
  .topbar {
    padding-right: 34px;
    padding-left: 34px;
  }

  .intro {
    top: 145px;
    left: 34px;
  }

  .control-dock {
    right: 28px;
    bottom: 28px;
    left: auto;
    width: min(454px, calc(100% - 56px));
    padding: 14px 18px 18px;
  }

  .dock-handle {
    display: none;
  }

  .gesture-hint {
    top: 50%;
  }
}

@media (max-height: 660px) {
  .intro {
    top: 88px;
    padding: 10px 13px;
  }

  .intro p {
    font-size: 0.75rem;
  }

  .gesture-hint {
    display: none;
  }

  .control-dock {
    padding-top: 8px;
    padding-bottom: 9px;
  }

  .dock-handle {
    margin-bottom: 5px;
  }

  .control-row {
    padding: 4px 0;
  }

  .intensity-row {
    padding: 5px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .pulse {
    animation: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
