:root {
  --bg: #040812;
  --bg-2: #091426;
  --surface: rgba(9, 19, 36, 0.88);
  --surface-strong: rgba(13, 27, 49, 0.96);
  --line: rgba(104, 225, 255, 0.24);
  --line-strong: rgba(104, 225, 255, 0.58);
  --text: #eaf6ff;
  --muted: rgba(202, 222, 238, 0.74);
  --accent: #58e6ff;
  --accent-strong: #18bfe5;
  --secondary: #d86cff;
  --secondary-strong: #984ee8;
  --success: #4ee6a1;
  --warning: #f4c95d;
  --danger: #ff657f;
  --purple: #7f72ff;
  --accent-rgb: 88, 230, 255;
  --secondary-rgb: 216, 108, 255;
  --success-rgb: 78, 230, 161;
  --warning-rgb: 244, 201, 93;
  --danger-rgb: 255, 101, 127;
  --panel-rgb: 7, 15, 29;
  --shadow-neon: 0 0 28px rgba(var(--accent-rgb), 0.14);
  --shadow-card: 0 24px 70px rgba(0, 0, 0, 0.45);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--bg);
}

[hidden] {
  display: none !important;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, rgba(34, 247, 255, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 61, 242, 0.14), transparent 28%),
    radial-gradient(circle at bottom center, rgba(139, 92, 246, 0.12), transparent 34%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: 0;
  background-image:
    linear-gradient(rgba(116, 255, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(116, 255, 241, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent);
}

body::after {
  z-index: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(238, 247, 255, 0.025) 0,
    rgba(238, 247, 255, 0.025) 1px,
    transparent 1px,
    transparent 7px
  );
  opacity: 0.34;
}

button,
input,
textarea {
  font: inherit;
}

button,
summary,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.mode-card:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(34, 247, 255, 0.16);
}

h1,
h2,
p {
  margin-top: 0;
}

p {
  margin-bottom: 0;
}

h1 {
  margin-bottom: 14px;
  color: var(--text);
  font-size: clamp(3.2rem, 6vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 0 34px rgba(34, 247, 255, 0.24);
}

h2 {
  margin-bottom: 4px;
  color: var(--text);
  font-size: clamp(1.18rem, 1.35vw, 1.35rem);
  line-height: 1.25;
  letter-spacing: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 44px;
  display: grid;
  gap: clamp(18px, 2vw, 26px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(18px, 2vw, 28px);
  align-items: start;
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(34, 247, 255, 0.08), transparent 34%),
    linear-gradient(155deg, rgba(255, 61, 242, 0.08), transparent 42%),
    var(--surface);
  box-shadow: var(--shadow-card), 0 0 42px rgba(34, 247, 255, 0.12);
  backdrop-filter: blur(18px);
}

.hero-copy {
  max-width: 790px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-shadow: 0 0 18px rgba(255, 61, 242, 0.36);
}

.lede {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.trust-strip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid rgba(116, 255, 241, 0.3);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(3, 8, 18, 0.5);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  font-weight: 750;
}

.trust-strip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(34, 247, 255, 0.8), 0 0 0 4px rgba(34, 247, 255, 0.1);
}

.status-pill,
.status-chip,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  color: var(--muted);
  background: rgba(3, 8, 18, 0.58);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.status-pill::before,
.status-chip::before,
.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.status-pill {
  min-height: 46px;
  padding: 10px 16px;
  box-shadow: var(--shadow-neon);
}

.status-success,
.chip-success {
  color: var(--success);
  border-color: rgba(44, 255, 154, 0.42);
  background: rgba(44, 255, 154, 0.08);
}

.status-warning,
.chip-warning {
  color: var(--warning);
  border-color: rgba(255, 209, 102, 0.46);
  background: rgba(255, 209, 102, 0.09);
}

.status-danger,
.chip-danger {
  color: var(--danger);
  border-color: rgba(255, 77, 109, 0.46);
  background: rgba(255, 77, 109, 0.1);
}

.status-neutral,
.chip-info,
.chip-muted {
  color: var(--accent);
  border-color: rgba(116, 255, 241, 0.26);
  background: rgba(34, 247, 255, 0.07);
}

.card {
  min-width: 0;
  height: auto;
  min-height: 0;
  align-self: start;
  padding: clamp(20px, 2vw, 28px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-card), 0 0 28px rgba(34, 247, 255, 0.1);
  backdrop-filter: blur(18px);
}

.interactive-card {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.interactive-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-card), 0 0 36px rgba(34, 247, 255, 0.18), 0 0 24px rgba(255, 61, 242, 0.08);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.card-header p,
.field small,
.mode-card em,
.compact-list span,
.activity-list time,
.setup-steps p,
.setup-note,
.option-row p,
.warning-note,
#resultAction,
.advanced-card em {
  color: var(--muted);
}

.dashboard-grid,
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: clamp(18px, 2vw, 28px);
  align-items: start;
}

.bento-card {
  height: auto;
  min-height: 0;
  align-self: start;
}

/* Cards in the same row that should match the row's height (fill empty space). */
.bento-card.fill-row {
  align-self: stretch;
}

.span-full {
  grid-column: 1 / -1;
}

.span-3 {
  grid-column: span 3;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

/* Export/Import + Relay Health stacked on the left, Queue beside them. */
.stack-beside {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: clamp(18px, 2vw, 28px);
  align-items: start;
}

.stack-beside__col {
  display: grid;
  gap: clamp(18px, 2vw, 28px);
  align-content: start;
}

.setup-card {
  background: linear-gradient(135deg, rgba(34, 247, 255, 0.06), transparent 38%), var(--surface);
}

.setup-steps,
.setup-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.setup-steps li,
.setup-step {
  min-width: 0;
  min-height: 150px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(116, 255, 241, 0.2);
  border-radius: var(--radius-md);
  background: rgba(3, 8, 18, 0.54);
  box-shadow: inset 0 0 0 1px rgba(238, 247, 255, 0.02), 0 0 18px rgba(34, 247, 255, 0.05);
}

.setup-steps li.complete {
  border-color: rgba(44, 255, 154, 0.45);
  box-shadow: 0 0 22px rgba(44, 255, 154, 0.1);
}

.setup-steps li.active {
  border-color: rgba(255, 209, 102, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.08), 0 0 24px rgba(255, 61, 242, 0.12);
}

.setup-steps li.waiting {
  background: rgba(3, 8, 18, 0.5);
}

.step-number {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(34, 247, 255, 0.5);
  border-radius: 999px;
  color: #041016;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-weight: 900;
  box-shadow: 0 0 20px rgba(34, 247, 255, 0.25);
}

.setup-steps strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}

.setup-steps p {
  font-size: 0.92rem;
}

.setup-steps em {
  font-style: normal;
}

.setup-note {
  margin-top: 16px;
  font-size: 0.96rem;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field span {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 800;
}

.field small {
  display: block;
  margin-top: 8px;
  font-size: 0.9rem;
}

input,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(116, 255, 241, 0.24);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text);
  background: rgba(3, 8, 18, 0.72);
  box-shadow: inset 0 1px 0 rgba(238, 247, 255, 0.04);
}

input::placeholder,
textarea::placeholder {
  color: rgba(238, 247, 255, 0.42);
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 247, 255, 0.16), 0 0 18px rgba(34, 247, 255, 0.12);
  outline: none;
}

input:disabled {
  color: rgba(238, 247, 255, 0.46);
  background: rgba(3, 8, 18, 0.45);
  cursor: not-allowed;
}

input[type="radio"] {
  width: 18px;
  min-height: 18px;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

textarea {
  resize: vertical;
}

.inline-field {
  max-width: 280px;
}

.sync-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.mode-grid {
  display: grid;
  gap: 12px;
}

.mode-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  padding: 13px;
  border: 1px solid rgba(116, 255, 241, 0.18);
  border-radius: var(--radius-md);
  background: rgba(3, 8, 18, 0.58);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.mode-card:hover {
  transform: translateY(-1px);
  border-color: rgba(116, 255, 241, 0.36);
}

.mode-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(34, 247, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(34, 247, 255, 0.08), 0 0 22px rgba(34, 247, 255, 0.12);
}

.mode-card strong,
.mode-card em {
  grid-column: 2;
}

.mode-card em {
  font-size: 0.9rem;
  font-style: normal;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card-footer {
  margin-top: 18px;
}

.btn,
button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 0.96rem;
  font-weight: 850;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.btn:hover,
button:hover {
  transform: translateY(-1px);
}

.btn:active,
button:active {
  transform: translateY(0);
}

.btn:disabled,
button:disabled,
.btn.loading,
.btn.is-disabled {
  color: rgba(238, 247, 255, 0.48);
  background: rgba(18, 26, 48, 0.56);
  border-color: rgba(116, 255, 241, 0.14);
  cursor: not-allowed;
  opacity: 0.76;
  transform: none;
  box-shadow: none;
}

/* State-locked buttons (e.g. Enable/Stop sync) must be unclickable. */
.btn.is-disabled {
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  display: inline-block;
  width: 0.72em;
  height: 0.72em;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: spin 820ms linear infinite;
}

.btn-primary,
.button-primary,
button:not([class]) {
  color: #041016;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 0 22px rgba(34, 247, 255, 0.28);
}

.btn-primary:hover,
.button-primary:hover,
button:not([class]):hover {
  box-shadow: 0 0 30px rgba(34, 247, 255, 0.38);
}

.btn-secondary,
.button-secondary {
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 61, 242, 0.92), rgba(139, 92, 246, 0.92));
  box-shadow: 0 0 22px rgba(255, 61, 242, 0.22);
}

.btn-secondary:hover,
.button-secondary:hover {
  box-shadow: 0 0 30px rgba(255, 61, 242, 0.32);
}

.btn-ghost,
.button-ghost {
  color: var(--text);
  background: rgba(3, 8, 18, 0.34);
  border-color: rgba(116, 255, 241, 0.28);
}

.btn-ghost:hover,
.button-ghost:hover {
  border-color: var(--line-strong);
  background: rgba(34, 247, 255, 0.08);
  box-shadow: 0 0 18px rgba(34, 247, 255, 0.12);
}

.btn-danger,
.button-danger,
.button-danger-ghost {
  color: #ffdce4;
  background: rgba(255, 77, 109, 0.13);
  border-color: rgba(255, 77, 109, 0.42);
  box-shadow: 0 0 18px rgba(255, 77, 109, 0.12);
}

.btn-danger:hover,
.button-danger:hover,
.button-danger-ghost:hover {
  background: rgba(255, 77, 109, 0.2);
  border-color: rgba(255, 77, 109, 0.62);
}

.btn-small {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 0.88rem;
}

.btn-full {
  width: 100%;
}

.status-grid,
.stats-grid {
  display: grid;
  gap: 12px;
}

.status-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.stats-grid {
  grid-template-columns: repeat(9, minmax(0, 1fr));
}

.status-tile,
.stats-grid div,
.queue-counts span {
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(116, 255, 241, 0.18);
  border-radius: var(--radius-md);
  background: rgba(3, 8, 18, 0.58);
}

.status-tile.success {
  border-color: rgba(44, 255, 154, 0.34);
  background: rgba(44, 255, 154, 0.07);
}

.status-tile.warning {
  border-color: rgba(255, 209, 102, 0.34);
  background: rgba(255, 209, 102, 0.08);
}

.status-tile.danger {
  border-color: rgba(255, 77, 109, 0.36);
  background: rgba(255, 77, 109, 0.09);
}

.status-tile strong,
.stats-grid span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.status-tile p,
.stats-grid strong {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.stats-card .stats-grid strong {
  color: var(--accent);
  font-size: clamp(1.08rem, 1.6vw, 1.38rem);
  text-shadow: 0 0 18px rgba(34, 247, 255, 0.22);
}

.queue-counts,
.queue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.queue-card,
.relay-health-card {
  min-height: unset;
}

.queue-counts span {
  color: var(--muted);
  font-size: 0.82rem;
}

.queue-counts strong {
  display: block;
  color: var(--accent);
  font-size: 1.24rem;
  text-shadow: 0 0 14px rgba(34, 247, 255, 0.22);
}

.queue-counts span:nth-child(3) strong {
  color: var(--success);
}

.queue-counts span:nth-child(4) strong {
  color: var(--danger);
}

.compact-list,
.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.compact-list li,
.activity-list li {
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(116, 255, 241, 0.18);
  border-radius: var(--radius-md);
  background: rgba(3, 8, 18, 0.52);
}

.compact-list li {
  display: grid;
  gap: 5px;
}

.compact-list strong,
.compact-list span {
  overflow-wrap: anywhere;
}

.compact-list span {
  font-size: 0.9rem;
}

.relay-row {
  position: relative;
  padding-left: 34px !important;
}

.relay-row::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px var(--success), 0 0 0 4px rgba(44, 255, 154, 0.1);
}

.relay-row.unstable::before {
  background: var(--warning);
  box-shadow: 0 0 12px var(--warning), 0 0 0 4px rgba(255, 209, 102, 0.1);
}

.relay-row.failing::before {
  background: var(--danger);
  box-shadow: 0 0 12px var(--danger), 0 0 0 4px rgba(255, 77, 109, 0.1);
}

.relay-row.disabled::before {
  background: rgba(238, 247, 255, 0.42);
  box-shadow: 0 0 0 4px rgba(238, 247, 255, 0.08);
}

.empty-state {
  color: var(--muted);
  border-style: dashed !important;
  background: rgba(3, 8, 18, 0.42) !important;
}

.empty-state::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(34, 247, 255, 0.7);
}

.queue-empty {
  margin-top: 14px;
  padding: 14px !important;
}

.activity-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.event-badge {
  min-width: 74px;
  justify-content: center;
}

.activity-list strong {
  display: block;
}

.activity-list details {
  min-width: 0;
}

.activity-list summary {
  cursor: pointer;
}

.activity-list code {
  display: none;
  margin-top: 4px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.activity-list details[open] code {
  display: block;
}

.activity-list time {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  white-space: nowrap;
}

.soft-details {
  margin-bottom: 16px;
  border: 1px solid rgba(116, 255, 241, 0.2);
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(3, 8, 18, 0.48);
}

.soft-details summary,
.advanced-card summary {
  cursor: pointer;
  font-weight: 850;
}

/* Render the advanced backup disclosure toggle as a primary button. */
.summary.backup-toggle,
.backup-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  list-style: none;
}

.backup-toggle::-webkit-details-marker {
  display: none;
}

.soft-details .field:first-of-type {
  margin-top: 16px;
}

.settings-groups {
  display: grid;
  gap: 16px;
}

.option-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(116, 255, 241, 0.18);
  border-radius: var(--radius-md);
  background: rgba(3, 8, 18, 0.52);
}

.option-row p {
  margin-top: 4px;
  font-size: 0.92rem;
}

.preview-box {
  min-height: 92px;
  padding: 14px;
  border: 1px dashed rgba(116, 255, 241, 0.26);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(3, 8, 18, 0.48);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.warning-note {
  margin: -4px 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 209, 102, 0.3);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(255, 209, 102, 0.08);
  font-size: 0.92rem;
}

.result-summary {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(116, 255, 241, 0.2);
}

.result-card .result-summary {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.result-summary strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.advanced-card details {
  border: 0;
}

.advanced-card details::details-content,
.soft-details::details-content,
.activity-list details::details-content {
  block-size: 0;
  overflow: hidden;
  transition: block-size 180ms ease, content-visibility 180ms ease allow-discrete;
}

.advanced-card details[open]::details-content,
.soft-details[open]::details-content,
.activity-list details[open]::details-content {
  block-size: auto;
}

.advanced-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  list-style-position: inside;
}

.advanced-card summary span {
  display: inline-grid;
  gap: 4px;
}

.advanced-card em {
  font-size: 0.9rem;
  font-style: normal;
  font-weight: 500;
}

.advanced-actions {
  margin-top: 16px;
}

pre {
  max-height: 420px;
  margin: 14px 0 0;
  padding: 16px;
  border: 1px solid rgba(34, 247, 255, 0.25);
  border-radius: var(--radius-md);
  color: #b9fff8;
  background: #030812;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  box-shadow: inset 0 0 28px rgba(34, 247, 255, 0.04);
}

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

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

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

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

@media (max-width: 1200px) {
  .span-3,
  .span-4 {
    grid-column: span 6;
  }

  .span-5,
  .span-6,
  .span-8 {
    grid-column: span 12;
  }

  .span-full,
  .span-12,
  .stats-card {
    grid-column: 1 / -1;
  }

  .setup-steps,
  .setup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sync-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 28px, 1180px);
    padding: 18px 0 36px;
    gap: 18px;
  }

  .hero,
  .dashboard-grid,
  .bento-grid,
  .stack-beside,
  .setup-steps,
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 24px;
  }

  .status-pill {
    justify-self: start;
  }

  .card {
    padding: 20px;
    border-radius: var(--radius-md);
  }

  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-8,
  .span-12,
  .span-full,
  .card {
    grid-column: 1 / -1;
  }

  .setup-steps li {
    min-height: auto;
  }

  .status-grid,
  .stats-grid,
  .queue-counts,
  .queue-grid,
  .sync-layout {
    grid-template-columns: 1fr;
  }

  .card-header,
  .option-row {
    display: grid;
  }

  .activity-list li {
    grid-template-columns: 1fr;
  }

  .activity-list time {
    white-space: normal;
  }

  .actions .btn,
  .actions button {
    width: 100%;
  }

  .inline-field {
    max-width: none;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 2.45rem;
  }

  .hero,
  .card {
    padding: 18px;
  }

  .btn,
  button {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Self-hosted Orbitron (SIL OFL) for the title and headings only. */
@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/orbitron.woff2") format("woff2");
}

/* HUD command-center treatment. Existing palette variables remain authoritative. */
:root {
  --hud-cut: 14px;
  --hud-cut-sm: 8px;
  --hud-font: "Arial Narrow", "Roboto Condensed", Inter, ui-sans-serif, system-ui, sans-serif;
  --terminal-font: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --display-font: "Orbitron", "Arial Narrow", "Roboto Condensed", Inter, ui-sans-serif, system-ui, sans-serif;
}

body {
  font-family: var(--hud-font);
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(34, 247, 255, 0.035) 50%, transparent 50.2%),
    radial-gradient(circle at 12% 8%, rgba(34, 247, 255, 0.16), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(255, 61, 242, 0.12), transparent 26%),
    linear-gradient(145deg, var(--bg) 0%, var(--bg-2) 72%, #080817 100%);
}

body::before {
  background-image:
    linear-gradient(rgba(116, 255, 241, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(116, 255, 241, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, transparent 49.75%, rgba(255, 61, 242, 0.025) 50%, transparent 50.25%);
  background-size: 32px 32px, 32px 32px, 128px 128px;
}

.app-shell {
  width: min(1380px, calc(100% - 40px));
  padding-top: 20px;
  gap: 16px;
}

.hero,
.card {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  clip-path: polygon(
    0 var(--hud-cut),
    var(--hud-cut) 0,
    calc(100% - 42px) 0,
    100% 42px,
    100% calc(100% - var(--hud-cut)),
    calc(100% - var(--hud-cut)) 100%,
    42px 100%,
    0 calc(100% - 42px)
  );
  background:
    linear-gradient(90deg, var(--accent) 0 52px, transparent 52px) top left / 100% 2px no-repeat,
    linear-gradient(180deg, var(--secondary) 0 36px, transparent 36px) top right / 2px 100% no-repeat,
    linear-gradient(135deg, rgba(34, 247, 255, 0.075), transparent 34%),
    rgba(8, 13, 27, 0.91);
  box-shadow: 0 18px 58px rgba(0, 0, 0, 0.48), inset 0 0 42px rgba(34, 247, 255, 0.025);
}

.hero::before,
.card::before {
  content: attr(data-module);
  position: absolute;
  z-index: 2;
  top: 0;
  left: 66px;
  min-height: 20px;
  padding: 2px 10px 1px;
  color: var(--bg);
  background: var(--accent);
  font-family: var(--terminal-font);
  font-size: 0.64rem;
  font-weight: 900;
  line-height: 17px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero::after,
.card::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 12px;
  width: 64px;
  height: 5px;
  opacity: 0.7;
  background: repeating-linear-gradient(
    90deg,
    var(--secondary) 0 8px,
    transparent 8px 12px
  );
}

.card {
  padding: 34px 22px 24px;
  border-color: rgba(116, 255, 241, 0.31);
}

.interactive-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.52),
    0 0 24px rgba(34, 247, 255, 0.12),
    inset 0 0 36px rgba(34, 247, 255, 0.04);
}

.hero {
  min-height: 230px;
  align-items: center;
  padding: 48px 44px 34px;
  border-color: rgba(116, 255, 241, 0.42);
}

.hero-copy {
  position: relative;
  min-width: 0;
  max-width: 100%;
  padding-left: 18px;
  border-left: 2px solid var(--accent);
}

.hero-copy::before,
.hero-copy::after {
  content: "";
  position: absolute;
  left: -5px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(34, 247, 255, 0.65);
}

.hero-copy::before {
  top: 0;
}

.hero-copy::after {
  bottom: 0;
}

.eyebrow,
.micro-label,
.card-header::after,
.field > span,
.status-tile strong,
.stats-grid span,
.queue-counts span,
.option-row .status-chip {
  font-family: var(--terminal-font);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  font-family: var(--display-font);
  font-size: clamp(2.3rem, 5.2vw, 4.6rem);
  font-weight: 800;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}

h2 {
  font-family: var(--display-font);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.lede {
  max-width: 700px;
  font-size: 1rem;
  line-height: 1.7;
}

.hero-status {
  min-width: 190px;
  display: grid;
  justify-items: end;
  gap: 10px;
}

.micro-label {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 900;
}

.signal-bars {
  display: grid;
  grid-template-columns: repeat(5, 26px);
  gap: 4px;
}

.signal-bars i {
  height: 5px;
  border: 1px solid var(--line-strong);
  background: rgba(34, 247, 255, 0.18);
  transition: background 200ms ease, box-shadow 200ms ease;
}

/* Lit bars reflect completed setup steps (driven by JS). */
.signal-bars i.active {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(34, 247, 255, 0.55);
}

.trust-strip {
  gap: 6px;
}

.trust-strip span,
.status-pill,
.status-chip,
.chip {
  border-radius: 0;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  font-family: var(--terminal-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.trust-strip span {
  min-height: 30px;
  border-color: rgba(116, 255, 241, 0.23);
  font-size: 0.68rem;
}

.status-pill {
  min-height: 42px;
  padding-inline: 18px;
}

.card-header {
  position: relative;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(116, 255, 241, 0.18);
}

.card-header::after {
  content: "ONLINE // MODULE READY";
  position: absolute;
  right: 0;
  bottom: -5px;
  padding-left: 8px;
  color: rgba(238, 247, 255, 0.36);
  background: rgba(8, 13, 27, 0.96);
  font-size: 0.55rem;
}

.card-header p {
  max-width: 58ch;
  font-size: 0.88rem;
}

.dashboard-grid {
  gap: 14px;
}

.setup-card {
  background:
    linear-gradient(90deg, rgba(34, 247, 255, 0.08), transparent 42%),
    rgba(8, 13, 27, 0.91);
}

.setup-steps,
.setup-grid {
  gap: 8px;
}

.setup-steps li,
.setup-step {
  position: relative;
  min-height: 136px;
  border-radius: 0;
  clip-path: polygon(0 10px, 10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
  background:
    linear-gradient(90deg, rgba(34, 247, 255, 0.12), transparent 60%),
    rgba(3, 8, 18, 0.72);
}

.setup-steps li::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 12px;
  width: 30px;
  height: 3px;
  background: repeating-linear-gradient(90deg, currentColor 0 5px, transparent 5px 8px);
  opacity: 0.55;
}

.step-number {
  width: 34px;
  height: 34px;
  border-radius: 0;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  font-size: 0.82rem;
}

.field span {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.7rem;
}

.field small {
  font-size: 0.78rem;
}

input,
textarea,
.preview-box {
  border-radius: 0;
  clip-path: polygon(0 8px, 8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  border-color: rgba(116, 255, 241, 0.28);
  background:
    linear-gradient(90deg, rgba(34, 247, 255, 0.05), transparent 32%),
    rgba(2, 6, 15, 0.86);
  font-family: var(--terminal-font);
  font-size: 0.88rem;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent), 0 0 18px rgba(34, 247, 255, 0.13);
}

.btn,
button {
  position: relative;
  min-height: 40px;
  border-radius: 0;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  padding: 8px 17px;
  font-family: var(--terminal-font);
  font-size: 0.76rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.btn::before,
button::before {
  content: "";
  position: absolute;
  left: 7px;
  bottom: 5px;
  width: 18px;
  height: 2px;
  background: currentColor;
  opacity: 0.42;
}

.btn-primary {
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), 0 0 16px rgba(34, 247, 255, 0.18);
}

.btn-secondary {
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), 0 0 16px rgba(255, 61, 242, 0.17);
}

.btn-ghost {
  border-color: rgba(116, 255, 241, 0.38);
  background:
    linear-gradient(90deg, rgba(34, 247, 255, 0.07), transparent),
    rgba(3, 8, 18, 0.65);
}

.mode-grid {
  gap: 7px;
}

.mode-card {
  border-radius: 0;
  clip-path: polygon(0 8px, 8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  padding: 12px;
}

.mode-card:has(input:checked) {
  box-shadow: inset 3px 0 0 var(--accent), 0 0 18px rgba(34, 247, 255, 0.1);
}

.status-grid,
.stats-grid,
.queue-counts {
  gap: 7px;
}

.status-tile,
.stats-grid div,
.queue-counts span,
.compact-list li,
.activity-list li,
.soft-details,
.option-row,
.warning-note {
  border-radius: 0;
  clip-path: polygon(0 7px, 7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%);
}

.status-tile,
.stats-grid div,
.queue-counts span {
  position: relative;
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(34, 247, 255, 0.07), transparent 70%),
    rgba(3, 8, 18, 0.72);
}

.status-tile::after,
.stats-grid div::after,
.queue-counts span::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 18px;
  height: 3px;
  background: currentColor;
  opacity: 0.4;
}

.stats-grid {
  grid-template-columns: repeat(9, minmax(110px, 1fr));
  overflow-x: auto;
  padding-bottom: 4px;
}

.stats-grid div {
  min-height: 94px;
  display: grid;
  align-content: space-between;
}

.queue-counts strong {
  font-family: var(--terminal-font);
}

.compact-list li,
.activity-list li {
  border-left: 2px solid var(--accent);
  background: rgba(3, 8, 18, 0.68);
}

.relay-row::before {
  border-radius: 0;
  transform: rotate(45deg);
}

.soft-details summary,
.advanced-card summary {
  font-family: var(--terminal-font);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-card {
  min-height: 94px;
  border-left: 3px solid var(--accent);
}

.result-card:has(.danger) {
  border-color: var(--danger);
  background:
    linear-gradient(90deg, rgba(255, 77, 109, 0.11), transparent 55%),
    rgba(8, 13, 27, 0.92);
}

.result-card:has(.warning),
.result-card:has(.warn) {
  border-color: var(--warning);
}

.result-summary strong {
  font-family: var(--terminal-font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.advanced-card {
  background:
    linear-gradient(180deg, rgba(34, 247, 255, 0.045), transparent 38%),
    #050914;
}

.output-meta {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.output-meta-item {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 10px;
  border-left: 2px solid var(--accent);
  background: rgba(34, 247, 255, 0.045);
}

.output-meta-item span {
  color: var(--muted);
  font-family: var(--terminal-font);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.output-meta-item code {
  color: var(--accent);
  font-family: var(--terminal-font);
  font-size: 0.72rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.output-meta-item.danger {
  border-color: var(--danger);
  background: rgba(255, 77, 109, 0.07);
}

.output-meta-item.danger code {
  color: var(--danger);
}

pre {
  border-radius: 0;
  clip-path: polygon(0 9px, 9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%);
  border-color: rgba(116, 255, 241, 0.32);
  font-family: var(--terminal-font);
  font-size: 0.76rem;
  line-height: 1.6;
  background:
    repeating-linear-gradient(to bottom, transparent 0 23px, rgba(34, 247, 255, 0.025) 23px 24px),
    #02060e;
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, 1380px);
    gap: 10px;
  }

  .hero,
  .hero > * {
    min-width: 0;
    max-width: 100%;
  }

  .hero {
    padding: 46px 22px 28px;
  }

  .hero-copy {
    padding-left: 14px;
  }

  .lede {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .trust-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .trust-strip span {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding-inline: 8px;
    font-size: 0.61rem;
  }

  .hero-status {
    justify-items: start;
  }

  .card {
    padding: 34px 16px 20px;
  }

  .hero,
  .card {
    --hud-cut: 9px;
    clip-path: polygon(
      0 var(--hud-cut),
      var(--hud-cut) 0,
      calc(100% - 26px) 0,
      100% 26px,
      100% calc(100% - var(--hud-cut)),
      calc(100% - var(--hud-cut)) 100%,
      26px 100%,
      0 calc(100% - 26px)
    );
  }

  .card::before,
  .hero::before {
    left: 42px;
    max-width: calc(100% - 72px);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .card-header::after {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .output-meta-item {
    grid-template-columns: 1fr;
  }

  .actions .btn,
  .actions button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .signal-bars {
    grid-template-columns: repeat(5, 20px);
  }
}

/* Refined HUD palette: cooler surfaces, calmer neon, clearer state colors. */
body {
  color-scheme: dark;
  background:
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.13), transparent 30%),
    radial-gradient(circle at top right, rgba(var(--secondary-rgb), 0.09), transparent 28%),
    radial-gradient(circle at bottom center, rgba(127, 114, 255, 0.08), transparent 34%),
    linear-gradient(145deg, var(--bg) 0%, #07101f 56%, var(--bg-2) 100%);
}

body::before {
  background-image:
    linear-gradient(rgba(var(--accent-rgb), 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.026) 1px, transparent 1px);
}

.hero,
.card {
  border-color: var(--line);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.052), transparent 32%),
    linear-gradient(315deg, rgba(var(--secondary-rgb), 0.026), transparent 30%),
    rgba(var(--panel-rgb), 0.95);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(234, 246, 255, 0.035),
    var(--shadow-neon);
}

.hero::before,
.card::before {
  color: #031018;
  background: linear-gradient(90deg, var(--accent), #a4f2ff);
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.24);
}

.hero::after,
.card::after {
  background: repeating-linear-gradient(
    90deg,
    var(--secondary) 0 7px,
    transparent 7px 12px
  );
  opacity: 0.72;
}

input,
textarea,
select,
pre {
  border-color: rgba(var(--accent-rgb), 0.25);
  background-color: rgba(3, 10, 22, 0.9);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px rgba(var(--accent-rgb), 0.11),
    0 0 20px rgba(var(--accent-rgb), 0.08);
}

.btn-primary,
button.primary {
  color: #031018;
  background: linear-gradient(135deg, #86edff, var(--accent-strong));
  box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.2);
}

.btn-secondary,
button.secondary {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-strong));
  box-shadow: 0 0 20px rgba(var(--secondary-rgb), 0.17);
}

.btn:hover:not(:disabled),
button:hover:not(:disabled) {
  border-color: rgba(var(--accent-rgb), 0.68);
  box-shadow:
    0 0 0 1px rgba(var(--accent-rgb), 0.18),
    0 0 24px rgba(var(--accent-rgb), 0.15);
}

.status-success,
.notice.success {
  border-color: rgba(var(--success-rgb), 0.48);
  background-color: rgba(var(--success-rgb), 0.1);
}

.status-warning,
.notice.warning {
  border-color: rgba(var(--warning-rgb), 0.48);
  background-color: rgba(var(--warning-rgb), 0.1);
}

.status-error,
.notice.error,
.output-meta-item.danger {
  border-color: rgba(var(--danger-rgb), 0.5);
  background-color: rgba(var(--danger-rgb), 0.095);
}
