/* Shared by both panel views. Twitch panels are 318px wide and up to 496 tall,
   so everything here assumes a narrow column and vertical scrolling. */
:root {
  color-scheme: dark;
  --text: #efeff1;
  --muted: #adadb8;
  --good: #6fcf6f;
  --warn: #e0b750;
  --bad: #e06c6c;
  --chip: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.12);
}

body {
  margin: 0;
  padding: 10px 12px 16px;
  /* FLUID, not a fixed 318px.
     Twitch gives a panel 318x496 and expects the content to fit rather than
     scroll the iframe. A badly hurt survivor with every skill trained runs far
     past that vertically, so the panel scrolls internally instead -- and that
     vertical scrollbar is the problem a fixed width created: a classic
     scrollbar takes ~15px off the viewport, the rigid 318px body no longer
     fits, and the iframe gains a HORIZONTAL scrollbar with the skill levels
     clipped off the right edge. Anything narrower than 318 did the same.
     100% adapts; max-width keeps the intended size when there is room. */
  width: 100%;
  max-width: 318px;
  max-height: 496px;
  overflow-y: auto;
  /* Nothing here is ever worth sideways scrolling for. */
  overflow-x: hidden;
  overscroll-behavior: contain;
  box-sizing: border-box;
  background: #0e0e10;
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
}

h1 { font-size: .95rem; margin: 0 0 .1em; font-weight: 650; }

.tabs { display: flex; gap: 4px; margin: 0 0 .7em; }
.tabs button {
  flex: 1; padding: 5px 8px; font: inherit; font-size: .78rem; font-weight: 600;
  background: #1c1c21; color: var(--muted); border: 1px solid #2c2c33;
  border-radius: 5px; cursor: pointer;
}
.tabs button.on { background: #2a2a32; color: var(--text); border-color: #45454f; }
.tabs button:hover:not(.on) { color: var(--text); }

/* State line. Always present, never implicit -- a viewer should never have to
   guess whether they are looking at live data. */
#state {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 .8em; font-size: .8rem; color: var(--muted);
  /* Stays visible while scrolled: a viewer should never read numbers without
     also seeing whether they are live. */
  position: sticky; top: -10px;
  background: #0e0e10; padding: 6px 0 4px; z-index: 2;
}
#state .dot { width: 8px; height: 8px; border-radius: 50%; background: #555; flex: none; }
#state.live .dot { background: var(--good); box-shadow: 0 0 6px var(--good); }
#state.paused .dot { background: var(--warn); }
#state.offline .dot { background: #6a6a72; }
#state.offline { color: #8a8a94; }

.empty { color: #7c7c85; font-size: .85rem; padding: 1.4em 0; text-align: center; }

/* --- moodle grid --- */
.moodles { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.moodle {
  position: relative;
  width: 60px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: help;
}
/* A ring around a glyph, matching the dashboard's .chip-icon .ring. */
.moodle .badge svg { display: block; }
.moodle .badge {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  background: #26262c; border: 2px solid #3a3a42; color: var(--text);
}
.moodle.good .badge { border-color: var(--good); color: var(--good); }
.moodle.bad .badge { border-color: var(--bad); color: var(--bad); }
.moodle .label {
  font-size: .62rem; color: var(--muted); text-align: center;
  line-height: 1.15; overflow-wrap: anywhere;
}
/* Level as pips rather than a number: reads faster at this size. */
.moodle .pips { display: flex; gap: 2px; }
.moodle .pip { width: 4px; height: 4px; border-radius: 50%; background: #4a4a52; }
.moodle.bad .pip.on { background: var(--bad); }
.moodle.good .pip.on { background: var(--good); }
.moodle .pip.on { background: var(--text); }

/* --- shared readouts --- */
.subtitle {
  font-size: .72rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  margin: 1.1em 0 .4em;
}
.divider { height: 1px; background: var(--line); margin: .9em 0 .2em; }
.title { font-weight: 650; margin-bottom: .25em; }
.title.good { color: var(--good); }
.title.bad { color: var(--bad); }
.body { color: var(--muted); font-size: .85rem; }
.summary { margin-top: .3em; font-size: .82rem; }
.summary.bad { color: var(--bad); }

.bar {
  height: .5em; border-radius: 999px; background: rgba(255,255,255,.14);
  overflow: hidden; margin: .3em 0 .25em;
}
.bar.thin { height: .28em; margin: .12em 0 0; }
.bar .fill { height: 100%; border-radius: 999px; background: var(--muted); }
.bar .fill.ok { background: var(--good); }
.bar .fill.warn { background: var(--warn); }
.bar .fill.crit { background: var(--bad); }

.needs, .skills, .parts { list-style: none; margin: 0; padding: 0; }
.needs li, .skills li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .05em .5em; padding: .2em 0;
}
.need-name, .skill-name { color: var(--text); font-size: .84rem; }
.need-pct, .skill-lvl { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.needs .bar, .skills .bar { grid-column: 1 / -1; }

.parts li {
  /* minmax(0,1fr): a grid item's default min-width is auto, so a long body
     part name would refuse to shrink and push the percentage off the edge. */
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1em .5em;
  padding: .28em 0; border-top: 1px solid rgba(255,255,255,.07);
}
.parts li:first-child { border-top: 0; }
.part-name { font-size: .84rem; }
.part-hp { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .25em; }
.chip {
  background: var(--chip); color: var(--muted);
  border-radius: 3px; padding: .05em .35em; font-size: .7rem;
}

/* --- hover card --- */
#card {
  position: fixed;
  z-index: 10;
  max-width: 260px;
  padding: .55em .7em;
  border-radius: 7px;
  background: rgba(18,18,20,.97);
  border: 1px solid #34343c;
  box-shadow: 0 6px 20px rgba(0,0,0,.6);
  pointer-events: none;
  font-size: .82rem;
}
#card[hidden] { display: none; }

.foot {
  margin-top: 1.4em; padding-top: .8em; border-top: 1px solid var(--line);
  font-size: .74rem; color: #7c7c85;
}
.foot a { color: #a970ff; }

/* Required by the Project Zomboid Terms when using the game's assets.
   Must stay visible -- it is the condition the icon licence depends on. */
.attrib { color: #6a6a73; font-size: .72rem; line-height: 1.5; max-width: 60ch; }
.attrib a { color: #8a8a96; }

/* Currently-burning count. Warm, because it is the one live-changing figure
   in the panel and reads as an alert rather than a statistic. */
.body.burning { color: #e8913c; }

/* Names the percentage column in the injuries list, so a bare number is not
   read as a damage figure. */
.parts-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: .5em 0 .15em;
}
.parts-head span:first-child {
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim);
}
.parts-head .col-head {
  font-size: .64rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--dim);
}
