:root {
  /* графит + один тёплый акцент: только действие и текущий выбор */
  --bg: #0b0d11;
  --panel: #11141a;
  --panel-hi: #171b23;
  --line: #1f2532;
  --line-hi: #2b3342;
  --ink: #e9ecf3;
  --dim: #8d95a8;
  --accent: #f0913f;
  --accent-ink: #180f05;
  --ok: #46c48a;
  --warn: #e8b84b;
  --fail: #ef5f74;

  --r: 14px;
  --t: 180ms cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 400 13px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: contain;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  accent-color: var(--accent);
  caret-color: var(--accent);
}

::selection { background: rgba(240, 145, 63, .28); color: #fff; }

*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- top bar ---------- */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  height: 46px; padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 7px; color: var(--ink); }
.brand span { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.brand svg { color: var(--accent); }

.meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--dim); }
.meta .sep { opacity: .5; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(70, 196, 138, .12); }
.dot.bad { background: var(--fail); box-shadow: 0 0 0 3px rgba(239, 95, 116, .12); }

/* ---------- dial ---------- */
main { display: flex; flex-direction: column; min-height: calc(100dvh - 46px); padding-bottom: 20px; }
.dial-wrap { display: grid; place-items: center; padding: 10px 0 0; }

.dial { position: relative; width: 320px; height: 320px; display: grid; place-items: center; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-line { fill: none; stroke: var(--line); stroke-width: 1; }
.ring-ticks {
  fill: none; stroke: var(--line); stroke-width: 5;
  stroke-dasharray: 1 11.7;
  stroke-linecap: butt;
}

.wheel { position: absolute; inset: 0; list-style: none; }
.wheel li {
  position: absolute; top: 50%; left: 50%;
  transform-origin: 0 0;
  transition: transform 320ms cubic-bezier(.22, .8, .26, 1);
}
.wheel button {
  width: 84px; height: 62px; padding: 0 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px;
  background: transparent; border: 0; color: var(--dim);
  font: 500 11px/1.2 inherit; text-align: center; cursor: pointer;
  transition: color var(--t), transform var(--t);
}
.wheel button svg { width: 20px; height: 20px; stroke-width: 1.5; flex: none; }
.wheel button span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; height: 26px;   /* всегда две строки — круг ровный */
}
.wheel button.is-on { color: var(--ink); }
.wheel button.is-on svg { color: var(--accent); }
.wheel button.busy { color: var(--warn); }
.wheel button.busy svg { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .4; } }

/* ---------- hub ---------- */
.hub {
  position: relative; z-index: 2;
  width: 168px; height: 168px; border-radius: 50%;
  background: radial-gradient(120% 130% at 50% -10%, #1e2430 0%, #12161e 72%);
  border: 1px solid #333c4d;
  box-shadow: 0 14px 34px -16px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .045);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 18px 14px; text-align: center;
}
.hub h1 { font-size: 14.5px; font-weight: 650; line-height: 1.15; letter-spacing: -.01em; }
.hint { font-size: 10.5px; line-height: 1.3; color: #9aa3b7; }
.hub .hint { min-height: 26px; max-width: 134px; }

.run {
  margin-top: 3px;
  min-height: 34px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font: 650 12.5px/1 inherit;
  cursor: pointer;
  box-shadow: 0 6px 16px -8px rgba(240, 145, 63, .75);
  transition: transform var(--t), background var(--t), box-shadow var(--t);
}
.run:hover { background: #f49d50; }
.run:active { transform: scale(.97); }
.run[disabled] { background: var(--panel-hi); color: var(--dim); box-shadow: none; cursor: default; }
.run.loading { position: relative; color: transparent; }
.run.loading::after {
  content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(24, 15, 5, .25); border-top-color: var(--accent-ink);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.state { min-height: 13px; font-size: 10px; color: var(--dim); }

/* ---------- history ---------- */
.history { padding: 16px 16px 0; margin-top: auto; }
.hist-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.hist-head h2 { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--dim); }
.ghost {
  background: transparent; border: 0; color: var(--dim);
  font: 500 11.5px/1 inherit; padding: 6px 2px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-hi);
  transition: color var(--t);
}
.ghost:hover { color: var(--ink); }

.hist-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.hist-list li { display: flex; }
.hist-btn {
  flex: 1; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
  min-height: 42px; padding: 0 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.hist-btn:hover { background: var(--panel-hi); border-color: var(--line-hi); }
.hist-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-time { font-size: 10.5px; color: var(--dim); }
.empty { font-size: 11.5px; color: var(--dim); line-height: 1.4; padding: 10px 2px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 999px;
  font-size: 9.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  background: var(--panel-hi); color: var(--dim);
}
.chip::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip.ok { background: rgba(70, 196, 138, .13); color: var(--ok); }
.chip.fail, .chip.timeout { background: rgba(239, 95, 116, .13); color: var(--fail); }
.chip.running { background: rgba(232, 184, 75, .13); color: var(--warn); }

/* ---------- drawer ---------- */
.drawer {
  width: 100%; max-width: 100%;
  margin: auto 0 0; padding: 0;
  border: 0; border-top: 1px solid var(--line-hi);
  border-radius: 18px 18px 0 0;
  background: #0e1117; color: var(--ink);
  max-height: 82vh;
}
.drawer::backdrop { background: rgba(4, 6, 9, .62); }
.drawer[open] { animation: rise 200ms cubic-bezier(.2, .7, .3, 1); }
@keyframes rise { from { transform: translateY(16px); opacity: .5; } }

.drawer-head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 13px; font-weight: 650; }
.drawer-head > div:first-child { flex: 1; min-width: 0; }
.dmeta { margin-top: 3px; display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--dim); }
.drawer-head .ghost { flex: none; }
.icon-btn {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--panel); color: var(--dim); cursor: pointer;
  transition: color var(--t), border-color var(--t);
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-hi); }

.out {
  padding: 12px 16px calc(18px + env(safe-area-inset-bottom));
  overflow: auto; max-height: calc(82vh - 76px);
  font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #cbd2e2;
  overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-hi) transparent;
}
.out::-webkit-scrollbar { width: 6px; }
.out::-webkit-scrollbar-thumb { background: var(--line-hi); border-radius: 3px; }
.out::-webkit-scrollbar-track { background: transparent; }

.out table { border-collapse: collapse; width: 100%; margin: 6px 0 10px; }
.out th, .out td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; white-space: normal; word-break: break-word; }
.out th { color: var(--dim); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.out td { font-size: 10.5px; }
.out h3, .out h4, .out h5 { font: 600 12px/1.3 inherit; margin: 10px 0 5px; color: var(--ink); }
.out code { background: var(--panel-hi); padding: 1px 4px; border-radius: 4px; }
.out strong { color: #fff; }
.out .ln { white-space: pre-wrap; }

/* запись вместо широкой таблицы: сервер + IP в шапке, метрики сеткой */
.rec { border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; margin: 0 0 9px; background: var(--panel); }
.rec-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.rec-h b { font: 600 12px/1.2 inherit; color: var(--ink); }
.rec-h span { font-size: 10px; color: var(--dim); }
.rec-b { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; }
.rec-b div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rec-b em { font-style: normal; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: #a6aec0; }
.rec-b span { font-size: 11px; color: #dbe1ee; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.out .li { padding-left: 2px; }
.out .dim { color: var(--dim); }

@media (prefers-reduced-motion: reduce) {
  .wheel li, .wheel button, .run, .hist-btn, .drawer[open] { transition: none !important; animation: none !important; }
}
