:root {
  --bg: #101218;
  --panel: #171b22;
  --card: #1d222b;
  --line: #2c3340;
  --text: #efe8dc;
  --muted: #9a9286;
  --amber: #d4a017;
  --accept: #2fa36a;
  --accept-hover: #39be7c;
  --danger: #e23d3d;
  --danger-hover: #ff5353;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.sprockets {
  height: 10px;
  background: repeating-linear-gradient(90deg, #0a0c10 0 10px, #d8c7a0 10px 16px, #0a0c10 16px 28px);
  opacity: 0.55;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex-wrap: wrap;
}

.brand h1 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}

.stats {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
}

.tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.views {
  display: flex;
  gap: 4px;
  background: #12151b;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
}

.tab {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.tab.active {
  background: #2a3140;
  color: var(--text);
}

.search input,
.sort select,
.btn,
.type-wrap input {
  background: #12151b;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.search input { width: min(280px, 70vw); }

.btn { cursor: pointer; font-weight: 600; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: #4a5568; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-hover); }
.btn.accept { background: var(--accept); border-color: var(--accept); color: #fff; }
.btn.accept:hover { background: var(--accept-hover); }
.btn:disabled { opacity: 0.4; cursor: default; }

main { padding: 16px 22px 48px; max-width: 1100px; }

.status-line {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  min-height: 1.2em;
  margin: 0 0 14px;
}

.cards { display: grid; gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.card.current { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
}

.pill {
  background: #12151b;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--text);
}

.reason {
  margin: 0 0 12px;
  color: #e0b36a;
  font-size: 0.92rem;
}

.question {
  margin: 0 0 10px;
  font-size: 1.12rem;
  line-height: 1.45;
}

.answer {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.answer strong { color: var(--text); font-weight: 600; }

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.figure {
  background: #0b0d11;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.figure img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  background: #000;
  display: block;
  cursor: zoom-in;
}

.figure.missing {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 12px;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
}

.figure figcaption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
}

.figure button {
  background: transparent;
  color: var(--danger);
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 48px 12px;
}

.hidden { display: none !important; }

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.92);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 24px;
}

.lightbox img {
  max-width: 96vw;
  max-height: 90vh;
  object-fit: contain;
}

.lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.72);
  display: grid;
  place-items: center;
  z-index: 40;
}

.modal-card {
  width: min(440px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.modal-card h2 { margin: 0 0 8px; font-size: 1.15rem; }
.modal-card p { color: var(--muted); margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.type-wrap {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #222833;
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  z-index: 50;
  box-shadow: var(--shadow);
}

#toast-undo {
  background: transparent;
  color: var(--amber);
  border: 0;
  font-weight: 700;
  cursor: pointer;
}
