/* ============================================
   NEWSCRATE — editorial / studio minimal (seeded from toolcrate-site)
   Near-monochrome. One sans-serif throughout.
   Hierarchy carried by weight, size, and gray —
   not color, not decoration.
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #141414;
  --ink-soft: #4A4844;
  --paper: #F5F4F2;
  --panel: #FFFFFF;
  --line: #DEDCD8;
  --line-soft: #EAE8E4;
  --muted: #8A8782;
  --accent: #2255DD;
  --ok: #2E7D5B;
  --danger: #C0392B;
  --line-len: 68ch;
}

[data-theme="dark"] {
  --ink: #EDECEA;
  --ink-soft: #B8B5AF;
  --paper: #161513;
  --panel: #1E1D1A;
  --line: #33312C;
  --line-soft: #262420;
  --muted: #7C7972;
  --accent: #6C93F5;
  --ok: #52A57C;
  --danger: #DB6B5A;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

h1, h2, h3 {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em 0;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 { font-size: clamp(2rem, 5vw, 2.75rem); }
h1 em { font-style: normal; color: var(--muted); font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 600; }
h3 { font-size: 0.95rem; font-weight: 600; }

p { margin: 0 0 1em 0; max-width: var(--line-len); color: var(--ink-soft); }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -3rem;
  left: 0.5rem;
  z-index: 1000;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Layout shell ---- */
.site-header {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
}
.site-header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.3rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--ink); }
.brand em { font-style: normal; color: var(--muted); font-weight: 500; }

.brand-wrap { display: flex; align-items: baseline; gap: 0.5rem; }
.brand-offshoot {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding-left: 0.55rem;
  border-left: 1px solid var(--line);
}
.brand-offshoot:hover { color: var(--ink); }
.brand-offshoot-icon { align-self: center; padding-left: 0.55rem; opacity: 0.75; transition: opacity 0.15s; }
.brand-offshoot-icon:hover { opacity: 1; }
.brand-offshoot-icon img { display: block; border-radius: 4px; }

.header-right { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; justify-content: flex-end; row-gap: 0.5rem; }

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  margin-left: 1.3rem;
}
.site-nav a:first-child { margin-left: 0; }
.site-nav a:hover { color: var(--ink); }

.theme-toggle {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--ink); color: var(--ink); background: none; }

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.75rem 1.5rem;
  margin-top: 4rem;
}
.site-footer-inner {
  max-width: 860px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-footer a { color: var(--muted); text-decoration-color: var(--line); margin-right: 1.1rem; }
.site-footer a:last-child { margin-right: 0; }
.site-footer a:hover { color: var(--ink); }
.footer-links { display: flex; }

/* ---- Homepage tool index ---- */
.intro { margin-bottom: 3rem; }
.intro h1 { margin-bottom: 0.5em; max-width: 16ch; }
.intro-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: wrap;
}
.intro p { color: var(--ink-soft); font-size: 1.02rem; max-width: 46ch; }
.intro-count { text-align: right; flex-shrink: 0; }
.intro-count .num {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  display: block;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.intro-count .label {
  font-size: 0.75rem;
  color: var(--muted);
}

.category-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin: 2.75rem 0 0.5rem 0;
}
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}
.tag-pill {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: none;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}
.tag-pill:hover { color: var(--ink); border-color: var(--ink-soft); }
.tag-pill .tag-count { color: var(--muted); font-weight: 400; }
.tag-pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.tag-pill.active .tag-count { color: var(--paper); opacity: 0.75; }
.tag-clear {
  font-size: 0.8rem;
  color: var(--muted);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.4rem 0;
}
.tag-clear:hover { color: var(--ink); }

.search-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 2.5rem;
}
.search-panel label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
.search-input-wrap { position: relative; }
.search-input-wrap input[type="text"] { padding-right: 2.6rem; }
.search-clear {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
}
.search-clear:hover { color: var(--ink); opacity: 1; background: var(--line-soft); }
.search-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  min-height: 1em;
}
.search-panel .sort-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0;
  color: var(--muted);
}
.sort-control select {
  font: inherit;
  font-size: 0.78rem;
  color: var(--ink);
  background-color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.35rem 1.6rem 0.35rem 0.5rem;
  cursor: pointer;
}
.search-hint kbd {
  font-family: 'Courier New', monospace;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  font-size: 0.75rem;
  background: var(--paper);
}
.no-results {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 0;
  border-top: 1px solid var(--line);
}

.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 15;
}
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { opacity: 0.85; }

/* ---- Global search modal ---- */
.gsearch-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0.12s;
}
.gsearch-backdrop.open { opacity: 1; visibility: visible; }
.gsearch-modal {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  transform: translateY(-8px);
  transition: transform 0.12s ease;
}
.gsearch-backdrop.open .gsearch-modal { transform: translateY(0); }
.gsearch-input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.gsearch-input-row svg { flex-shrink: 0; color: var(--muted); }
#gsearchInput {
  border: none;
  background: transparent;
  font-size: 1.05rem;
  color: var(--ink);
  width: 100%;
  padding: 0.2rem 0;
}
#gsearchInput:focus { outline: none; }
.gsearch-esc-hint {
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.gsearch-close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  padding: 0.3rem;
  border-radius: 6px;
  cursor: pointer;
}
.gsearch-close:hover { background: var(--line-soft); color: var(--ink); }
.gsearch-results {
  overflow-y: auto;
  padding: 0.5rem;
}
.gsearch-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  padding: 0.6rem 0.7rem 0.3rem;
}
.gsearch-result {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.gsearch-result:hover, .gsearch-result.active { background: var(--line-soft); }
.gsearch-result-text { flex: 1; min-width: 0; }
.gsearch-result-name { font-weight: 600; color: var(--ink); }
.gsearch-result-desc { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsearch-result-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--line-soft);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.gsearch-result-badge.game { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); border-color: transparent; }
.gsearch-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
@media (max-width: 600px) {
  .gsearch-backdrop { padding: 0; align-items: stretch; }
  .gsearch-modal { max-width: none; max-height: none; height: 100%; border-radius: 0; }
  .gsearch-esc-hint { display: none; }
  .gsearch-close { font-size: 1.3rem; padding: 0.4rem; }
}

.install-hint {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  max-width: 420px;
  margin: 0 auto;
  background: var(--ink);
  color: var(--paper);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.3;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  z-index: 60;
}
.install-hint span:first-child { flex: 1; }
.install-hint-action {
  background: var(--paper);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.install-hint-dismiss {
  background: none;
  border: none;
  color: var(--paper);
  opacity: 0.7;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem;
  flex-shrink: 0;
}
.install-hint-dismiss:hover { opacity: 1; }

/* Ko-fi's floating widget is fixed-position by design (docked bottom-right,
   persists through scroll); this just guarantees it regardless of any page
   CSS, and keeps it above the back-to-top button's stacking order. */
/* Ko-fi's floating widget is fixed-position by design via its own
   stylesheet (storage.ko-fi.com). This is a self-sufficient fallback in
   case that stylesheet is blocked or slow to load (ad blockers, CSP,
   flaky network) -- without it, the widget's markup would still be
   injected but unstyled, sitting in normal document flow and scrolling
   away instead of floating. Bottom-left keeps it clear of the
   bottom-right back-to-top button. */
#kofi-widget-overlay {
  position: fixed !important;
  left: 20px !important;
  bottom: 20px !important;
  right: auto !important;
  top: auto !important;
  z-index: 9999 !important;
}

.tool-list {
  list-style: none;
  margin: 0 0 0.5rem 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.tool-list li { display: flex; align-items: center; gap: 0.2rem; border-bottom: 1px solid var(--line-soft); }
.tool-list li[hidden] { display: none; }
.tool-list a {
  display: flex;
  flex: 1;
  min-width: 0;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.8rem 0.1rem;
  text-decoration: none;
  color: var(--ink);
}

.star-btn {
  flex-shrink: 0;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.star-btn:hover { color: var(--ink-soft); background: var(--line-soft); }
.star-btn.active { color: #E5A93B; }
.star-btn.active:hover { color: #E5A93B; opacity: 0.8; }

.pinned-group { margin-bottom: 2.25rem; }
.pinned-group .category-label { margin-top: 0; }
.tool-list a:hover { color: var(--accent); }
.tool-list a:hover .tool-desc { color: var(--accent); opacity: 0.7; }
.tool-list a:hover .tool-name { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.tool-num { display: none; }
.tool-name { font-weight: 500; }
.tool-desc { color: var(--muted); font-size: 0.85rem; text-align: right; white-space: nowrap; }

@media (max-width: 620px) {
  .tool-list li { align-items: flex-start; }
  .star-btn { margin-top: 0.55rem; }
  .tool-list a { flex-direction: column; align-items: flex-start; gap: 0.15rem; }
  .tool-desc { text-align: left; white-space: normal; }
  .intro-meta { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .intro-count { text-align: left; }
  .site-footer-inner { flex-direction: column; }
  .search-hint { display: none; }
}

/* ---- Tool page ---- */
.tool-header { margin-bottom: 2.25rem; }
.tool-kicker { display: none; }
.tool-header h1 { margin-bottom: 0.4em; font-size: clamp(1.7rem, 4.5vw, 2.2rem); max-width: none; }
.tool-header p { color: var(--ink-soft); font-size: 1rem; }
.share-btn {
  margin-top: 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}
.share-btn:hover { color: var(--ink); border-color: var(--ink-soft); }
.install-btn { margin-left: 0.5rem; }
.last-updated { margin-top: 0.5rem; font-size: 0.68rem; color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.65rem;
  margin-bottom: 1.65rem;
}

.donate-embed {
  max-width: 420px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
}

label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
  font-weight: 500;
}
label::before { content: none; }

textarea, input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], select {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  padding: 0.68rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}
textarea:focus, input:focus, select:focus {
  border-color: var(--accent);
  outline: none;
}
select {
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  appearance: none;
  padding-right: 2.2rem;
  text-overflow: ellipsis;
}
:root select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238A8782' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}
[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237C7972' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }

.field { margin-bottom: 1.05rem; }
.field:last-child { margin-bottom: 0; }

.row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.05rem; }
.row:last-child { margin-bottom: 0; }
.row .field { flex: 1; min-width: 140px; margin-bottom: 0; }

button, .btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 0.62rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
}
button:disabled, .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:hover { opacity: 0.82; }
button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.secondary:hover { border-color: var(--ink); opacity: 1; background: var(--line-soft); }

.btn-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }

.output-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 1.35rem 1.55rem;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 3em;
  font-variant-numeric: tabular-nums;
}
.output-panel.empty { color: var(--muted); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.65rem;
}
.stat {
  background: var(--panel);
  padding: 0.95rem 0.9rem;
  text-align: left;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  display: block;
  line-height: 1.1;
  letter-spacing: -0.01em;
  word-break: break-word;
  overflow-wrap: break-word;
}
.stat-label { font-size: 0.7rem; color: var(--muted); }

.copy-feedback {
  font-size: 0.8rem;
  color: var(--ok);
  font-weight: 600;
  margin-left: 0.25rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.copy-feedback.show { opacity: 1; }

.fallback-details { margin-top: 1.1rem; }
.fallback-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  user-select: none;
}
.fallback-details summary:hover { color: var(--ink); }
.fallback-details[open] summary { margin-bottom: 0.75rem; }
.fallback-details .btn-row { margin-top: 0; }

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  font-weight: 500;
}

.ad-slot {
  text-align: center;
  margin: 2.1rem 0;
  overflow: hidden;
}

.related-tools {
  margin-top: 3rem;
  padding-top: 1.85rem;
  border-top: 1px solid var(--line);
}
.related-tools h2 { color: var(--ink); font-size: 1.05rem; margin-bottom: 0.6rem; }
.related-tools .tool-list li:first-child { border-top: none; }

.explainer {
  margin-top: 3rem;
  padding-top: 1.85rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.explainer h2 { color: var(--ink); font-size: 1.05rem; margin-bottom: 0.6rem; }
.explainer code {
  background: var(--line-soft);
  color: var(--ink);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
}

.disclaimer-note {
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.65rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--line-soft);
}
.disclaimer-note strong { color: var(--ink); }

/* ---- Article list (homepage) ---- */
.category-filter { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.cat-btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  text-transform: capitalize;
}
.cat-btn:hover { color: var(--ink); border-color: var(--ink-soft); }
.cat-btn.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.article-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.25rem; max-width: 720px; }
.article-item { border-bottom: 1px solid var(--line-soft); padding-bottom: 1.25rem; }
.article-title { font-size: 1.05rem; font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.35; }
.article-title:hover { color: var(--accent); }
.article-summary { color: var(--ink-soft); font-size: 0.92rem; margin: 0.35rem 0 0.5rem 0; max-width: var(--line-len); }
.article-meta { display: flex; align-items: center; gap: 0.75rem; font-size: 0.78rem; color: var(--muted); }
.article-cat { text-transform: capitalize; }
.article-empty { color: var(--muted); font-size: 0.95rem; padding: 2rem 0; text-align: center; list-style: none; }

/* ---- Source bias badge + share button (see src/sourceBias.js) ---- */
.bias-badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.08rem 0.4rem;
  border-radius: 4px;
  color: #fff;
}
.bias-badge.bias-left { background: #3B6EA5; }
.bias-badge.bias-lean-left { background: #6C97C4; }
.bias-badge.bias-center { background: #6B6B6B; }
.bias-badge.bias-lean-right { background: #C47A6C; }
.bias-badge.bias-right { background: #B0463A; }

.tier-badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.08rem 0.4rem;
  border-radius: 4px;
  color: var(--muted);
  border: 1px solid var(--line);
}

.article-share-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
}
.article-share-btn:hover { color: var(--ink); }

.article-map-link { font-size: 0.78rem; color: var(--accent); text-decoration: none; }
.article-map-link:hover { text-decoration: underline; }

.snapshot-strip:not([hidden]) { display: flex; }
.snapshot-strip {
  flex-wrap: wrap;
  gap: 0;
  list-style: none;
  margin: 0 0 1.4rem 0;
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.snapshot-item {
  padding: 0.65rem 1.1rem 0.65rem 0;
  margin-right: 1.1rem;
  border-right: 1px solid var(--line-soft);
}
.snapshot-item:last-child { border-right: none; margin-right: 0; }
.snapshot-item a {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
}
.snapshot-item a:hover { color: var(--accent); }

.balance-bar:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.balance-bar {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1.2rem;
}
.balance-bar-track { display: flex; height: 8px; width: 140px; border-radius: 999px; overflow: hidden; background: var(--line-soft); }
.balance-bar-seg { height: 100%; }
.balance-bar-seg.bias-left { background: #3B6EA5; }
.balance-bar-seg.bias-lean-left { background: #6C97C4; }
.balance-bar-seg.bias-center { background: #6B6B6B; }
.balance-bar-seg.bias-lean-right { background: #C47A6C; }
.balance-bar-seg.bias-right { background: #B0463A; }

.sparkline { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.sparkline.sparkline-up { color: var(--ok); }
.sparkline.sparkline-down { color: var(--danger); }
.sparkline-note { font-size: 0.68rem; color: var(--muted); margin-left: 0.35rem; }
.zscore-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  color: var(--danger);
  border: 1px solid var(--danger);
  cursor: help;
}

/* ---- Global Monitor (ACLED map) ---- */
.archive-extra-filters {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.archive-extra-filters > div { min-width: 160px; flex: 1; }
.archive-extra-filters label { margin-bottom: 0.3rem; }
.archive-extra-filters input { width: 100%; }

.map-search { display: flex; gap: 0.6rem; margin-bottom: 1rem; max-width: 420px; }
.map-search-input { width: auto; flex: 1; }
.map-search-input.map-search-input-notfound { border-color: var(--danger); }

.monitor-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.monitor-controls select {
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
}
.monitor-count { margin-left: auto; color: var(--muted); font-size: 0.8rem; }

.monitor-map {
  width: 100%;
  height: 480px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--line-soft);
  margin-bottom: 1rem;
}
.monitor-map .leaflet-popup-content-wrapper,
.monitor-map .leaflet-popup-tip {
  background: var(--panel);
  color: var(--ink);
}
.monitor-popup { font-size: 0.82rem; line-height: 1.5; max-width: 240px; }
.monitor-popup-notes { color: var(--ink-soft); }
.monitor-popup-link { display: inline-block; margin-top: 0.3rem; font-size: 0.78rem; }

.globe-wrap { position: relative; margin-bottom: 1rem; }
.globe-wrap .monitor-map { margin-bottom: 0; }
.globe-wrap:fullscreen .monitor-map,
.globe-wrap:-webkit-full-screen .monitor-map { height: 100vh; border-radius: 0; }
.globe-controls { position: absolute; top: 0.6rem; right: 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; z-index: 5; }
.globe-ctrl-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.globe-ctrl-btn:hover { background: var(--line-soft); }

.monitor-legend { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 2.5rem; font-size: 0.78rem; color: var(--muted); }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: var(--muted);
  cursor: pointer;
}
.legend-item:hover { color: var(--ink); }
.legend-item-off { opacity: 0.4; }
.legend-swatch { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend-divider { width: 1px; align-self: stretch; background: var(--line); margin: 0 0.3rem; }

.event-list-heading { margin-bottom: 0.75rem; }
.event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; max-width: 720px; }
.event-item { display: flex; gap: 0.65rem; border-bottom: 1px solid var(--line-soft); padding-bottom: 1rem; }
.event-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-top: 0.4rem; }
.event-body { display: flex; flex-direction: column; gap: 0.2rem; }
.event-title { font-weight: 600; color: var(--ink); font-size: 0.95rem; }
.event-place { color: var(--ink-soft); font-size: 0.85rem; }
.event-actors { color: var(--ink-soft); font-size: 0.82rem; font-style: italic; }
.event-meta { color: var(--muted); font-size: 0.78rem; }

/* ---- Methodology table ---- */
.methodology-table { width: 100%; max-width: 480px; border-collapse: collapse; margin: 1rem 0 1.5rem 0; font-size: 0.88rem; }
.methodology-table th, .methodology-table td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line-soft); }
.methodology-table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.methodology-table td { color: var(--ink-soft); }

/* ---- Monitor: quake toggle + prediction markets ---- */
.monitor-toggle { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; user-select: none; }
.projection-toggle { display: inline-flex; gap: 0.4rem; }
.projection-toggle .cat-btn { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.monitor-toggle input { accent-color: var(--ink); cursor: pointer; }
.monitor-markets-note { color: var(--muted); font-size: 0.85rem; max-width: var(--line-len); margin-bottom: 1.25rem; }

.market-list { list-style: none; margin: 0 0 3rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; max-width: 640px; }
.market-item { border-bottom: 1px solid var(--line-soft); padding-bottom: 0.9rem; }
.market-platform {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--line-soft);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-bottom: 0.3rem;
}
.market-title { display: block; color: var(--ink); font-weight: 600; font-size: 0.92rem; text-decoration: none; margin-bottom: 0.4rem; }
.market-title:hover { color: var(--accent); }
.market-bar-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.3rem; }
.market-outcome-label { font-size: 0.82rem; color: var(--ink-soft); }
.market-bar { position: relative; height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; display: flex; }
.market-bar-fill { height: 100%; background: var(--accent); }
.market-bar-fill-second { height: 100%; background: var(--muted); }
.market-pct { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.market-runner-up { font-size: 0.76rem; color: var(--muted); margin: 0.3rem 0 0 0; }
.market-delta { font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.market-delta.fx-up { color: var(--ok); }
.market-delta.fx-down { color: var(--danger); }
.market-delta.market-delta-big { text-decoration: underline; text-decoration-style: dotted; }
.market-news-link { margin: 0.3rem 0 0 0; }

.situation-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.6rem 0;
}
.situation-confidence { font-size: 0.82rem; color: var(--ink-soft); margin: 0.6rem 0 0 0; }
.situation-caveats { margin: 0.5rem 0 0 0; padding-left: 1.2rem; font-size: 0.78rem; color: var(--muted); }

.archive-status-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.rss-link { font-size: 0.82rem; color: var(--accent); text-decoration: none; white-space: nowrap; }
.rss-link:hover { text-decoration: underline; }

.nl-search-panel { margin-bottom: 1.5rem; }
.nl-search-panel summary { cursor: pointer; font-size: 0.85rem; color: var(--ink-soft); }
.nl-search-panel summary:hover { color: var(--accent); }
.market-end-date { font-size: 0.76rem; color: var(--muted); margin: 0.2rem 0 0 0; }

.fx-list { list-style: none; margin: 0 0 3rem 0; padding: 0; display: flex; flex-direction: column; gap: 0; max-width: 480px; border-top: 1px solid var(--line-soft); }
.fx-item { display: flex; align-items: center; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line-soft); font-size: 0.9rem; }
.fx-search {
  width: 100%;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  margin-bottom: 0.75rem;
}
.fx-currency { font-weight: 600; color: var(--ink); width: 9ch; display: flex; flex-direction: column; }
.fx-name { font-weight: 400; font-size: 0.72rem; color: var(--muted); }
.fx-rate { color: var(--ink-soft); flex: 1; }
.fx-change { font-weight: 600; font-size: 0.85rem; color: var(--muted); }
.fx-change.fx-up { color: var(--ok); }
.fx-change.fx-down { color: var(--danger); }

.entity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.entity-item { display: flex; align-items: baseline; gap: 0.6rem; border-bottom: 1px solid var(--line-soft); padding-bottom: 0.7rem; }
.entity-name { font-weight: 600; color: var(--ink); font-size: 0.88rem; }
.entity-type { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.entity-count { font-size: 0.78rem; color: var(--ink-soft); margin-left: auto; }
.entity-sentiment { font-size: 0.78rem; font-weight: 600; width: 4.5ch; text-align: right; }
.entity-sentiment.sentiment-positive { color: var(--ok); }
.entity-sentiment.sentiment-negative { color: var(--danger); }
.entity-sentiment.sentiment-neutral { color: var(--muted); }
.entity-search-link { font-size: 0.72rem; color: var(--accent); text-decoration: none; }
.entity-search-link:hover { text-decoration: underline; }

/* ---- Monitor dashboard ---- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; align-items: start; }
.dashboard-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.dashboard-box h2 { margin: 0; }
.dashboard-box .market-list,
.dashboard-box .fx-list,
.dashboard-box .event-list { max-width: none; margin-bottom: 0; }
.market-no-data { color: var(--muted); font-size: 0.78rem; margin: 0; }

.dashboard-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 1.1rem 1.4rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.dashboard-box-header:hover { background: var(--line-soft); }
.dashboard-box-expand { color: var(--muted); font-size: 1rem; flex-shrink: 0; }
.dashboard-box-body { padding: 1.3rem 1.4rem; max-height: 420px; overflow-y: auto; }

.fx-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.fx-controls label { font-size: 0.8rem; color: var(--muted); }
.fx-controls select {
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
}
.fx-controls .fx-search { flex: 1 1 200px; margin-bottom: 0; }

/* Expanded box: an in-window modal on desktop, a full-page takeover on
   mobile (see the media query below) - either way, closing hands you back
   to the dashboard exactly where you left it, since the box's real DOM
   node (with its live-updating content) just moves back into place rather
   than being rebuilt. */
.box-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  padding: 4vh 4vw;
}
/* Setting display unconditionally on .box-overlay would override the
   browser's default [hidden] { display: none }, leaving it clickable and
   visible even while the hidden attribute is set - only apply flex when
   the element is actually shown. */
.box-overlay:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
}
.box-overlay-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: min(720px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.box-overlay-titlebar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); }
.box-overlay-titlebar h2 { margin: 0; }
.box-overlay-close {
  background: none;
  border: none;
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.3rem;
  flex-shrink: 0;
}
.box-overlay-close:hover { color: var(--accent); }
.box-overlay-content { padding: 1.3rem 1.4rem; overflow-y: auto; }
.box-overlay-content .dashboard-box-body { padding: 0; max-height: none; overflow-y: visible; }

@media (max-width: 640px) {
  .box-overlay { padding: 0; }
  .box-overlay-panel { width: 100%; height: 100%; max-height: 100%; border-radius: 0; border: none; }
}
