:root {
  color-scheme: dark;
  --bg: #08090e;
  --surface: #171922;
  --line: #ffffff16;
  --text: #f5f6fb;
  --muted: #aeb5c7;
  --accent: #a6c5ff;
  --selected: #749aff;
  font: 16px -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(ellipse at 65% 5%, #385bbd69, transparent 54%),
    radial-gradient(ellipse at 14% 90%, #183a9463, transparent 43%),
    linear-gradient(146deg, transparent 22%, #a3bdff23 38%, #527ee224 42%, transparent 59%),
    linear-gradient(160deg, #161d34, #06080f 67%, #101a35);
  background-attachment: fixed;
}
main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: min(100%, 1000px);
  margin: auto;
  padding: 20px clamp(16px, 4vw, 34px);
  gap: 12px;
}
header, .row, .brand { display: flex; align-items: center; gap: 10px; }
header, .row { justify-content: space-between; }
header { min-height: 51px; }
.brand { min-width: 0; }
.brand strong {
  display: block;
  color: var(--muted);
  font-size: .69rem;
  font-weight: 700;
  letter-spacing: .12em;
}
.mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(150deg, #568bff, #2344db 80%);
  box-shadow: inset 0 1px 1px #ffffff55, 0 4px 14px #1a51f34d;
  font-size: .84rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -.06em;
}
h1 { margin: 2px 0 0; font-size: clamp(1.3rem, 4.8vw, 1.9rem); line-height: 1.08; letter-spacing: -.055em; }
.muted { color: var(--muted); }
.connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 600;
}
.connection::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #858fa6;
}
.connection[data-connected="true"] { color: #a4f3cc; }
.connection[data-connected="true"]::before { background: #62e7a5; box-shadow: 0 0 10px #62e7a57a; }
.layout { display: grid; grid-template-columns: minmax(0, 1.14fr) minmax(320px, 1fr); gap: 14px; }
.card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 26px;
  border-color: #9cb9ff38 #a2b8fa22 #060914;
  background:
    radial-gradient(ellipse at 18% 0%, #b7ccff29, transparent 58%),
    linear-gradient(155deg, #6b90de24 0%, #26365715 46%, #080b1455 47%, transparent 77%),
    linear-gradient(155deg, #283448, #121626 64%, #0d1120);
  box-shadow:
    0 18px 35px -8px #02040cce,
    0 5px 12px #0006,
    inset 0 1px 0 #d6e3ff38,
    inset 0 -1px 0 #89aaff16;
}
.preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100px;
  height: clamp(115px, 28dvh, 235px);
  margin: 11px 0;
  overflow: hidden;
  isolation: isolate;
  border-radius: 19px;
  background: linear-gradient(166deg, #131d35, #070a13 54%, #0b1328);
  border: 1px solid #a9c3ff26;
  box-shadow: inset 0 5px 16px #0008, 0 1px 0 #d1ddff1a;
}
.preview::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at 50% 75%, var(--selected), transparent 72%);
  opacity: .19;
}
canvas { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.preview-label {
  position: absolute;
  top: 7px;
  left: 9px;
  padding: 4px 8px;
  border-radius: 99px;
  background: #151825e8;
  color: #c4cde0;
  font-size: .73rem;
}
button, input, select { font: inherit; }
button, select, #hex {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #3c4a66, #242d43);
  box-shadow: inset 0 1px #ffffff17, 0 3px 7px #0004;
  color: var(--text);
}
button { padding: 8px 12px; cursor: pointer; font-size: .875rem; font-weight: 650; transition: background .15s; }
button:hover { background: #39435b; }
button:disabled { opacity: .5; cursor: default; }
button[aria-pressed="true"] { background: #384a71; color: #edf3ff; }
button:focus-visible, #wheel:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
#connect { border-radius: 99px; background: linear-gradient(180deg, #6192ff, #3263e7); border-color: #83a8ff; color: #fff; }
#connect:hover { background: #3565dd; }
#power { border-radius: 99px; }
.meter { display: block; width: 100%; height: 24px; margin: 4px 0 0; accent-color: var(--accent); cursor: pointer; }
output { color: var(--accent); font-size: .875rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.panel-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 19px;
  background: linear-gradient(180deg, #080c18dc, #171f33);
  box-shadow: inset 0 2px 6px #0008;
  border: 1px solid var(--line);
}
.panel-switch button { background: transparent; color: var(--muted); border-color: transparent; box-shadow: none; }
.panel-switch button[aria-pressed="true"] { background: linear-gradient(180deg, #536788, #31405e); color: #fff; box-shadow: inset 0 1px #e2ebff40, 0 3px 8px #0007; }
.wheel-wrap { display: grid; place-items: center; margin: 15px 0; }
#wheel {
  width: min(100%, clamp(108px, 25dvh, 211px));
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  touch-action: none;
  background: radial-gradient(circle closest-side, #fff, transparent), conic-gradient(red, #ff0, #0f0, #0ff, #00f, #f0f, red);
  box-shadow: 0 0 0 4px #ffffff1c, 0 8px 25px #0007;
}
#cursor {
  pointer-events: none;
  position: absolute;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 3px solid white;
  background: var(--selected);
  box-shadow: 0 0 0 2px #16181a, 0 2px 8px #0008;
  transform: translate(-50%, -50%);
}
#hex { width: min(100%, 103px); padding: 8px 9px; text-transform: uppercase; font-family: ui-monospace, monospace; }
.swatches { display: flex; gap: 4px; }
.swatches button { padding: 0; width: 40px; display: grid; place-items: center; border: 0; background: transparent; box-shadow: none; }
.swatches button::before {
  content: "";
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px #ffffff60;
}
.swatches button[aria-pressed="true"]::before { outline: 2px solid var(--swatch); outline-offset: 3px; }
.effect-picker, .speed { display: grid; gap: 8px; margin-top: 12px; align-items: center; }
.effect-picker, .speed { grid-template-columns: auto minmax(0, 1fr) auto; }
.effect-select { position: relative; }
.effect-select select { appearance: none; width: 100%; padding: 7px 28px 7px 9px; text-overflow: ellipsis; }
.effect-select::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 16px;
  width: 7px;
  height: 7px;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  pointer-events: none;
}
#effect-note { margin: 9px 0 0; font-size: .82rem; line-height: 1.4; }
.speed input { margin: 0; }
#steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
footer { margin: 0 3px; font-size: .8125rem; line-height: 1.35; }
@media (max-width: 730px) {
  main {
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .layout { flex: 1; display: flex; flex-direction: column; gap: 8px; }
  .card { padding: 10px 12px; border-radius: 22px; }
  .layout > :first-child { display: flex; flex: 1; flex-direction: column; }
  .preview { flex: 1; height: auto; min-height: clamp(72px, 15dvh, 130px); margin: 7px 0; }
  canvas { position: absolute; inset: 0; }
  .preview-label { z-index: 1; }
  .wheel-wrap { margin: 11px 0; }
  #wheel { width: min(100%, clamp(84px, 24dvh, 188px)); }
  .effect-picker, .speed { margin-top: 8px; }
}
@media (max-width: 370px) {
  .brand strong { letter-spacing: .05em; }
  #connect, .effect-picker button { padding-inline: 7px; }
  .swatches { gap: 2px; }
  .swatches button { width: 37px; }
}
@media (max-width: 730px) and (max-height: 535px) {
  .preview { min-height: 60px; }
  #wheel { width: min(100%, 90px); }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }

body {
  background: #070b13;
  isolation: isolate;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 35%, #345c811a, transparent 64%),
    linear-gradient(180deg, #05090e30, #090f1a24),
    url("fnf-wallpaper.webp") center / cover no-repeat;
}
.card {
  border-color: #c8ddff54 #b2cef442 #91abd33b;
  background: linear-gradient(145deg, #8fabc237, #41597544 43%, #121b31a3);
  -webkit-backdrop-filter: blur(14px) saturate(145%);
  backdrop-filter: blur(14px) saturate(145%);
  box-shadow:
    inset 0 1px 0 #eef6ff58,
    inset 0 -1px 0 #bbcfff30,
    0 12px 28px #01040bbb;
}
.panel-switch {
  background: #10182782;
  border-color: #c4d9ff29;
}
.preview {
  background: linear-gradient(165deg, #1826428c, #070b18b5);
}
footer { text-shadow: 0 1px 4px #000; }
@media (min-width: 731px) {
  body::before { background-size: auto, auto, min(690px, 72vw) auto; background-repeat: no-repeat, no-repeat, repeat; }
}
