/* База из mqttGrid — те же правила дизайна. */
:root {
  --paper: #f2f1ec;
  --ink: #0b0b0b;
  --bg: var(--paper);
  --fg: var(--ink);
  --shade: rgba(8, 8, 8, .52);
  --grain-op: .055;

  --ease: cubic-bezier(.22, .9, .24, 1);
  --ease-io: cubic-bezier(.7, 0, .2, 1);
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Golos Text', 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', 'Consolas', monospace;
  --alert: #d7263d;
  --good: #1f9d55;
}

:root,
:root[data-theme="light"] {
  --bg: var(--paper);
  --fg: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --bg: #0b0b0b; --fg: #efeee8; --shade: rgba(0, 0, 0, .68); --grain-op: .075; --alert: #ff4d5e; --good: #3ecf7a; }
}

:root[data-theme="dark"] { --bg: #0b0b0b; --fg: #efeee8; --shade: rgba(0, 0, 0, .68); --grain-op: .075; --alert: #ff4d5e; --good: #3ecf7a; }

:root {
  --muted: color-mix(in oklab, var(--fg) 52%, var(--bg));
  --soft: color-mix(in oklab, var(--fg) 30%, var(--bg));
  --faint: color-mix(in oklab, var(--fg) 16%, var(--bg));
  --line: color-mix(in oklab, var(--fg) 12%, var(--bg));
  --card: color-mix(in oklab, var(--fg) 4%, var(--bg));
  --glass: color-mix(in oklab, var(--bg) 60%, transparent);
  --glass-line: color-mix(in oklab, var(--fg) 13%, transparent);
  --alert-soft: color-mix(in oklab, var(--alert) 14%, var(--bg));
  --alert-line: color-mix(in oklab, var(--alert) 55%, var(--bg));
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

html.theme-anim body,
html.theme-anim body * {
  transition: background-color .6s var(--ease), color .6s var(--ease), border-color .6s var(--ease), fill .6s var(--ease), stroke .6s var(--ease) !important;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

::selection { background: var(--fg); color: var(--bg); }

:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }

/* ─────────── атмосфера: точечная сетка, зерно, поле колец ─────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--faint) 1px, transparent 1.3px);
  background-size: 28px 28px;
  background-position: -14px -14px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 35%, transparent 100%);
  z-index: 0;
}

.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  z-index: 60;
  opacity: var(--grain-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(4) infinite;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); }
  75% { transform: translate(-1%, -2%); }
  100% { transform: translate(3%, 1%); }
}


/* ─────────── маски для «вылета снизу вверх» ─────────── */

.mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: .04em .02em .14em;
  margin: -.04em -.02em -.14em;
}

.mask > span {
  display: inline-block;
  transform: translateY(115%) rotate(4deg);
  transform-origin: 0 100%;
  opacity: 0;
  transition: transform 1.2s var(--ease) var(--d, 0ms), opacity .9s var(--ease) var(--d, 0ms);
}

.mask.in > span { transform: none; opacity: 1; }

/* ─────────── бренд ─────────── */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: .02em;
}

.brand b { font-weight: 500; }

.brand-mark {
  width: 13px;
  height: 13px;
  background-image: radial-gradient(circle, var(--fg) 1.3px, transparent 1.6px);
  background-size: 4.5px 4.5px;
  background-position: -.2px -.2px;
}

/* ─────────── сцена приветствия ─────────── */

.stage {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 28px clamp(22px, 5vw, 64px);
  transition: opacity .9s var(--ease), filter .9s var(--ease), transform 1.1s var(--ease);
}

.stage.leave { opacity: 0; filter: blur(12px); transform: scale(.985); pointer-events: none; }

.stage-meta, .stage-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .04em;
}

.stage-meta .brand { color: var(--fg); }
.stage-foot { align-self: end; }

.greet, .auth {
  align-self: center;
  padding-left: clamp(0px, 6vw, 110px);
}

.greet { transition: opacity .85s var(--ease), transform .95s var(--ease), filter .85s var(--ease); }
.greet.out { opacity: 0; transform: translateY(-4vh); filter: blur(8px); }

.greet-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(54px, 10.5vw, 176px);
  line-height: .98;
  letter-spacing: -.02em;
}

.greet-words { display: block; font-style: italic; }

.greet-name {
  display: block;
  font-weight: 500;
  word-break: break-all;
}

.greet-name.unknown { color: var(--soft); letter-spacing: .06em; }

.auth-lead {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 5.4vw, 88px);
  line-height: 1.02;
  letter-spacing: -.015em;
  transition: opacity .6s var(--ease), filter .6s var(--ease);
}

.auth-lead.out { opacity: 0; filter: blur(6px); }
.lead-line { display: block; }
.lead-line:first-child { font-style: italic; }
.lead-line.small { font-size: .62em; color: var(--muted); margin-bottom: .25em; }
.lead-line.big { font-size: 1.35em; }
.lead-name { font-style: normal; font-weight: 500; }

.login {
  display: grid;
  gap: 26px;
  width: min(440px, 82vw);
  margin-top: clamp(28px, 6vh, 64px);
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .9s var(--ease), transform 1s var(--ease), filter .6s var(--ease);
}

.login.in { opacity: 1; transform: none; }
.login.out { opacity: 0; transform: translateY(-12px); filter: blur(4px); }
.login.shake { animation: shake .5s var(--ease); }

@keyframes shake {
  20% { transform: translateX(-9px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

.field {
  position: relative;
  display: grid;
  align-content: start;
  gap: 6px;
}

.field-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input {
  width: 100%;
  border: 0;
  padding: 8px 0 11px;
  font-size: 20px;
  outline: none;
  border-radius: 0;
  /* Обе линии под полем — слои фона самого поля: сверху линия фокуса,
     под ней постоянная серая. Рамку не используем: она рисуется поверх
     фона и закрыла бы линию фокуса. А ::after у всего блока уходил под
     подсказку, если она есть под полем. */
  background-color: transparent;
  background-image: linear-gradient(var(--fg), var(--fg)), linear-gradient(var(--line), var(--line));
  background-repeat: no-repeat;
  background-position: 0 100%, 0 100%;
  background-size: 0% 1px, 100% 1px;
  transition: background-size .7s var(--ease);
}

.field input:focus { background-size: 100% 1px, 100% 1px; }

.login-row, .pw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.login-error, .form-msg {
  margin: 0;
  min-height: 1.4em;
  font-size: 14px;
  color: var(--muted);
}

.round-btn {
  position: relative;
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid var(--fg);
  background: transparent;
  display: grid;
  place-items: center;
  transition: background .4s var(--ease), color .4s var(--ease), transform .4s var(--ease);
}

.round-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform .5s var(--ease); }
.round-btn:hover { background: var(--fg); color: var(--bg); }
.round-btn:hover svg { transform: translateX(3px); }
.round-btn:active { transform: scale(.95); }

.spinner {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid transparent;
  border-top-color: var(--fg);
  opacity: 0;
  animation: spin .8s linear infinite;
}

.login.busy .spinner { opacity: 1; }
.login.busy .round-btn svg { opacity: .25; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────── приложение ─────────── */

.app { position: relative; z-index: 2; min-height: 100vh; }

.app .topbar {
  transform: translateY(-110%);
  transition: transform 1s var(--ease) .1s;
}

.app .view { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease) .35s, transform 1s var(--ease) .35s; }
.app.in .topbar { transform: none; }
.app.in .view { opacity: 1; transform: none; }
.app.in .view.leaving { opacity: 0; transform: translateY(10px); transition: opacity .22s var(--ease), transform .22s var(--ease); }
.app.in .view.entering { opacity: 0; transform: translateY(18px); transition: none; }

body.bye .app { opacity: 0; filter: blur(8px); transition: opacity .6s var(--ease), filter .6s var(--ease); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 14px clamp(18px, 3vw, 36px);
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.tabs {
  position: relative;
  display: flex;
  gap: 2px;
}

.tab {
  border: 0;
  background: none;
  padding: 9px 16px 11px;
  font-weight: 500;
  font-size: 15px;
  color: var(--muted);
  transition: color .4s var(--ease);
}

.tab:hover, .tab.active { color: var(--fg); }

.tab-thumb {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 1.5px;
  width: 0;
  background: var(--fg);
  transition: transform .6s var(--ease), width .6s var(--ease);
}

.topbar-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}

.live-unit { color: var(--muted); font-size: 12px; }

.live-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg);
}

.live-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--fg);
  opacity: 0;
  animation: ping 2.2s var(--ease) infinite;
}

.live.off .live-dot { background: transparent; border: 1px solid var(--muted); }
.live.off .live-dot::after { display: none; }

@keyframes ping {
  0% { transform: scale(.4); opacity: .7; }
  100% { transform: scale(1.8); opacity: 0; }
}

.whoami { color: var(--muted); font-size: 13px; }

.view {
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) clamp(18px, 3vw, 36px) 140px;
}


.set-note { margin: 0 0 20px; color: var(--muted); }

.seg {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.seg button {
  position: relative;
  z-index: 1;
  border: 0;
  background: none;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color .45s var(--ease);
}

.seg button.active { color: var(--bg); }

.seg-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--fg);
  transition: transform .6s var(--ease), width .6s var(--ease);
}


.line-btn, .solid-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .35s var(--ease), color .35s var(--ease), transform .3s var(--ease);
}

.line-btn { background: transparent; color: var(--fg); }
.line-btn:hover { background: var(--fg); color: var(--bg); }
.solid-btn { background: var(--fg); color: var(--bg); }
.solid-btn:hover { transform: translateY(-1px); }
.line-btn:active, .solid-btn:active { transform: scale(.97); }
.line-btn:disabled, .solid-btn:disabled { opacity: .4; pointer-events: none; }

/* ─────────── стекло (экскурсия, модалки, тосты) ─────────── */

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(175%);
  backdrop-filter: blur(28px) saturate(175%);
  border: 1px solid var(--glass-line);
  border-radius: 22px;
  box-shadow:
    0 30px 80px -24px rgba(0, 0, 0, .45),
    inset 0 1px 0 color-mix(in oklab, #fff 28%, transparent);
}

.offer {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 32px);
  z-index: 70;
  width: min(360px, calc(100vw - 32px));
  padding: 22px 22px 18px;
  opacity: 0;
  transform: translateY(18px) scale(.97);
  transition: opacity .6s var(--ease), transform .7s var(--ease);
}

.offer.in { opacity: 1; transform: none; }

.offer-kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.offer-title {
  margin: 6px 0 4px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 30px;
  line-height: 1.05;
}

.offer-text { margin: 0 0 18px; color: var(--muted); }
.offer-actions { display: flex; justify-content: flex-end; gap: 10px; }

.tour-shield {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.tour-spot {
  position: fixed;
  z-index: 81;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  border-radius: 16px;
  pointer-events: none;
  box-shadow: 0 0 0 200vmax var(--shade), 0 0 0 1px color-mix(in oklab, #fff 40%, transparent);
  opacity: 0;
  transition: left .65s var(--ease-io), top .65s var(--ease-io), width .65s var(--ease-io), height .65s var(--ease-io), opacity .5s var(--ease);
}

.tour-spot.in { opacity: 1; }
.tour-spot.none { width: 0 !important; height: 0 !important; left: 50% !important; top: 50% !important; }

.tour-card {
  position: fixed;
  z-index: 82;
  left: 50%;
  top: 50%;
  padding: 18px 20px 16px;
  opacity: 0;
  transform: translateY(10px) scale(.98);
  transition: left .65s var(--ease-io), top .65s var(--ease-io), opacity .45s var(--ease), transform .55s var(--ease);
}

.tour-card.in { opacity: 1; transform: none; }
.tour-card.swap .tour-title, .tour-card.swap .tour-text { opacity: 0; transform: translateY(6px); }

.tour-top { display: flex; justify-content: space-between; align-items: center; }
.tour-count { font-size: 11px; letter-spacing: .12em; color: var(--muted); }

.tour-skip {
  border: 0;
  background: none;
  padding: 4px 0;
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--faint);
}

.tour-skip:hover { color: var(--fg); }

.tour-title, .tour-text { transition: opacity .35s var(--ease), transform .45s var(--ease); }

.tour-title {
  margin: 10px 0 4px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 28px;
  line-height: 1.05;
}

.tour-text { margin: 0; font-size: 14.5px; color: color-mix(in oklab, var(--fg) 78%, var(--bg)); }

.tour-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.tour-dots { display: flex; gap: 6px; }
.tour-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); transition: background .4s var(--ease), width .5s var(--ease); }
.tour-dots span.on { width: 20px; border-radius: 3px; background: var(--fg); }

.tour-next {
  position: relative;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  display: grid;
  place-items: center;
  transition: transform .35s var(--ease);
}

.tour-next:hover { transform: scale(1.06); }
.tour-next svg.arrow { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.tour-ring {
  position: absolute;
  inset: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  transform: rotate(-90deg);
  pointer-events: none;
}

.tour-ring circle {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.2;
  stroke-dasharray: 170;
  stroke-dashoffset: 170;
}

.tour-card.auto .tour-ring circle { animation: ring var(--auto, 9000ms) linear forwards; }
.tour-card.paused .tour-ring circle { animation-play-state: paused; }

@keyframes ring { to { stroke-dashoffset: 0; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 95;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  transform: translate(-50%, 20px);
  opacity: 0;
  transition: opacity .45s var(--ease), transform .55s var(--ease);
}

.toast.in { opacity: 1; transform: translate(-50%, 0); }

/* ─────────── адаптив и доступность ─────────── */

@media (max-width: 860px) {
  .topbar { grid-template-columns: 1fr auto; }
  .tabs { grid-column: 1 / -1; order: 3; justify-content: flex-start; overflow-x: auto; }
  .whoami { display: none; }
  .greet, .auth { padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .grain { animation: none; }
}

/* ═══════════════════ иконки и нижняя панель ═══════════════════ */

.ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.tab { display: inline-flex; align-items: center; gap: 8px; }
.tab .ico { width: 17px; height: 17px; opacity: .75; transition: opacity .4s var(--ease), transform .5s var(--ease); }
.tab.active .ico, .tab:hover .ico { opacity: 1; }
.chip-btn.with-ico { display: inline-flex; align-items: center; gap: 8px; }
.chip-btn .ico { width: 16px; height: 16px; }

/* Док: вкладки внизу экрана, иконка над подписью, активная — в «пилюле». */
.tabs.dock {
  position: fixed;
  left: 10px; right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 60;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 6px;
  border-radius: 24px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--glass-line);
  box-shadow: 0 18px 50px -20px rgba(0, 0, 0, .55);
  animation: dock-in .8s var(--ease) both .2s;
}
@keyframes dock-in { from { transform: translateY(140%); } to { transform: none; } }
.tabs.dock .tab {
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  padding: 7px 4px;
  border-radius: 18px;
  font-size: 11.5px;
  transition: background .4s var(--ease), color .4s var(--ease);
}
.tabs.dock .tab .ico { width: 22px; height: 22px; }
.tabs.dock .tab.active { background: var(--fg); color: var(--bg); }
.tabs.dock .tab.active .ico { transform: translateY(-1px) scale(1.06); }
.tabs.dock .tab-thumb { display: none; }
body.has-dock .view { padding-bottom: 110px; }


/* ═══════════════════ переключатель как в iOS ═══════════════════ */

:root { --sw-on: #34c759; --sw-off: #e3e3e6; --warn: #b7791f; --beta: #6b4fd8; }
:root[data-theme="dark"] { --sw-on: #30d158; --sw-off: #3a3a3e; --warn: #f0b340; --beta: #a592ff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --sw-on: #30d158; --sw-off: #3a3a3e; --warn: #f0b340; --beta: #a592ff; }
}

.sw {
  --w: 51px; --h: 31px; --p: 2px; --stretch: 7px;
  position: relative;
  display: inline-flex;
  flex: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  vertical-align: middle;
}
.sw-lg { --w: 58px; --h: 35px; --stretch: 8px; }
.sw-sm { --w: 42px; --h: 26px; --stretch: 6px; }
.sw-input {
  position: absolute; inset: 0; z-index: 2;
  margin: 0; opacity: 0; cursor: inherit;
}
.sw-track {
  position: relative;
  width: var(--w); height: var(--h);
  border-radius: 999px;
  background: var(--sw-off);
  transition: background .35s var(--ease);
  overflow: hidden;
}
/* Заливка цветом «из центра», как у переключателей iPhone. */
.sw-track::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: var(--sw-on);
  transform: scale(.35);
  opacity: 0;
  transition: transform .45s cubic-bezier(.3, 1.25, .5, 1), opacity .3s var(--ease);
}
.sw-knob {
  position: absolute; z-index: 1;
  top: var(--p); left: var(--p);
  width: calc(var(--h) - var(--p) * 2);
  height: calc(var(--h) - var(--p) * 2);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06), 0 0 0 .5px rgba(0, 0, 0, .04);
  /* Пружинка: бегунок чуть перелетает и возвращается. */
  transition: transform .5s cubic-bezier(.3, 1.45, .45, 1), width .28s var(--ease);
}
.sw-input:checked + .sw-track::before { transform: none; opacity: 1; }
.sw-input:checked + .sw-track .sw-knob { transform: translateX(calc(var(--w) - var(--h))); }
/* Нажатие: бегунок вытягивается к центру и держится у своего края. */
.sw-input:active + .sw-track .sw-knob { width: calc(var(--h) - var(--p) * 2 + var(--stretch)); }
.sw-input:checked:active + .sw-track .sw-knob { transform: translateX(calc(var(--w) - var(--h) - var(--stretch))); }
.sw-input:focus-visible + .sw-track { outline: 2px solid var(--fg); outline-offset: 3px; }
.sw-input:disabled + .sw-track { opacity: .45; }
.sw:has(.sw-input:disabled) { cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .sw-knob, .sw-track::before { transition-duration: .01s; }
}

