/* Замер скорости — Liquid Glass (тёмный графит + слива #5C1B6E) */

:root {
  --bg: #08090d;

  /* Liquid Glass: материал = полупрозрачное стекло с преломлением на кромке */
  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.035);   /* вторичный слой */
  --glass-brd: rgba(255, 255, 255, 0.14);
  --glass-brd-hover: rgba(192, 125, 214, 0.55);
  --spec-top: rgba(255, 255, 255, 0.34);   /* спекуляр сверху */
  --spec-bottom: rgba(255, 255, 255, 0.06);
  --edge-glow: rgba(192, 125, 214, 0.35);  /* преломлённая кромка в акценте */

  --ink: #f2f4fa;
  --muted: #a2abc2;
  --muted-2: #7c85a0;
  --accent: #c07dd6;
  --accent-deep: #5c1b6e;
  --accent-soft: rgba(92, 27, 110, 0.22);
  --danger: #ff6f9c;
  --ok: #7ce0b1;
  --warn: #e2b158;

  --radius: 26px;
  --shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.35);
  --lift:
    0 22px 50px rgba(0, 0, 0, 0.55),
    0 0 0 1px var(--edge-glow);
  --gap: 14px;

  --seg: 'DSEG7', 'Consolas', 'Menlo', monospace;

  /* положение курсора для жидкого блика (обновляет js) */
  --mx: 50%;
  --my: 0%;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

.mono { font-variant-numeric: tabular-nums; }

.num7 {
  font-family: var(--seg);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: normal;
}

/* ---------- фон: под стеклом должно быть что преломлять ---------- */

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); }
.orb-a {
  width: 56vmax; height: 56vmax; left: -14vmax; top: -18vmax;
  background: radial-gradient(circle at 40% 40%, rgba(92, 27, 110, 0.4), rgba(92, 27, 110, 0) 66%);
  animation: drift 30s ease-in-out infinite alternate;
}
.orb-b {
  width: 48vmax; height: 48vmax; right: -16vmax; bottom: -20vmax;
  background: radial-gradient(circle at 55% 55%, rgba(170, 80, 190, 0.3), rgba(170, 80, 190, 0) 66%);
  animation: drift 36s ease-in-out infinite alternate-reverse;
}
.orb-c {
  width: 32vmax; height: 32vmax; left: 40%; top: 55%;
  background: radial-gradient(circle, rgba(124, 224, 177, 0.1), rgba(124, 224, 177, 0) 60%);
  animation: drift 44s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(5vmax, 4vmax, 0) scale(1.14); }
}

/* ---------- жидкая линза: общая механика стекла ---------- */

.lens {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(26px) saturate(190%) brightness(1.08);
  -webkit-backdrop-filter: blur(26px) saturate(190%) brightness(1.08);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* спекуляр: яркий верх, тихий низ, жидкий блик ходит за курсором */
.lens::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120px circle at var(--mx) var(--my),
    rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 70%);
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}
.lens::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 var(--spec-top),
    inset 0 -1px 0 var(--spec-bottom),
    inset 1px 0 0 rgba(255, 255, 255, 0.07),
    inset -1px 0 0 rgba(255, 255, 255, 0.07);
}
.lens:hover::before { opacity: 1; }

/* ---------- плавающая шапка ---------- */

.topbar {
  position: sticky; top: 12px; z-index: 40;
  width: min(1040px, calc(100vw - 24px));
  margin: 12px auto 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 16px;
  border-radius: 18px;
}
.topbar.lens { --radius: 18px; border-radius: 18px; }
.topbar > :first-child { justify-self: start; }
.topbar > .tag { justify-self: center; }
.topbar > :last-child { justify-self: end; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); position: relative; }
.mark {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px;
  background: linear-gradient(135deg, rgba(92, 27, 110, 0.55), rgba(200, 130, 210, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 4px 14px rgba(92, 27, 110, 0.4);
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}
.brand:hover .mark { transform: rotate(-8deg) scale(1.06); }
.mark svg { width: 17px; height: 17px; }
.name { font-weight: 700; font-size: 15px; letter-spacing: 0.01em; }
.tag { font-size: 12px; color: var(--muted); }

/* логотип сайта в центре панели: стеклянная плашка */
.tag {
  display: flex; align-items: center; gap: 8px;
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  white-space: nowrap;
}
.tag img {
  display: block;
  height: 30px; width: auto;
  max-width: 210px;
  -webkit-user-drag: none;
  user-select: none;
}

/* слоты логотипа: для тёмной темы — logo-dark (светлые буквы),
   для светлой — logo-light (тёмные); нейтральный logo.* живёт в обеих */
/* специфичность .tag .tag-logo нужна, чтобы перебить .tag img */
.tag .tag-logo { display: none; }
.tag .tag-logo.both { display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 8px rgba(0, 0, 0, 0.2)); }
/* авто-режим по умолчанию считается тёмным: светлые буквы на тёмном фоне */
.tag .tag-logo.for-dark { display: block; }
:root[data-theme="dark"] .tag .tag-logo.for-dark { filter: none; }
:root[data-theme="light"] .tag .tag-logo.for-dark { display: none; }
:root[data-theme="light"] .tag .tag-logo.for-light { display: block; filter: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .tag .tag-logo.for-dark { display: none; }
  :root:not([data-theme]) .tag .tag-logo.for-light { display: block; filter: none; }
}

/* ---------- bento ---------- */

.bento {
  width: min(1040px, calc(100vw - 24px));
  margin: 16px auto 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  align-items: stretch;
}

.tile {
  border-radius: var(--radius);
  padding: 18px;
  transition:
    border-color 0.5s cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow 0.5s cubic-bezier(0.32, 0.72, 0, 1),
    transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.tile.lens:hover { border-color: rgba(192, 125, 214, 0.35); }

.tile-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 8px; padding: 0 2px; position: relative;
}
.tile-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted);
}
.tile-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 6px; padding: 0 2px; position: relative;
}
.hint { font-size: 12px; color: var(--muted-2); }

.chip {
  font-size: 12px; color: #c9cfe4; white-space: nowrap;
  position: relative;
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  border-radius: 999px;
  padding: 5px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: border-color 0.4s cubic-bezier(0.32, 0.72, 0, 1), color 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}
.chip.hot { border-color: var(--glass-brd-hover); color: var(--ink); }

/* --- спидометр --- */

.tile-gauge { display: flex; flex-direction: column; }
.gauge-wrap { position: relative; width: 100%; aspect-ratio: 1 / 1; margin: 0 auto; }
@media (min-width: 720px) { .gauge-wrap { width: min(100%, 520px); } }
#gauge { width: 100%; height: 100%; display: block; }

.gauge-center {
  position: absolute; inset: 0;
  display: grid; place-items: center;
}
/* кнопка и живое значение стеком в одной ячейке: скрытый не толкает видимый */
.gauge-center > * { grid-area: 1 / 1; }

/* кнопка — жидкая линза Apple-стай: чистое стекло, свет по куполу,
   кромка-блик, плавные переходы без рывков. Радиалы живут в ::before,
   не в фоне кнопки — баг Firefox с язычком за верхним краем круга */
.start {
  width: 118px; height: 118px; border-radius: 50%; cursor: pointer;
  color: var(--ink); font-size: 15px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; font-family: inherit;
  position: relative;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: rgba(255, 255, 255, 0.05);
  border: none; /* кромку рисует градиентное кольцо ::after */
  box-shadow:
    /* краевой хайлайт и мягкое поднятие */
    0 1px 1px rgba(255, 255, 255, 0.28),
    0 4px 10px rgba(6, 6, 14, 0.22),
    0 14px 34px rgba(6, 6, 14, 0.42),
    0 30px 80px rgba(6, 6, 14, 0.36),
    /* ареол: два слоя мягкой подсветки вместо кольца */
    0 0 14px rgba(150, 62, 168, 0.14),
    0 0 50px rgba(150, 62, 168, 0.2),
    /* стекло: свет сверху, сиреневое дно */
    inset 0 1.5px 1px rgba(255, 255, 255, 0.5),
    inset 0 -14px 22px rgba(92, 27, 110, 0.3);
  backdrop-filter: blur(20px) saturate(170%) brightness(1.12);
  -webkit-backdrop-filter: blur(20px) saturate(170%) brightness(1.12);
  /* Apple-плавность: единая мягкая кривая, без пружин и скачков */
  transition:
    transform 0.65s cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow 0.65s cubic-bezier(0.32, 0.72, 0, 1),
    background 0.65s cubic-bezier(0.32, 0.72, 0, 1);
}
.start::before { /* линза света: ходит за курсором по куполу + оба радиала
  (клип по кругу здесь — см. комментарий у .start про баг Firefox) */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  border-radius: 50%; overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 38%),
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 46%),
    radial-gradient(circle at 50% 118%, rgba(92, 27, 110, 0.5), rgba(92, 27, 110, 0) 62%);
  transition: opacity 0.65s cubic-bezier(0.32, 0.72, 0, 1);
}
.start::after { /* градиентное кольцо по кромке: блик сверху -> сирень снизу.
  inset:-1px накрывает позицию снятого border; маска держит 2px обода */
  content: ''; position: absolute; inset: -1px; border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(from 0deg,
    var(--ring-top),
    var(--ring-side) 80deg,
    var(--ring-bottom) 180deg,
    var(--ring-side) 280deg,
    var(--ring-top));
  -webkit-mask: radial-gradient(circle, transparent 0 95.25%, #000 96.25% 100%);
  mask: radial-gradient(circle, transparent 0 95.25%, #000 96.25% 100%);
  transition: opacity 0.65s cubic-bezier(0.32, 0.72, 0, 1);
}
.start:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 1px 1.5px rgba(255, 255, 255, 0.34),
    0 7px 16px rgba(6, 6, 14, 0.24),
    0 20px 44px rgba(6, 6, 14, 0.46),
    0 40px 96px rgba(6, 6, 14, 0.36),
    0 0 20px rgba(150, 62, 168, 0.2),
    0 0 70px rgba(150, 62, 168, 0.28),
    inset 0 1.5px 2px rgba(255, 255, 255, 0.62),
    inset 0 -16px 26px rgba(92, 27, 110, 0.36);
}
.start:active { /* вдавливание: быстрый отклик, мягкий возврат (как iOS-кнопки) */
  transform: scale(0.955);
  transition-duration: 0.32s;
  box-shadow:
    0 1px 1px rgba(255, 255, 255, 0.2),
    0 2px 6px rgba(6, 6, 14, 0.3),
    0 10px 26px rgba(6, 6, 14, 0.5),
    0 0 10px rgba(150, 62, 168, 0.16),
    0 0 34px rgba(150, 62, 168, 0.22),
    inset 0 1px 1px rgba(255, 255, 255, 0.34),
    inset 0 -18px 30px rgba(92, 27, 110, 0.44);
}
.start:focus-visible, .ghost-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* --- живые значения: подложка + семисегментный индикатор --- */

@font-face {
  font-family: 'DSEG7';
  src: url('/fonts/DSEG7Classic-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

.live { display: flex; flex-direction: column; align-items: center; }
.live-val {
  /* стеклянный дисплей: цифры читаются сквозь затемнённое стекло */
  font-family: 'DSEG7', 'Consolas', 'Menlo', monospace;
  background: rgba(10, 8, 14, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 13px 22px 11px;
  backdrop-filter: blur(20px) saturate(160%) brightness(0.9);
  -webkit-backdrop-filter: blur(20px) saturate(160%) brightness(0.9);
  box-shadow:
    0 16px 44px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  font-size: 42px; font-weight: 700; line-height: 1;
  letter-spacing: 0.05em;
  min-width: 3.2ch; text-align: center;
  color: #f2f4fa;
  text-shadow: 0 0 22px rgba(192, 125, 214, 0.55);
}
.live-unit {
  margin-top: 8px; font-size: 11px; color: var(--muted);
  letter-spacing: 0.18em; text-transform: uppercase;
}

.hidden { opacity: 0; pointer-events: none; }

.phase { font-size: 13px; color: var(--muted); letter-spacing: 0.02em; }
.phase.error { color: var(--danger); }
.phase.ok { color: var(--ok); }

/* --- карточки результатов --- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  position: relative;
}
@media (max-width: 719px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.result { display: flex; flex-direction: column; gap: 3px; padding: 15px 15px 14px; }
.result:hover { transform: translateY(-2px); box-shadow: var(--lift); }
.result .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.result.active { border-color: var(--glass-brd-hover); box-shadow: var(--lift); }
.result.active .dot { background: var(--accent); box-shadow: 0 0 14px rgba(192, 125, 214, 0.9); }
.result .value {
  font-size: 24px; font-weight: 700; line-height: 1.15; letter-spacing: 0;
  text-shadow: 0 0 18px rgba(192, 125, 214, 0.25);
}
.result .unit { margin-top: 6px; font-size: 10px; color: var(--muted-2); letter-spacing: 0.08em; text-transform: uppercase; }
.result.err .value { color: var(--danger); font-size: 14px; }

/* --- одноразовая ссылка на замер --- */

.saved { display: flex; flex-direction: column; gap: 4px; animation: appear 0.65s cubic-bezier(0.32, 0.72, 0, 1); position: relative; }
@keyframes appear {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.saved.hidden { animation: none; }
.saved-link {
  align-self: flex-start;
  font-size: 16px; color: #e4e9ff;
  background: rgba(10, 8, 14, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  overflow-wrap: anywhere;
}
.warn { margin: 6px 2px 0; font-size: 12px; line-height: 1.5; color: var(--warn); }

.ghost-btn {
  font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--muted); background: var(--glass-2);
  border: 1px solid var(--glass-brd); border-radius: 12px; padding: 7px 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: color 0.25s cubic-bezier(0.32, 0.72, 0, 1), border-color 0.25s cubic-bezier(0.32, 0.72, 0, 1), background 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}
.ghost-btn:hover { color: var(--ink); border-color: var(--glass-brd-hover); background: rgba(150, 62, 168, 0.14); }
.ghost-btn:disabled { opacity: 0.45; cursor: default; }

/* кнопка темы: компактная круглая, только иконка */
.icon-btn {
  width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center;
  border-radius: 999px;
  color: var(--muted);
  transition: color 0.3s cubic-bezier(0.32, 0.72, 0, 1), border-color 0.3s cubic-bezier(0.32, 0.72, 0, 1), background 0.3s cubic-bezier(0.32, 0.72, 0, 1), transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}
.icon-btn:hover { color: var(--ink); transform: translateY(-1px); }
.icon-btn:active { transform: scale(0.94); transition-duration: .14s; }
.icon-btn svg { width: 18px; height: 18px; display: block; }

.cta {
  display: block;
  width: min(560px, 100%); margin: 0 auto;
  text-align: center; text-decoration: none;
  font-size: 14px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--ink);
  padding: 14px 16px; border-radius: 16px;
  position: relative;
  background:
    linear-gradient(135deg, rgba(150, 62, 168, 0.32), rgba(200, 130, 210, 0.2));
  border: 1px solid rgba(192, 125, 214, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.45s cubic-bezier(0.32, 0.72, 0, 1), border-color 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}
.cta:hover { transform: translateY(-1px); border-color: rgba(192, 125, 214, 0.8); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 12px 36px rgba(150, 62, 168, 0.35); }
.cta:active { transform: scale(0.98); transition-duration: .14s; }

.share { width: min(620px, calc(100vw - 24px)); margin: 16px auto 0; display: flex; flex-direction: column; gap: 14px; }
.share-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
@media (min-width: 560px) { .share-grid { grid-template-columns: repeat(4, 1fr); } }
.result.big { padding: 16px 14px 14px; }
.result.big:hover { transform: translateY(-2px); box-shadow: var(--lift); }
.result.big .value { font-size: 27px; margin-top: 6px; }
.result.big .unit { margin-top: 5px; }
.share-head { grid-column: 1 / -1; display: flex; flex-direction: column; }
.share-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }

/* ---------- низ страницы ---------- */

.foot {
  text-align: center; font-size: 11px; color: var(--foot-ink);
  padding: 22px 16px 26px;
}
.foot b { font-weight: 600; color: var(--muted); }
.foot-sub { color: var(--foot-ink); opacity: 0.75; font-size: 10px; }

/* ---------- адаптив ---------- */

@media (min-width: 720px) {
  .bento {
    grid-template-columns: repeat(2, 1fr);
  }
  .tile-gauge { grid-column: 1; }
  .stats { grid-column: 2; grid-template-rows: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
  .saved { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
  .tile, .start, .result, .row, .cta, .ghost-btn { transition: none; }
}

/* ---------- светлая тема: те же имена токенов, другие значения ----------
  /manual: html[data-theme]; авто: prefers-color-scheme, если data-theme нет.
   Тёмный «дисплей» live-val и спидометр-обводки остаются приборными. */

/* закреплённая тёмная тема силой перекрывает светлую системную */
:root[data-theme="dark"] {
  --bg: #08090d;
  --ink: #f2f4fa;
  --muted: #a2abc2;
  --muted-2: #7c85a0;
  --accent: #c07dd6;
  --accent-soft: rgba(92, 27, 110, 0.22);
  --ring-top: rgba(255, 255, 255, 0.75);
  --ring-side: rgba(255, 255, 255, 0.14);
  --ring-bottom: rgba(150, 62, 168, 0.55);
  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.035);
  --glass-brd: rgba(255, 255, 255, 0.14);
  --glass-brd-hover: rgba(192, 125, 214, 0.55);
  --spec-top: rgba(255, 255, 255, 0.34);
  --spec-bottom: rgba(255, 255, 255, 0.06);
  --edge-glow: rgba(192, 125, 214, 0.35);
  --shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.35);
  --lift:
    0 22px 50px rgba(0, 0, 0, 0.55),
    0 0 0 1px var(--edge-glow);
  --chip-ink: #c9cfe4;
  --link-ink: #e4e9ff;
  --foot-ink: #757d93;
}

:root[data-theme="light"] {
  --bg: #f1eff5;
  --ink: #211d28;
  --muted: #5d6373;
  --muted-2: #878da0;
  --accent: #9b3fb8;
  --accent-soft: rgba(92, 27, 110, 0.12);
  --ring-top: rgba(255, 255, 255, 1);
  --ring-side: rgba(255, 255, 255, 0.5);
  --ring-bottom: rgba(150, 62, 168, 0.4);
  --glass: rgba(255, 255, 255, 0.5);
  --glass-2: rgba(255, 255, 255, 0.38);
  --glass-brd: rgba(30, 20, 45, 0.09);
  --glass-brd-hover: rgba(140, 55, 165, 0.5);
  --spec-top: rgba(255, 255, 255, 0.8);
  --spec-bottom: rgba(40, 30, 60, 0.05);
  --edge-glow: rgba(150, 70, 170, 0.3);
  --shadow:
    0 20px 44px rgba(84, 62, 110, 0.14),
    0 2px 6px rgba(84, 62, 110, 0.1);
  --lift:
    0 18px 40px rgba(84, 62, 110, 0.16),
    0 0 0 1px var(--edge-glow);
  --chip-ink: #43485c;
  --link-ink: #2a2340;
  --foot-ink: #858290;
}

/* авто: светлая, если системная светлая и режим не закреплён вручную */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f1eff5;
    --ink: #211d28;
    --muted: #5d6373;
    --muted-2: #878da0;
    --accent: #9b3fb8;
    --accent-soft: rgba(92, 27, 110, 0.12);
    --ring-top: rgba(255, 255, 255, 1);
    --ring-side: rgba(255, 255, 255, 0.5);
    --ring-bottom: rgba(150, 62, 168, 0.4);
    --glass: rgba(255, 255, 255, 0.5);
    --glass-2: rgba(255, 255, 255, 0.38);
    --glass-brd: rgba(30, 20, 45, 0.09);
    --glass-brd-hover: rgba(140, 55, 165, 0.5);
    --spec-top: rgba(255, 255, 255, 0.8);
    --spec-bottom: rgba(40, 30, 60, 0.05);
    --edge-glow: rgba(150, 70, 170, 0.3);
    --shadow:
      0 20px 44px rgba(84, 62, 110, 0.14),
      0 2px 6px rgba(84, 62, 110, 0.1);
    --lift:
      0 18px 40px rgba(84, 62, 110, 0.16),
      0 0 0 1px var(--edge-glow);
    --chip-ink: #43485c;
    --link-ink: #2a2340;
    --foot-ink: #858290;
  }
}

/* канва live-дисплея: приборная тёмная вставка в обеих темах */
:root[data-theme="light"] .live-val,
:root[data-theme="light"] .saved-link { background: rgba(28, 22, 38, 0.8); border-color: rgba(255, 255, 255, 0.14); }
:root[data-theme="light"] .live-val { color: #f2f4fa; }
:root[data-theme="light"] .saved-link { color: #e8ecff; }
:root[data-theme="light"] .chip { color: var(--chip-ink); }
:root[data-theme="light"] .foot { color: var(--foot-ink); }
:root[data-theme="light"] .result .value { text-shadow: none; }

/* кнопка старт в светлой теме: тени фиолет-серые вместо чёрных, стекло ярче */
:root[data-theme="light"] .start {
  background: rgba(255, 255, 255, 0.34);
  box-shadow:
    0 1px 1px rgba(255, 255, 255, 0.9),
    0 4px 10px rgba(84, 62, 110, 0.12),
    0 14px 34px rgba(84, 62, 110, 0.2),
    0 30px 80px rgba(84, 62, 110, 0.16),
    0 0 14px rgba(150, 62, 168, 0.14),
    0 0 50px rgba(150, 62, 168, 0.18),
    inset 0 1.5px 1px rgba(255, 255, 255, 1),
    inset 0 -14px 22px rgba(92, 27, 110, 0.2);
}
:root[data-theme="light"] .start:hover {
  background: rgba(255, 255, 255, 0.44);
  box-shadow:
    0 1px 1.5px rgba(255, 255, 255, 1),
    0 7px 16px rgba(84, 62, 110, 0.14),
    0 20px 44px rgba(84, 62, 110, 0.22),
    0 40px 96px rgba(84, 62, 110, 0.16),
    0 0 20px rgba(150, 62, 168, 0.18),
    0 0 70px rgba(150, 62, 168, 0.22),
    inset 0 1.5px 2px rgba(255, 255, 255, 1),
    inset 0 -16px 26px rgba(92, 27, 110, 0.26);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .start {
    background: rgba(255, 255, 255, 0.34);
    box-shadow:
      0 1px 1px rgba(255, 255, 255, 0.9),
      0 4px 10px rgba(84, 62, 110, 0.12),
      0 14px 34px rgba(84, 62, 110, 0.2),
      0 30px 80px rgba(84, 62, 110, 0.16),
      0 0 14px rgba(150, 62, 168, 0.14),
      0 0 50px rgba(150, 62, 168, 0.18),
      inset 0 1.5px 1px rgba(255, 255, 255, 1),
      inset 0 -14px 22px rgba(92, 27, 110, 0.2);
  }
  :root:not([data-theme]) .start:hover {
    background: rgba(255, 255, 255, 0.44);
    box-shadow:
      0 1px 1.5px rgba(255, 255, 255, 1),
      0 7px 16px rgba(84, 62, 110, 0.14),
      0 20px 44px rgba(84, 62, 110, 0.22),
      0 40px 96px rgba(84, 62, 110, 0.16),
      0 0 20px rgba(150, 62, 168, 0.18),
      0 0 70px rgba(150, 62, 168, 0.22),
      inset 0 1.5px 2px rgba(255, 255, 255, 1),
      inset 0 -16px 26px rgba(92, 27, 110, 0.26);
  }
}
