/* Project Zomboid dashboard.
   Structure and class names deliberately mirror the Valheim dashboard so the two
   sites feel like siblings; only the palette changes. Valheim is Norse gold on
   blue-black — this is the outbreak: olive green on a sickly dark grey-green,
   with blood red doing the work the Valheim red did. */
:root {
  --bg: #0e1210;
  --panel: #161c18;
  --panel-2: #1d2520;
  --line: #2b352e;
  --text: #dbe2d9;
  --muted: #8a9488;
  --accent: #a8bf4b;      /* PZ olive/lime */
  --green: #5f9e5a;
  --red: #b4423a;         /* blood */
  --blue: #5b8fd6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1a221c 0%, var(--bg) 60%);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}

.brandmark { display: flex; justify-content: center; padding: 2px 0 0; }
.brandmark:not(.has-logo) { display: none; }
/* Hidden until the image is confirmed loaded — there is no logo in assets/ yet, and
   a 404 fires before app.js can attach an error handler, which would otherwise leave
   a 132px hole under the header. app.js adds .has-logo once the load succeeds. */
/* Taller than the Valheim mark's 132px on purpose: this logo is portrait and carries
   a three-line wordmark, so at 132 the type turns to mush. */
.brandmark-logo {
  height: 190px; width: auto; display: block;
  filter: drop-shadow(0 0 18px rgba(168,191,75,.14)) drop-shadow(0 4px 12px rgba(0,0,0,.5));
}
@media (max-width: 720px) { .brandmark-logo { height: 150px; } }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: rgba(14, 18, 16, 0.7); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.rune { color: var(--accent); font-size: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name { font-size: 20px; font-weight: 600; }
.brand-hint { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.hint-label { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 560px) { .brand-hint { display: none; } }
.status { display: flex; align-items: center; gap: 12px; }

.pill {
  padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
}
.pill-online { background: rgba(95,158,90,.15); color: var(--green); border-color: rgba(95,158,90,.4); }
.pill-offline { background: rgba(180,66,58,.15); color: var(--red); border-color: rgba(180,66,58,.4); }
.pill-unknown { background: var(--panel-2); color: var(--muted); }
.count { color: var(--muted); font-size: 14px; }
.updated { color: var(--muted); font-size: 12px; }
.day-badge { background: rgba(168,191,75,.15); color: var(--accent);
  border: 1px solid rgba(168,191,75,.4); padding: 4px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; }
.day-badge:empty { display: none; }
@media (max-width: 700px) { .day-badge, .updated { display: none; } }

main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 40px; display: grid; gap: 16px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px;
}
.card h3 {
  margin: 0 0 12px; font-size: 15px; font-weight: 600; letter-spacing: .02em;
  color: var(--text); display: flex; align-items: baseline; gap: 8px;
}
.subtle { color: var(--muted); font-size: 12px; font-weight: 400; }
.muted { color: var(--muted); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* --- who's online --- */
.online-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.online-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.who-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 8px rgba(95,158,90,.7); flex: none; }
.who-name { font-weight: 600; }
.who-as { color: var(--muted); }
.who-meta { color: var(--muted); font-size: 13px; margin-left: auto; }

/* --- world clock --- */
.world-now { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.world-date { font-size: 24px; font-weight: 700; color: var(--accent);
  letter-spacing: .01em; }
.world-time { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.world-utils { display: grid; gap: 8px; }
.util { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  border-left: 2px solid var(--line); padding-left: 10px; }
.util-name { font-weight: 600; min-width: 84px; }
.util-msg { color: var(--muted); font-size: 14px; }
.util-imminent { border-left-color: var(--accent); }
.util-imminent .util-msg { color: var(--accent); }
.util-gone { border-left-color: var(--red); }
.util-gone .util-msg { color: var(--red); }

/* --- the living --- */
.living-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.living { background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px; }
.living-top { display: flex; align-items: baseline; gap: 8px; }
.living-name { font-weight: 600; }
.living-char { color: var(--muted); font-size: 13px; }
.living-days { font-size: 26px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 6px; }
.living-days .unit { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.living-where { font-size: 12px; color: var(--muted); margin-top: 2px; }
.living.dead .living-days { color: var(--red); }

/* --- Knox County map ---
   The base image is the game's own illustrated visitor map. Markers are placed
   with percentage offsets so everything scales with the image at any width. */
.map-controls { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.map-toggle { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.map-toggle[aria-pressed="true"] { color: var(--accent); border-color: var(--accent);
  background: rgba(168,191,75,.12); }

.map-wrap { position: relative; width: 100%; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; background: #0b0e0c; }
.map-wrap img { display: block; width: 100%; height: auto; }
.map-pins { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; }

.pin-death { width: 11px; height: 11px; border-radius: 50%;
  background: var(--red); border: 1.5px solid #1a0d0c;
  box-shadow: 0 0 6px rgba(180,66,58,.9); }
.pin-player { width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid #10140f;
  box-shadow: 0 0 10px rgba(168,191,75,1); }
/* Gentle pulse so a live player reads as live, not as another static dot. */
@keyframes pz-pulse { 0%,100% { box-shadow: 0 0 6px rgba(168,191,75,.8); }
                      50%     { box-shadow: 0 0 16px rgba(168,191,75,1); } }
.pin-player { animation: pz-pulse 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .pin-player { animation: none; } }

.pin-town { display: flex; align-items: center; gap: 4px; }
.pin-town i { width: 5px; height: 5px; background: var(--text); opacity: .55;
  display: block; flex: none; }
.pin-town span { font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: #efeadb; text-shadow: 0 0 3px #000, 0 0 6px #000; white-space: nowrap; }
@media (max-width: 620px) { .pin-town span { display: none; } }

.pin[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: 150%;
  transform: translateX(-50%); background: rgba(10,13,11,.96);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px;
  font-size: 12px; color: var(--text); white-space: pre; z-index: 3;
}

/* --- in memoriam --- */
.deaths-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px;
  max-height: 460px; overflow-y: auto; }
.deaths-list li { border-left: 2px solid var(--red); padding: 2px 0 2px 12px; }
.d-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.d-name { font-weight: 600; }
.d-days { color: var(--red); font-weight: 600; font-variant-numeric: tabular-nums; }
.d-when { color: var(--muted); font-size: 12px; margin-left: auto; }
.d-cause { color: var(--text); opacity: .85; font-size: 14px; }
.d-where { color: var(--muted); font-size: 12px; }

/* --- stat tiles (toll + health) --- */
.build-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.build-stats .stat { background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; }
.build-stats .stat-num { display: block; font-size: 20px; font-weight: 700;
  color: var(--text); font-variant-numeric: tabular-nums; }
.build-stats .stat-label { font-size: 12px; color: var(--muted); }
.build-stats .stat.hot .stat-num { color: var(--red); }

/* --- character sheets --- */
.skills { display: grid; gap: 14px; }
.sheet { background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px; }
.sheet-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.sheet-name { font-weight: 600; }
.sheet-char { color: var(--muted); font-size: 13px; }
.sheet-prof { font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent); border: 1px solid rgba(168,191,75,.4);
  background: rgba(168,191,75,.1); border-radius: 999px; padding: 1px 9px; }
.sheet-meta { color: var(--muted); font-size: 12px; margin-left: auto; }
/* Traits carry the game's own description as a title tooltip. Negative ones aren't
   distinguished from positive — PZ doesn't label them in a way we can read here. */
.trait { background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 8px; font-size: 13px; color: var(--text); cursor: help; }
.sheet-group { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
  padding: 3px 0; }
.sg-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent); min-width: 66px; }
.perk { background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 8px; font-size: 13px; }
.perk .lvl { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- footer + changelog (identical structure to the Valheim dashboard) --- */
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 0 26px; }
.version-btn { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 10px; font: inherit; cursor: pointer; }
.version-btn:hover { color: var(--accent); border-color: var(--accent); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
  align-items: center; justify-content: center; padding: 20px; z-index: 20; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  max-width: 640px; width: 100%; max-height: 80vh; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 22px;
  cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.changelog-body { padding: 16px 18px; overflow-y: auto; }
.cl-entry { margin-bottom: 18px; }
.cl-ver { font-weight: 700; color: var(--accent); }
.cl-date { color: var(--muted); font-size: 12px; margin-left: 6px; font-weight: 400; }
.cl-title { font-weight: 600; margin: 2px 0 6px; }
.cl-entry ul { margin: 0; padding-left: 18px; }
.cl-entry li { margin-bottom: 4px; }

/* --- login gate --- */
.login { position: fixed; inset: 0; background: var(--bg); display: grid;
  place-items: center; z-index: 30; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 26px 28px; width: min(360px, 90vw); display: grid; gap: 10px; }
.login-card h2 { margin: 0; font-size: 19px; }
.login-card p { margin: 0; color: var(--muted); font-size: 13px; }
.login-card input { background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; color: var(--text); font: inherit; }
.login-card button { background: var(--accent); color: #16200f; border: none;
  border-radius: 8px; padding: 10px 12px; font: inherit; font-weight: 700; cursor: pointer; }
.login-error { color: var(--red); font-size: 13px; min-height: 18px; }
