/* NPV — a small, dark-first stylesheet built from nopixel.net's palette.
   Barlow Condensed (SIL OFL, see fonts/OFL.txt) is the display face. */

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/BarlowCondensed-600.woff2) format("woff2");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url(../fonts/BarlowCondensed-700.woff2) format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #0c0c0c;
  --surface: #121315;
  --surface-2: #202226;
  --ink: #fefefe;
  --ink-2: #c9cbcf;
  --muted: #919296;
  --line: rgba(254, 254, 254, .10);
  /* NoPixel V leads with electric cyan (the wiki's link/accent color and
     nopixel.net's chrome accent). Mint #00f8b9 is the older 4.0-era lead, kept
     here only as a sparingly-used secondary. */
  --accent: #40e5ff;
  --accent-hover: #a6f2ff;
  --accent-2: #00f8b9;
  --accent-wash: rgba(64, 229, 255, .12);
  --good: #57c98a;
  --warn: #f7c600;
  --bad: #e22631;
  --crime: #ff6b72;
  --civilian: #40e5ff;
  --government: #c39bf5;
  --news: #f08c2e;
  --twitch: #bf94ff;
  --radius: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Frosted glass, à la nopixel.net: a translucent dark surface, a blur, and a
     hairline light edge (#fefefe1f). Needs something behind it to blur — see the
     ambient glow on body. */
  --glass: rgba(18, 19, 21, .55);
  --glass-strong: rgba(12, 12, 12, .55);
  --glass-border: rgba(254, 254, 254, .12);
  --glass-blur: blur(10px) saturate(1.15);
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  /* A dark base with two soft glows (cyan lead, mint hint) fixed behind the page,
     so the frosted surfaces have colour to catch when they blur. */
  background:
    radial-gradient(1100px 520px at 100% -8%, rgba(64, 229, 255, .12), transparent 60%),
    radial-gradient(820px 480px at -8% 4%, rgba(0, 248, 185, .05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .85em; }

/* ---------- header ---------- */
.site {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--glass-border);
  position: sticky; top: 0; z-index: 5;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.mark {
  font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: .5px;
  color: var(--accent); line-height: 1;
}
.tagline { font-family: var(--display); font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 1px; font-size: 14px; }
.live { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 0 4px rgba(87,201,138,.18); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px rgba(247,198,0,.16); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px rgba(226,38,49,.16); }
.dot.off { background: var(--muted); }

/* ---------- tabs (nopixel.net nav: condensed caps, wide tracking, underline-only) ---------- */
.tabs {
  display: flex; gap: 2px; padding: 6px 12px 0; max-width: 820px; margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.tab {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font-family: var(--display); font-weight: 600; font-size: 17px;
  text-transform: uppercase; letter-spacing: .16em;
  padding: 10px 16px 12px; margin-bottom: -1px; cursor: pointer;
  border-bottom: 2px solid transparent; transition: color .15s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab.active .count { color: var(--accent); }

.status-line { max-width: 820px; margin: 8px auto 0; padding: 0 16px; color: var(--muted); min-height: 1.2em; font-size: 13px; }

/* ---------- panels ---------- */
main { max-width: 820px; margin: 0 auto; padding: 8px 12px 40px; }
.panel { display: none; }
.panel.active { display: block; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 2px 6px 10px;
}
.panel-meta { color: var(--ink-2); font-size: 13px; }
.panel-tools { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.updated { font-size: 12px; }
.refresh {
  appearance: none; border: 1px solid var(--glass-border); color: var(--ink);
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 16px; line-height: 1;
}
.refresh:hover { border-color: var(--accent); color: var(--accent); }
.refresh:disabled { opacity: .5; cursor: default; }
.refresh.busy { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- rows ---------- */
.list {
  display: flex; flex-direction: column;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-radius: 14px;
  padding: 2px 16px; box-shadow: var(--shadow);
}
.row {
  display: flex; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.list:empty { display: none; }
.row-main { min-width: 0; flex: 1; }
.row-side { text-align: right; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.sub { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.sub.muted { color: var(--muted); }
.when { font-size: 12px; color: var(--muted); }
.empty { padding: 28px 6px; color: var(--muted); text-align: center; }

.badge {
  font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: .6px;
  text-transform: uppercase; padding: 1px 6px; border-radius: 5px; margin-left: 6px;
  background: var(--surface-2); color: var(--ink-2);
}
.badge.new { background: var(--accent); color: #04222b; }
.flash { animation: flash 2.4s ease-out; }
@keyframes flash { from { background: var(--accent-wash); } to { background: transparent; } }

/* characters */
.char-name { font-family: var(--display); font-weight: 600; font-size: 19px; line-height: 1.1; }
.twitch { color: var(--twitch); }

/* characters controls: view toggle + sort */
.char-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 0 6px 12px; }
.seg { display: inline-flex; border: 1px solid var(--glass-border); border-radius: 8px; overflow: hidden; background: var(--glass); }
.seg-btn {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  font-size: 13px; padding: 7px 15px;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--glass-border); }
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: var(--accent-wash); color: var(--ink); }
.sort { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.sort select {
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--glass-border);
  border-radius: 6px; padding: 6px 8px; font-family: var(--font); font-size: 13px; cursor: pointer;
}

/* players view: one player, their characters listed under a Twitch label */
.player-group { padding: 12px 2px; border-bottom: 1px solid var(--line); }
.player-group:last-child { border-bottom: 0; }
.player-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.player-name { font-family: var(--display); font-weight: 600; font-size: 18px; line-height: 1.1; }
.player-handle { font-size: 13px; }
.player-count { font-size: 12px; margin-left: auto; }
.player-chars { display: flex; flex-direction: column; gap: 5px; padding-left: 2px; }
.player-char { display: flex; align-items: baseline; gap: 8px; }
.pc-name { color: var(--ink-2); }
.player-char .when { margin-left: auto; }

/* events */
.event { border-left: 3px solid var(--civilian); padding-left: 10px; }
.event.t-crime { border-left-color: var(--crime); }
.event.t-civilian { border-left-color: var(--civilian); }
.event.t-government { border-left-color: var(--government); }
.event.t-news { border-left-color: var(--news); }
.event-title { font-family: var(--display); font-weight: 600; font-size: 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.type-tag {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  padding: 2px 6px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2);
}
.t-crime .type-tag { color: var(--crime); }
.t-government .type-tag { color: var(--government); }
.t-news .type-tag { color: var(--news); }
.prio { font-family: var(--mono); font-size: 12px; color: var(--warn); }
.player-pill {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: var(--accent-wash); color: var(--accent);
  border: 1px solid rgba(64, 229, 255, .28); border-radius: 999px;
  padding: 2px 10px 2px 8px; font-size: 12px; font-weight: 600; line-height: 1.5;
}
.player-pill .p-icon { display: inline-flex; }
.player-pill .p-icon svg { display: block; }

/* expandable event rows */
.event-item > .row { cursor: pointer; }
.event-item:last-child > .row { border-bottom: 0; }
.event-item.open > .row { border-bottom: 0; }
.event-item.open { border-bottom: 1px solid var(--line); }
.event-item:last-child.open { border-bottom: 0; }
.ev-chevron { align-self: center; flex: none; color: var(--muted); font-size: 12px; transition: transform .15s, color .15s; }
.event-item.open .ev-chevron { transform: rotate(90deg); color: var(--accent); }
.event-item > .row:hover .event-title { color: var(--accent); }
.event-item > .row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.event-detail { padding: 10px 6px 16px 26px; border-top: 1px dashed var(--line); }
.detail-block { margin-bottom: 12px; }
.detail-block:last-child { margin-bottom: 0; }
.detail-h {
  font-family: var(--display); font-weight: 600; font-size: 13px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 8px;
}
.people { display: flex; flex-direction: column; gap: 7px; }
.person { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.person-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.person-link:hover { color: var(--accent-hover); text-decoration: underline; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; font-size: 13px; }
.fact-k { color: var(--muted); }
.fact-v { color: var(--ink-2); word-break: break-word; }
.reported-as { margin-top: 12px; font-size: 12px; font-style: italic; color: var(--muted); }

/* feed */
.post { }
.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; object-fit: cover; background: var(--surface-2); }
.avatar.initials {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .01em;
}
.post-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.post-name { font-weight: 600; }
.post-body { margin: 3px 0; white-space: pre-wrap; word-break: break-word; }
.post-media { display: grid; gap: 4px; margin: 8px 0 4px; border-radius: 10px; overflow: hidden; }
.post-media.n1 { grid-template-columns: 1fr; }
.post-media.n2, .post-media.n4 { grid-template-columns: 1fr 1fr; }
.post-media.n3 { grid-template-columns: 1fr 1fr 1fr; }
.media { width: 100%; max-height: 320px; object-fit: cover; display: block; background: var(--surface-2); }
.post-stats { display: flex; gap: 16px; font-size: 12px; margin-top: 6px; }
.repost-line { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.repost-line .ri { display: inline-flex; color: var(--accent-2); }
.quoted { display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgba(255, 255, 255, .02); }
.quoted .avatar { width: 36px; height: 36px; }
.quoted .avatar.initials { font-size: 14px; }
.quoted-empty { display: block; color: var(--muted); font-size: 13px; padding: 14px 12px; }
.more {
  appearance: none; border: 1px solid var(--glass-border); color: var(--ink-2);
  background: rgba(255,255,255,.03); padding: 11px; border-radius: 8px; cursor: pointer; margin: 12px 0;
  font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
}
.more:hover { border-color: var(--accent); color: var(--accent); }

/* footer + toast */
.site-foot { max-width: 820px; margin: 0 auto; padding: 20px 16px 40px; font-size: 12px; text-align: center; border-top: 1px solid var(--line); }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: var(--glass-strong); color: var(--ink); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 560px) {
  .tagline { display: none; }
}
