:root {
  color-scheme: dark;

  --bg: #020a22;
  --ink: #00040f;
  --navy: #020a22;
  --tide: #1668f0;
  --aqua: #62cdff;
  --fg: #f3f8ff;
  --fg-strong: #ffffff;
  --fg-2: rgba(226, 238, 255, .72);
  --fg-3: rgba(226, 238, 255, .46);
  --hair: rgba(255, 255, 255, .1);
  --stroke: rgba(255, 255, 255, .16);
  --stroke-2: rgba(255, 255, 255, .25);
  --fill: rgba(255, 255, 255, .07);
  --fill-2: rgba(255, 255, 255, .12);
  --hover: rgba(255, 255, 255, .06);
  --well: rgba(0, 8, 32, .38);
  --glass-a: rgba(255, 255, 255, .11);
  --glass-b: rgba(255, 255, 255, .035);
  --glass-hi: rgba(255, 255, 255, .28);
  --glass-glow: rgba(130, 205, 255, .3);
  --glass-shadow: rgba(0, 4, 22, .65);
  --rim-hi: rgba(255, 255, 255, .75);
  --rim-lo: rgba(255, 255, 255, .06);
  --rim-tint: rgba(150, 215, 255, .6);
  --title-a: #ffffff;
  --title-b: #a9d8ff;
  --lens-bg: #051a48;
  --chk-a: rgba(255, 255, 255, .09);
  --chk-b: rgba(255, 255, 255, .02);
  --sheet-a: rgba(14, 40, 104, .62);
  --sheet-b: rgba(4, 18, 58, .56);
  --overlay: rgba(0, 6, 26, .55);
  --tick: rgba(255, 255, 255, .85);
  --tick-2: rgba(255, 255, 255, .32);
  --needle: #ffffff;
  --knob-a: rgba(255, 255, 255, .22);
  --knob-b: rgba(255, 255, 255, .1);
  --logo-shadow: drop-shadow(0 1px 3px rgba(0, 6, 30, .45));
  --group-bg: rgba(255, 255, 255, .065);
  --detail-a: rgba(8, 26, 74, .55);
  --detail-b: rgba(3, 14, 44, .45);
  --danger: #ff8a9b;
  --vignette: rgba(0, 3, 14, .85);
  --blob-1: rgba(18, 86, 226, .55); --blob-2: rgba(0, 150, 255, .34); --blob-3: rgba(10, 40, 130, .75); --blob-4: rgba(64, 196, 255, .2);
  --ok: #42e09a;
  --bad: #ff6b81;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Be Vietnam Pro", "Segoe UI", Roboto, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Be Vietnam Pro", "Segoe UI", sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", "Be Vietnam Pro", -apple-system, sans-serif;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #e3eeff; --navy: #e3eeff; --tide: #1668f0; --aqua: #0a6ad8;
    --fg: #0a1a3d; --fg-strong: #04102c; --fg-2: rgba(10, 26, 61, .7); --fg-3: rgba(10, 26, 61, .48);
    --hair: rgba(10, 40, 100, .1); --stroke: rgba(10, 40, 100, .13); --stroke-2: rgba(10, 40, 100, .2);
    --fill: rgba(10, 40, 100, .06); --fill-2: rgba(10, 40, 100, .1); --hover: rgba(10, 40, 100, .05); --well: rgba(10, 40, 100, .07);
    --glass-a: rgba(255, 255, 255, .66); --glass-b: rgba(255, 255, 255, .36); --glass-hi: rgba(255, 255, 255, .95);
    --glass-glow: rgba(120, 180, 255, .28); --glass-shadow: rgba(20, 60, 140, .25);
    --rim-hi: rgba(255, 255, 255, 1); --rim-lo: rgba(255, 255, 255, .35); --rim-tint: rgba(110, 165, 255, .55);
    --title-a: #04102c; --title-b: #1d5fd6; --lens-bg: #cfe1ff;
    --chk-a: rgba(10, 40, 100, .09); --chk-b: rgba(10, 40, 100, .02);
    --sheet-a: rgba(255, 255, 255, .8); --sheet-b: rgba(238, 245, 255, .72); --overlay: rgba(214, 230, 255, .6);
    --tick: rgba(10, 26, 61, .8); --tick-2: rgba(10, 26, 61, .28); --needle: #0a6ad8;
    --knob-a: rgba(255, 255, 255, .98); --knob-b: rgba(255, 255, 255, .8);
    --logo-shadow: drop-shadow(0 0 1px rgba(0, 20, 70, .55)) drop-shadow(0 1px 2px rgba(0, 20, 70, .25));
    --group-bg: rgba(255, 255, 255, .6); --detail-a: rgba(255, 255, 255, .5); --detail-b: rgba(255, 255, 255, .32);
    --danger: #d4243f; --vignette: rgba(160, 195, 245, .45); --blob-1: rgba(255, 255, 255, .9); --blob-2: rgba(110, 175, 255, .5); --blob-3: rgba(70, 130, 240, .38); --blob-4: rgba(170, 225, 255, .6);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #e3eeff; --navy: #e3eeff; --tide: #1668f0; --aqua: #0a6ad8;
  --fg: #0a1a3d; --fg-strong: #04102c; --fg-2: rgba(10, 26, 61, .7); --fg-3: rgba(10, 26, 61, .48);
  --hair: rgba(10, 40, 100, .1); --stroke: rgba(10, 40, 100, .13); --stroke-2: rgba(10, 40, 100, .2);
  --fill: rgba(10, 40, 100, .06); --fill-2: rgba(10, 40, 100, .1); --hover: rgba(10, 40, 100, .05); --well: rgba(10, 40, 100, .07);
  --glass-a: rgba(255, 255, 255, .66); --glass-b: rgba(255, 255, 255, .36); --glass-hi: rgba(255, 255, 255, .95);
  --glass-glow: rgba(120, 180, 255, .28); --glass-shadow: rgba(20, 60, 140, .25);
  --rim-hi: rgba(255, 255, 255, 1); --rim-lo: rgba(255, 255, 255, .35); --rim-tint: rgba(110, 165, 255, .55);
  --title-a: #04102c; --title-b: #1d5fd6; --lens-bg: #cfe1ff;
  --chk-a: rgba(10, 40, 100, .09); --chk-b: rgba(10, 40, 100, .02);
  --sheet-a: rgba(255, 255, 255, .8); --sheet-b: rgba(238, 245, 255, .72); --overlay: rgba(214, 230, 255, .6);
  --tick: rgba(10, 26, 61, .8); --tick-2: rgba(10, 26, 61, .28); --needle: #0a6ad8;
  --knob-a: rgba(255, 255, 255, .98); --knob-b: rgba(255, 255, 255, .8);
  --logo-shadow: drop-shadow(0 0 1px rgba(0, 20, 70, .55)) drop-shadow(0 1px 2px rgba(0, 20, 70, .25));
  --group-bg: rgba(255, 255, 255, .6); --detail-a: rgba(255, 255, 255, .5); --detail-b: rgba(255, 255, 255, .32);
  --danger: #d4243f; --vignette: rgba(160, 195, 245, .45); --blob-1: rgba(255, 255, 255, .9); --blob-2: rgba(110, 175, 255, .5); --blob-3: rgba(70, 130, 240, .38); --blob-4: rgba(170, 225, 255, .6);
}
:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .topbar, :root:not([data-theme="dark"]) .logo-plate {
    --bg: #04143c;
    --fg: #f3f8ff; --fg-strong: #ffffff; --fg-2: rgba(226, 238, 255, .72); --fg-3: rgba(226, 238, 255, .46);
    --stroke: rgba(255, 255, 255, .16); --stroke-2: rgba(255, 255, 255, .25); --fill: rgba(255, 255, 255, .08); --fill-2: rgba(255, 255, 255, .13);
    --glass-a: rgba(16, 46, 120, .86); --glass-b: rgba(6, 24, 70, .8); --glass-hi: rgba(255, 255, 255, .3); --glass-glow: rgba(130, 205, 255, .35);
    --glass-shadow: rgba(20, 50, 130, .4); --rim-hi: rgba(255, 255, 255, .8); --rim-lo: rgba(255, 255, 255, .08); --rim-tint: rgba(150, 215, 255, .6);
    --logo-shadow: drop-shadow(0 1px 3px rgba(0, 6, 30, .45)); color: var(--fg);
  }
}
:root[data-theme="light"] .topbar, :root[data-theme="light"] .logo-plate {
    --bg: #04143c;
    --fg: #f3f8ff; --fg-strong: #ffffff; --fg-2: rgba(226, 238, 255, .72); --fg-3: rgba(226, 238, 255, .46);
    --stroke: rgba(255, 255, 255, .16); --stroke-2: rgba(255, 255, 255, .25); --fill: rgba(255, 255, 255, .08); --fill-2: rgba(255, 255, 255, .13);
    --glass-a: rgba(16, 46, 120, .86); --glass-b: rgba(6, 24, 70, .8); --glass-hi: rgba(255, 255, 255, .3); --glass-glow: rgba(130, 205, 255, .35);
    --glass-shadow: rgba(20, 50, 130, .4); --rim-hi: rgba(255, 255, 255, .8); --rim-lo: rgba(255, 255, 255, .08); --rim-tint: rgba(150, 215, 255, .6);
    --logo-shadow: drop-shadow(0 1px 3px rgba(0, 6, 30, .45)); color: var(--fg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font: 15px/1.45 var(--font);
  color: var(--fg);
  background: var(--bg);
  transition: background-color .5s var(--ease), color .3s;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  letter-spacing: -.006em;
}
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }

.scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.scene i {
  position: absolute; border-radius: 50%; will-change: transform; pointer-events: none;
  background: radial-gradient(closest-side, var(--c), transparent);
  animation: drift 46s ease-in-out infinite alternate;
}
.scene i:nth-child(1) { --c: var(--blob-1); width: 90vmax; height: 90vmax; left: -34vmax; top: -34vmax; }
.scene i:nth-child(2) { --c: var(--blob-2); width: 64vmax; height: 64vmax; right: -24vmax; top: -26vmax; animation-duration: 58s; animation-delay: -20s; }
.scene i:nth-child(3) { --c: var(--blob-3); width: 110vmax; height: 80vmax; left: -10vmax; bottom: -50vmax; animation-duration: 64s; animation-delay: -34s; }
.scene i:nth-child(4) { display: none; }
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(7vw, 4vh, 0) scale(1.08); }
  100% { transform: translate3d(-4vw, 8vh, 0) scale(.96); }
}

.busy .scene i { animation-play-state: paused; }

.lite .scene i { animation: none; }
.lite .lg { -webkit-backdrop-filter: blur(10px) saturate(160%); backdrop-filter: blur(10px) saturate(160%); }
.scene::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(140% 90% at 50% 120%, var(--vignette), transparent 60%),
    radial-gradient(80% 50% at 50% -10%, rgba(120, 200, 255, .12), transparent 70%);
}
.scene::after {
  content: ""; position: absolute; inset: 0; opacity: .08; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.lg {
  position: relative; isolation: isolate;
  background: linear-gradient(180deg, var(--glass-a), var(--glass-b));
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  backdrop-filter: blur(14px) saturate(180%);
  box-shadow:
    inset 0 18px 22px -20px var(--glass-hi),
    inset 0 -16px 22px -20px var(--glass-glow),
    0 12px 34px -12px var(--glass-shadow),
    0 1px 2px rgba(0, 0, 0, .2);
}

.lg::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1px;
  background: conic-gradient(from 220deg,
    var(--rim-hi), var(--rim-lo) 22%, var(--rim-lo) 45%,
    var(--rim-tint) 62%, var(--rim-lo) 80%, var(--rim-hi));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.lg-thick {
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  backdrop-filter: blur(20px) saturate(190%);
}

.btn {
  appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 600; font-size: 15px; white-space: nowrap; text-decoration: none;
  background: var(--fill); box-shadow: inset 0 0 0 .5px var(--stroke), inset 0 1px 0 var(--stroke);
  transition: transform .5s var(--spring), background .2s, box-shadow .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--fill-2); }
.btn:active { transform: scale(1.06); }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn-tint {
  color: #fff;
  background: linear-gradient(180deg, rgba(98, 180, 255, .96), rgba(22, 104, 240, .96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -1px 0 rgba(0, 30, 110, .4),
    inset 0 0 0 .5px rgba(190, 228, 255, .6), 0 10px 26px -8px rgba(30, 120, 255, .8);
}
.btn-tint:hover { background: linear-gradient(180deg, rgba(118, 192, 255, 1), rgba(34, 116, 250, 1)); }
.btn-sm { min-height: 34px; padding: 0 13px; font-size: 13.5px; }
.btn-danger { color: var(--danger); }

:focus-visible { outline: 2px solid var(--aqua); outline-offset: 3px; }

.switch { position: relative; width: 51px; height: 31px; flex: none; display: inline-block; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(120, 140, 180, .32); transition: background .3s; }
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .28), 0 0 0 .5px rgba(0, 0, 0, .05);
  transition: transform .45s var(--spring), width .25s var(--ease);
}
.switch input:active + span::after { width: 33px; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:checked:active + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--aqua); outline-offset: 3px; }

.input {
  width: 100%; border: 0; background: transparent; padding: 0; font-size: 16px; color: var(--fg); outline: none;
}
.input::placeholder { color: var(--fg-3); }
textarea.input { resize: vertical; min-height: 44px; line-height: 1.4; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; position: relative; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--ok); opacity: 0; animation: ring 2.2s var(--ease) infinite; }
.live-dot.off { background: var(--fg-3); }
.live-dot.off::after { display: none; }
@keyframes ring { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(1.8); opacity: 0; } }

.toast {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 80;
  transform: translate(-50%, -160%); opacity: 0; visibility: hidden;
  padding: 12px 18px; border-radius: 22px; font-weight: 600; font-size: 14px; max-width: min(420px, calc(100vw - 32px)); text-align: center;
  transition: transform .6s var(--spring), opacity .3s, visibility .3s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

.theme-btn {
  flex: none; position: relative; width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--fill); box-shadow: inset 0 0 0 .5px var(--stroke), inset 0 1px 0 var(--stroke);
  transition: transform .5s var(--spring), background .2s; -webkit-tap-highlight-color: transparent;
}
.theme-btn:hover { background: var(--fill-2); }
.theme-btn:active { transform: scale(1.12); }
.theme-btn svg { position: absolute; width: 34px; height: 34px; transition: transform .7s var(--spring), opacity .35s var(--ease); }
.theme-btn .ico-sun { transform: rotate(-120deg) scale(.4); opacity: 0; }
.theme-btn .ico-moon { transform: rotate(0) scale(1); opacity: 1; }
:root[data-theme="light"] .theme-btn .ico-sun { transform: rotate(0) scale(1); opacity: 1; }
:root[data-theme="light"] .theme-btn .ico-moon { transform: rotate(120deg) scale(.4); opacity: 0; }
.theme-btn:hover .ico-sun { animation: sun-spin 6s linear infinite; }
@keyframes sun-spin { to { transform: rotate(360deg); } }
.theme-btn:hover .ico-moon { animation: moon-rock 1.6s var(--ease) infinite alternate; }
@keyframes moon-rock { from { transform: rotate(-8deg); } to { transform: rotate(10deg); } }

::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: theme-reveal .7s cubic-bezier(.22, 1, .36, 1); }
@keyframes theme-reveal {
  from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0)); }
  to { clip-path: circle(150vmax at var(--vt-x, 50%) var(--vt-y, 0)); }
}
