/* ═══ §4 · SHARED · THE SHELL ═════════════════════════════════════════════════════════
   The header, the scroll container, the bottom nav and the toast — the four things present on
   every tab. Nothing below §4 may restyle them. */

#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── §4.1 the header: mode dot · LIVE pill · SFTi brand · STATIK · the regime clock ── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--status-height);
  padding: max(var(--sp-md), var(--safe-top)) var(--sp-lg) var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  z-index: 10;
}
/* every header child sits on the same baseline — without this the LIVE pill and the STATIK
   trigger read taller than the brand beside them. */
.status-bar > * {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.status-bar .status-clock { margin-left: auto; }

.status-mode {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: var(--glow-green);
}
.status-dot.live    { animation: pulse 2s ease-in-out infinite; }
.status-dot.offline { background: var(--accent-red); box-shadow: var(--glow-red); }
.status-dot.replay  { background: var(--accent-orange); }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}

.status-brand {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.status-clock {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* the live-feed pill — the organism's own liveness, not the broker's */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  font-weight: 700;
  background: rgba(58, 255, 138, 0.12);
  border: 1px solid rgba(58, 255, 138, 0.4);
  color: var(--outcome-win);
  transition: all 0.25s;
  font-variant: all-small-caps;
}
.live-pill.offline {
  background: rgba(255, 90, 122, 0.15);
  border-color: rgba(255, 90, 122, 0.5);
  color: var(--outcome-fade);
}
.live-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: live-pill-pulse 1.4s ease-in-out infinite;
}
.live-pill.offline .live-pill-dot { animation: none; }
@keyframes live-pill-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.75); }
}

/* the STATIK trigger — same geometry as .live-pill so the header reads uniform */
.statik-chat-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  font-weight: 700;
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.40);
  color: var(--accent-cyan);
  font-variant: all-small-caps;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s ease;
}
.statik-chat-trigger:hover {
  background: rgba(0, 229, 255, 0.20);
  border-color: rgba(0, 229, 255, 0.60);
  color: #fff;
}
.statik-chat-trigger.has-pending::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff6080;
  box-shadow: 0 0 8px rgba(255, 96, 128, 0.7);
  margin-left: 4px;
}

/* ── §4.2 the scroll container + view visibility ── */
.view-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* THE CARD COLUMN. This box's content width is what every card is wide, on every surface —
     so it is the only box that states one. */
  max-width: var(--shell-w);
  margin: 0 auto;
  padding: var(--sp-md);
  padding-bottom: var(--nav-clearance);
  padding-left: max(var(--sp-md), var(--safe-left));
  padding-right: max(var(--sp-md), var(--safe-right));
}
.view-container::-webkit-scrollbar { display: none; }

.view { display: none; }
.view.active { display: block; animation: viewFadeIn 0.3s ease-out; }
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* THE CARD FAMILIES — ONE WIDTH, ONE DECLARATION. Every top-level card on every surface is
   exactly the card column wide. A family that wants to be narrower has to say so here, in
   front of the others, rather than by quietly adding an inset three hundred lines away. */
.race-bar,
.scanner-card,
.home-section,
.r-panel,
details.settings-section,
.discover-hdr,
.discover-section {
  width: var(--card-w);
  max-width: 100%;
}

/* ── §4.3 the bottom nav. #201: the nav is HOLLOW BY DESIGN and content scrolls clear behind
   it. Do not make it opaque and do not change its padding. ── */
.holo-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  /* THE ROW MUST HOLD EVERY BUTTON. At eight tabs the old `3.5vw` gap + 24px side pad needed
     460px of row inside a 390px phone, and the two end labels were clipped mid-word — "OME" and
     "SETTING". The gap and the SIDE pad now shrink with the viewport so the row fits at 390px
     and still opens up on a wide screen.
     ⚠ The BOTTOM pad below is untouched: #201 ruled the hollow nav correct and #218 measured the
     home-indicator inset, and neither is what overflowed — this is the horizontal axis only. */
  gap: clamp(4px, 2vw, 28px);
  padding: 14px clamp(6px, 2vw, 24px) 28px;
  /* the 28px is OUR design margin; the inset is the DEVICE's and only it may state one. A 28px
     FALLBACK would assert 28px of home indicator on exactly the screens that report none. */
  padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
  /* SEMI-TRANSPARENT AT THE BOTTOM ON PURPOSE. `to top` means 0% is the BOTTOM edge, so an
     opaque first stop paints a solid slab under the labels — and the labels necessarily sit one
     home-indicator inset above that edge, which then reads as the nav hovering. */
  background: linear-gradient(to top,
      rgba(4, 8, 14, 0.92) 0%,
      rgba(4, 8, 14, 0.78) 40%,
      rgba(4, 8, 14, 0.0) 100%);
  pointer-events: none;
}
.holo-btn {
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  background: none;
  border: none;
  color: rgba(0, 229, 255, 0.72);
  transition: color 0.3s ease;
  animation: holoFloat 3.2s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}
.holo-btn:nth-child(1) { animation-delay: 0s; }
.holo-btn:nth-child(2) { animation-delay: 0.15s; }
.holo-btn:nth-child(3) { animation-delay: 0.3s; }
.holo-btn:nth-child(4) { animation-delay: 0.45s; }
.holo-btn:nth-child(5) { animation-delay: 0.6s; }
.holo-btn:nth-child(6) { animation-delay: 0.75s; }
.holo-btn:nth-child(7) { animation-delay: 0.9s; }
.holo-btn:nth-child(8) { animation-delay: 1.05s; }
/* the travel here IS --nav-float; app.js adds it back when it measures the occlusion. */
@keyframes holoFloat {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-5px); }
}
.holo-btn svg {
  width: 34px;
  height: 34px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.55))
          drop-shadow(0 0 14px rgba(0, 229, 255, 0.28));
  transition: filter 0.3s ease;
}
.holo-btn span {
  font-family: 'Orbitron', monospace;
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(0, 229, 255, 0.5);
  transition: color 0.3s ease;
}
.holo-btn.active { color: rgba(255, 255, 255, 0.95); }
.holo-btn.active svg {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.85))
          drop-shadow(0 0 18px rgba(0, 229, 255, 0.7))
          drop-shadow(0 0 36px rgba(0, 229, 255, 0.35));
}
.holo-btn.active span { color: rgba(255, 255, 255, 0.8); }
@media (hover: hover) and (pointer: fine) {
  .holo-btn:hover {
    color: rgba(0, 229, 255, 1);
    animation-play-state: paused;
    transform: translateY(-8px) scale(1.1);
  }
  .holo-btn:hover svg {
    filter: drop-shadow(0 0 10px rgba(0, 229, 255, 1))
            drop-shadow(0 0 22px rgba(0, 229, 255, 0.6))
            drop-shadow(0 0 40px rgba(0, 229, 255, 0.3));
  }
  .holo-btn:hover span { color: rgba(0, 229, 255, 0.9); }
}

/* ── §4.4 the toast ── */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-200px);
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 300;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.toast.visible { transform: translateX(-50%) translateY(0); }
.toast.error {
  background: rgba(199, 78, 10, 0.85);
  color: white;
  backdrop-filter: blur(10px);
}
.toast.success {
  background: rgba(33, 133, 75, 0.2);
  color: var(--accent-green-bright);
  border: 1px solid rgba(33, 133, 75, 0.4);
  backdrop-filter: blur(10px);
}
.toast.info {
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.25);
  backdrop-filter: blur(10px);
}
.toast.warning {
  background: rgba(255, 215, 0, 0.12);
  color: var(--accent-gold);
  border: 1px solid rgba(255, 215, 0, 0.25);
  backdrop-filter: blur(10px);
}

