:root {
  --bg: #e8eaed;
  --surface: #fffdf4;
  --surface2: #f1f3f4;
  --ink: #202124;
  --muted: #5f6368;
  --line: #80868b;
  --shadow: #9aa0a6;
  --blue: #4285f4;
  --red: #ea4335;
  --yellow: #fbbc05;
  --green: #34a853;
  --cyan: #1967d2;
  --orange: #e37400;
  --pixel: 4px;
  --font: "Space Mono", ui-monospace, monospace;
  --display: "DotGothic16", "Space Mono", sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #171a1f;
  --surface: #20242b;
  --surface2: #292e36;
  --ink: #f4f0df;
  --muted: #9aa3ad;
  --line: #4b535d;
  --shadow: #090a0c;
  --blue: #8ab4f8;
  --red: #f28b82;
  --yellow: #fdd663;
  --green: #81c995;
  --cyan: #8ab4f8;
  --orange: #fcad70;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body, #app { min-width: 0; min-height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  image-rendering: pixelated;
}
body:before {
  content: "";
  pointer-events: none;
  opacity: .22;
  background-image:
    linear-gradient(90deg, transparent 31px, color-mix(in srgb, var(--line) 14%, transparent) 32px),
    linear-gradient(transparent 31px, color-mix(in srgb, var(--line) 14%, transparent) 32px);
  background-size: 32px 32px;
  position: fixed;
  inset: 0;
}
.gbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 4px;
  z-index: 40;
  background: linear-gradient(
    to right,
    var(--blue) 0 25%,
    var(--red) 25% 50%,
    var(--yellow) 50% 75%,
    var(--green) 75% 100%
  );
}
button, select, input, textarea { font: inherit; color: inherit; }
button, a, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.app-shell {
  flex-direction: column;
  min-height: 100vh;
  display: flex;
  position: relative;
}

.topbar {
  z-index: 20;
  background: var(--surface);
  border-bottom: var(--pixel) solid var(--line);
  box-shadow: 0 4px 0 var(--shadow);
  position: sticky;
  top: 4px;
}
.topbar-inner {
  align-items: center;
  gap: 26px;
  max-width: 1380px;
  min-height: 76px;
  margin: auto;
  padding: 10px 24px;
  display: flex;
}
.brand { align-items: center; gap: 10px; min-width: 230px; display: flex; }
.brand > span:last-child { flex-direction: column; display: flex; }
.brand b { font-family: var(--display); font-size: 19px; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 9px; letter-spacing: .08em; }
.brand-sprite {
  width: 42px;
  height: 42px;
  border: 4px solid var(--ink);
  background: var(--surface2);
  box-shadow: 4px 4px 0 var(--shadow);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 5px;
}
.brand-sprite .dot { display: block; }
.brand-sprite .b { background: var(--blue); }
.brand-sprite .r { background: var(--red); }
.brand-sprite .y { background: var(--yellow); }
.brand-sprite .g { background: var(--green); }

.topbar nav { align-self: stretch; display: flex; }
.topbar nav a {
  color: var(--muted);
  border-bottom: 4px solid transparent;
  align-items: center;
  gap: 8px;
  margin-bottom: -14px;
  padding: 0 16px;
  display: flex;
}
.topbar nav a.active, .topbar nav a:hover { color: var(--ink); border-color: var(--yellow); }
.top-actions { align-items: center; gap: 8px; margin-left: auto; display: flex; }
.link-status, .live-count { align-items: center; gap: 7px; font-size: 11px; display: flex; }
.link-status i, .live-count i {
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 30%, transparent);
  background: currentColor;
  display: block;
}
.link-status.ok i, .live-count i { animation: 1.6s steps(2, end) infinite blink; }
.ok { color: var(--green) !important; }
.warn { color: var(--orange) !important; }
.danger { color: var(--red) !important; }

.icon-button, .pixel-button {
  border: 2px solid var(--line);
  background: var(--surface2);
  color: var(--ink);
  min-height: 36px;
  box-shadow: 3px 3px 0 var(--shadow);
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  display: inline-flex;
}
.icon-button { width: 38px; padding: 0; }
.icon-button:active, .pixel-button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.admin-button { background: var(--yellow); border-color: var(--ink); color: #202124; }
.pixel-button.accent { background: var(--blue); border-color: var(--ink); color: #fff; }
[data-theme="dark"] .pixel-button.accent { color: #202124; }

.main-wrap {
  flex: 1;
  width: 100%;
  max-width: 1380px;
  margin: auto;
  padding: 30px 24px 50px;
}
.pixel-panel {
  background: var(--surface);
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--shadow);
}

.overview {
  grid-template-columns: 1.25fr repeat(3, 1fr);
  margin-bottom: 22px;
  display: grid;
}
.overview > div {
  border-right: 2px solid var(--line);
  flex-direction: column;
  justify-content: center;
  min-height: 112px;
  padding: 16px 20px;
  display: flex;
}
.overview > div:last-child { border: 0; }
.eyebrow { color: var(--cyan); text-transform: uppercase; font-size: 10px; letter-spacing: .08em; }
.overview-title { background: var(--surface2); }
.overview-title strong { font-family: var(--display); font-size: 42px; line-height: 1; }
.overview-title strong small { font-family: var(--font); color: var(--muted); font-size: 16px; }
.overview-title > span:last-child, .stat small { color: var(--muted); font-size: 11px; }
.stat > span:first-child { color: var(--muted); gap: 6px; font-size: 11px; display: flex; }
.stat strong { font-family: var(--display); color: var(--yellow); white-space: nowrap; font-size: 22px; }
[data-theme="light"] .stat strong { color: #b06000; }
.clock small { align-items: center; gap: 6px; display: flex; }
.clock small i { background: var(--green); width: 7px; height: 7px; display: inline-block; }

.publish-panel { padding: 18px 20px 20px; margin-bottom: 22px; }
.section-head { align-items: end; gap: 15px; margin-bottom: 10px; display: flex; }
.section-head h2, .block-title { font-family: var(--display); margin: 1px 0 0; font-size: 20px; }
.lede { color: var(--muted); font-size: 12px; line-height: 1.6; max-width: 78ch; }
.publish-tabs { display: flex; gap: 0; margin: 14px 0 12px; border: 2px solid var(--line); width: max-content; }
.publish-tabs button {
  border: 0;
  border-right: 2px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  min-height: 36px;
  padding: 6px 18px;
}
.publish-tabs button:last-child { border-right: 0; }
.publish-tabs button.active { background: var(--yellow); color: #202124; }
.dropzone {
  border: 2px dashed var(--line);
  background: var(--surface2);
  min-height: 120px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  cursor: pointer;
}
.dropzone.drag { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 10%, var(--surface2)); }
.dropzone span, .dropzone em { color: var(--muted); font-size: 11px; font-style: normal; }
.dropzone em { color: var(--blue); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 10px; color: var(--muted); }
.field input, .field textarea, .search-label input, .copy-row input, .copy-row textarea {
  border: 2px solid var(--line);
  background: var(--surface2);
  padding: 10px 12px;
  min-height: 42px;
  width: 100%;
}
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row input, .copy-row textarea { flex: 1; }
.publish-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.form-status { font-size: 12px; color: var(--muted); }
.form-status.err { color: var(--red); }
.form-status.ok { color: var(--green); }

.control-deck { align-items: center; gap: 18px; margin-bottom: 15px; display: flex; flex-wrap: wrap; }
.search-form { display: flex; }
.search-label {
  border: 2px solid var(--line);
  background: var(--surface);
  height: 38px;
  color: var(--muted);
  align-items: center;
  gap: 5px;
  padding-left: 9px;
  font-size: 10px;
  display: flex;
}
.search-label input { border: 0; background: var(--surface2); height: 100%; min-height: 0; min-width: 180px; }
.group-tabs { align-items: center; gap: 4px; padding-bottom: 4px; display: flex; overflow: auto; }
.group-tabs a {
  color: var(--muted);
  white-space: nowrap;
  background: 0 0;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 8px 12px;
}
.group-tabs a.active { color: var(--ink); border-color: var(--yellow); background: var(--surface2); }
.filters { align-items: center; gap: 8px; margin-left: auto; display: flex; }
.filters label {
  border: 2px solid var(--line);
  background: var(--surface);
  height: 38px;
  color: var(--muted);
  align-items: center;
  gap: 5px;
  padding-left: 9px;
  font-size: 10px;
  display: flex;
}
.filters select { background: var(--surface2); height: 100%; color: var(--ink); border: 0; padding: 0 8px; }

.server-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; display: grid; }
.server-card { flex-direction: column; gap: 11px; min-width: 0; padding: 13px 15px; display: flex; position: relative; }
.card-bar, .share-box .card-bar {
  display: block;
  height: 4px;
  margin: -13px -15px 2px;
  background: linear-gradient(to right, var(--blue) 0 25%, var(--red) 25% 50%, var(--yellow) 50% 75%, var(--green) 75% 100%);
}
.server-card header { align-items: center; gap: 9px; min-width: 0; display: flex; }
.server-card header strong {
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--display);
  font-size: 18px;
  overflow: hidden;
}
.status-pip { width: 10px; height: 10px; box-shadow: 2px 2px 0 var(--shadow); background: currentColor; flex: none; display: block; }
.country { border: 1px solid var(--line); color: var(--muted); padding: 3px 6px; font-size: 10px; }
.card-state { margin-left: auto; font-size: 10px; }
.card-desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  min-height: 36px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-facts { border-top: 1px dashed var(--line); grid-template-columns: repeat(4, 1fr); gap: 7px; padding-top: 9px; display: grid; }
.card-facts span { color: var(--muted); flex-direction: column; min-width: 0; font-size: 9px; display: flex; }
.card-facts b { color: var(--ink); text-overflow: ellipsis; font-size: 11px; overflow: hidden; white-space: nowrap; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mono-clip { font-family: var(--font); }

.empty-state, .terminal-message { text-align: center; color: var(--muted); padding: 42px; }
.empty-state > span { font-family: var(--display); color: var(--line); font-size: 38px; display: block; }
.boot-caret { color: var(--yellow); }
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  height: 100vh;
  font-family: var(--display);
  place-items: center;
  display: grid;
  font-size: 22px;
}
.boot-screen.gone { display: none; }

.back-button { margin-bottom: 16px; width: max-content; }
.detail-page { flex-direction: column; gap: 22px; display: flex; }
.server-hero { padding: 22px; }
.server-hero > header { align-items: center; gap: 13px; display: flex; }
.server-hero header small { color: var(--muted); font-size: 9px; }
.server-hero h1 { font-family: var(--display); margin: 0; font-size: 30px; }
.hero-state { border: 2px solid currentColor; margin-left: auto; padding: 5px 9px; font-size: 11px; }
.tag-row { flex-wrap: wrap; gap: 5px; display: flex; margin-top: 10px; }
.tag-row span { border: 1px solid var(--line); background: var(--surface2); color: var(--cyan); padding: 3px 6px; font-size: 10px; }
.share-box { padding: 20px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.share-box .card-bar { margin: -20px -20px 4px; }
.share-box h2 { font-family: var(--display); margin: 0; font-size: 22px; }
.info-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; display: grid; }
.info-grid article { background: var(--surface); border: 2px solid var(--line); box-shadow: 4px 4px 0 var(--shadow); min-width: 0; padding: 13px; }
.info-grid h2 { font-family: var(--display); color: var(--yellow); border-bottom: 2px solid var(--line); margin: 0 0 12px; padding-bottom: 8px; font-size: 15px; }
[data-theme="light"] .info-grid h2 { color: #b06000; }
.kv { grid-template-columns: 95px minmax(0, 1fr); gap: 7px; padding: 5px 0; font-size: 11px; display: grid; }
.kv > span { color: var(--muted); }
.kv strong { overflow-wrap: anywhere; font-weight: 400; }
.file-list { margin: 0; padding-left: 18px; font-size: 12px; }
.file-list a { color: var(--blue); text-decoration: underline; }
.how { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.md-panel { padding: 18px 20px 24px; }
.markdown-body { font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { font-family: var(--display); }
.markdown-body pre, .raw-details pre {
  background: var(--surface2);
  border: 1px solid var(--line);
  padding: 12px;
  overflow: auto;
  font-size: 12px;
}
.markdown-body code { background: var(--surface2); padding: 1px 4px; }
.markdown-body a { color: var(--blue); text-decoration: underline; }
.raw-details { margin-top: 16px; color: var(--muted); font-size: 12px; }
.cat-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.cat-chip {
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--cyan);
  padding: 4px 8px;
  font-size: 10px;
}
.cat-chip.active { background: var(--yellow); color: #202124; border-color: var(--ink); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cat-card { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.cat-card strong { font-family: var(--display); font-size: 18px; }
.install-panel { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.related { margin-top: 8px; }
.related h2 { font-family: var(--display); }
.docs-page .md-panel { padding: 22px; }
.file-body {
  background: var(--surface2);
  border: 1px solid var(--line);
  padding: 12px;
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.not-found { text-align: center; padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.not-found > strong { font-family: var(--display); color: var(--red); font-size: 100px; display: block; line-height: 1; }
.not-found h1 { font-family: var(--display); margin: 0; }

footer {
  border-top: 2px solid var(--line);
  width: 100%;
  max-width: 1380px;
  color: var(--muted);
  justify-content: space-between;
  margin: auto;
  padding: 22px 24px;
  font-size: 10px;
  display: flex;
  gap: 12px;
}
.footer-pixels { color: var(--yellow); }

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  background: var(--yellow);
  color: #202124;
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 10px 14px;
  font-size: 12px;
}

@keyframes blink { 50% { opacity: .3; } }

@media (width <= 1000px) {
  .topbar-inner { gap: 12px; }
  .brand { min-width: 0; }
  .brand small { display: none; }
  .overview { grid-template-columns: repeat(2, 1fr); }
  .overview > div:nth-child(2) { border-right: 0; }
  .overview > div:nth-child(-n+2) { border-bottom: 2px solid var(--line); }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .info-grid article:last-child { grid-column: 1 / -1; }
  .control-deck { flex-direction: column; align-items: flex-start; }
  .filters { width: 100%; margin-left: 0; }
}
@media (width <= 720px) {
  body { font-size: 13px; }
  .topbar-inner { flex-wrap: wrap; min-height: 62px; padding: 8px 12px; }
  .brand-sprite { width: 34px; height: 34px; }
  .brand b { font-size: 15px; }
  .topbar nav { order: 3; width: 100%; height: 42px; }
  .topbar nav a { flex: 1; justify-content: center; margin-bottom: -12px; }
  .main-wrap { padding: 22px 12px 40px; }
  .overview-title strong { font-size: 28px; }
  .server-grid, .info-grid, .card-facts { grid-template-columns: 1fr; }
  .copy-row { flex-direction: column; }
  footer { padding: 18px 12px; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .01ms !important; }
}
