/* The Ledger — World status panel ("Operations Theater").
 * Scoped entirely under #panel-world. Read-only command-center wall:
 * Third Shift campaign tracker + Takeover Watch. Blue/green ops identity,
 * big mono digits, crisp grid lines, pulsing status LEDs. */

#panel-world {
  margin: 18px auto 0;
  max-width: 1240px;
  background:
    radial-gradient(900px 320px at 15% -10%, rgba(58, 168, 224, 0.08), transparent 60%),
    radial-gradient(900px 320px at 85% -10%, rgba(56, 211, 159, 0.07), transparent 60%),
    var(--panel);
  border-color: rgba(58, 168, 224, 0.2);
}

/* ── Panel header ──────────────────────────────────────────────────── */
#panel-world .world-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
#panel-world .world-head h2 { margin: 0; }
#panel-world .world-kicker {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(58, 168, 224, 0.1);
  border: 1px solid rgba(58, 168, 224, 0.28);
  border-radius: 999px;
  padding: 2px 9px;
}
#panel-world .world-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#panel-world .world-clock {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
#panel-world .world-refresh { padding: 6px 12px; font-size: 12px; }

/* Stale-feed warning strip */
#panel-world .world-feed-err {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
  margin-bottom: 14px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(240, 180, 41, 0.4);
  background: rgba(240, 180, 41, 0.08);
  color: var(--warn);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

/* ── Card grid — the console screen ─────────────────────────────────── */
#panel-world .world-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(58, 168, 224, 0.14);
  border-radius: 10px;
  background:
    linear-gradient(rgba(58, 168, 224, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58, 168, 224, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: rgba(11, 14, 20, 0.35);
}
@media (max-width: 900px) {
  #panel-world .world-cards { grid-template-columns: 1fr; }
}

/* ── Cards ──────────────────────────────────────────────────────────── */
#panel-world .world-card {
  position: relative;
  min-width: 0;
  background: rgba(23, 30, 41, 0.92);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
/* HUD corner brackets */
#panel-world .world-card::before,
#panel-world .world-card::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: rgba(58, 168, 224, 0.55);
  border-style: solid;
  pointer-events: none;
}
#panel-world .world-card::before { top: 6px; left: 6px; border-width: 1px 0 0 1px; }
#panel-world .world-card::after { bottom: 6px; right: 6px; border-width: 0 1px 1px 0; }

#panel-world .card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(58, 168, 224, 0.14);
}
#panel-world .card-head-text { display: flex; flex-direction: column; min-width: 0; }
#panel-world .card-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
#panel-world .card-title {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Status LEDs ────────────────────────────────────────────────────── */
#panel-world .led {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #3a4456;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.5);
}
#panel-world .led-green { background: var(--up); animation: world-pulse-green 2.2s ease-in-out infinite; }
#panel-world .led-amber { background: var(--warn); animation: world-pulse-amber 1.6s ease-in-out infinite; }
#panel-world .led-scan { background: var(--accent); animation: world-pulse-scan 1s ease-in-out infinite; }
@keyframes world-pulse-green {
  0%, 100% { box-shadow: 0 0 6px 1px rgba(56, 211, 159, 0.6), inset 0 0 4px rgba(255, 255, 255, 0.55); }
  50%      { box-shadow: 0 0 14px 3px rgba(56, 211, 159, 0.95), inset 0 0 4px rgba(255, 255, 255, 0.55); }
}
@keyframes world-pulse-amber {
  0%, 100% { box-shadow: 0 0 6px 1px rgba(240, 180, 41, 0.55), inset 0 0 4px rgba(255, 255, 255, 0.45); }
  50%      { box-shadow: 0 0 13px 3px rgba(240, 180, 41, 0.9), inset 0 0 4px rgba(255, 255, 255, 0.45); }
}
@keyframes world-pulse-scan {
  0%, 100% { opacity: 0.7; box-shadow: 0 0 8px 1px rgba(58, 168, 224, 0.5); }
  50%      { opacity: 1; box-shadow: 0 0 14px 3px rgba(58, 168, 224, 0.8); }
}

/* ── Phase pills ────────────────────────────────────────────────────── */
#panel-world .phase-pill {
  margin-left: auto;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
#panel-world .phase-dormant { color: var(--muted); border-color: rgba(139, 150, 168, 0.4); background: rgba(139, 150, 168, 0.08); }
#panel-world .phase-cooling  { color: var(--warn); border-color: rgba(240, 180, 41, 0.45); background: rgba(240, 180, 41, 0.1); }
#panel-world .phase-window   { color: var(--up); border-color: rgba(56, 211, 159, 0.45); background: rgba(56, 211, 159, 0.1); }
#panel-world .phase-acquired { color: var(--accent); border-color: rgba(58, 168, 224, 0.5); background: rgba(58, 168, 224, 0.1); }
#panel-world .phase-active   { color: var(--accent); border-color: rgba(58, 168, 224, 0.5); background: rgba(58, 168, 224, 0.1); }

#panel-world .offer-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
}

/* ── Third Shift: four-gate checklist ────────────────────────────────── */
#panel-world .gates-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 480px) {
  #panel-world .gates-grid { grid-template-columns: 1fr; }
}
#panel-world .gate {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(11, 14, 20, 0.55);
}
#panel-world .gate-met   { border-color: rgba(56, 211, 159, 0.35); }
#panel-world .gate-unmet { border-color: rgba(255, 92, 122, 0.35); }
#panel-world .gate-glyph {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin-top: 1px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}
#panel-world .gate-met .gate-glyph   { background: rgba(56, 211, 159, 0.16); color: var(--up); }
#panel-world .gate-unmet .gate-glyph { background: rgba(255, 92, 122, 0.16); color: var(--down); }
#panel-world .gate-body { display: flex; flex-direction: column; min-width: 0; }
#panel-world .gate-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  overflow-wrap: anywhere;
}
#panel-world .gate-value {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
#panel-world .gate-detail {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ALL GATES MET banner */
#panel-world .all-met-banner {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--up);
  background: linear-gradient(135deg, rgba(56, 211, 159, 0.18), rgba(58, 168, 224, 0.14));
  border: 1px solid rgba(56, 211, 159, 0.5);
  box-shadow: 0 0 18px rgba(56, 211, 159, 0.16), inset 0 0 12px rgba(56, 211, 159, 0.08);
  overflow-wrap: anywhere;
  animation: world-banner-pulse 2.2s ease-in-out infinite;
}
#panel-world .all-met-banner.all-met-acquired {
  color: var(--accent);
  border-color: rgba(58, 168, 224, 0.6);
  background: linear-gradient(135deg, rgba(58, 168, 224, 0.2), rgba(56, 211, 159, 0.16));
  box-shadow: 0 0 18px rgba(58, 168, 224, 0.16), inset 0 0 12px rgba(58, 168, 224, 0.08);
}
@keyframes world-banner-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.82; } }

#panel-world .gates-pending {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--warn);
  border: 1px dashed rgba(240, 180, 41, 0.4);
  background: rgba(240, 180, 41, 0.06);
  overflow-wrap: anywhere;
}

/* Campaign meta line */
#panel-world .electorate {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
#panel-world .electorate b { color: var(--text); font-weight: 600; }

#panel-world .world-feed-tag {
  margin-top: 12px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
  opacity: 0.7;
}
/* Mobile: when the leaderboard period is Third Shift Watch, drop the dot
   divider and stack the label above the value, both centered. */
@media (max-width: 640px) {
  #panel-world .world-feed-tag.world-feed-tag--watch {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.6;
  }
  #panel-world .world-feed-tag.world-feed-tag--watch .world-feed-sep {
    display: none;
  }
}

/* ── Takeover offers ─────────────────────────────────────────────────── */
#panel-world .offers-list { display: flex; flex-direction: column; gap: 12px; }
#panel-world .offer {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(11, 14, 20, 0.45);
}
#panel-world .offer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
#panel-world .offer-head .phase-pill { margin-left: 0; }
#panel-world .offer-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#panel-world .offer-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
@media (max-width: 480px) {
  #panel-world .offer-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
#panel-world .stat {
  background: rgba(23, 30, 41, 0.7);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  text-align: center;
  min-width: 0;
  overflow-wrap: anywhere;
}
#panel-world .stat-lbl {
  display: block;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  overflow-wrap: anywhere;
}
#panel-world .stat-val {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* Tendered-shares progress */
#panel-world .tender-progress { margin-bottom: 10px; }
#panel-world .progress-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
#panel-world .progress-head b { color: var(--text); }
#panel-world .progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(11, 14, 20, 0.85);
  border: 1px solid var(--border);
  overflow: hidden;
}
#panel-world .progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(58, 168, 224, 0.6), var(--accent));
  transition: width 0.45s ease;
}
#panel-world .progress-fill.fill-partial { background: linear-gradient(90deg, rgba(240, 180, 41, 0.6), var(--warn)); }
#panel-world .progress-fill.fill-majority { background: linear-gradient(90deg, rgba(56, 211, 159, 0.65), var(--up)); }
#panel-world .progress-pct {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
#panel-world .progress-pct .majority { color: var(--up); font-weight: 700; }

/* Offer footer: countdown + tender form */
#panel-world .offer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  border-top: 1px dashed rgba(139, 150, 168, 0.2);
  padding-top: 9px;
}
#panel-world .cd-label { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
#panel-world .cd {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
#panel-world .cd-urgent { color: var(--warn); }
#panel-world .cd-expired { color: var(--down); }

#panel-world .tender-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  flex-wrap: wrap;
}
#panel-world .tender-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}
#panel-world .tender-shares { width: 74px; padding: 5px 8px; font-family: var(--mono); }
#panel-world .tender-btn {
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(56, 211, 159, 0.14);
  border-color: rgba(56, 211, 159, 0.4);
  color: var(--up);
}
#panel-world .tender-btn:hover:not(:disabled) { background: rgba(56, 211, 159, 0.24); }
#panel-world .tender-btn:disabled { opacity: 0.5; cursor: wait; }

/* ── Empty + loading states ──────────────────────────────────────────── */
#panel-world .world-empty-state {
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(139, 150, 168, 0.28);
  border-radius: 8px;
}
#panel-world .world-empty-glyph { font-size: 26px; color: rgba(139, 150, 168, 0.7); }
#panel-world .world-empty-title {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
#panel-world .world-empty-sub {
  margin: 6px auto 0;
  max-width: 340px;
  font-size: 12px;
  color: var(--muted);
  opacity: 0.8;
  overflow-wrap: anywhere;
}

#panel-world .world-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 130px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
  overflow-wrap: anywhere;
}
#panel-world .world-scanwrap {
  position: relative;
  width: 160px;
  height: 2px;
  border-radius: 2px;
  background: rgba(58, 168, 224, 0.14);
  overflow: hidden;
}
#panel-world .world-scanwrap::after {
  content: '';
  position: absolute;
  top: 0;
  left: -48px;
  width: 48px;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: world-scan 1.3s linear infinite;
}
@keyframes world-scan { to { left: 160px; } }

/* Phones: the world-card subtitle wraps onto a second line instead of
   truncating to "…" — desktop keeps the single-line ellipsis it had before
   the mobile pass. */
@media (max-width: 640px) {
  #panel-world .card-title {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
  }
}
