/* Styled after WARDOGS' in-game server browser: dark translucent panels over
   a blurred battlefield, condensed uppercase type, square buttons. Dark-only
   on purpose — it's a replica of a dark game UI, so there's no light theme. */

:root {
  color-scheme: dark;
  --bg: #0b0b0a;
  --panel: rgba(17, 17, 16, 0.74);
  --panel-solid: #151514;
  --cell: rgba(8, 8, 8, 0.72);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #e9e7e2;
  --text-2: #a9a6a0;
  --text-3: #74716b;
  --accent: #e0a43a;
  --accent-soft: rgba(224, 164, 58, 0.18);
  --row-hover: rgba(255, 255, 255, 0.05);
  --row-selected: rgba(255, 255, 255, 0.11);
  --tag-bg: #5d5b57;
  --warn: #d9793a;
  --display: 'Barlow Semi Condensed', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Barlow', system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* Several components set their own display, which would otherwise beat the
   hidden attribute's UA style. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
}

button, input { font: inherit; color: inherit; }

/* Blurred warm bokeh standing in for the game's out-of-focus battlefield. */
.backdrop {
  position: fixed;
  inset: -80px;
  z-index: 0;
  filter: blur(38px) saturate(0.9);
  opacity: 0.55;
  pointer-events: none;
}
.backdrop-shade {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 40%, transparent 0%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(rgba(10, 10, 9, 0.35), rgba(10, 10, 9, 0.35));
  pointer-events: none;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Top bar ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 64px;
  padding: 0 24px 0 56px;
  background: rgba(14, 14, 13, 0.94);
  border-bottom: 1px solid var(--line-strong);
}
.brand img { height: 38px; width: auto; display: block; }
.back {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  background: #2a2a28;
  color: var(--text);
  text-decoration: none;
}
.back:hover { background: #363633; }
.topbar h1 {
  margin: 0 0 0 12px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-right: 58px;
  align-self: stretch;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--line-strong);
}
.totals {
  margin-left: auto;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
}
.totals b { color: var(--text); font-weight: 600; }

.refresh-status {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.3);
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.refresh-status .time { color: var(--text); font-weight: 600; min-width: 2.6em; }
.refresh-ring { width: 20px; height: 20px; transform: rotate(-90deg); flex: none; }
.refresh-ring circle { fill: none; stroke-width: 3; }
.refresh-ring .track { stroke: rgba(255, 255, 255, 0.12); }
.refresh-ring .fill { stroke: var(--accent); stroke-linecap: butt; transition: stroke-dashoffset 0.9s linear; }
.refresh-status.updating .refresh-ring { animation: spin 1s linear infinite; }
.refresh-status.stale { border-color: rgba(217, 121, 58, 0.6); }
.refresh-status .stale-flag { color: var(--warn); font-weight: 600; }
@keyframes spin { to { transform: rotate(270deg); } }

/* ---- Layout ------------------------------------------------------------- */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 22px;
  padding: 44px 30px 18px 56px;
  min-height: 0;
}

.list-col { display: flex; flex-direction: column; min-width: 0; position: relative; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  min-width: 124px;
  padding: 0 18px;
  background: rgba(20, 20, 19, 0.7);
  border: 1px solid var(--line-strong);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
.btn:hover { background: rgba(48, 48, 45, 0.85); border-color: rgba(255, 255, 255, 0.35); }
.btn[aria-expanded="true"] { background: rgba(60, 60, 56, 0.9); }
.btn:focus-visible, .chip:focus-visible, .sort:focus-visible, .list-body:focus-visible, .search:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.btn .badge {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: #1a1206;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}
.search {
  height: 42px;
  flex: 1 1 220px;
  max-width: 360px;
  margin-left: 8px;
  padding: 0 14px;
  background: rgba(10, 10, 10, 0.6);
  border: 1px solid var(--line-strong);
  font-family: var(--display);
  letter-spacing: 0.06em;
}
.search::placeholder { color: var(--text-3); text-transform: uppercase; }
.result-count {
  margin-left: auto;
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ---- Filter panel ------------------------------------------------------- */

.filter-panel {
  position: absolute;
  top: 54px;
  left: 0;
  z-index: 5;
  width: min(560px, 100%);
  padding: 18px 20px 20px;
  background: rgba(20, 20, 19, 0.97);
  border: 1px solid var(--line-strong);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}
.filter-panel[hidden] { display: none; }
.filter-group + .filter-group { margin-top: 16px; }
.filter-group h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  height: 32px;
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  cursor: pointer;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}
.chip .n { color: var(--text-3); margin-left: 6px; font-size: 12px; }
.filter-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}
.filter-footer .btn { min-width: 100px; height: 36px; }
.filter-hint { font-size: 13px; color: var(--text-3); }

/* ---- Server list -------------------------------------------------------- */

.list-panel {
  /* Fixed height (fills the viewport below the toolbar), not flex-grow — the
     column's height is auto, so growing would just size it to all rows. */
  flex: none;
  display: flex;
  flex-direction: column;
  height: max(420px, calc(100vh - 64px - 44px - 54px - 58px));
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.cols {
  display: grid;
  grid-template-columns: 42px 42px minmax(0, 1fr) 144px 160px 104px 128px;
  gap: 4px;
}
.list-head { flex: none; }
.list-head > * {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  background: var(--cell);
  border: 0;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  text-align: left;
  white-space: nowrap;
}
.list-head .icon-col { justify-content: center; padding: 0; }
.sort { cursor: pointer; }
.sort:hover { color: var(--text); background: rgba(30, 30, 28, 0.85); }
.sort[aria-sort="ascending"], .sort[aria-sort="descending"] { color: var(--text); background: rgba(34, 34, 32, 0.9); }
.sort .arrow { font-size: 10px; }

.list-body {
  flex: 1;
  min-height: 0; /* let it shrink below its content so it scrolls itself */
  overflow-y: auto;
  margin-top: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.row {
  height: 40px;
  cursor: pointer;
  align-items: center;
  border-left: 2px solid transparent;
}
.row:nth-child(even) { background: rgba(255, 255, 255, 0.018); }
.row:hover { background: var(--row-hover); }
.row.selected { background: var(--row-selected); border-left-color: var(--accent); }
.row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 12px;
  font-size: 15px;
}
.row .icon-col { display: grid; place-items: center; padding: 0; color: var(--text-2); }
.row .name { color: var(--text); }
.row .mode, .row .map, .row .region {
  font-family: var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  font-size: 14px;
}
.row .mode .rs { color: var(--accent); margin-left: 6px; font-size: 12px; }
.row .players { font-variant-numeric: tabular-nums; font-family: var(--display); font-size: 15px; }
.row .players .cap { color: var(--text-3); }
.row .players.full { color: var(--text-3); }
.row .players .bar {
  display: block;
  height: 2px;
  margin-top: 3px;
  background: rgba(255, 255, 255, 0.1);
}
.row .players .bar i { display: block; height: 100%; background: var(--text-2); }
.row .players.full .bar i { background: var(--text-3); }

.list-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px 80px;
  color: var(--text-2);
}
.list-state[hidden] { display: none; }
.list-state svg { color: var(--text-3); margin-bottom: 22px; }
.list-state h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.list-state p { margin: 0 0 28px; font-size: 17px; }
.list-state .btn { min-width: 186px; height: 50px; }
.list-state.loading svg { animation: pulse 1.4s ease-in-out infinite; }
.list-state.loading .slash { display: none; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---- Detail panel ------------------------------------------------------- */

.detail {
  align-self: start;
  padding: 10px 10px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  min-height: 420px;
}

.map-card {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #2b2a27;
}
.map-card .art { position: absolute; inset: 0; }
/* Painted stand-ins for the in-game map thumbnails (no game art is used). */
.map-card .art::before, .map-card .art::after { content: ''; position: absolute; inset: 0; }
.map-card .art::after {
  /* Distant ridge line + HUD scanlines. */
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    linear-gradient(transparent 52%, rgba(0, 0, 0, 0.28) 52.5%, transparent 70%);
  clip-path: polygon(0 58%, 12% 50%, 24% 55%, 38% 44%, 52% 52%, 66% 41%, 80% 50%, 100% 45%, 100% 100%, 0 100%);
  background-color: rgba(0, 0, 0, 0.35);
}
.map-bakurani .art::before {
  background:
    radial-gradient(circle at 20% 78%, #f0b534 0 3%, transparent 3.5%),
    radial-gradient(circle at 44% 86%, #e8a92b 0 4%, transparent 4.5%),
    radial-gradient(circle at 70% 80%, #f2bd3c 0 3%, transparent 3.5%),
    radial-gradient(circle at 88% 90%, #d9951f 0 5%, transparent 5.5%),
    radial-gradient(circle at 8% 92%, #e0a12a 0 4%, transparent 4.5%),
    linear-gradient(180deg, #6e5836 0%, #c48a3e 38%, #e7b264 50%, #5a4520 62%, #2d220f 100%);
}
.map-ozeti .art::before {
  background:
    linear-gradient(90deg, transparent 0 8%, #3a2419 8% 15%, transparent 15% 22%, #45291c 22% 34%, transparent 34% 41%, #3a2419 41% 48%, transparent 48% 60%, #4b2d1f 60% 72%, transparent 72% 80%, #3a2419 80% 92%, transparent 92%) bottom / 100% 42% no-repeat,
    linear-gradient(180deg, #5b3a2c 0%, #b3683f 40%, #e2a26a 55%, #6e3f28 70%, #2b1a12 100%);
}
.map-zestafona .art::before {
  background:
    linear-gradient(90deg, transparent 0 10%, #1c222c 10% 13%, transparent 13% 30%, #232a36 30% 45%, transparent 45% 62%, #1c222c 62% 65%, transparent 65% 74%, #232a36 74% 90%, transparent 90%) bottom / 100% 55% no-repeat,
    linear-gradient(180deg, #2a323e 0%, #5d6b7c 42%, #93a1ae 55%, #3a4452 68%, #151a22 100%);
}
.map-unknown .art::before { background: linear-gradient(180deg, #3a3935 0%, #1c1b19 100%); }
.map-card .overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 10px 10px;
  background: linear-gradient(transparent 40%, rgba(0, 0, 0, 0.72) 100%);
}
.map-card .incoming {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}
.map-card .map-name {
  font-family: var(--display);
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #fff;
  margin: 3px 0 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  padding-bottom: 6px;
}
.map-card .map-sub {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 6px 8px;
}
.detail-name {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.share {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  margin-top: 2px;
  padding: 0 11px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line-strong);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  cursor: pointer;
}
.share:hover { color: var(--text); border-color: var(--text-2); }
.share svg { flex: none; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 6px 16px; }
.tag {
  padding: 2px 6px;
  background: var(--tag-bg);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e6e4df;
}
.tag.accent { background: var(--accent); color: #1a1206; }
.tag.dim { background: rgba(255, 255, 255, 0.1); color: var(--text-2); }

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  margin: 0 6px;
  border-top: 1px solid var(--line);
}
.facts dt, .facts dd {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.facts dt {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding-right: 14px;
}
.facts dd { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.copy {
  margin-left: 8px;
  padding: 1px 7px;
  background: transparent;
  border: 1px solid var(--line-strong);
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  cursor: pointer;
}
.copy:hover { color: var(--text); border-color: var(--text-2); }
.code { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 13px; }

.spark { margin: 18px 6px 0; }
.spark h3 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.spark h3 b { color: var(--text-2); font-weight: 500; }
.spark-plot { position: relative; }
.spark svg { display: block; width: 100%; height: 86px; overflow: visible; }
.spark .grid { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .area { fill: var(--accent); opacity: 0.12; }
.spark .axis-label { fill: var(--text-3); font-size: 10px; font-family: var(--display); letter-spacing: 0.08em; }
.spark .cross { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; }
.spark .dot { fill: var(--accent); stroke: var(--panel-solid); stroke-width: 2; }
.spark .hit { fill: transparent; cursor: crosshair; }
.spark-tip {
  position: absolute;
  top: -6px;
  transform: translate(-50%, -100%);
  padding: 4px 8px;
  background: #242422;
  border: 1px solid var(--line-strong);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}
.spark-tip[hidden] { display: none; }
.spark-tip b { font-weight: 600; }
.spark-empty { font-size: 13px; color: var(--text-3); padding: 14px 0; }

.detail-note {
  margin: 14px 6px 0;
  font-size: 12px;
  color: var(--text-3);
}
.detail-note.warn { color: var(--warn); }
.detail-empty {
  margin: 18px 6px 0;
  color: var(--text-2);
  font-size: 15px;
}

/* ---- Footer ------------------------------------------------------------- */

.site-footer {
  padding: 0 30px 18px 56px;
  font-size: 12px;
  color: var(--text-3);
}
.site-footer a { color: var(--text-2); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- Narrow screens ----------------------------------------------------- */

@media (max-width: 1100px) {
  .cols { grid-template-columns: 38px 38px minmax(0, 1fr) 120px 130px 96px; }
  .cols > .col-region { display: none; }
  .topbar h1 { padding-right: 24px; }
}

@media (max-width: 860px) {
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar h1 { border-right: 0; padding-right: 0; margin-left: 4px; font-size: 18px; }
  .brand { display: none; }
  .totals { display: none; }
  .refresh-status { margin-left: auto; }
  .layout { grid-template-columns: 1fr; padding: 18px 16px 12px; gap: 16px; }
  .list-panel { height: max(340px, 62vh); padding: 6px; }
  .cols { grid-template-columns: 30px 30px minmax(0, 1fr) 110px 84px; }
  .cols > .col-mode { display: none; }
  .search { max-width: none; margin-left: 0; flex-basis: 100%; order: 3; margin-top: 4px; }
  .btn { min-width: 0; flex: 1; }
  .result-count { display: none; }
  .site-footer { padding: 0 16px 16px; }
}

@media (max-width: 480px) {
  .cols { grid-template-columns: 26px minmax(0, 1fr) 96px 72px; }
  .cols > .col-official { display: none; }
  .row > span, .list-head > * { padding: 0 8px; }
  .refresh-status .label { display: none; }
}
