/* --------------------------------------------------------------------------
   Portal application UI (memory archive, card actions, gate dialog).
   Same visual language as planet.css: thin lines, mono labels, one accent.
   -------------------------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ------------------------------------------------------------ card extras */
.mem-card-meta {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.7;
  color: var(--muted);
  text-transform: uppercase;
}

.mem-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.mem-act {
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.mem-act:hover,
.mem-act:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.mem-act.is-danger:hover,
.mem-act.is-danger:focus-visible {
  border-color: var(--coral);
  color: var(--coral);
}

.mem-act.is-ghost {
  color: var(--muted);
  border-color: var(--line-soft);
}

/* ----------------------------------------------------------------- toast */
.portal-toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 60;
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: rgba(8, 11, 24, 0.92);
  border: 1px solid var(--line);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

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

/* --------------------------------------------------------------- console */
.mem-console {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: min(680px, 100vw);
  height: 100%;
  padding: 22px var(--pad) 28px;
  background: rgba(8, 11, 24, 0.93);
  border-left: 1px solid var(--line);
  transform: translateX(102%);
  transition: transform 0.5s var(--ease);
  overscroll-behavior: contain;
}

.mem-console.is-open {
  transform: translateX(0);
}

.mem-console-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.mem-console-kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
  white-space: nowrap;
}

.mem-console-tabs {
  display: flex;
  gap: 4px;
}

.mem-console-tab {
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
}

.mem-console-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.mem-console-spacer {
  flex: 1;
}

.mem-console-action {
  padding: 7px 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
}

.mem-console-action:hover,
.mem-console-action:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.mem-console-action:disabled {
  opacity: 0.35;
  cursor: default;
}

.mem-console-action.is-ghost {
  color: var(--muted);
}

.mem-console-close {
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line-soft);
  cursor: pointer;
}

.mem-console-close:hover,
.mem-console-close:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.mem-console-body {
  flex: 1;
  min-height: 0;
  padding-top: 18px;
  overflow-y: auto;
}

.mem-console-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.mem-console-input {
  flex: 1 1 140px;
  min-width: 0;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-soft);
}

.mem-console-input:focus {
  border-color: var(--accent);
  outline: none;
}

.mem-console-input.is-area {
  width: 100%;
  flex-basis: 100%;
  line-height: 1.7;
  resize: vertical;
}

.mem-console-input.is-area.is-small {
  font-size: 10px;
}

.mem-console-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line-soft);
}

.mem-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  font-family: var(--mono);
  font-size: 11px;
  text-align: left;
  color: var(--body);
  background: #0a0e1d;
  border: 0;
  cursor: pointer;
}

.mem-row:hover,
.mem-row:focus-visible {
  background: rgba(200, 244, 92, 0.06);
  outline: none;
}

.mem-row.is-static {
  cursor: default;
}

.mem-row-date {
  color: var(--dim);
  letter-spacing: 0.06em;
}

.mem-row-title {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mem-row-tag {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--accent-soft);
  text-transform: uppercase;
}

.mem-row-tag.is-dim {
  color: var(--dim);
}

.mem-console-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 14px;
}

.mem-console-page {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.mem-console-hint {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.7;
  color: var(--dim);
}

.mem-console-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mem-console-label {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}

.mem-console-form input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.mem-console-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* ------------------------------------------------------- paper / gate */
/* ---------------------------------------------------- letter / postmark */
.letter-form {
  width: 160px;
}

.letter-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 84px;
  height: 84px;
  margin: 0 auto 8px;
  color: #7c2f2f;
  text-align: center;
  border: 1px solid rgba(124, 47, 47, 0.42);
  border-radius: 50%;
  outline: 1px dashed rgba(124, 47, 47, 0.22);
  outline-offset: -5px;
  opacity: 0.92;
  transform: rotate(-6deg);
}

.letter-stamp-date {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
}

.letter-stamp-place {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.18em;
  color: rgba(124, 47, 47, 0.62);
}

.letter-row {
  display: flex;
  align-items: stretch;
}

.letter-pass {
  flex: 1;
  min-width: 0;
  padding: 6px 4px 5px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #8f3a2b;
  text-align: center;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed rgba(124, 62, 46, 0.42);
  border-radius: 0;
  caret-color: #8f3a2b;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.letter-pass::placeholder {
  color: rgba(124, 62, 46, 0.32);
  letter-spacing: 0.2em;
}

.letter-pass:focus-visible {
  border-bottom-style: solid;
  border-bottom-color: rgba(143, 58, 43, 0.85);
}

.letter-form.is-stamped .letter-pass {
  padding: 5px 6px;
  background: rgba(143, 58, 43, 0.05);
  border: 1px solid rgba(143, 58, 43, 0.55);
  border-radius: 3px;
}

.letter-form.is-busy .letter-pass {
  opacity: 0.55;
}

/* ---------------------------------------------------------- paper sheet */
.paper {
  align-items: center;
  justify-content: center;
  padding: clamp(48px, 9vh, 110px) clamp(24px, 7vw, 120px);
}

.paper-back {
  position: absolute;
  left: var(--pad);
  bottom: max(var(--pad), env(safe-area-inset-bottom));
}

/* 纸角的两束玫瑰：同一份 SVG，左上原样、右下转 180°，压纹不如压色 */
.paper-spray {
  position: absolute;
  width: clamp(240px, 29vw, 420px);
  height: auto;
  opacity: 0;
  pointer-events: none;
  user-select: none;
  transition: opacity 1.1s var(--ease) 0.4s;
}

.paper-spray-tl {
  top: -12px;
  left: -14px;
}

.paper-spray-br {
  right: -14px;
  bottom: -12px;
  transform: rotate(180deg);
}

.paper.is-open .paper-spray {
  opacity: 0.94;
}

.paper.is-returning .paper-spray {
  opacity: 0;
  transition-delay: 0s;
}

@media (max-width: 900px) {
  .paper-spray {
    width: 200px;
  }
}

@media (max-width: 700px) {
  .paper-spray {
    width: 150px;
    opacity: 0.8;
  }
}

.paper-sheet {
  display: grid;
  place-items: center;
  width: 100%;
}

.paper-sheet-inner {
  width: min(620px, 100%);
  color: #3f2f1d;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
}

/* 退回去时，字先收回纸里、纸再退回信封，然后把画面交还给 3D 那张纸 */
.paper.is-returning .paper-sheet-inner {
  opacity: 0;
  transform: translateY(9%) scale(0.94);
}

.paper-kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(96, 72, 46, 0.62);
  text-transform: uppercase;
}

.paper-title {
  margin: 14px 0 22px;
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.paper-body p {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 2.05;
  color: #4a3722;
}

.paper-enter {
  display: inline-block;
  margin-top: 30px;
  padding: 12px 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #4a3a24;
  background: transparent;
  border: 1px solid rgba(74, 58, 36, 0.4);
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

.paper-enter:hover,
.paper-enter:focus-visible {
  color: #f8f0e0;
  background: #4a3a24;
  outline: none;
}

.paper-enter:disabled {
  opacity: 0.5;
  cursor: default;
}

.gate-dialog {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 6, 14, 0.72);
  backdrop-filter: blur(6px);
}

.gate-dialog-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(380px, 100%);
  padding: 26px;
  background: #0a0e1d;
  border: 1px solid var(--line);
}

.gate-dialog-kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--dim);
}

.gate-dialog-title {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 400;
  color: var(--ink);
}

.gate-dialog-hint {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.gate-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.mem-console-open {
  margin-left: auto;
}

@media (max-width: 760px) {
  .mem-console {
    width: 100%;
    padding: 16px 18px 22px;
  }

  .mem-console-head {
    flex-wrap: wrap;
    gap: 10px;
  }

  .mem-row {
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
  }

  .mem-row-date {
    grid-column: 1 / -1;
    font-size: 9px;
  }

  .mem-row-title {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .letter-form {
    width: 148px;
  }

  .letter-stamp {
    font-size: 12px;
    letter-spacing: 0.1em;
  }

  .letter-pass {
    font-size: 11px;
  }

  .paper {
    padding: 7vh 7vw;
  }

  .paper-title {
    margin: 10px 0 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mem-console,
  .portal-toast {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Satellite telemetry (hidden entry, opened from the 3D satellite)
   -------------------------------------------------------------------------- */

body.is-sat .ui {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
}

.sat-view {
  /* The satellite reports in its own colour: a cold instrument blue, scoped
     to this view so the rest of the site keeps the lime accent. */
  --sat-accent: #6fb7ff;
  --sat-accent-rgb: 111, 183, 255;
  --sat-accent-deep: #3f7fd6;
  --accent: var(--sat-accent);
  --accent-soft: var(--sat-accent-deep);
  position: fixed;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  padding: max(var(--pad), env(safe-area-inset-top)) var(--pad)
    max(22px, env(safe-area-inset-bottom));
  background: radial-gradient(
      120% 86% at 50% 0%,
      rgba(10, 16, 34, 0.68),
      rgba(4, 7, 16, 0.9) 72%
    );
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0s linear 0.4s;
}

.sat-view.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.55s var(--ease) 0.04s;
}

/* head --------------------------------------------------------------------- */

.sat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.sat-back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.25s var(--ease);
}

.sat-back:hover,
.sat-back:focus-visible {
  color: var(--ink);
  outline: none;
}

.sat-back-arrow {
  font-size: 13px;
  line-height: 1;
  transition: transform 0.3s var(--ease);
}

.sat-back:hover .sat-back-arrow {
  transform: translateX(-3px);
}

.sat-crumb span {
  color: var(--accent);
}

/* body --------------------------------------------------------------------- */

.sat-body {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
}

/* gate --------------------------------------------------------------------- */

.sat-gate {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(460px, 86vw);
  transform: translate(-50%, -50%);
  text-align: center;
  transition: opacity 0.6s var(--ease), transform 0.8s var(--ease),
    filter 0.6s var(--ease);
}

.sat-view.is-unlocked .sat-gate {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.97);
  filter: blur(8px);
  pointer-events: none;
}

.sat-gate-kicker {
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}

.sat-gate-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(42px, 5vw, 68px);
  line-height: 1;
  letter-spacing: 0.18em;
  color: var(--ink);
}

.sat-gate-line {
  margin: 18px 0 26px;
  font-size: 13px;
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: var(--body);
}

.sat-form {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
}

.sat-input {
  width: 168px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 24, 0.5);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.42em;
  text-align: center;
  outline-offset: 4px;
  transition: border-color 0.3s, background 0.3s;
}

.sat-input:focus {
  border-color: var(--accent);
  background: rgba(10, 16, 34, 0.66);
}

.sat-submit {
  padding: 12px 20px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}

.sat-submit:hover,
.sat-submit:focus-visible {
  background: var(--accent);
  color: #0a0f05;
}

.sat-gate-hint {
  margin: 16px 0 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--dim);
  min-height: 12px;
}

.sat-gate.is-wrong {
  animation: mem-shake 0.42s ease;
}

/* board -------------------------------------------------------------------- */

.sat-board {
  width: min(1120px, 100%);
  max-height: calc(100vh - 148px);
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease) 0.15s, transform 0.9s var(--ease) 0.15s;
}

.sat-view.is-unlocked .sat-board {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* hero --------------------------------------------------------------------- */

.sat-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 10px;
}

.sat-hero-kicker {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--dim);
}

.sat-hero-status {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 3.7vw, 44px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.sat-hero-status[data-state="warn"] {
  color: #f0b766;
}

.sat-hero-status[data-state="down"] {
  color: var(--coral);
}

.sat-hero-meta {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.sat-hero-stats {
  display: flex;
  gap: clamp(20px, 3vw, 44px);
  padding-bottom: 4px;
}

.sat-stat {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: flex-end;
  min-width: 86px;
}

.sat-stat b {
  font-family: var(--mono);
  font-size: clamp(16px, 1.6vw, 21px);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
}

.sat-stat span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}

/* cards -------------------------------------------------------------------- */

.sat-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

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

.sat-span-7 {
  grid-column: span 7;
}

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

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

.sat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 11px 18px 10px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.036),
    rgba(255, 255, 255, 0.008)
  );
}

.sat-card-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.sat-card-title {
  margin: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}

.sat-card-note {
  margin: 0;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  color: var(--dim);
}

.sat-card-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 0 auto;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.sat-card-live i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: sat-live 2.6s var(--ease) infinite;
}

@keyframes sat-live {
  0%,
  100% {
    opacity: 0.35;
  }
  12% {
    opacity: 1;
  }
  26% {
    opacity: 0.4;
  }
  38% {
    opacity: 0.9;
  }
}

/* charts ------------------------------------------------------------------- */

.sat-chart {
  position: relative;
  min-height: 0;
}

.sat-chart-bars {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
}

.sat-chart svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.sat-axis {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  fill: var(--dim);
}

.sat-crosshair {
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0;
}

.sat-crosshair.is-on {
  opacity: 0.5;
}

.sat-tip {
  position: absolute;
  z-index: 3;
  min-width: 78px;
  padding: 6px 9px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  line-height: 1.7;
  color: var(--ink);
  background: rgba(6, 10, 22, 0.94);
  border: 1px solid var(--line);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -120%);
  transition: opacity 0.16s var(--ease);
  white-space: nowrap;
}

.sat-tip.is-on {
  opacity: 1;
}

.sat-tip b {
  font-weight: 400;
  color: var(--accent);
}

/* traffic bars ------------------------------------------------------------- */

.sat-bars {
  display: flex;
  flex: 1;
  min-height: 92px;
  align-items: flex-end;
  gap: 4px;
  padding-top: 6px;
}

.sat-bar {
  position: relative;
  flex: 1;
  height: var(--h, 6%);
  min-height: 3px;
  background: linear-gradient(
    180deg,
    rgba(var(--sat-accent-rgb), 0.95),
    rgba(var(--sat-accent-rgb), 0.26)
  );
  transition: height 0.8s var(--ease) 0.1s, background 0.3s;
}

.sat-bar:hover {
  background: var(--accent);
}

.sat-bar {
  transform-origin: bottom;
  animation: sat-bar-in 0.7s var(--ease) backwards;
}

@keyframes sat-bar-in {
  from {
    transform: scaleY(0.05);
    opacity: 0.2;
  }
}

.sat-bar.is-peak {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.96),
    rgba(var(--sat-accent-rgb), 0.5)
  );
}

.sat-bars-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--dim);
}

/* services ----------------------------------------------------------------- */

.sat-checks {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sat-check {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) minmax(96px, 152px) 52px 46px;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--line-soft);
}

.sat-checks.is-plain .sat-check {
  grid-template-columns: 8px minmax(0, 1fr) 52px;
}

.sat-checks.is-plain .sat-heat,
.sat-checks.is-plain .sat-check-uptime {
  display: none;
}

.sat-check:first-child {
  border-top: 0;
  padding-top: 2px;
}

.sat-check-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--sat-accent-rgb), 0.35);
}

.sat-check[data-state="warn"] .sat-check-dot {
  background: #f0b766;
  box-shadow: 0 0 8px rgba(240, 183, 102, 0.35);
}

.sat-check[data-state="down"] .sat-check-dot {
  background: var(--coral);
  box-shadow: 0 0 8px rgba(255, 122, 89, 0.4);
}

.sat-check-body {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.sat-check-name {
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: var(--ink);
  white-space: nowrap;
}

.sat-check-detail {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  color: var(--dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sat-heat {
  display: flex;
  gap: 2px;
  height: 18px;
  align-items: flex-end;
}

.sat-heat i {
  flex: 1;
  min-width: 2px;
  height: var(--h, 100%);
  background: var(--accent);
  opacity: 0.5;
  transform-origin: bottom;
  animation: sat-heat-in 0.5s var(--ease) backwards;
}

.sat-heat i.is-slow {
  opacity: 1;
}

.sat-heat i.is-down {
  background: var(--coral);
  opacity: 1;
}

.sat-heat i.is-missing {
  background: var(--line);
  opacity: 0.6;
}

@keyframes sat-heat-in {
  from {
    transform: scaleY(0.2);
    opacity: 0;
  }
}

.sat-check-latency {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

.sat-check-latency.is-down {
  color: var(--coral);
}

.sat-check-uptime {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-align: right;
  white-space: nowrap;
}

/* gauges ------------------------------------------------------------------- */

.sat-gauges {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  gap: 6px 10px;
}

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

.sat-gauge svg {
  flex: none;
  width: 62px;
  height: 62px;
  transform: rotate(-90deg);
}

.sat-gauge-track {
  stroke: var(--line);
}

.sat-gauge-arc {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dasharray 0.9s var(--ease);
}

.sat-gauge[data-state="warn"] .sat-gauge-arc {
  stroke: #f0b766;
}

.sat-gauge[data-state="down"] .sat-gauge-arc {
  stroke: var(--coral);
}

.sat-gauge-text {
  min-width: 0;
}

.sat-gauge-value {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
}

.sat-gauge-label {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

.sat-gauge-sub {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

/* paths -------------------------------------------------------------------- */

.sat-paths {
  margin: 10px 0 0;
  padding: 10px 0 0;
  list-style: none;
  border-top: 1px solid var(--line-soft);
}

.sat-paths-title {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.sat-path {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.sat-path-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sat-path b {
  font-weight: 400;
  color: var(--dim);
  white-space: nowrap;
}

/* codes + maintenance ------------------------------------------------------ */

.sat-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--dim);
}

.sat-codes span {
  white-space: nowrap;
}

.sat-codes b {
  margin-left: 5px;
  font-weight: 400;
  color: var(--ink);
}

.sat-codes .is-4xx b {
  color: #f0b766;
}

.sat-codes .is-5xx b,
.sat-codes .is-5xx {
  color: var(--coral);
}

.sat-maint {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.006)
  );
}

.sat-maint-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 16px;
  border-left: 1px solid var(--line-soft);
}

.sat-maint-item:first-child {
  border-left: 0;
}

.sat-maint-item span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.sat-maint-item b {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--ink);
  white-space: nowrap;
}

.sat-maint-item[data-state="warn"] b {
  color: #f0b766;
}

.sat-maint-item[data-state="down"] b {
  color: var(--coral);
}

/* foot --------------------------------------------------------------------- */

.sat-foot {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 8px;
}

.sat-refresh {
  padding: 9px 18px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: background 0.3s, color 0.3s, opacity 0.3s;
}

.sat-refresh:hover,
.sat-refresh:focus-visible {
  background: var(--accent);
  color: #0a0f05;
}

.sat-refresh[disabled] {
  opacity: 0.4;
  cursor: wait;
}

.sat-foot-note {
  margin: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--dim);
}

/* narrow ------------------------------------------------------------------- */

@media (max-width: 980px) {
  .sat-span-8,
  .sat-span-7 {
    grid-column: span 12;
  }

  .sat-span-5,
  .sat-span-4 {
    grid-column: span 6;
  }

  .sat-check {
    grid-template-columns: 8px minmax(0, 1fr) 52px 46px;
  }

  .sat-heat {
    display: none;
  }

  .sat-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .sat-hero-stats {
    padding-bottom: 0;
  }

  .sat-stat {
    align-items: flex-start;
  }
}

@media (max-width: 620px) {
  .sat-span-5,
  .sat-span-4 {
    grid-column: span 12;
  }

  .sat-board {
    max-height: none;
  }

  .sat-hero-stats {
    gap: 20px;
  }

  .sat-stat {
    min-width: 0;
  }

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

@media (prefers-reduced-motion: reduce) {
  .sat-card-live i,
  .sat-heat i {
    animation: none;
  }

  .sat-view,
  .sat-board,
  .sat-gate,
  .sat-bar,
  .sat-gauge-arc {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Relay (04) — dive out of the planet into the gateway
   -------------------------------------------------------------------------- */

body.is-relay .ui {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
}

.dive {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(10, 18, 36, 0.98), #04060f 70%);
  clip-path: circle(0px at var(--x, 50%) var(--y, 50%));
  transition: clip-path 0.92s cubic-bezier(0.55, 0, 0.75, 0.4);
}

.dive.is-closing {
  clip-path: circle(160vmax at var(--x, 50%) var(--y, 50%));
}

.relay-view {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  padding: max(var(--pad), env(safe-area-inset-top)) var(--pad)
    max(22px, env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s var(--ease), visibility 0s linear 0.45s;
}

.relay-view.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.5s var(--ease) 0.05s;
}

.relay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.relay-back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.25s var(--ease);
}

.relay-back:hover,
.relay-back:focus-visible {
  color: var(--ink);
  outline: none;
}

.relay-back-arrow {
  font-size: 13px;
  line-height: 1;
  transition: transform 0.3s var(--ease);
}

.relay-back:hover .relay-back-arrow {
  transform: translateX(-3px);
}

.relay-crumb span {
  color: var(--accent);
}

/* gate --------------------------------------------------------------------- */

.relay-gate {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: min(460px, 86vw);
  transform: translate(-50%, -50%);
  text-align: center;
  transition: opacity 0.6s var(--ease), transform 0.8s var(--ease),
    filter 0.6s var(--ease);
}

.relay-view.is-verified .relay-gate {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.97);
  filter: blur(8px);
  pointer-events: none;
}

.relay-gate-kicker {
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}

.relay-gate-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(42px, 5vw, 68px);
  line-height: 1;
  letter-spacing: 0.18em;
  color: var(--ink);
}

.relay-gate-line {
  margin: 18px 0 26px;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--body);
}

.relay-form {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
}

.relay-input {
  width: 180px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 24, 0.5);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.42em;
  text-align: center;
  outline-offset: 4px;
  transition: border-color 0.3s, background 0.3s;
}

.relay-input:focus {
  border-color: var(--accent);
  background: rgba(10, 16, 34, 0.66);
}

.relay-submit {
  padding: 12px 20px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}

.relay-submit:hover,
.relay-submit:focus-visible {
  background: var(--accent);
  color: #0a0f05;
}

.relay-gate-hint {
  margin: 16px 0 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--dim);
  min-height: 12px;
}

.relay-form.is-wrong {
  animation: mem-shake 0.42s ease;
}

/* board placeholder -------------------------------------------------------- */

.relay-board {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  margin-top: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease) 0.2s;
}

.relay-view.is-verified .relay-board {
  opacity: 1;
  pointer-events: auto;
}

.relay-empty {
  margin: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--dim);
}

@media (prefers-reduced-motion: reduce) {
  .dive {
    transition: none;
  }
}

/* upstream strip ----------------------------------------------------------- */

.relay-upstream {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
  padding: 9px 14px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.028),
    rgba(255, 255, 255, 0.005)
  );
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--dim);
  animation: relay-rise 0.5s var(--ease) 0.1s both;
}

.relay-up-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px rgba(200, 244, 92, 0.55);
}

.relay-upstream[data-state="warn"] .relay-up-dot {
  background: #f0b766;
  box-shadow: 0 0 9px rgba(240, 183, 102, 0.55);
}

.relay-upstream[data-state="down"] .relay-up-dot {
  background: var(--coral);
  box-shadow: 0 0 9px rgba(255, 122, 89, 0.55);
}

.relay-up-name {
  color: var(--ink);
  letter-spacing: 0.04em;
}

.relay-up-sep {
  width: 1px;
  height: 11px;
  flex: none;
  background: var(--line-soft);
}

.relay-up-meta b {
  color: var(--body);
  font-weight: 400;
}

.relay-up-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.relay-up-tag {
  padding: 2px 7px;
  border: 1px solid rgba(240, 183, 102, 0.32);
  color: #f0b766;
  font-size: 8px;
  letter-spacing: 0.12em;
}

.relay-up-tag.is-safe {
  border-color: rgba(200, 244, 92, 0.32);
  color: var(--accent);
}

/* grid --------------------------------------------------------------------- */

.relay-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.relay-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 12px 15px 11px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.006)
  );
  overflow: hidden;
  animation: relay-rise 0.5s var(--ease) both;
}

.relay-grid > .relay-card:first-child {
  animation-delay: 0.16s;
}

.relay-grid > .relay-card:last-child {
  animation-delay: 0.22s;
}

.relay-feed-card {
  flex: none;
  height: 168px;
  animation-delay: 0.28s;
}

@keyframes relay-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.relay-card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.relay-card-title {
  margin: 0;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.relay-card-note {
  margin: 0 0 0 auto;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--dim);
}

/* key table ---------------------------------------------------------------- */

.relay-keys {
  position: relative;
}

.relay-key-head,
.relay-key-row,
.relay-key-total {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 58px 76px 78px 58px;
  gap: 10px;
  align-items: center;
}

.relay-key-head {
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.relay-key-head span:nth-child(n + 2) {
  text-align: right;
}

.relay-key-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: opacity 0.24s var(--ease), background 0.24s var(--ease);
}

.relay-key-row:hover,
.relay-key-row.is-hot {
  background: rgba(255, 255, 255, 0.028);
}

.relay-key-name {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.relay-key-prefix {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--dim);
}

.relay-key-sub {
  display: block;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--dim);
}

.relay-num {
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
  color: var(--body);
  font-variant-numeric: tabular-nums;
}

.relay-num.is-cost {
  color: var(--accent);
}

.relay-key-share {
  display: block;
  position: relative;
  height: 3px;
  background: var(--line-soft);
  overflow: hidden;
}

.relay-key-share i {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  opacity: 0.7;
  transition: width 0.7s var(--ease);
}

.relay-key-share-text {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-style: normal;
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--dim);
  text-align: right;
}

/* focusing one key pushes the rest back */
.relay-keys.has-focus .relay-key-row:not(.is-hot) {
  opacity: 0.3;
}

.relay-key-total {
  margin-top: auto;
  padding-top: 10px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
}

.relay-total-label {
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.relay-key-total .relay-num {
  color: var(--ink);
}

/* chart -------------------------------------------------------------------- */

.relay-range {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.relay-range button {
  padding: 3px 9px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.relay-range button:hover {
  color: var(--body);
}

.relay-range button.is-on {
  color: var(--accent);
  border-color: rgba(200, 244, 92, 0.4);
}

.relay-chart {
  position: relative;
  flex: 1;
  min-height: 0;
}

.relay-chart canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.relay-chart-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--dim);
}

.relay-chart-foot b {
  color: var(--body);
  font-weight: 400;
}

/* feed --------------------------------------------------------------------- */

.relay-feed {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.relay-feed-row {
  display: grid;
  grid-template-columns: 52px 76px minmax(0, 1.1fr) 100px 60px 46px;
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  animation: relay-row-in 0.4s var(--ease);
}

.relay-feed-row .t {
  color: var(--dim);
}

.relay-feed-row .k {
  color: var(--body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relay-feed-row .m {
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relay-feed-row .tk,
.relay-feed-row .ms {
  text-align: right;
  color: var(--dim);
}

.relay-feed-row .s {
  text-align: right;
}

.relay-feed-row .s.is-ok {
  color: var(--accent);
}

.relay-feed-row .s.is-warn {
  color: #f0b766;
}

.relay-feed-row .s.is-err {
  color: var(--coral);
}

@keyframes relay-row-in {
  from {
    opacity: 0.3;
    transform: translateY(-5px);
  }
}

@media (max-width: 980px) {
  .relay-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .relay-board {
    overflow-y: auto;
  }

  .relay-upstream {
    flex-wrap: wrap;
  }
}
