/* ============================================================
   SF/MIRROR — identidade
   Tinta azul-nanquim, sinal âmbar, dados em mono tabular.
   ============================================================ */

:root {
  --bg: #0b111e;
  --surface: #111a2b;
  --surface-2: #162135;
  --line: #24314c;
  --line-soft: #1b2540;
  --text: #e9eef8;
  --muted: #94a2be;
  --faint: #64739080;

  --amber: #ffb020;
  --amber-hi: #ffc24d;
  --amber-soft: rgba(255, 176, 32, 0.12);
  --blue: #6c9bff;
  --red: #ff7a6b;
  --ok: #45d9a0;

  --sans: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 10px;
  --wrap: 1120px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* luz fria no topo, só para dar profundidade */
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 55vh;
  background: radial-gradient(58% 100% at 50% 0%, rgba(108, 155, 255, 0.11), transparent 72%);
  pointer-events: none;
  z-index: 0;
}

header,
main,
footer {
  position: relative;
  z-index: 1;
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.5rem);
}

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

a {
  color: var(--blue);
}

:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* ---------------------------------------------------------- topbar */

.topbar {
  border-bottom: 1px solid var(--line-soft);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 62px;
}

.wordmark {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
}

.wordmark span {
  color: var(--amber);
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
}

.led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(69, 217, 160, 0.7);
}

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

.hero {
  padding: clamp(2.75rem, 8vh, 5rem) 0 clamp(2rem, 5vh, 3rem);
}

.hero h1 {
  margin-top: 0.9rem;
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.03;
}

.lede {
  margin-top: 1.1rem;
  max-width: 56ch;
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  color: var(--muted);
}

.picker {
  display: flex;
  gap: 0.6rem;
  margin-top: clamp(1.75rem, 4vh, 2.5rem);
}

.picker input {
  flex: 1;
  min-width: 0;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(0.82rem, 2vw, 0.95rem);
}

.picker input::placeholder {
  color: #5d6b87;
}

.picker input:focus {
  border-color: #38507f;
  outline: none;
  box-shadow: 0 0 0 3px rgba(108, 155, 255, 0.16);
}

.picker__hint {
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(108, 155, 255, 0.4);
}

.linkish:hover {
  color: var(--amber);
  text-decoration-color: rgba(255, 176, 32, 0.5);
}

.picker__error {
  margin-top: 0.8rem;
  max-width: 62ch;
  font-size: 0.86rem;
  color: var(--red);
}

/* inventário de nós */
.nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  margin: clamp(1.75rem, 4vh, 2.5rem) 0 0;
  padding: 1.1rem 0 0;
  list-style: none;
  border-top: 1px solid var(--line-soft);
}

.nodes li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: #5f6d8b;
  transition: color 0.3s;
}

.nodes .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2c3a57;
  transition: background 0.3s, box-shadow 0.3s;
}

.nodes li.is-probing {
  color: var(--muted);
}

.nodes li.is-probing .dot {
  background: var(--amber);
  animation: blink 0.9s ease-in-out infinite;
}

.nodes li.is-ok {
  color: var(--muted);
}

.nodes li.is-ok .dot {
  background: var(--ok);
  box-shadow: 0 0 6px rgba(69, 217, 160, 0.6);
}

.nodes li.is-fail .dot {
  background: var(--red);
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

/* ---------------------------------------------------------- resultados */

.results {
  padding-bottom: clamp(3rem, 8vh, 5rem);
}

.filecard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
  padding: 1.25rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filename {
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  line-height: 1.4;
  word-break: break-all;
}

.filemeta {
  margin-top: 0.45rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.filemeta span {
  font-family: var(--mono);
  color: #b9c4da;
}

/* vencedor */
.winner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  margin-top: 1rem;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  background:
    linear-gradient(180deg, rgba(255, 176, 32, 0.07), transparent 65%),
    var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
}

.bigms {
  display: flex;
  align-items: baseline;
  gap: 0.15em;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(2.6rem, 8vw, 4.25rem);
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.bigms small {
  font-size: 0.26em;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.winner__who {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

#winnerFlag {
  font-size: 1.15rem;
  line-height: 1;
}

.winner__host {
  font-family: var(--mono);
  font-size: clamp(0.92rem, 2.4vw, 1.05rem);
}

.winner__city {
  font-size: 0.82rem;
  color: var(--muted);
}

.winner__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  min-width: min(100%, 260px);
}

.winner__stable {
  justify-self: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.15rem;
  white-space: nowrap;
}

.winner__link {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.94rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--amber);
  color: #171205;
}

.btn--primary:hover {
  background: var(--amber-hi);
}

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

.btn--ghost:hover {
  border-color: #3d4d70;
  background: rgba(255, 255, 255, 0.03);
}

.btn--lg {
  padding: 1rem 1.5rem;
  font-size: 1rem;
}

/* progresso */
.progress {
  margin-top: 1.5rem;
}

.progress__track {
  height: 3px;
  background: var(--line-soft);
  border-radius: 2px;
  overflow: hidden;
}

.progress__track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--amber);
  transition: width 0.35s ease;
}

.progress__text {
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
}

/* quadro de nós */
.board {
  margin-top: 2.25rem;
}

.board__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.board__title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.board__note {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--faint);
}

.board__labels,
.node-row {
  display: grid;
  grid-template-columns:
    2rem 1.6rem minmax(8rem, 1.3fr) minmax(5rem, 1fr) 5.6rem
    minmax(56px, 2fr) 7.5rem 3.3rem;
  align-items: center;
  gap: 0.85rem;
}

.board__labels {
  margin-top: 0.9rem;
  padding: 0 0.9rem 0.5rem;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: #64739a;
}

.board__labels .col-ms {
  text-align: right;
}

.nodelist {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.node-row {
  padding: 0.72rem 0.9rem;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.node-row + .node-row {
  border-top: 1px solid var(--line-soft);
}

.node-row:hover {
  background: rgba(255, 255, 255, 0.022);
}

.node-row.is-selected {
  background: var(--amber-soft);
  box-shadow: inset 3px 0 0 var(--amber);
}

.node-row__rank {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.node-row.is-selected .node-row__rank {
  color: var(--amber);
  font-weight: 600;
}

.node-row__flag {
  font-size: 1.05rem;
  line-height: 1;
}

.node-row__id {
  font-family: var(--mono);
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-row__city {
  font-size: 0.82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-row__ms {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.9rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.node-row__ms i {
  font-style: normal;
  font-size: 0.68em;
  color: var(--muted);
  margin-left: 0.15em;
}

.node-row__ms.is-empty {
  color: var(--faint);
}

.node-row__bar {
  height: 6px;
  background: #1c2742;
  border-radius: 3px;
  overflow: hidden;
}

.node-row__bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue);
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.22, 0.8, 0.24, 1);
}

.node-row.is-selected .node-row__bar i {
  background: var(--amber);
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
}

.state__dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #33405e;
}

.state.is-ok .state__dot {
  background: var(--ok);
}

.state.is-probing .state__dot {
  background: var(--amber);
  animation: blink 0.9s ease-in-out infinite;
}

.state.is-fail .state__dot {
  background: var(--red);
}

.state.is-fail {
  color: #b58a86;
}

.btn-use {
  padding: 0.4rem 0.55rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s;
}

.btn-use:hover:not(:disabled) {
  border-color: rgba(255, 176, 32, 0.55);
  color: var(--amber);
}

.btn-use:disabled {
  opacity: 0.35;
  cursor: default;
}

.node-row.is-selected .btn-use {
  border-color: rgba(255, 176, 32, 0.55);
  color: var(--amber);
}

.notice {
  margin-top: 1.25rem;
  padding: 0.9rem 1.1rem;
  background: var(--amber-soft);
  border: 1px solid rgba(255, 176, 32, 0.32);
  border-radius: 8px;
  font-size: 0.88rem;
  color: #f3ddb3;
}

/* ---------------------------------------------------------- rodapé */

.footer {
  margin-top: clamp(2rem, 6vh, 4rem);
  padding: clamp(2.5rem, 6vh, 3.5rem) 0 4rem;
  border-top: 1px solid var(--line-soft);
}

.footer__title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.75rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.steps__num {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--amber);
}

.steps h3 {
  margin-top: 0.55rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.steps p {
  margin-top: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.footer__note {
  margin-top: 2.5rem;
  max-width: 70ch;
  font-size: 0.8rem;
  color: var(--faint);
}

.footer__note a {
  color: var(--muted);
  text-decoration-color: rgba(148, 162, 190, 0.4);
  text-underline-offset: 3px;
}

.footer__note a:hover {
  color: var(--blue);
}

/* ---------------------------------------------------------- responsivo */

@media (max-width: 860px) {
  .board__labels {
    display: none;
  }

  .node-row {
    grid-template-columns: 1.7rem 1.5rem minmax(0, 1fr) auto 3.2rem;
    grid-template-areas:
      "rank flag id ms use"
      ". . state bar bar";
    gap: 0.35rem 0.65rem;
    padding-block: 0.62rem;
  }

  .node-row__rank {
    grid-area: rank;
  }

  .node-row__flag {
    grid-area: flag;
  }

  .node-row__id {
    grid-area: id;
  }

  .node-row__city {
    display: none;
  }

  .node-row__ms {
    grid-area: ms;
  }

  .node-row__bar {
    grid-area: bar;
  }

  .node-row__state {
    grid-area: state;
  }

  .btn-use {
    grid-area: use;
  }

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

  .winner__actions {
    min-width: 0;
  }

  .winner__link {
    text-align: left;
  }
}

@media (max-width: 620px) {
  .topbar__meta {
    font-size: 0.68rem;
  }

  .picker {
    flex-direction: column;
  }

  .picker .btn {
    width: 100%;
    padding-block: 0.95rem;
  }

  .filecard {
    flex-direction: column;
    align-items: stretch;
  }

  .filecard .btn {
    width: 100%;
  }

  .nodes li {
    font-size: 0.66rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
