/* The live page: a wall that fills the screen on desktop; on narrower screens the same wall scrolls with the page. */

.view--live {
  position: relative;
  height: 100dvh;
  overflow: hidden;
}

.stage {
  position: absolute;
  inset: 0;
  --mx: 40%;
  --my: 40%;
}
/* a soft light that follows the pointer */
.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(460px circle at var(--mx) var(--my), rgba(170, 195, 245, 0.075), transparent 70%);
  pointer-events: none;
}

.stage__wait {
  position: absolute;
  top: 50%;
  left: calc((100% - 372px) / 2);
  transform: translate(-50%, -50%);
  font: 500 var(--t-sm)/1 var(--mono);
  letter-spacing: 0.04em;
  color: var(--ink-3);
  animation: blink 1.6s ease-in-out infinite;
}

#links { position: absolute; inset: 0; width: 100%; height: 100%; }
.nodes { position: absolute; inset: 0; z-index: var(--z-web); }

/* ---------- wall tiles ---------- */

.stage { --tile: 80px; }

.cell {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 5px;
  width: var(--tile);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cell:disabled { cursor: default; }
.cell:focus-visible { outline: none; }
.cell.is-arriving { animation: seat var(--slow) var(--ease-spring) backwards; }
.cell.is-leaving { opacity: 0; transform: scale(0.7); transition: opacity 240ms ease-in, transform 240ms ease-in; }
@keyframes seat { from { opacity: 0; transform: scale(0.4); } }

.cell__pic {
  position: relative;
  width: var(--tile);
  height: var(--tile);
  border-radius: 24%;
  transition: transform var(--base) var(--ease-out);
}
.cell:hover .cell__pic, .cell:focus-visible .cell__pic, .cell.is-hot .cell__pic { transform: translateY(-4px) scale(1.06); }
.cell:active .cell__pic { transform: scale(0.97); }

.cell__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: inherit;
  background: var(--bg-raise);
  color: var(--ink-2);
  font: 600 calc(var(--tile) * 0.2)/1 var(--mono);
  box-shadow: 0 0 0 1.5px var(--ring, rgba(255, 255, 255, 0.14)), 0 14px 28px -14px rgba(0, 0, 0, 0.8);
  transition: box-shadow var(--fast);
}
.cell:hover .cell__face, .cell:focus-visible .cell__face, .cell.is-hot .cell__face { --ring: var(--ink); }
.cell[data-state='xd'] .cell__face { box-shadow: 0 0 0 2px var(--x), 0 0 34px -4px rgba(255, 61, 79, 0.7); }
.cell[data-state='sniped'] .cell__face, .cell[data-state='dev'] .cell__face { box-shadow: 0 0 0 2px var(--amber), 0 14px 28px -14px rgba(0, 0, 0, 0.8); }
.cell[data-state='clean'] .cell__face { box-shadow: 0 0 0 2px var(--up), 0 14px 28px -14px rgba(0, 0, 0, 0.8); }
.cell__face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cell[data-state='scanning'] .cell__face { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; } }

.cell__x {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(8, 6, 8, 0.55);
  color: var(--x);
}
.cell__x svg { width: 70%; height: 70%; stroke-width: 2.6; filter: drop-shadow(0 0 5px rgba(255, 61, 79, 0.75)); }
.cell[data-state='xd'] .cell__x { display: grid; }

.cell__ok {
  position: absolute;
  right: -5%;
  bottom: -5%;
  display: none;
  place-items: center;
  width: 30%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--up);
  color: #04130c;
  box-shadow: 0 0 0 2px var(--bg);
}
.cell__ok svg { width: 70%; height: 70%; stroke-width: 3; }
.cell[data-state='clean'] .cell__ok { display: grid; }
/* an older pair filling a spare tile is tagged by its check, never as a "runner": it can still go to zero */
.cell[data-runner][data-state='watching'] .cell__face { box-shadow: 0 0 0 2px var(--up), 0 14px 28px -14px rgba(0, 0, 0, 0.8); }
/* the one short tag over a tile's corner: bundled (red), dev holding (amber), checked (green) */
.cell__tag {
  position: absolute;
  top: -7px;
  left: -5px;
  z-index: 2;
  max-width: calc(100% + 10px);
  overflow: hidden;
  padding: 3px 6px;
  border-radius: var(--r-pill);
  background: var(--up);
  color: #04130c;
  font: 600 0.5625rem/1 var(--mono);
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 0 0 0 2px var(--bg);
}
.cell__tag:empty { display: none; }
.cell[data-state='xd'] .cell__tag { background: var(--x); color: #1a0206; }
.cell[data-state='dev'] .cell__tag { background: var(--amber); color: #1a1002; }

/* a frame that pulses out from a flagged tile */
.cell__halo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid var(--c);
  opacity: 0;
  pointer-events: none;
}
.cell[data-state='xd'] .cell__halo { animation: halo 1.8s ease-out infinite; }
.cell[data-state='sniped'] .cell__halo { animation: halo 3s ease-out infinite; }
@keyframes halo {
  0% { transform: scale(1); opacity: 0.85; }
  100% { transform: scale(1.32); opacity: 0; }
}

.cell__name, .cell__cap {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell__name { font: 600 0.6875rem/1 var(--mono); color: var(--ink); }
.cell__cap { font: 400 0.625rem/1 var(--mono); color: var(--ink-3); }
.cell[data-state='xd'] .cell__name { color: var(--x-ink); }
.cell[data-state='sniped'] .cell__name, .cell[data-state='dev'] .cell__name { color: var(--amber-ink); }
.cell[data-state='clean'] .cell__name { color: var(--c-ink); }

/* ---------- filters ---------- */

.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-2); }
.hud .toggle { white-space: nowrap; }
.field {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 40px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  font-size: var(--t-xs);
  color: var(--ink-3);
  transition: border-color var(--fast);
}
.field:focus-within { border-color: var(--line-strong); }
.field span { white-space: nowrap; }
.field input, .field select {
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--ink);
  font: 500 var(--t-sm)/1 var(--sans);
  outline: none;
}
.field input { width: 128px; }
.field input::placeholder { color: var(--ink-3); }
.field select { cursor: pointer; }
.field select option { background: var(--bg-raise); color: var(--ink); }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 40px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink-3);
  font-size: var(--t-xs);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}
.toggle:hover { color: var(--ink); }
.toggle[aria-pressed='true'] { color: var(--ink); border-color: var(--line-strong); background: var(--fill-strong); }

/* previous / next page of the wall */
.pager {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--fill-strong);
  font: 500 var(--t-xs)/1 var(--mono);
  color: var(--ink);
}
.pager[hidden] { display: none; }
.pager span { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.pager button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--fast);
}
.pager button:hover:not(:disabled) { background: var(--fill); }
.pager button:disabled { color: var(--ink-3); cursor: default; }

/* tooltip that follows the hovered node */
.tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: var(--z-ui);
  display: grid;
  gap: 3px;
  width: max-content;
  max-width: 340px;
  padding: 9px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: rgba(12, 14, 19, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 40px -18px #000;
  pointer-events: none;
  white-space: nowrap;
}
.tip__name { font: 500 var(--t-xs)/1.3 var(--mono); }
/* a long finding goes onto a second line; it used to run out of the box */
.tip__fact { font-size: var(--t-xs); color: var(--c-ink, var(--ink-2)); white-space: normal; }
.tip__link { font-size: var(--t-xs); color: var(--ink-3); white-space: normal; }

/* ---------- headline ---------- */

.hero {
  position: absolute;
  top: calc(var(--nav-h) + 44px);
  left: calc(var(--gutter) + 8px);
  z-index: var(--z-ui);
  display: grid;
  gap: var(--s-3);
  pointer-events: none;
}
.hero h1 { font-size: clamp(1.9rem, 1.1rem + 2.4vw, 3.25rem); }

/* ---------- bottom bar ---------- */

.hud {
  position: absolute;
  left: var(--gutter);
  right: calc(var(--gutter) + 372px);
  bottom: var(--gutter);
  z-index: var(--z-ui);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-6);
  padding: var(--s-4) var(--s-6);
}

.stats { display: flex; gap: clamp(20px, 3vw, 44px); }
.stats dt {
  font: 500 0.6875rem/1.2 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.stats dd {
  margin-top: 6px;
  font: 500 1.5rem/1 var(--sans);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stats dd small { font-size: 0.875rem; font-weight: 400; color: var(--ink-3); }
.stats [data-tone='xd'] dd { color: var(--x-ink); }
.stats [data-tone='sniped'] dd { color: var(--amber-ink); }

.hud__side { display: grid; gap: var(--s-3); justify-items: end; min-width: 0; margin-left: auto; }
.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 16px;
  font-size: var(--t-xs);
  color: var(--ink-2);
}
.legend li { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--c);
  background: var(--c-soft);
}
.legend [data-state='scanning'] i { border-style: dashed; }
.legend [data-state='xd'] i { background: var(--x); box-shadow: 0 0 0 3px var(--x-soft); }
/* on the wall the X'd-now strip sits beside the headline; with less room it would cover it */
@media (min-width: 1200px) { .stage .xd-strip { max-width: calc(100% - 1010px); overflow: hidden; } }
@media (min-width: 1200px) and (max-width: 1399px) { .stage .xd-strip { display: none; } }
.legend__note { color: var(--ink-3); }
[data-mode='real'] [data-demo-only] { display: none !important; }
[data-mode='demo'] [data-real-only] { display: none !important; }

/* ---------- signals rail ---------- */

.rail {
  position: absolute;
  top: calc(var(--nav-h) + 28px);
  right: var(--gutter);
  bottom: var(--gutter);
  z-index: var(--z-ui);
  display: flex;
  flex-direction: column;
  width: 352px;
  overflow: hidden;
}
.rail__head { padding: var(--s-5) var(--s-5) var(--s-3); border-bottom: 1px solid var(--line); }
.rail__head h2 { font-size: var(--t-lg); font-weight: 500; letter-spacing: -0.02em; }
.rail__head p { margin-top: 2px; font-size: var(--t-xs); color: var(--ink-3); }
.rail__head .seg { display: flex; margin-top: var(--s-3); }
.rail__head .seg button { flex: 1; padding: 0 var(--s-2); }
.rail__note {
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--line);
  font-size: var(--t-xs);
  line-height: 1.45;
  color: var(--ink-3);
}
.row[data-state='clean'] .row__fact { color: var(--c-ink); }
.rail__list {
  flex: 1;
  padding: var(--s-2);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

/* ---------- a coin row (rail + board) ---------- */

.row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 64px;
  padding: 10px var(--s-3);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), transform var(--fast) var(--ease-out);
}
.row:hover { background: var(--fill); border-color: var(--line); }
.row:active { transform: scale(0.985); }
.row.is-new { animation: row-in var(--slow) var(--ease-spring) both; }
@keyframes row-in {
  from { opacity: 0; transform: translateY(-14px) scale(0.97); }
}
.row__main { display: grid; gap: 2px; min-width: 0; }
.row__title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row__title b { font: 600 var(--t-sm)/1.3 var(--mono); white-space: nowrap; }
.row__title span {
  overflow: hidden;
  font-size: var(--t-xs);
  color: var(--ink-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row__fact {
  display: -webkit-box;
  overflow: hidden;
  font-size: var(--t-xs);
  line-height: 1.35;
  color: var(--ink-2);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.row[data-state='xd'] .row__fact { color: var(--x-ink); }
.row[data-state='sniped'] .row__fact, .row[data-state='dev'] .row__fact { color: var(--amber-ink); }
.row__side { display: grid; justify-items: end; gap: 5px; }
.row__side time { font: 400 0.6875rem/1 var(--mono); color: var(--ink-3); }

.feed__empty { padding: var(--s-8) var(--s-4); text-align: center; font-size: var(--t-sm); color: var(--ink-3); }

/* ---------- narrow screens: the wall scrolls with the page, the list sits under it ---------- */

.board { display: none; } /* the old list-only phone layout; the wall is used at every width now */

@media (max-width: 1199px) {
  .view--live { height: auto; overflow: visible; padding: calc(var(--nav-h) + 36px) var(--gutter) 130px; }
  .stage {
    position: static;
    display: grid;
    gap: var(--s-5);
    width: min(900px, 100%);
    margin: 0 auto;
  }
  .stage::before, #links, .tip { display: none; }
  /* Order down the page: headline, filters, the wall, then the colour key and the numbers.
     The bottom bar's two wrappers dissolve so their parts can be placed one by one. */
  .hero { position: static; order: 1; }
  .hud, .hud__side { display: contents; }
  .filters { order: 2; justify-content: flex-start; }
  .stage .xd-strip { display: none; } /* the X'd tiles are right there on the wall */
  .stage__wait { position: static; order: 3; padding: var(--s-8) 0; transform: none; text-align: center; }
  .nodes { position: relative; inset: auto; order: 4; }
  .legend { order: 5; }
  .stats {
    order: 6;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4);
    padding: var(--s-4);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--fill);
  }
  .stats dt { white-space: normal; }
  .stats dd { font-size: 1.25rem; }
  .field { flex: 1; height: 44px; }
  .field:first-of-type { flex-basis: 100%; }  /* the search box gets a row to itself (the pager is the first child) */
  .field input { width: 100%; font-size: 1rem; }
  .toggle { height: 44px; }
  .legend { justify-content: flex-start; }

  .rail {
    position: static;
    width: min(900px, 100%);
    margin: var(--s-6) auto 0;
    overflow: visible;
  }
  .rail__list { overflow: visible; }
}

@media (max-width: 599px) {
  .cell__name { font-size: 0.625rem; }
  .cell__cap { font-size: 0.5625rem; }
  .cell__tag { font-size: 0.5rem; padding: 2px 4px; letter-spacing: 0.02em; }
}
