/* HAPPY PRAZDNIK Panel — mobile-first dark UI (vanilla CSS, no external assets) */

:root {
  color-scheme: dark;

  --bg: #0b0d10;
  --bg-elev: #0e1116;
  --card: #151922;
  --card-2: #1e2430;
  --card-3: #252c3a;
  --text: #f5f1ea;
  --muted: #9aa4b2;
  --muted-2: #707b8c;

  --berry: #c24b6a;
  --berry-2: #e0708f;
  --berry-deep: #8e3450;
  --berry-soft: rgba(194, 75, 106, 0.15);
  --berry-line: rgba(194, 75, 106, 0.34);

  --success: #35c46a;
  --success-soft: rgba(53, 196, 106, 0.13);
  --warning: #f5a524;
  --warning-soft: rgba(245, 165, 36, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.13);

  --line: rgba(245, 241, 234, 0.075);
  --line-strong: rgba(245, 241, 234, 0.15);
  --inset: rgba(245, 241, 234, 0.035);
  --inset-strong: rgba(245, 241, 234, 0.085);
  --field: #10141b;

  --on-berry: #ffffff;
  --radius: 16px;
  --radius-sm: 12px;
  --nav-h: 64px;
  --page: 720px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  --hero-bg:
    radial-gradient(120% 120% at 100% 0%, rgba(194, 75, 106, 0.3), transparent 58%),
    linear-gradient(145deg, #201821, #12161d 68%);
  --glow:
    radial-gradient(58% 38% at 88% -4%, rgba(194, 75, 106, 0.2), transparent 72%),
    radial-gradient(42% 30% at 8% 18%, rgba(53, 196, 106, 0.05), transparent 70%);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html[data-theme="light"] {
  color-scheme: light;

  --bg: #f2ede6;
  --bg-elev: #ece5dc;
  --card: #ffffff;
  --card-2: #f8f3ec;
  --card-3: #efe7de;
  --text: #221e1b;
  --muted: #666c77;
  --muted-2: #858b96;

  --berry: #b23e5d;
  --berry-2: #9a3450;
  --berry-deep: #7d2a42;
  --berry-soft: rgba(178, 62, 93, 0.1);
  --berry-line: rgba(178, 62, 93, 0.26);

  --success: #1b8f4a;
  --success-soft: rgba(27, 143, 74, 0.11);
  --warning: #a66a00;
  --warning-soft: rgba(166, 106, 0, 0.12);
  --danger: #c92a2a;
  --danger-soft: rgba(201, 42, 42, 0.1);

  --line: rgba(34, 30, 27, 0.09);
  --line-strong: rgba(34, 30, 27, 0.17);
  --inset: rgba(34, 30, 27, 0.035);
  --inset-strong: rgba(34, 30, 27, 0.085);
  --field: #f6f1ea;

  --shadow: 0 18px 40px rgba(74, 46, 32, 0.13);
  --hero-bg:
    radial-gradient(120% 120% at 100% 0%, rgba(178, 62, 93, 0.16), transparent 58%),
    linear-gradient(145deg, #fff8f5, #fbf8f4 68%);
  --glow:
    radial-gradient(58% 38% at 88% -4%, rgba(178, 62, 93, 0.12), transparent 72%),
    radial-gradient(42% 30% at 8% 18%, rgba(27, 143, 74, 0.05), transparent 70%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--glow);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--berry-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: -1px;
  padding: 0 !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--berry);
  color: var(--on-berry);
  transform: translateY(-160%);
  transition: transform 0.15s var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--berry-2);
  outline-offset: 2px;
}

::selection {
  background: var(--berry);
  color: var(--on-berry);
}

/* ---------- Typography ---------- */

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2 {
  font-size: 24px;
  line-height: 1.18;
  letter-spacing: -0.025em;
  font-weight: 750;
}

h3 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.eyebrow {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.value-ok {
  color: var(--success);
}

.value-warn {
  color: var(--warning);
}

.value-bad {
  color: var(--danger);
}

.dot {
  display: inline-block;
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- Login ---------- */

.login-screen {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(env(safe-area-inset-top) + 28px)
    max(16px, env(safe-area-inset-left))
    calc(env(safe-area-inset-bottom) + 28px)
    max(16px, env(safe-area-inset-right));
  overflow: hidden;
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: -20% -30% auto;
  height: 80vh;
  pointer-events: none;
  background:
    radial-gradient(50% 50% at 65% 30%, rgba(194, 75, 106, 0.24), transparent 70%),
    radial-gradient(45% 45% at 20% 45%, rgba(194, 75, 106, 0.08), transparent 70%);
}

.login-card {
  position: relative;
  width: min(430px, 100%);
  padding: 24px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.login-brand h1 {
  font-size: 24px;
}

.login-intro {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 14px;
}

.login-foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
}

#loginDemoLink {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin: -13px -4px;
  padding: 0 4px;
  vertical-align: middle;
}

.logo-mark {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(145deg, #d15a78, #9b3452);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 16px rgba(142, 52, 80, 0.32);
  color: #fff7f2;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.logo-mark--lg {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  font-size: 18px;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.field > label {
  font-size: 14px;
  font-weight: 650;
}

.input-wrap {
  position: relative;
}

input[type="password"],
input[type="text"],
input[inputmode="numeric"],
.totp-input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder {
  color: var(--muted-2);
}

.input-wrap input {
  padding-right: 54px;
}

input:focus {
  outline: none;
  border-color: var(--berry);
  box-shadow: 0 0 0 3px var(--berry-soft);
}

.input-toggle {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.input-toggle:hover {
  color: var(--text);
}

.input-toggle svg {
  width: 20px;
  height: 20px;
}

.totp-input {
  padding-left: 0.42em;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.42em;
  font-variant-numeric: tabular-nums;
}

.form-error {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
}

.form-error::before {
  content: "!";
  display: grid;
  flex: none;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: currentColor;
  color: var(--bg);
  font-size: 12px;
  font-weight: 800;
}

.totp-help {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.totp-help summary {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  color: var(--berry-2);
  font-weight: 650;
  cursor: pointer;
}

.totp-help summary::after {
  content: "+";
  color: var(--muted);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}

.totp-help[open] summary::after {
  content: "−";
}

.totp-help[open] summary {
  margin-bottom: 6px;
}

.totp-help p {
  margin: 6px 0;
  line-height: 1.55;
}

/* ---------- Shell ---------- */

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 26px);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 12px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right));
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  overflow: hidden;
  font-size: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
}

.status-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill[data-state="warn"] {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-pill[data-state="bad"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-pill[data-state="demo"] {
  background: var(--berry-soft);
  color: var(--berry-2);
}

.status-pill .dot {
  width: 6px;
  height: 6px;
}

.icon-btn {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--inset);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--inset-strong);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn.is-busy svg {
  animation: spin 0.8s linear infinite;
}

.icon-btn.is-active {
  border-color: var(--berry-line);
  background: var(--berry-soft);
  color: var(--berry-2);
}

/* ---------- Connection banner ---------- */

.conn-banner {
  border-bottom: 1px solid var(--line);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 12px;
}

.conn-banner[data-variant="bad"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.conn-banner[data-variant="demo"] {
  background: var(--berry-soft);
  color: var(--berry-2);
}

.conn-banner-inner {
  display: flex;
  max-width: var(--page);
  min-height: 34px;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
  padding: 5px max(16px, env(safe-area-inset-left)) 5px max(16px, env(safe-area-inset-right));
}

.conn-banner svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.conn-banner span {
  flex: 1;
  min-width: 0;
}

.conn-action {
  flex: none;
  min-width: 64px;
  min-height: 44px;
  padding: 2px 11px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Layout ---------- */

.app-main {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 10px max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
}

.view:not([hidden]) {
  animation: view-in 0.22s var(--ease);
}

.view-content {
  display: grid;
  gap: 14px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 0;
}

.section-head h2 {
  font-size: 24px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 2px;
}

.card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-head--tight {
  align-items: center;
}

.card-head h3 {
  overflow-wrap: anywhere;
}

.card-head p + h3,
.card-head h3 + p {
  margin-top: 2px;
}

.card-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.card-title > div {
  min-width: 0;
}

.card-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--inset-strong);
  color: var(--muted);
}

.card-icon svg {
  width: 21px;
  height: 21px;
}

.card-icon--berry {
  background: var(--berry-soft);
  color: var(--berry-2);
}

.card-icon--amber {
  background: var(--warning-soft);
  color: var(--warning);
}

.card-icon--green {
  background: var(--success-soft);
  color: var(--success);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--card-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn:hover {
  border-color: var(--muted-2);
}

.btn:active {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.btn:disabled:active {
  transform: none;
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(145deg, #d15a78, var(--berry));
  box-shadow: 0 8px 20px rgba(194, 75, 106, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: var(--on-berry);
}

html[data-theme="light"] .btn-primary {
  background: linear-gradient(145deg, #c24b6a, #a53a58);
}

.btn-primary:hover {
  border-color: transparent;
  filter: brightness(1.04);
}

.btn-danger {
  border-color: rgba(239, 68, 68, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-danger:hover {
  border-color: var(--danger);
}

.btn-soft {
  background: var(--inset);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--inset);
  color: var(--text);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 48px;
  padding: 0 12px;
  border-radius: 11px;
  font-size: 13px;
}

.btn-sm svg {
  width: 16px;
  height: 16px;
}

.btn.is-busy {
  pointer-events: none;
}

.btn.is-busy::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0.75;
  animation: spin 0.7s linear infinite;
}

.btn.is-busy svg {
  display: none;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  flex: none;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

body.modal-open {
  overflow: hidden;
}

/* ---------- Badges / pills ---------- */

.badge {
  display: inline-flex;
  min-height: 26px;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--inset-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge--ok {
  background: var(--success-soft);
  color: var(--success);
}

.badge--warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge--bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge--berry {
  background: var(--berry-soft);
  color: var(--berry-2);
}

.badge--ok .dot,
.badge--warn .dot,
.badge--bad .dot {
  background: currentColor;
}

/* ---------- Hero / scene ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--berry-line);
  border-radius: var(--radius);
  background: var(--hero-bg);
}

.hero::after {
  content: "";
  position: absolute;
  top: -70px;
  right: -50px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(194, 75, 106, 0.22), transparent 68%);
}

.hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.hero-top h2 {
  font-size: 24px;
}

.hero-text {
  position: relative;
  z-index: 1;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.scene-badge {
  display: inline-flex;
  min-height: 26px;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--inset-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.scene-badge[data-state="running"] {
  background: var(--warning-soft);
  color: var(--warning);
}

.scene-badge[data-state="success"] {
  background: var(--success-soft);
  color: var(--success);
}

.scene-badge[data-state="partial"] {
  background: var(--warning-soft);
  color: var(--warning);
}

.scene-badge[data-state="failed"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.hero.is-running {
  border-color: rgba(245, 165, 36, 0.36);
}

.scene-controls {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 9px;
  margin-top: 15px;
}

.select-field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.select-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}

select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hero-progress {
  position: relative;
  z-index: 1;
  height: 4px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--inset-strong);
}

.hero-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--berry), var(--berry-2));
  transition: width 0.4s var(--ease);
}

.scene-steps {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.step {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.step:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.step-marker {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  margin-top: 1px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted-2);
}

.step-marker svg {
  width: 12px;
  height: 12px;
}

.step-marker .marker-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.step-content {
  min-width: 0;
}

.step-title {
  display: block;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.step-message {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.step-state {
  padding-top: 1px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.step[data-status="success"] .step-marker {
  border-color: var(--success);
  background: var(--success);
  color: #04120a;
}

.step[data-status="success"] .step-state {
  color: var(--success);
}

.step[data-status="running"] .step-marker {
  border-color: var(--warning);
  color: var(--warning);
  animation: pulse 1.4s ease-in-out infinite;
}

.step[data-status="running"] .step-state {
  color: var(--warning);
}

.step[data-status="failed"] .step-marker {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.step[data-status="failed"] .step-state {
  color: var(--danger);
}

.step[data-status="skipped"] {
  opacity: 0.62;
}

.step[data-status="skipped"] .step-state {
  color: var(--muted);
}

/* ---------- Quick actions ---------- */

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 11px;
}

.quick-btn {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--inset);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.quick-btn:hover {
  border-color: var(--line-strong);
}

.quick-btn:active {
  transform: scale(0.985);
}

.quick-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.quick-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--berry-soft);
  color: var(--berry-2);
}

.quick-icon svg {
  width: 17px;
  height: 17px;
}

/* ---------- Devices ---------- */

.device-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 12px 0 0;
}

.meta {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--inset);
}

.meta dt {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.meta dd {
  margin: 3px 0 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 13px;
}

.game-row .btn {
  padding: 0 14px;
}

.action-grid {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.action-grid--2 {
  grid-template-columns: 1fr 1fr;
}

.action-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.action-grid .btn {
  padding: 0 8px;
  font-size: 12.5px;
}

.action-grid .btn svg {
  width: 16px;
  height: 16px;
}

.device-sub {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- TV ---------- */

.tv-section {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.tv-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.volume-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px 48px;
  gap: 7px;
  align-items: center;
  margin-top: 13px;
}

.volume-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--inset);
  color: var(--text);
  cursor: pointer;
}

.volume-btn svg {
  width: 18px;
  height: 18px;
}

.volume-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.volume-value {
  min-width: 0;
  text-align: center;
}

.volume-value strong {
  display: block;
  font-size: 22px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.volume-value span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tv-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 5px;
}

.dpad-btn {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--inset);
  color: var(--text);
  cursor: pointer;
}

.dpad-btn svg {
  width: 19px;
  height: 19px;
}

.dpad-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.dpad-btn:active:not(:disabled) {
  background: var(--berry-soft);
  border-color: var(--berry-line);
}

.dpad-up {
  grid-area: 1 / 2;
}

.dpad-left {
  grid-area: 2 / 1;
}

.dpad-center {
  grid-area: 2 / 2;
  background: var(--berry-soft);
  border-color: var(--berry-line);
  color: var(--berry-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.dpad-right {
  grid-area: 2 / 3;
}

.dpad-down {
  grid-area: 3 / 2;
}

.tv-side {
  display: grid;
  gap: 7px;
}

.tv-side .icon-btn {
  width: 52px;
  height: 52px;
}

.hdmi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.hdmi-btn {
  min-height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--inset);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.hdmi-btn.is-active {
  border-color: var(--berry-line);
  background: var(--berry-soft);
  color: var(--berry-2);
}

.hdmi-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.app-btn {
  display: flex;
  min-height: 52px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--inset);
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.app-btn svg {
  width: 18px;
  height: 18px;
  color: var(--berry-2);
}

.app-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tv-current {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Sites ---------- */

.sites-list {
  display: grid;
  gap: 12px;
}

.site-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.site-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.site-name {
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.site-url {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  margin-top: -11px;
  margin-bottom: -13px;
  padding: 13px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
}

.site-url-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-url svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.site-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 12px;
}

.site-stat {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--inset);
}

.site-stat dt {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.site-stat dd {
  margin: 3px 0 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.site-errors {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.site-errors strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.site-errors .sep {
  color: var(--muted-2);
}

.site-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px 10px;
}

.site-link {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.site-link svg {
  width: 12px;
  height: 12px;
}

.site-link:hover {
  color: var(--berry-2);
  text-decoration: none;
}

/* ---------- Server ---------- */

.resource {
  margin-top: 13px;
}

.resource:first-of-type {
  margin-top: 12px;
}

.resource-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  font-size: 13px;
}

.resource-head span {
  max-width: 68%;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.resource-head strong {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.resource-track {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--inset-strong);
}

.resource-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2ea95b, var(--success));
  transition: width 0.4s var(--ease);
}

.resource-fill[data-level="warn"] {
  background: linear-gradient(90deg, #d98d12, var(--warning));
}

.resource-fill[data-level="bad"] {
  background: linear-gradient(90deg, #c93333, var(--danger));
}

.server-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 14px;
}

.service-list {
  display: grid;
  margin-top: 11px;
}

.service {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.service:first-child {
  padding-top: 0;
  border-top: 0;
}

.service:last-child {
  padding-bottom: 0;
}

.service-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.service-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.service-unit {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.audit-list {
  display: grid;
  margin-top: 10px;
}

.audit-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.audit-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.audit-icon {
  margin-top: 2px;
  color: var(--muted-2);
}

.audit-icon svg {
  width: 15px;
  height: 15px;
}

.audit-icon[data-result="success"] {
  color: var(--success);
}

.audit-icon[data-result="failed"],
.audit-icon[data-result="error"] {
  color: var(--danger);
}

.audit-main {
  min-width: 0;
}

.audit-main strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-main span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-time {
  padding-top: 1px;
  color: var(--muted-2);
  font-size: 10px;
  white-space: nowrap;
}

/* ---------- More ---------- */

.link-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 11px;
}

.link-tile {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--inset);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.25;
}

.link-tile:hover {
  border-color: var(--line-strong);
  text-decoration: none;
}

.link-tile > svg:first-child {
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--berry-2);
}

.link-tile .ext {
  width: 13px;
  height: 13px;
  flex: none;
  margin-left: auto;
  color: var(--muted-2);
}

.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 11px;
  padding: 4px;
  border-radius: 13px;
  background: var(--inset-strong);
}

.theme-btn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.theme-btn svg {
  width: 16px;
  height: 16px;
}

.theme-btn[aria-pressed="true"] {
  background: var(--card-2);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.16);
  color: var(--text);
}

html[data-theme="light"] .theme-btn[aria-pressed="true"] {
  background: var(--card);
}

.steps-list {
  display: grid;
  gap: 7px;
  margin: 11px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.steps-list li::marker {
  color: var(--berry-2);
  font-weight: 700;
}

.steps-list strong {
  color: var(--text);
  font-weight: 650;
}

.demo-note {
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid var(--berry-line);
  border-radius: 11px;
  background: var(--berry-soft);
  color: var(--berry-2);
  font-size: 12px;
  line-height: 1.45;
}

.about-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 12px;
}

.about-line + .about-line {
  margin-top: 4px;
}

/* ---------- Empty / inline errors ---------- */

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 20px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--inset-strong);
  color: var(--muted);
}

.empty-icon svg {
  width: 22px;
  height: 22px;
}

.empty-state p {
  max-width: 300px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Skeleton ---------- */

.skeleton-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.sk-line {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--inset-strong);
}

.sk-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.06) 48%, transparent 76%);
  transform: translateX(-100%);
  animation: shimmer 1.6s infinite;
}

html[data-theme="light"] .sk-line::after {
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.65) 48%, transparent 76%);
}

.sk-line--title {
  width: 42%;
  height: 20px;
}

.sk-line--wide {
  width: 82%;
}

.sk-line--mid {
  width: 62%;
}

.sk-line--short {
  width: 34%;
}

.sk-line--tiny {
  width: 22%;
}

.sk-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sk-box {
  height: 58px;
  border-radius: 11px;
  background: var(--inset);
}

/* ---------- Pull to refresh ---------- */

.pull-indicator {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 10px);
  left: 50%;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card-2);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 0.15s, transform 0.15s;
}

.pull-indicator.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pull-indicator.is-ready {
  border-color: var(--berry-line);
  color: var(--text);
}

.pull-indicator svg {
  width: 15px;
  height: 15px;
  transition: transform 0.15s;
}

.pull-indicator.is-ready svg {
  transform: rotate(180deg);
}

.pull-indicator.is-refreshing svg {
  animation: spin 0.8s linear infinite;
}

/* ---------- Toasts ---------- */

.toast-region {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  left: 50%;
  z-index: 90;
  display: flex;
  width: min(430px, calc(100vw - 24px));
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  transform: translateX(-50%);
}

body.is-login .toast-region {
  bottom: calc(env(safe-area-inset-bottom) + 14px);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--berry);
  border-radius: 13px;
  background: var(--card-2);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  pointer-events: none;
  animation: toast-in 0.22s var(--ease);
}

.toast svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
  color: var(--berry-2);
}

.toast--success {
  border-left-color: var(--success);
}

.toast--success svg {
  color: var(--success);
}

.toast--warning {
  border-left-color: var(--warning);
}

.toast--warning svg {
  color: var(--warning);
}

.toast--error {
  border-left-color: var(--danger);
}

.toast--error svg {
  color: var(--danger);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s, transform 0.18s;
}

/* ---------- Modal ---------- */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  align-items: end;
  justify-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(4, 6, 9, 0.68);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.modal {
  position: relative;
  display: flex;
  width: min(500px, 100%);
  max-height: min(88vh, 88dvh);
  flex-direction: column;
  padding: 18px 18px calc(16px + env(safe-area-inset-bottom));
  border: 1px solid var(--line-strong);
  border-radius: 20px 20px 0 0;
  background: var(--card);
  box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.42);
  animation: sheet-up 0.24s var(--ease);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  color: var(--text);
  font-size: 20px;
}

.modal-body {
  margin-top: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.modal-body strong {
  color: var(--text);
}

.modal-actions {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.modal-actions .btn {
  width: 100%;
}

.confirm-copy {
  display: grid;
  gap: 8px;
}

.confirm-copy .confirm-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(245, 165, 36, 0.24);
  border-radius: 11px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 12px;
}

.confirm-copy .confirm-warning svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
}

.log-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}

.log-toolbar select {
  width: auto;
  min-width: 0;
  flex: 1;
  min-height: 44px;
  font-size: 13px;
}

.log-toolbar .btn {
  flex: none;
}

.log-output {
  min-height: 180px;
  max-height: 48vh;
  margin: 0;
  padding: 11px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-elev);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.log-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 11px;
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
}

.nav-inner {
  display: grid;
  width: 100%;
  max-width: var(--page);
  height: var(--nav-h);
  grid-template-columns: repeat(4, 1fr);
  margin: 0 auto;
}

.nav-item {
  position: relative;
  display: flex;
  min-height: 56px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.nav-item svg {
  width: 23px;
  height: 23px;
}

.nav-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 26px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: transparent;
  transform: translateX(-50%);
  transition: background 0.15s;
}

.nav-item.is-active {
  color: var(--text);
}

.nav-item.is-active::before {
  background: var(--berry);
}

.nav-item.is-active svg {
  color: var(--berry-2);
}

/* ---------- Misc ---------- */

.updated-at {
  padding: 0 4px 2px;
  color: var(--muted-2);
  font-size: 11px;
  text-align: center;
}

.noscript {
  margin: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 165, 36, 0.3);
  border-radius: 12px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 14px;
}

/* ---------- Offline page ---------- */

.offline-body {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding:
    calc(env(safe-area-inset-top) + 24px)
    max(16px, env(safe-area-inset-left))
    calc(env(safe-area-inset-bottom) + 24px)
    max(16px, env(safe-area-inset-right));
}

.offline-screen {
  width: min(430px, 100%);
}

.offline-card {
  display: grid;
  justify-items: start;
  padding: 26px 24px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  box-shadow: var(--shadow);
}

.offline-card .eyebrow {
  margin-top: 18px;
}

.offline-card h1 {
  margin-top: 2px;
}

.offline-text {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.offline-btn {
  margin-top: 18px;
  text-decoration: none;
}

.offline-btn:hover {
  text-decoration: none;
}

.offline-card .hint {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* ---------- Animations ---------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(245, 165, 36, 0.28);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(245, 165, 36, 0);
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* ---------- Responsive ---------- */

@media (min-width: 560px) {
  .modal-root {
    align-items: center;
    padding: 24px;
  }

  .modal {
    padding: 20px;
    border-radius: 20px;
    animation: modal-in 0.2s var(--ease);
  }

  .modal-actions {
    grid-template-columns: 1fr 1fr;
  }

  .modal-actions .btn {
    width: auto;
  }

  .scene-controls {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .scene-controls .btn {
    width: auto;
    min-width: 190px;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 380px) {
  .app-main {
    padding-top: 8px;
  }

  .header-inner {
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .brand-text h1 {
    font-size: 20px;
  }

  .status-pill {
    padding: 5px 8px;
  }

  .card,
  .hero,
  .site-card {
    padding: 14px;
  }

  .action-grid--3 {
    grid-template-columns: 1fr 1fr;
  }

  .action-grid--3 .btn:last-child {
    grid-column: 1 / -1;
  }

  .dpad {
    grid-template-columns: repeat(3, 46px);
    grid-template-rows: repeat(3, 46px);
  }

  .site-stat dd {
    font-size: 13px;
  }

  .link-grid,
  .quick-grid {
    gap: 6px;
  }

  .site-foot {
    flex-wrap: wrap;
  }

  .site-links {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
