/* ═══════════════════ 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;
}

: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; }
}

:root[data-theme="dark"] { --bg: #0b0b0b; --fg: #efeee8; --shade: rgba(0, 0, 0, .68); --grain-op: .075; }

: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);
}

*, *::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%); }
}

.ripples {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 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;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 8px 0 10px;
  font-size: 20px;
  outline: none;
  border-radius: 0;
}

.field::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .7s var(--ease);
}

.field:focus-within::after { transform: scaleX(1); }

.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;
}

/* ─────────── обзор ─────────── */

.server {
  margin-bottom: 72px;
  animation: rise 1s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 90ms + 450ms);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

.server-head {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.server-name {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(34px, 4.4vw, 60px);
  line-height: 1;
  letter-spacing: -.01em;
}

.server-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.server-host { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--soft); }

.server-error {
  margin: 4px 0 0;
  padding: 8px 12px;
  border: 1px dashed var(--soft);
  font-size: 13px;
  width: fit-content;
}

.server-error:empty { display: none; }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--fg);
}

.status-dot.online { background: var(--fg); box-shadow: 0 0 0 0 var(--fg); animation: glow 2.4s var(--ease) infinite; }
.status-dot.connecting { animation: blink 1s steps(2) infinite; }
.status-dot.offline, .status-dot.disabled { border-color: var(--muted); }
.status-dot.error { background: repeating-linear-gradient(45deg, var(--fg) 0 1.5px, transparent 1.5px 3px); }

@keyframes glow {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--fg) 45%, transparent); }
  100% { box-shadow: 0 0 0 7px transparent; }
}

@keyframes blink { 50% { opacity: .2; } }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.tile, .tile-empty {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 164px;
  padding: 16px 18px 14px;
  background: var(--bg);
  overflow: hidden;
  transition: background .5s var(--ease);
  animation: tile-in .7s var(--ease) both;
}

@keyframes tile-in {
  from { opacity: 0; transform: scale(.97); }
  to { opacity: 1; transform: none; }
}

.tile:hover { background: var(--card); }

.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  mix-blend-mode: difference;
  opacity: 0;
  pointer-events: none;
}

.tile.pulse::after { animation: invert 1s var(--ease); }

@keyframes invert {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.tile-path, .tile-name {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-path { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tile-name { font-size: 15px; font-weight: 600; margin-top: 2px; }

.tile-value {
  margin-top: auto;
  padding-top: 14px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.05;
  letter-spacing: -.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-value.text {
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  white-space: normal;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.spark {
  display: block;
  width: 100%;
  height: 28px;
  margin-top: 8px;
  overflow: visible;
}

.spark polyline {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: .75;
}

.spark.none { visibility: hidden; }

.tile-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.tile-empty {
  grid-column: 1 / -1;
  padding: 40px 22px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--muted);
}

.empty {
  padding: 12vh 0;
  max-width: 760px;
}

.empty-title {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(48px, 7vw, 110px);
  line-height: 1;
}

.empty-text { margin: 18px 0 0; font-size: 18px; color: var(--muted); max-width: 520px; }

/* ─────────── поток ─────────── */

.stream-bar {
  position: sticky;
  top: 70px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  margin-bottom: 8px;
  background: var(--bg);
}

.search {
  flex: 1;
  min-width: 0;
  max-width: 520px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  outline: none;
  transition: border-color .4s var(--ease);
}

.search:focus { border-color: var(--fg); }

.chip-btn {
  padding: 10px 18px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  transition: background .35s var(--ease), color .35s var(--ease);
}

.chip-btn:hover, .chip-btn.on { background: var(--fg); color: var(--bg); }

.stream-wrap { min-height: 50vh; }

.stream-head, .stream li {
  display: grid;
  grid-template-columns: 112px minmax(90px, 180px) minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 18px;
  align-items: baseline;
}

.stream-head {
  padding: 10px 0;
  border-bottom: 1px solid var(--fg);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.stream {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 13px;
}

.stream li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.stream li > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream li .s-time { color: var(--muted); }
.stream li .s-server { color: var(--soft); }
.stream li.fresh { animation: row-in .7s var(--ease); }

@keyframes row-in {
  from { opacity: 0; transform: translateY(-8px); background: var(--card); }
  to { opacity: 1; transform: none; background: transparent; }
}

.stream-empty {
  padding: 60px 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 24px;
  color: var(--muted);
}

/* ─────────── настройки ─────────── */

.settings {
  display: grid;
  gap: 64px;
  max-width: 760px;
}

.set-title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 40px;
  line-height: 1.05;
}

.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);
}

.pw-form {
  display: grid;
  gap: 22px;
  width: min(440px, 100%);
  margin-top: 14px;
}

.pw-form .field input { font-size: 17px; }

.set-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }

.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; }
  .stream-bar { top: 118px; }
  .stream-head, .stream li { grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1fr); }
  .stream-head span:nth-child(2), .stream li .s-server { 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; }
}
