/* Bilateral founder / tokoloshe flags — Proudly SA (left) · Commonwealth (right) */
.tokoloshe-flag-rail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1rem;
  padding: 0.45rem 0.75rem;
  z-index: 28;
  pointer-events: auto;
}

.tokoloshe-flag-rail[data-bridge-component='TokolosheFlags'] {
  background: rgba(4, 8, 15, 0.55);
  border: 1px solid rgba(0, 200, 255, 0.14);
  border-radius: 12px;
  backdrop-filter: blur(6px);
}

.tokoloshe-flag {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-decoration: none;
  color: #cbd5e1;
  max-width: 88px;
  transform-origin: 50% 100%;
}

.tokoloshe-flag img {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(255, 184, 28, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  will-change: transform;
}

.tokoloshe-flag--left img {
  animation: tokoloshe-flag-wave-left 3.2s ease-in-out infinite;
}

.tokoloshe-flag--right img {
  border-color: rgba(255, 213, 74, 0.4);
  animation: tokoloshe-flag-wave-right 3.4s ease-in-out infinite;
  animation-delay: 0.35s;
}

.tokoloshe-flag-rail__keys {
  width: min(160px, 28vw);
  height: auto;
  border-radius: 8px;
  opacity: 0.92;
  animation: tokoloshe-keys-breathe 4.5s ease-in-out infinite;
}

@keyframes tokoloshe-flag-wave-left {
  0%, 100% { transform: rotate(-2.5deg) skewX(-1deg); }
  50% { transform: rotate(3deg) skewX(1.5deg); }
}

@keyframes tokoloshe-flag-wave-right {
  0%, 100% { transform: rotate(2.5deg) skewX(1deg); }
  50% { transform: rotate(-3deg) skewX(-1.5deg); }
}

@keyframes tokoloshe-keys-breathe {
  0%, 100% { transform: translateY(0); opacity: 0.9; }
  50% { transform: translateY(-3px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .tokoloshe-flag--left img,
  .tokoloshe-flag--right img,
  .tokoloshe-flag-rail__keys {
    animation: none !important;
  }
}

.tokoloshe-flag__label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
  color: #94a3b8;
}

.tokoloshe-flag-rail__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.tokoloshe-flag-rail__keys-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.58rem;
  font-family: ui-monospace, monospace;
  color: #64748b;
  text-align: center;
  max-width: 220px;
}

.tokoloshe-flag-rail__keys-list code {
  color: #7dd3fc;
}

.tokoloshe-flag-rail__proof {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #00e57b;
  text-decoration: none;
  border: 1px solid rgba(0, 229, 123, 0.35);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.tokoloshe-flag-rail__proof:hover {
  color: #fff;
  border-color: #00e57b;
}

.tokoloshe-flag-rail__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  width: 100%;
  margin-top: 0.15rem;
}

.tokoloshe-flag-rail__nav a {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.tokoloshe-flag-rail__nav a:hover {
  color: #e2e8f0;
  border-bottom-color: rgba(0, 200, 255, 0.45);
}

/* Engine gauge — skill-gas + crypto-gas */
.tokoloshe-engine-gauge {
  width: 100%;
  max-width: 280px;
  margin: 0.35rem auto 0;
  padding: 0.35rem 0.45rem;
  border: 1px solid rgba(255, 184, 28, 0.22);
  border-radius: 8px;
  background: rgba(2, 6, 12, 0.55);
  text-align: center;
}

.tokoloshe-engine-gauge__title {
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fbbf24;
  margin-bottom: 0.25rem;
}

.tokoloshe-engine-gauge__user {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  font-size: 0.55rem;
  font-family: ui-monospace, monospace;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}

.tokoloshe-engine-gauge__user strong {
  color: #e2e8f0;
}

.tokoloshe-engine-gauge__bars {
  display: flex;
  gap: 0.25rem;
  height: 6px;
  margin-bottom: 0.3rem;
}

.tokoloshe-engine-gauge__bar {
  flex: 1;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.2);
  position: relative;
  overflow: hidden;
}

.tokoloshe-engine-gauge__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  width: var(--p, 0%);
  max-width: 100%;
  border-radius: 3px;
}

.tokoloshe-engine-gauge__bar--air::after { background: #38bdf8; }
.tokoloshe-engine-gauge__bar--elec::after { background: #facc15; }
.tokoloshe-engine-gauge__bar--media::after { background: #a78bfa; }

.tokoloshe-engine-gauge__readout {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.58rem;
  font-family: ui-monospace, monospace;
  color: #cbd5e1;
}

.tokoloshe-engine-gauge__readout strong {
  color: #f8fafc;
}

.tokoloshe-engine-gauge__crypto strong {
  color: #4ade80;
}

.tokoloshe-engine-gauge__channels {
  display: flex;
  justify-content: space-between;
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-top: 0.15rem;
}

.tokoloshe-engine-gauge__note {
  margin: 0.25rem 0 0;
  font-size: 0.48rem;
  color: #64748b;
  line-height: 1.3;
}

/* Header / founder-tasks compact strip */
.tokoloshe-flag-rail--header {
  margin: 0.5rem auto 0;
  max-width: 36rem;
}

#tokoloshe-flags-mount {
  position: fixed;
  left: 50%;
  bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 1.5rem));
  max-height: min(42vh, 280px);
  overflow-y: auto;
  z-index: 22; /* below topbar (30) / bubble (26); never cover hero brand */
  pointer-events: none;
}

#tokoloshe-flags-mount .tokoloshe-flag-rail {
  pointer-events: auto;
}

/* Content clearance for fixed Proudly SA rail + engine gas chip */
body.apex-arena,
body.wa-login-kasi,
body.has-login-svg-parallax {
  --flag-rail-clearance: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  padding-bottom: var(--flag-rail-clearance);
}

@media (max-width: 720px) {
  body.apex-arena,
  body.wa-login-kasi,
  body.has-login-svg-parallax {
    --flag-rail-clearance: calc(6.75rem + env(safe-area-inset-bottom, 0px));
  }
  #tokoloshe-flags-mount {
    bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    width: min(640px, calc(100vw - 1rem));
  }
  .tokoloshe-engine-gauge {
    max-width: 100%;
  }
}

/* Gateway: sit under OS header, don't touch LINEA_RPC scripts */
.os-header .tokoloshe-flag-rail,
#tokoloshe-flags-mount.gateway-flags {
  position: static;
  transform: none;
  width: auto;
  margin: 0.75rem auto 0;
  max-width: 520px;
}

@media (max-width: 640px) {
  .tokoloshe-flag-rail__keys-list { display: none; }
  .tokoloshe-flag img { width: 56px; height: 37px; }
}
