/*
 * iDULS desktop look: Apple-inspired "liquid glass", light and dark.
 * Brand: navy #16152E · purple #B329FF · grey-purple #5C5A78 · off-white #F5F5FA ·
 *        deep blue #1A1640 · cyan #00C8FF (gradient partner).
 *
 * Built for old PCs (Library runs on Windows 7 / Chromium 108):
 *  - glass = translucent fills + sheen gradient + inner highlight; no backdrop-filter blur
 *  - animations move only transform / opacity; colour cross-fades only while switching theme
 *  - nothing newer than Chromium 108 (no CSS nesting, no color-mix, no :has dependence)
 */

/* ============================================================ tokens */
:root {
  --navy: #16152E;
  --purple: #B329FF;
  --grey: #5C5A78;
  --white: #F5F5FA;
  --deep: #1A1640;
  --cyan: #00C8FF;

  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, system-ui, Tahoma, Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", -apple-system, system-ui, Tahoma, Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "Courier New", monospace;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --titlebar-h: 48px;
  --caption-w: 138px;

  --grad: linear-gradient(135deg, #B329FF 0%, #7B4DFF 55%, #00C8FF 120%);
  --grad-bar: linear-gradient(90deg, #B329FF 0%, #7B4DFF 55%, #19B8FF 100%);
  --grad-btn: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 55%), linear-gradient(135deg, #B02BFC 0%, #8A2CF2 55%, #6440F0 100%);

  /* light */
  --bg: #F4F3FA;
  --chrome: #F4F3FA;
  --ink: #16152E;
  --ink-2: #34324F;
  --muted: #5C5A78;
  --faint: rgba(22, 21, 46, 0.36);
  --line: rgba(22, 21, 46, 0.08);
  --line-strong: rgba(22, 21, 46, 0.14);
  --surface: rgba(255, 255, 255, 0.62);
  --surface-2: rgba(255, 255, 255, 0.82);
  --surface-hover: rgba(255, 255, 255, 0.96);
  --surface-sunken: rgba(22, 21, 46, 0.05);
  --surface-sunken-2: rgba(22, 21, 46, 0.08);
  --edge: rgba(255, 255, 255, 0.95);
  --hairline: rgba(22, 21, 46, 0.08);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 55%);
  --shadow-sm: 0 1px 2px rgba(22, 21, 46, 0.06), 0 3px 10px -4px rgba(60, 40, 120, 0.12);
  --shadow: 0 1px 2px rgba(22, 21, 46, 0.05), 0 16px 36px -14px rgba(70, 40, 150, 0.24);
  --shadow-lg: 0 2px 6px rgba(22, 21, 46, 0.08), 0 36px 90px -24px rgba(40, 20, 110, 0.42);
  --field: rgba(255, 255, 255, 0.78);
  --field-hover: #FFFFFF;
  --dialog: rgba(255, 255, 255, 0.97);
  --pop: #FFFFFF;
  --scrim: rgba(22, 21, 46, 0.34);
  --tip-bg: #1E1D3A;
  --tip-ink: #F5F5FA;
  --brand: #8E1BDB;
  --brand-soft: rgba(179, 41, 255, 0.10);
  --brand-line: rgba(179, 41, 255, 0.32);
  --focus: rgba(179, 41, 255, 0.6);
  --link: #8A16D6;
  --ok: #138A4A;
  --ok-soft: rgba(22, 163, 74, 0.10);
  --ok-line: rgba(22, 163, 74, 0.28);
  --ok-strong: #22C55E;
  --warn: #A55308;
  --warn-soft: rgba(245, 158, 11, 0.13);
  --warn-line: rgba(245, 158, 11, 0.38);
  --warn-strong: #F59E0B;
  --bad: #C0262D;
  --bad-soft: rgba(239, 68, 68, 0.09);
  --bad-line: rgba(239, 68, 68, 0.30);
  --bad-strong: #EF4444;
  --scroll: rgba(22, 21, 46, 0.18);
  --scroll-hover: rgba(22, 21, 46, 0.32);
  --glow-light: 1;
  --glow-dark: 0;

  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
}

/* Dark: follows the device before the script runs; afterwards data-theme is always set. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0D22; --chrome: #0E0D22; --ink: #F5F5FA; --ink-2: #DAD9EC; --muted: #A9A7C6; --faint: rgba(245, 245, 250, 0.36);
    --line: rgba(245, 245, 250, 0.08); --line-strong: rgba(245, 245, 250, 0.15);
    --surface: rgba(255, 255, 255, 0.045); --surface-2: rgba(255, 255, 255, 0.075); --surface-hover: rgba(255, 255, 255, 0.11);
    --surface-sunken: rgba(0, 0, 0, 0.22); --surface-sunken-2: rgba(255, 255, 255, 0.06);
    --edge: rgba(255, 255, 255, 0.10); --hairline: rgba(255, 255, 255, 0.07);
    --sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 50%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -6px rgba(0, 0, 0, 0.5);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 20px 44px -18px rgba(0, 0, 0, 0.75);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.4), 0 40px 100px -24px rgba(0, 0, 0, 0.85);
    --field: rgba(0, 0, 0, 0.24); --field-hover: rgba(0, 0, 0, 0.32);
    --dialog: #1A1938; --pop: #222143; --scrim: rgba(4, 3, 14, 0.62);
    --tip-bg: #F5F5FA; --tip-ink: #16152E;
    --brand: #D29AFF; --brand-soft: rgba(179, 41, 255, 0.17); --brand-line: rgba(196, 110, 255, 0.42); --focus: rgba(206, 130, 255, 0.75); --link: #D59BFF;
    --ok: #5BE08F; --ok-soft: rgba(74, 222, 128, 0.12); --ok-line: rgba(74, 222, 128, 0.30);
    --warn: #FBC14A; --warn-soft: rgba(251, 191, 36, 0.12); --warn-line: rgba(251, 191, 36, 0.34);
    --bad: #FF8A8A; --bad-soft: rgba(248, 113, 113, 0.12); --bad-line: rgba(248, 113, 113, 0.34);
    --scroll: rgba(245, 245, 250, 0.16); --scroll-hover: rgba(245, 245, 250, 0.30);
    --glow-light: 0; --glow-dark: 1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0D22; --chrome: #0E0D22; --ink: #F5F5FA; --ink-2: #DAD9EC; --muted: #A9A7C6; --faint: rgba(245, 245, 250, 0.36);
  --line: rgba(245, 245, 250, 0.08); --line-strong: rgba(245, 245, 250, 0.15);
  --surface: rgba(255, 255, 255, 0.045); --surface-2: rgba(255, 255, 255, 0.075); --surface-hover: rgba(255, 255, 255, 0.11);
  --surface-sunken: rgba(0, 0, 0, 0.22); --surface-sunken-2: rgba(255, 255, 255, 0.06);
  --edge: rgba(255, 255, 255, 0.10); --hairline: rgba(255, 255, 255, 0.07);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 50%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -6px rgba(0, 0, 0, 0.5);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 20px 44px -18px rgba(0, 0, 0, 0.75);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.4), 0 40px 100px -24px rgba(0, 0, 0, 0.85);
  --field: rgba(0, 0, 0, 0.24); --field-hover: rgba(0, 0, 0, 0.32);
  --dialog: #1A1938; --pop: #222143; --scrim: rgba(4, 3, 14, 0.62);
  --tip-bg: #F5F5FA; --tip-ink: #16152E;
  --brand: #D29AFF; --brand-soft: rgba(179, 41, 255, 0.17); --brand-line: rgba(196, 110, 255, 0.42); --focus: rgba(206, 130, 255, 0.75); --link: #D59BFF;
  --ok: #5BE08F; --ok-soft: rgba(74, 222, 128, 0.12); --ok-line: rgba(74, 222, 128, 0.30);
  --warn: #FBC14A; --warn-soft: rgba(251, 191, 36, 0.12); --warn-line: rgba(251, 191, 36, 0.34);
  --bad: #FF8A8A; --bad-soft: rgba(248, 113, 113, 0.12); --bad-line: rgba(248, 113, 113, 0.34);
  --scroll: rgba(245, 245, 250, 0.16); --scroll-hover: rgba(245, 245, 250, 0.30);
  --glow-light: 0; --glow-dark: 1;
  color-scheme: dark;
}

/* Smooth theme switch: colours cross-fade for a moment, the background glows fade over. */
.theme-switching,
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition: background-color 300ms var(--ease), border-color 300ms var(--ease), color 300ms var(--ease),
    fill 300ms var(--ease), stroke 300ms var(--ease), opacity 320ms var(--ease) !important;
}

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background-color: var(--bg);
  line-height: 1.45;
  user-select: none;
  cursor: default;
}
/* Two fixed glow layers (light + dark) cross-fade on theme change: opacity only. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  transition: opacity 320ms var(--ease);
}
body::before {
  opacity: var(--glow-light);
  background:
    radial-gradient(760px 520px at 102% 108%, rgba(179, 41, 255, 0.17), transparent 62%),
    radial-gradient(700px 460px at -8% 104%, rgba(0, 200, 255, 0.12), transparent 60%),
    radial-gradient(620px 360px at 18% 8%, rgba(123, 77, 255, 0.07), transparent 65%);
}
body::after {
  opacity: var(--glow-dark);
  background:
    radial-gradient(820px 560px at 104% 110%, rgba(179, 41, 255, 0.30), transparent 62%),
    radial-gradient(760px 520px at -10% 108%, rgba(0, 170, 255, 0.16), transparent 60%),
    radial-gradient(900px 520px at 30% 0%, rgba(26, 22, 64, 0.9), transparent 70%);
}

h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
input, textarea { font: inherit; color: inherit; user-select: text; }
img { display: block; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-tight { display: inline-flex; align-items: center; gap: 8px; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.stack-lg > * + * { margin-top: 20px; }
.selectable { user-select: text; cursor: text; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }

::selection { background: rgba(179, 41, 255, 0.28); }
:focus { outline: none; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; }

/* Custom scrollbars */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--scroll);
  border: 3.5px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
  min-height: 40px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-hover); }

/* ============================================================ window */
.app { height: 100vh; display: flex; flex-direction: column; }

.titlebar {
  position: relative;
  z-index: 20;
  flex: none;
  height: var(--titlebar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  /* Leave room for the Windows minimise / maximise / close buttons. */
  padding-right: calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, calc(100vw - var(--caption-w))) + 8px);
  background-color: var(--chrome);
  border-bottom: 1px solid var(--line);
  -webkit-app-region: drag;
  user-select: none;
}
.titlebar button, .titlebar input, .titlebar .seg, .titlebar [data-no-drag] { -webkit-app-region: no-drag; }
.tb-logo { width: 26px; height: 26px; border-radius: 7px; box-shadow: 0 2px 6px rgba(80, 30, 160, 0.3); }
.tb-name { display: flex; align-items: baseline; gap: 6px; font-family: var(--font-display); font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.tb-name b { font-weight: 700; }
.tb-product {
  font-weight: 600;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tb-tag {
  font-size: 12px;
  color: var(--muted);
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid var(--line-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.tb-spacer { flex: 1; }
.tb-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.tb-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: var(--surface-sunken); white-space: nowrap; -webkit-app-region: no-drag;
}
@media (max-width: 980px) { .tb-tag { display: none; } }
@media (max-width: 900px) { .tb-chip .tb-chip-text { display: none; } }

.main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; }
.content { max-width: 960px; margin: 0 auto; padding: 30px 32px 56px; }

/* Encryptor: sidebar + content */
.shell { flex: 1; min-height: 0; display: flex; }
.sidebar {
  flex: none;
  width: 228px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 12px 14px;
  background-color: var(--surface);
  background-image: var(--sheen);
  border-right: 1px solid var(--line);
  box-shadow: inset -1px 0 0 var(--edge);
}
.side-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); padding: 6px 12px 6px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  width: 100%; height: 40px; padding: 0 12px;
  border: 0; border-radius: 11px; background: transparent;
  font-size: 14.5px; font-weight: 600; color: var(--ink-2); text-align: left; cursor: pointer;
  transition: background-color 160ms var(--ease), transform 160ms var(--ease);
}
.nav-item svg { color: var(--muted); transition: color 160ms; }
.nav-item:hover { background-color: var(--surface-sunken); }
.nav-item:active { transform: scale(0.98); }
.nav-item.on { background-color: var(--surface-2); color: var(--ink); box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm); }
.nav-item.on svg { color: var(--brand); }
.nav-item.on::before {
  content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--grad); animation: grow-y 220ms var(--ease);
}
.nav-sub { height: 34px; padding-left: 40px; font-size: 13.5px; font-family: var(--mono); font-weight: 600; }
.nav-sub::after { content: ""; position: absolute; left: 21px; top: -4px; height: 22px; width: 10px; border-left: 1.5px solid var(--line-strong); border-bottom: 1.5px solid var(--line-strong); border-bottom-left-radius: 6px; }
.side-spacer { flex: 1; }
.side-card {
  border-radius: var(--r);
  padding: 12px;
  background-color: var(--surface-2);
  background-image: var(--sheen);
  border: 1px solid var(--hairline);
  box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm);
  animation: rise 260ms var(--ease);
}
.side-card-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 10px; line-height: 1.3; }
.side-card-title svg { color: var(--warn); flex: none; }
.side-card .btn { width: 100%; justify-content: flex-start; }
.side-card .btn + .btn { margin-top: 6px; }
.side-status { display: flex; align-items: center; gap: 8px; padding: 10px 12px 0; font-size: 12.5px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok-strong); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn-strong); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.live { background: var(--bad-strong); box-shadow: 0 0 0 3px var(--bad-soft); animation: blink 1.4s ease-in-out infinite; }

/* ============================================================ page structure */
.view { animation: view-in 280ms var(--ease) both; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head-text { min-width: 0; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--brand); margin-bottom: 4px; }
.page-title { font-family: var(--font-display); font-size: 31px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.12; }
.page-sub { margin-top: 6px; font-size: 15px; color: var(--muted); max-width: 640px; }
.page-head-actions { display: flex; gap: 10px; align-items: center; }

/* Glass card */
.card {
  position: relative;
  border-radius: var(--r-lg);
  padding: 22px;
  background-color: var(--surface);
  background-image: var(--sheen);
  border: 1px solid var(--hairline);
  box-shadow: inset 0 1px 0 var(--edge), var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-flush { padding: 0; overflow: hidden; }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }

.section-head { display: flex; align-items: center; gap: 14px; }
.section-head + * { margin-top: 18px; }
.section-head-text { flex: 1; min-width: 0; }
.section-head h2 { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.section-head p { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.section-head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Coloured icon squircle (app-icon style) */
.tile-icon {
  flex: none;
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  color: #fff;
  background: var(--grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -6px rgba(140, 50, 240, 0.7);
}
.tile-icon.lg { width: 56px; height: 56px; border-radius: 16px; }
.tile-icon.tone-ok { background: linear-gradient(135deg, #34D27B, #0EA5A0); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -6px rgba(20, 160, 110, 0.7); }
.tile-icon.tone-warn { background: linear-gradient(135deg, #FBBF24, #F97316); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -6px rgba(240, 140, 30, 0.7); }
.tile-icon.tone-bad { background: linear-gradient(135deg, #FB7185, #E11D48); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -6px rgba(225, 29, 72, 0.6); }
.tile-icon.tone-cyan { background: linear-gradient(135deg, #22D3EE, #3B82F6); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -6px rgba(40, 130, 240, 0.7); }
.tile-icon.tone-neutral { background: linear-gradient(135deg, #8B89A8, #5C5A78); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); }

/* Round status orbs */
.orb-ok { color: #fff; background: linear-gradient(135deg, #34D27B, #0EA5A0); box-shadow: 0 6px 16px -6px rgba(20, 170, 110, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.orb-warn { color: #fff; background: linear-gradient(135deg, #FBBF24, #F97316); box-shadow: 0 6px 16px -6px rgba(240, 140, 30, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.orb-bad { color: #fff; background: linear-gradient(135deg, #FB7185, #E11D48); box-shadow: 0 6px 16px -6px rgba(225, 29, 72, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.orb-neutral { color: #fff; background: linear-gradient(135deg, #8B89A8, #5C5A78); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.orb-brand { color: #fff; background: var(--grad); box-shadow: 0 6px 16px -6px rgba(140, 50, 240, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.35); }

/* ============================================================ buttons */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 17px;
  border-radius: 999px; border: 1px solid transparent;
  font: 600 14px/1 var(--font); letter-spacing: 0.005em; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: transform 160ms var(--ease), opacity 180ms var(--ease), background-color 160ms var(--ease), box-shadow 200ms var(--ease);
}
.btn svg { flex: none; }
.btn:active:not(:disabled) { transform: scale(0.965); }
.btn:disabled { cursor: default; opacity: 0.42; box-shadow: none; }
.btn.is-loading { opacity: 0.85; }
.btn-sm { height: 31px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-lg { height: 50px; padding: 0 26px; font-size: 16px; gap: 10px; }

.btn-primary {
  color: #fff;
  background-color: #9A28F2;
  background-image: var(--grad-btn);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), inset 0 -1px 0 rgba(30, 0, 80, 0.25), 0 8px 20px -8px rgba(130, 40, 240, 0.75);
}
/* Hover glow is a pre-made layer that only fades in (opacity), so hovering stays cheap. */
.btn-primary::after, .btn-danger::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  opacity: 0; transition: opacity 160ms var(--ease);
}
.btn-primary:hover:not(:disabled)::after, .btn-danger:hover:not(:disabled)::after { opacity: 1; }
.btn-primary.ready { animation: ready-glow 1.8s ease-in-out 2; }
.btn-danger {
  color: #fff;
  background-color: #D92D3A;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 55%), linear-gradient(135deg, #F0525E, #C81E3A);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 8px 20px -8px rgba(220, 40, 60, 0.7);
}
.btn-secondary {
  color: var(--ink);
  background-color: var(--surface-2);
  background-image: var(--sheen);
  border-color: var(--hairline);
  box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) { background-color: var(--surface-hover); }
.btn-secondary svg { color: var(--brand); }
.btn-ghost { color: var(--ink-2); background-color: transparent; }
.btn-ghost:hover:not(:disabled) { background-color: var(--surface-sunken); }
.btn-ghost svg { color: var(--muted); }
.btn-tinted { color: var(--brand); background-color: var(--brand-soft); border-color: transparent; }
.btn-tinted:hover:not(:disabled) { background-color: rgba(179, 41, 255, 0.2); }
.btn-ok-tinted { color: var(--ok); background-color: var(--ok-soft); }
.btn-ok-tinted:hover:not(:disabled) { background-color: rgba(34, 197, 94, 0.2); }
.btn-back { margin-left: -10px; padding: 0 12px; }
.btn-back svg { transition: transform 180ms var(--ease); }
.btn-back:hover svg { transform: translateX(-3px); }

.icon-btn {
  position: relative;
  flex: none;
  width: 34px; height: 34px; padding: 0;
  display: inline-grid; place-items: center;
  border-radius: 999px; border: 1px solid transparent;
  background-color: transparent; color: var(--ink-2);
  cursor: pointer;
  transition: background-color 160ms var(--ease), transform 160ms var(--ease), color 160ms;
}
.icon-btn:hover { background-color: var(--surface-sunken); color: var(--ink); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn-glass { background-color: var(--surface-2); border-color: var(--hairline); box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm); }
.icon-btn-glass:hover { background-color: var(--surface-hover); }
.icon-btn-danger:hover { color: var(--bad); background-color: var(--bad-soft); }

/* Theme toggle: sun and moon swap with a turn + fade. */
.theme-toggle { overflow: hidden; }
.theme-toggle svg { grid-area: 1 / 1; transition: transform 360ms var(--ease-spring), opacity 220ms var(--ease); }
.theme-toggle .tt-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
.theme-toggle.is-dark .tt-sun { opacity: 1; transform: none; }
.theme-toggle.is-dark .tt-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

.link { display: inline-flex; align-items: center; gap: 5px; border: 0; padding: 0; background: none; color: var(--link); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================ tooltips */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  left: 50%;
  width: max-content;
  max-width: 260px;
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--tip-bg);
  color: var(--tip-ink);
  font: 500 12.5px/1.4 var(--font);
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  white-space: pre-line;
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -4px);
  transition: opacity 140ms var(--ease), transform 140ms var(--ease);
}
[data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 450ms; }
[data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
[data-tip=""]::after, [data-tip-pos="none"]::after { display: none; }
[data-tip-pos="end"]::after { left: auto; right: 0; transform: translateY(-4px); }
[data-tip-pos="end"]:hover::after, [data-tip-pos="end"]:focus-visible::after { transform: none; }
[data-tip-pos="start"]::after { left: 0; transform: translateY(-4px); }
[data-tip-pos="start"]:hover::after, [data-tip-pos="start"]:focus-visible::after { transform: none; }
[data-tip-pos="top"]::after { top: auto; bottom: calc(100% + 8px); transform: translate(-50%, 4px); }

/* ============================================================ segmented control */
.seg {
  position: relative;
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background-color: var(--surface-sunken);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  max-width: 100%;
  overflow-x: auto;
}
.seg::-webkit-scrollbar { display: none; }
.seg-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 0;
  border-radius: 999px;
  background-color: var(--surface-hover);
  background-image: var(--sheen);
  box-shadow: inset 0 1px 0 var(--edge), 0 1px 3px rgba(22, 21, 46, 0.14), 0 4px 10px -4px rgba(80, 40, 160, 0.3);
  transition: transform 260ms var(--ease-spring), width 260ms var(--ease);
}
:root[data-theme="dark"] .seg-thumb { background-color: rgba(255, 255, 255, 0.14); }
.seg-btn {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 16px; min-width: 44px;
  border: 0; border-radius: 999px; background: transparent;
  font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; cursor: pointer;
  transition: color 160ms var(--ease);
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { color: var(--ink); }
.seg-btn.on svg { color: var(--brand); }
.seg-sm .seg-btn { height: 28px; padding: 0 11px; font-size: 12.5px; min-width: 38px; letter-spacing: 0.03em; }

/* ============================================================ fields */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field-hint { font-size: 12.5px; color: var(--muted); }
.input-wrap {
  position: relative;
  display: flex; align-items: center;
  height: 44px;
  border-radius: 12px;
  background-color: var(--field);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.input-wrap:hover { background-color: var(--field-hover); }
.input-wrap:focus-within, .input-wrap.is-open { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(179, 41, 255, 0.16); background-color: var(--field-hover); }
.input-icon { flex: none; margin-left: 13px; color: var(--muted); transition: color 160ms; }
.input-wrap:focus-within .input-icon { color: var(--brand); }
.input-wrap input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: none; background: transparent;
  padding: 0 13px; font-size: 15px; color: var(--ink);
}
.input-wrap input::placeholder { color: var(--faint); }
.input-action { flex: none; margin-right: 6px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.input-action:hover { background: var(--surface-sunken); color: var(--ink); }

/* Custom select */
.select { position: relative; }
.select-btn { width: 100%; padding: 0; cursor: pointer; text-align: left; font-size: 15px; color: var(--ink); }
.select-btn:focus-visible { outline: none; border-color: var(--purple); box-shadow: 0 0 0 4px rgba(179, 41, 255, 0.2); }
.select-value { flex: 1; min-width: 0; padding: 0 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-chev { flex: none; margin-right: 12px; color: var(--muted); }
.select-pop {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px);
  min-width: 200px; margin: 0; padding: 6px; list-style: none;
  border-radius: 14px;
  background-color: var(--pop);
  border: 1px solid var(--hairline);
  box-shadow: inset 0 1px 0 var(--edge), var(--shadow-lg);
  transform-origin: top center;
  animation: pop-in 170ms var(--ease) both;
}
.select-pop.closing { animation: pop-out 120ms var(--ease-in) both; }
.select-opt { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border-radius: 9px; font-size: 14.5px; cursor: pointer; }
.select-opt.active { background: var(--brand-soft); }
.select-opt[aria-selected="true"] { font-weight: 600; }
.select-check { width: 16px; flex: none; color: var(--brand); padding-top: 2px; }
.select-hint { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }

/* Custom checkbox / radio (in case any are used) */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 20px; height: 20px; flex: none;
  border-radius: 6px; border: 1.5px solid var(--line-strong); background: var(--field);
  display: inline-grid; place-items: center; cursor: pointer;
  transition: background-color 140ms, border-color 140ms;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before {
  content: ""; width: 11px; height: 6px; margin-top: -3px;
  border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) scale(0); transition: transform 160ms var(--ease-spring);
}
input[type="radio"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform 160ms var(--ease-spring); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: #9A28F2; border-color: #9A28F2; }
input[type="checkbox"]:checked::before { transform: rotate(-45deg) scale(1); }
input[type="radio"]:checked::before { transform: scale(1); }

/* ============================================================ status */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px;
  border-radius: 999px; border: 1px solid transparent;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap;
}
.badge-ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.badge-bad { color: var(--bad); background: var(--bad-soft); border-color: var(--bad-line); }
.badge-brand { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line); }
.badge-neutral { color: var(--muted); background: var(--surface-sunken); }

.notice {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r);
  border: 1px solid transparent;
  font-size: 14.5px; line-height: 1.45;
  animation: rise 240ms var(--ease) both;
}
.notice > svg { flex: none; margin-top: 1px; }
.notice-body { min-width: 0; flex: 1; }
.notice-body b { display: block; margin-bottom: 2px; }
.notice-ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ink); }
.notice-ok > svg { color: var(--ok); }
.notice-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--ink); }
.notice-warn > svg { color: var(--warn); }
.notice-bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--ink); }
.notice-bad > svg { color: var(--bad); }
.notice-info { background: var(--brand-soft); border-color: var(--brand-line); color: var(--ink); }
.notice-info > svg { color: var(--brand); }

.spinner {
  display: inline-block; flex: none;
  border-radius: 50%;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--purple);
  animation: spin 0.8s linear infinite;
}
.spinner-light { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }

/* Progress bar: the fill slides (transform) instead of resizing. */
.bar { position: relative; height: 8px; border-radius: 999px; background: var(--surface-sunken-2); overflow: hidden; }
.bar-fill { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; background: var(--grad-bar); transform: translateX(-100%); transition: transform 420ms var(--ease); }
.bar-ok .bar-fill { background: linear-gradient(90deg, #22C55E, #10B9A5); }
.bar.live .bar-fill::after, .bar.indeterminate .bar-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.6s var(--ease) infinite;
}
.bar.indeterminate .bar-fill { width: 38%; right: auto; animation: indeterminate 1.4s var(--ease) infinite; transition: none; }
.bar-lg { height: 10px; }

/* Progress ring */
.ring { position: relative; flex: none; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; }
.ring-track { stroke: var(--surface-sunken-2); }
.ring-fill { transition: stroke-dashoffset 500ms var(--ease); }
.ring-stop-a { stop-color: #B329FF; }
.ring-stop-b { stop-color: #00C8FF; }
.ring-ok .ring-stop-a { stop-color: #22C55E; }
.ring-ok .ring-stop-b { stop-color: #14B8A6; }
.ring-spin svg { animation: spin 1.6s linear infinite; }
.ring-label { position: relative; font-family: var(--font-display); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }

/* Stepper */
.stepper { display: flex; margin: 0 0 22px; padding: 0; list-style: none; }
.step { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 0; }
.step-dot {
  position: relative; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: var(--muted);
  background-color: var(--surface-2);
  border: 1px solid var(--line-strong);
  transition: transform 260ms var(--ease-spring);
}
.step-label { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 6px; }
.step-line { position: absolute; top: 16px; left: calc(50% + 22px); right: calc(-50% + 22px); height: 3px; border-radius: 3px; background: var(--line-strong); overflow: hidden; }
.step-line span { position: absolute; inset: 0; background: var(--grad-bar); transform: translateX(-101%); transition: transform 500ms var(--ease); }
.step-done .step-line span { transform: none; }
.step-done .step-dot { color: #fff; border-color: transparent; background: linear-gradient(135deg, #B329FF, #7B4DFF); }
.step-done .step-label { color: var(--ink-2); }
.step-on .step-dot {
  color: #fff; border-color: transparent; background: var(--grad);
  transform: scale(1.12);
  box-shadow: 0 0 0 5px var(--brand-soft), 0 6px 16px -4px rgba(140, 50, 240, 0.6);
}
.step-on .step-label { color: var(--ink); }

/* Empty states */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 24px 52px; }
.empty-compact { padding: 28px 16px; }
.empty-art { position: relative; width: 108px; height: 108px; display: grid; place-items: center; margin-bottom: 22px; }
.empty-compact .empty-art { width: 72px; height: 72px; margin-bottom: 14px; }
.empty-icon {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  border-radius: 30px;
  display: grid; place-items: center;
  color: #fff;
  background: var(--grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -10px 24px rgba(40, 0, 120, 0.25), 0 18px 40px -14px rgba(130, 40, 240, 0.7);
  animation: float-in 520ms var(--ease-spring) both;
}
.empty-compact .empty-icon { border-radius: 21px; }
.halo { position: absolute; inset: 0; border-radius: 34px; border: 2px solid var(--brand-line); opacity: 0; }
.pulse .halo { animation: halo 2.8s var(--ease) infinite; }
.pulse .halo-2 { animation-delay: 1.4s; }
.empty h2 { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.empty-compact h2 { font-size: 18px; }
.empty-text { margin-top: 8px; color: var(--muted); font-size: 15px; max-width: 460px; }
.empty-action { margin-top: 20px; }

/* Skeletons */
.skel { display: block; position: relative; overflow: hidden; background: var(--surface-sunken-2); }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s ease-in-out infinite;
}
:root[data-theme="dark"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent); }

/* Success mark */
.success-mark { position: relative; flex: none; margin: 0 auto; }
.success-mark svg { position: relative; z-index: 1; overflow: visible; }
.sm-circle { fill: #1FB866; stroke: none; transform-origin: 26px 26px; animation: pop-circle 520ms var(--ease-spring) both; filter: drop-shadow(0 8px 14px rgba(20, 160, 90, 0.4)); }
.sm-tick { fill: none; stroke: #fff; stroke-width: 4.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 380ms var(--ease) 300ms forwards; }
.spark {
  position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%;
  background: var(--grad); opacity: 0;
  transform: rotate(var(--a)) translateY(0) scale(0.4);
  animation: spark 700ms var(--ease) 260ms both;
}
.spark:nth-child(odd) { background: #22C55E; }

/* ============================================================ dialog & toasts */
.scrim {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 24px;
  background: var(--scrim);
  -webkit-app-region: no-drag;
  animation: fade-in 180ms var(--ease) both;
}
.scrim.closing { animation: fade-out 170ms var(--ease-in) both; }
.dialog {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 30px 28px 26px;
  border-radius: var(--r-xl);
  background-color: var(--dialog);
  background-image: var(--sheen);
  border: 1px solid var(--hairline);
  box-shadow: inset 0 1px 0 var(--edge), var(--shadow-lg);
  text-align: center;
  user-select: text;
  animation: dialog-in 300ms var(--ease-spring) both;
}
.scrim.closing .dialog { animation: dialog-out 170ms var(--ease-in) both; }
.dialog-x { position: absolute; top: 12px; right: 12px; }
.dialog h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.015em; margin-top: 16px; }
.dialog p { color: var(--muted); margin-top: 8px; }
.dialog-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.path-box { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-sunken); font-family: var(--mono); font-size: 12.5px; text-align: left; word-break: break-all; user-select: text; }

.toaster { position: fixed; z-index: 120; left: 0; right: 0; bottom: 22px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  max-width: min(460px, calc(100vw - 40px));
  padding: 11px 16px 11px 13px;
  border-radius: 16px;
  background-color: var(--pop);
  border: 1px solid var(--hairline);
  box-shadow: inset 0 1px 0 var(--edge), var(--shadow-lg);
  font-size: 14px; font-weight: 500;
  pointer-events: auto;
  animation: toast-in 320ms var(--ease-spring) both;
}
.toast.leaving { animation: toast-out 200ms var(--ease-in) both; }
.toast > svg { flex: none; }
.toast-ok > svg { color: var(--ok); }
.toast-bad > svg { color: var(--bad); }
.toast-warn > svg { color: var(--warn); }
.toast-info > svg { color: var(--brand); }

/* ============================================================ lists & rows */
.list { border-radius: var(--r); background: var(--surface-sunken); border: 1px solid var(--line); overflow: auto; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); animation: fade-in 200ms var(--ease) both; }
.list-row:last-child { border-bottom: 0; }
.list-row > svg { flex: none; color: var(--muted); }
.list-title { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.meta { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }
.meta svg { flex: none; }

/* Facts (label + value tiles) */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.fact { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-sunken); min-width: 0; }
.fact > svg { flex: none; color: var(--brand); }
.fact-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.fact-value { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================ animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes view-in { from { opacity: 0; transform: translateY(10px) scale(0.995); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes pop-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-4px) scale(0.97); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes dialog-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(6px) scale(0.97); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(270%); } }
@keyframes halo { 0% { opacity: 0.7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.55); } }
@keyframes float-in { from { opacity: 0; transform: translateY(10px) scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: 0.35; } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: none; } }
@keyframes pop-circle { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spark {
  0% { opacity: 0; transform: rotate(var(--a)) translateY(0) scale(0.4); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(-70px) scale(1); }
}
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: none; } }
@keyframes digit-in { from { transform: translateY(5px) scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes caret { 0%, 45% { opacity: 1; } 55%, 100% { opacity: 0; } }
@keyframes ready-glow { 50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 0 0 6px rgba(179, 41, 255, 0.18), 0 10px 26px -6px rgba(130, 40, 240, 0.85); } }

.shake { animation: shake 420ms var(--ease) both; }
.pop { animation: pop 420ms var(--ease-spring) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }
}
