/* =========== Pipedreams Dark Theme =========== */
:root{
  --bg: #0a0a0a;
  --panel: #1a1a1a;
  --panel-2: #1e1e1e;
  --border: #2a2a2a;
  --fg: #e0e0e0;
  --muted: #bdbdbd;
  --accent: #b01515;
  --accent-700: #8c1111;
  --accent-900: #5f0b0b;
  --ok: #21c87a;
  --warn: #ffcc80;
  --err: #ef5350;
}

/* Base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.45;
}

/* Header */
header{
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border-bottom: 2px solid var(--accent);
  padding: 18px 24px 16px 244px; /* leaves space for sidebar */
  position: sticky;
  top: 0;
  z-index: 50;
}
header h1{
  margin:0;
  font-weight: 700;
  color: var(--accent);
}
header p{
  margin:.25rem 0 0 0;
  color: var(--muted);
  font-size: .95rem;
}

/* Sidebar Nav */
nav{
  width: 220px;
  position: fixed;
  inset: 0 auto 0 0; /* top/right/bottom/left */
  background: var(--panel);
  border-right: 2px solid var(--accent);
  display: flex;
  flex-direction: column;
  padding-top: 16px;
  z-index: 60;
}
nav a{
  padding: 12px 16px;
  color: var(--fg);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
nav a:hover{
  background: #242424;
  color: var(--accent);
  border-left-color: var(--accent);
}

/* Main content */
main{
  margin-left: 220px;
  padding: 24px;
  max-width: 1500px;
}

/* Sections & Cards */
section{ margin-bottom: 24px; }
h2{
  color: var(--accent);
  margin: 0 0 12px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.card{
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 6px 24px rgba(0,0,0,.25);
  margin-bottom: 12px;
}

/* Links & Buttons */
a{ color: var(--accent); }
a:hover{ color: var(--accent-700); }
.btn{
  display:inline-block;
  background: var(--accent);
  color:#fff;
  border:1px solid var(--accent-900);
  border-radius: 8px;
  padding: 10px 14px;
  text-decoration:none;
  font-weight:600;
}
.btn:hover{ background: var(--accent-700); }

/* Lists */
ul{ margin: 0 0 0 1.1rem; }
.card ul{ margin: .25rem 0 0 1.1rem; }

/* Images */
img{
  max-width:100%;
  height:auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}
img.map{
  display:block;
  margin: 14px auto;
  max-width: 92%;
  border: 2px solid var(--accent);
}
img.chart{
  display:inline-block;
  max-width: 360px;
  margin: 10px;
  border: 1px solid var(--accent-900);
}

/* Charts Grid (auto-wrap) */
.charts-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.charts-grid img.chart{
  width:100%;
  max-width:100%;
  margin:0;
}

/* System tiles (optional) */
.tiles{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(240px,1fr));
  gap:12px;
}
.tile{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: 10px;
  padding:12px;
}
.tile h3{ margin:0 0 6px 0; color: var(--fg); }
.tile .meta{ color: var(--muted); font-size: .9rem; }

/* Badges */
.badges{ display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 8px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: #222;
  color: var(--fg);
  font-size: .85rem;
}
.badge--ok{ border-color: #125c3f; background:#0d3b2a; color:#c9f7df; }
.badge--warn{ border-color:#5c4212; background:#3b2b0d; color:#ffe3b3; }
.badge--err{ border-color:#5c1212; background:#3b0d0d; color:#ffc9c8; }
.badge-dot{
  width:8px; height:8px;
  border-radius:50%;
  background: var(--accent);
}

/* Tables (for quick stats) */
.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.table th, .table td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
}
.table thead th{
  text-align:left;
  background: #222;
  color: var(--fg);
}
.table tr:hover td{ background:#191919; }

/* Legend chips */
.legend{
  display:flex; flex-wrap:wrap; gap:8px; margin-top:10px;
}
.legend .chip{
  display:inline-flex; align-items:center; gap:8px;
  background:#202020; border:1px solid var(--border);
  padding:6px 10px; border-radius:999px; color:var(--fg);
}
.legend .dot{
  width:10px; height:10px; border-radius:50%; background:#ccc; outline:1px solid #222;
}
.dot--hq{ background: var(--accent); }
.dot--controlled{ background: #dddddd; }
.dot--front{ background: #bdbdbd; }
.dot--hop{ background: #ffcc80; }
.dot--target{ background: #90caf9; }

/* Code blocks (if you render markdown) */
pre, code{
  background:#141414;
  border:1px solid #272727;
  border-radius:8px;
  color:#f3f3f3;
}
pre{ padding:12px; overflow:auto; }
code{ padding:2px 6px; }

/* Footer (optional) */
footer{
  margin: 40px 0 20px;
  text-align:center;
  color: var(--muted);
}

/* Scrollbar (WebKit) */
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-thumb{
  background: #2d2d2d;
  border:2px solid #151515;
  border-radius:10px;
}
*::-webkit-scrollbar-thumb:hover{ background:#3a3a3a; }

/* Responsive */
@media (max-width: 980px){
  nav{
    position: sticky;
    top: 0;
    height: auto;
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 2px solid var(--accent);
  }
  nav a{ white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  nav a:hover{ border-bottom-color: var(--accent); }
  header{ padding-left: 24px; }
  main{ margin-left: 0; padding: 16px; }
  img.chart{ max-width: 100%; }
}
/* --- Active Fronts grid + cards --- */
.front-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap:12px;
}

.front-card__header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.front-card__header h3{
  margin:0;
}
.chip--accent{ border-color: var(--accent-900); background: #2a0f0f; color:#ffd6d6; }

/* progress bar for conflicts (0–7 days) */
.progress{
  width:100%;
  height:10px;
  background:#191919;
  border:1px solid var(--border);
  border-radius:999px;
  overflow:hidden;
  margin:8px 0 4px;
}
.progress__bar{
  height:100%;
  background: var(--accent);
}
.progress__caption{
  font-size:.85rem;
  color: var(--muted);
  margin-bottom:8px;
}

/* small meta line under tables in cards */
.meta{ color: var(--muted); font-size:.9rem; margin:.4rem 0 0 0; }

/* optional sections inside cards */
.front-card__notes p{ margin:.6rem 0; }
.front-card__plays h4{ margin:.6rem 0 .25rem 0; }
.front-card__plays ul{ margin:.25rem 0 0 1rem; }

/* Influence delta badges */
.delta{ font-weight:600; }
.delta--up{ color: var(--ok); }
.delta--down{ color: var(--err); }
.delta--flat, .delta--none{ color: var(--muted); }

/* Sparklines in table */
img.spark{ width:140px; height:auto; display:block; }

/* Top Movers layout */
.top-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(280px,1fr));
  gap:12px;
}
.stat{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:8px 10px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#111;
  margin-bottom:8px;
}
.stat-up{ border-color:#125c3f; background:#0d3b2a; }
.stat-down{ border-color:#5c1212; background:#3b0d0d; }
.stat .name a{ color: var(--fg); }
.stat .num{ white-space: nowrap; }
.muted{ color: var(--muted); }

/* ========= Conflict / Active Fronts ========== */
.conflict-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap:14px;
}

.conflict-card{
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display:grid;
  grid-template-columns: 1fr 120px 1fr;
  align-items: stretch;
  box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 6px 24px rgba(0,0,0,.25);
}

.conflict-card .side{
  padding:14px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:8px;
}
.conflict-card .side .name{ font-weight:700; font-size:1.05rem; }
.conflict-card .side .score{
  font-size:1.8rem; font-weight:800;
}
.conflict-card .side.ours{
  background: #151515;
  border-right: 1px solid var(--border);
  outline: 2px solid rgba(176,21,21,.25);
}

/* center strip */
.conflict-card .center{
  background: #101010;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding:12px 10px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  text-align:center;
}
.conflict-chip{
  display:inline-flex; align-items:center; gap:8px;
  padding:4px 10px; border-radius:999px;
  background:#201010; border:1px solid var(--accent-900);
  color:#ffd6d6; font-weight:700; font-size:.9rem;
}
.status-chip{
  display:inline-block; padding:2px 8px; border-radius:999px;
  border:1px solid var(--border); color:var(--muted); font-size:.8rem;
}
.stake{ color: var(--muted); font-size:.9rem; }

/* best-of-7 progress */
.series{ width:100%; }
.series .progress{ height:8px; border-radius:999px; background:#191919; border:1px solid var(--border); overflow:hidden; }
.series .progress__bar{ height:100%; background: var(--accent); }

/* footer line */
.conflict-footer{
  grid-column: 1 / -1;
  padding:10px 12px;
  border-top:1px solid var(--border);
  display:flex; justify-content:space-between; align-items:center;
  background:#131313; color: var(--muted);
}
.conflict-footer a{ color: var(--fg); }
.conflict-footer .when{ font-size:.9rem; }

/* type color accents (optional subtle glow) */
.conflict--war .center{ box-shadow: inset 0 0 0 1px rgba(176,21,21,.15); }
.conflict--election .center{ box-shadow: inset 0 0 0 1px rgba(144,202,249,.15); }
.conflict--civilwar .center{ box-shadow: inset 0 0 0 1px rgba(255,204,128,.15); }

/* small screens */
@media (max-width: 520px){
  .conflict-card{ grid-template-columns: 1fr; }
  .conflict-card .center{ order:-1; border-left:none; border-right:none; border-top:1px solid var(--border); border-bottom:1px solid var(--border); }
  .conflict-card .side.ours{ outline:none; }
}
