:root {
  --paper: #f7f3ea;
  --paper2: #efe9db;
  --ink: #1c1917;
  --ink-soft: #57534e;
  --ink-faint: #a8a29e;
  --amber: #d97706;
  --amber-soft: #fde68a;
  --rule: #d6cdb8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100%;
}

body { padding-bottom: 28px; }

.mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }

/* --- Wire header ------------------------------------------------------- */
.wirehead {
  background: var(--ink);
  color: var(--paper);
  padding: 14px 16px 12px;
  border-bottom: 4px double var(--amber);
}

.wirehead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wire-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.wire-mark {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--amber);
  color: var(--ink);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.5px;
  border-radius: 2px;
}

.wire-brand h1 {
  font-size: 17px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wire-clock {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--amber-soft);
  letter-spacing: 1px;
}

.wire-sub {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #d6d3d1;
  letter-spacing: 0.6px;
}

.wire-badge {
  background: var(--amber);
  color: var(--ink);
  font-weight: 900;
  font-size: 9.5px;
  letter-spacing: 2px;
  padding: 2px 7px;
  border-radius: 2px;
}

/* --- Flash bar --------------------------------------------------------- */
.flash {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: var(--amber-soft);
  border-bottom: 1px solid var(--rule);
  padding: 9px 16px;
  font-size: 12.5px;
}

.flash-tag {
  flex: 0 0 auto;
  color: var(--amber);
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 2px;
  animation: blink 1.6s steps(2, start) infinite;
}

@keyframes blink { to { visibility: hidden; } }

.flash-text {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Tabs -------------------------------------------------------------- */
.nav-wrap {
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 5;
  border-bottom: 2px solid var(--ink);
}

.wiretabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 10px 16px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--amber) transparent;
  cursor: grab;
  user-select: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.wiretabs:active { cursor: grabbing; }

.wiretabs::-webkit-scrollbar { height: 5px; }
.wiretabs::-webkit-scrollbar-thumb { background: var(--amber); border-radius: 3px; }
.wiretabs::-webkit-scrollbar-track { background: var(--rule); }

.edge {
  position: absolute;
  top: 0;
  bottom: 2px;
  width: 34px;
  border: none;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  padding: 0;
}

.edge-l { left: 0; background: linear-gradient(90deg, var(--paper) 60%, transparent); }
.edge-r { right: 0; background: linear-gradient(270deg, var(--paper) 60%, transparent); }
.edge[hidden] { display: none; }

.tab {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 13px;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
}

.tab.active {
  background: var(--ink);
  color: var(--amber-soft);
}

/* --- Wire feed ---------------------------------------------------------- */
.wirefeed { padding: 4px 0 0; }

.lead {
  padding: 16px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  background: var(--paper2);
}

.lead figcaption, .lead figure { margin: 0; }

.lead figure {
  margin: 10px 0 12px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  height: 190px;
}

.lead figure img { width: 100%; height: 100%; object-fit: cover; display: block; }

.lead h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  line-height: 1.25;
  font-weight: 800;
}

.lead .lede {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row {
  display: flex;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  align-items: flex-start;
}

.row:active { background: var(--paper2); }

.row-time {
  flex: 0 0 52px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--amber);
  font-weight: 700;
  padding-top: 2px;
}

.row-main { flex: 1; min-width: 0; }

.row-tags { display: flex; gap: 6px; margin-bottom: 4px; align-items: center; }

.row-cat {
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  padding: 2px 6px;
  border-radius: 2px;
}

.row-src { font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.8px; }

.row h3 {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.35;
}

.row-thumb {
  flex: 0 0 84px;
  width: 84px;
  height: 64px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--rule);
}

.row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- Load state --------------------------------------------------------- */
.loadstate { text-align: center; color: var(--ink-faint); padding: 44px 16px; font-size: 13.5px; }

/* --- Dispatch overlay ---------------------------------------------------- */
.dispatch-overlay {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 50;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.22s ease;
}

.dispatch-overlay.open { transform: translateY(0); }

.dispatch { max-width: 640px; margin: 0 auto; padding-bottom: 48px; }

.dispatch-close {
  position: sticky;
  top: 0;
  width: 100%;
  text-align: left;
  background: var(--ink);
  color: var(--paper);
  border: none;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 13px 16px;
  cursor: pointer;
  z-index: 2;
}

.dispatch-head { padding: 20px 18px 0; }

.dispatch-route {
  display: inline-block;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid var(--amber);
  padding: 4px 8px;
  border-radius: 2px;
  margin-bottom: 12px;
}

.dispatch-head h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.22;
}

.dispatch-meta {
  margin-top: 10px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.5px;
}

.dispatch-fig {
  margin: 16px 18px 0;
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  height: 210px;
}

.dispatch-fig img { width: 100%; height: 100%; object-fit: cover; }

.dispatch-text {
  padding: 16px 18px 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.dispatch-text::first-letter {
  font-family: Georgia, serif;
  font-size: 42px;
  font-weight: 800;
  float: left;
  line-height: 0.85;
  padding: 4px 8px 0 0;
  color: var(--ink);
}

.dispatch-actions { display: flex; gap: 10px; padding: 24px 18px 0; }

.wbtn {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 13px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
}

.wbtn-solid { background: var(--amber); color: #fff; }
.wbtn-line { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }

.dispatch-end {
  text-align: center;
  margin-top: 28px;
  color: var(--ink-faint);
  font-family: Georgia, serif;
  letter-spacing: 3px;
}
