:root {
  --bg: #0b0b0e;
  --bg-soft: #15151c;
  --fg: #ececf0;
  --fg-dim: #a4a4ad;
  --fg-faint: #6d6d75;
  --accent: #c9b389;        /* warm parchment, news-paper-y */
  --rule: rgba(255, 255, 255, 0.08);

  --ok: #6ee7a7;
  --bad: #ef6b6b;
  --maybe: #c9b389;
  --warn: #d8a657;          /* muted amber, for the stale freshness dot */

  --col: 680px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Iowan Old Style', 'Charter', Georgia, ui-serif, serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

.layout {
  display: flex;
  align-items: flex-start;
  gap: 56px;
  max-width: 940px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}

.sidebar {
  position: sticky;
  top: 64px;
  flex: 0 0 168px;
  width: 168px;
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: var(--col);
}

.section {
  scroll-margin-top: 16px;
}

.brand {
  margin: 0 0 28px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
}

/* Freshness indicator (under the brand) */
.updated {
  margin: -16px 0 26px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--fg-faint);
}

.updated-line {
  display: block;
  position: relative;        /* anchor for the dot that overflows into the left gutter */
}

.updated time {
  color: var(--fg-dim);
  font-style: normal;
}

.updated-dot {
  position: absolute;        /* overflow into the left gutter so the text stays
                                flush with the brand and nav, not indented */
  left: -13px;
  top: 0.5em;                /* vertically centered on the first line */
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.updated-dot.stale {
  background: var(--warn);
}

.updated-next {
  display: block;
  margin-top: 2px;
  opacity: 0.85;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.nav a {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
  text-decoration: none;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--fg);
  text-decoration: none;
}

/* Per-section links under "Today's brief" (issue #457): lowercase sub-items,
   indented a step so they read as the brief's table of contents. */
.nav-sections {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-left: 10px;
}

.nav .nav-sections a {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
}

.home-link {
  display: inline-block;
  margin-top: 32px;
  font-size: 13px;
  color: var(--fg-faint);
}

.tagline {
  margin: 0;
  color: var(--fg-dim);
  font-size: 14.5px;
  font-style: italic;
}

.section + .section {
  margin-top: 56px;
}

.section h2 {
  margin: 0 0 20px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.empty {
  margin: 0;
  color: var(--fg-faint);
  font-style: italic;
  font-size: 14.5px;
}

/* Headlines */
.headlines,
.predictions {
  margin: 0;
  padding-left: 1.6em;
  list-style: decimal;
}

.headlines li,
.predictions li {
  margin-bottom: 22px;
}

.headline-title {
  font-weight: 600;
  color: var(--fg);
}

.sources {
  display: block;
  margin: 3px 0 0;
  color: var(--fg-faint);
  font-size: 13.5px;
  font-style: italic;
}

.sources a {
  color: inherit;
  text-decoration: none;
}

.sources a:hover,
.sources a:focus-visible {
  color: var(--fg);
  text-decoration: underline;
}

.summary {
  margin: 4px 0 0;
  color: var(--fg-dim);
  font-size: 15px;
}

/* Predictions */
.claim {
  color: var(--fg);
}

.expires,
.confidence {
  color: var(--fg-faint);
  font-size: 13.5px;
  font-style: italic;
}

/* Open-prediction lifespan line + "time-to-call" ripeness bar (issue #201) */
.lifespan {
  margin: 5px 0 0;
  color: var(--fg-faint);
  font-size: 13.5px;
  font-style: italic;
}

.lifespan .when { white-space: nowrap; }
.lifespan .rel { opacity: 0.85; }
.lifespan .dot { margin: 0 0.45em; opacity: 0.6; }

.ripeness {
  margin: 7px 0 0;
  max-width: 360px;
  height: 3px;
  border-radius: 2px;
  background: var(--rule);
  overflow: hidden;
}

.ripeness > span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}

.rationale {
  margin: 6px 0 0;
  color: var(--fg-dim);
  font-size: 14.5px;
}

/* Collapsed overflow of the predictions list */
.more-predictions {
  margin-top: 18px;
}

.more-predictions > summary {
  cursor: pointer;
  width: fit-content;
  color: var(--accent);
  font-size: 13.5px;
  list-style: none;
}

.more-predictions > summary::-webkit-details-marker {
  display: none;
}

.more-predictions > summary::before {
  content: '▸ ';
  font-size: 11px;
}

.more-predictions[open] > summary::before {
  content: '▾ ';
}

.more-predictions > summary:hover,
.more-predictions > summary:focus-visible {
  text-decoration: underline;
}

.more-predictions .predictions {
  margin-top: 22px;
}

/* Past entries */
.record {
  margin: 0 0 28px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  color: var(--fg);
}

.past-entry {
  margin-bottom: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.past-entry > header time {
  display: block;
  margin-bottom: 14px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--fg-faint);
  text-transform: uppercase;
}

.past-result {
  margin-bottom: 22px;
}

.past-prediction {
  display: flex;
  gap: 0.5em;
  margin: 0;
  font-size: 15px;
  color: var(--fg);
}

/* Outcome glyph: a crisp inline SVG check / cross rather than the unicode
   ✓ / ✗, which fell back to a generic symbol font and clashed with the serif
   body type (issue #241). Stroke inherits the outcome color via currentColor;
   the box is line-height tall so the mark centers on the claim's first line. */
.past-prediction .mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95em;
  height: 1.55em;
}

.past-prediction .mark svg {
  display: block;
  width: 0.82em;
  height: 0.82em;
}

.past-prediction .claim { flex: 1 1 auto; }

/* The grader's own reason for the verdict (issue #230): why the call was
   scored the way it was, shown in place of the originating story. */
.why {
  margin: 5px 0 0 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--fg-dim);
}

.why-label {
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11.5px;
}

.why a { color: var(--fg-faint); }

.outcome-yes  { color: var(--ok); }
.outcome-no   { color: var(--bad); }
.outcome-ambiguous { color: var(--maybe); }

/* Resolved prediction's predicted → judged dates line. */
.pred-dates {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5em;
  margin: 5px 0 0 18px;
  color: var(--fg-faint);
  font-size: 12.5px;
  font-style: italic;
}

.pred-dates .dot { opacity: 0.6; }
.pred-dates .lead { opacity: 0.85; }

/* Track record chart (issue #472): the inline SVG the web tier draws from
   predictions.json in place of the text sparkline. viewBox-scaled, so it
   always fits the column; the SVG text is set in viewBox units and bumped up
   on phones where the whole drawing scales down. */
.brief figure.track-chart {
  margin: 12px 0 4px;
}

.track-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.track-chart .vol { fill: var(--fg-faint); opacity: 0.22; }
.track-chart .axis { stroke: var(--fg-faint); stroke-width: 1; opacity: 0.55; }
.track-chart .ref { stroke: var(--fg-faint); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.7; }
.track-chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.track-chart .dot { fill: var(--accent); }
.track-chart .now { fill: var(--fg); font-size: 14px; font-weight: 600; }
.track-chart .tick { fill: var(--fg-faint); font-size: 10.5px; letter-spacing: 0.03em; }
.track-chart .hit { fill: transparent; }
.track-chart .hit:hover { fill: var(--fg); opacity: 0.08; }
/* The do-nothing forecaster (issue #479): dotted, in the muted ink, under the
   accuracy line. */
.track-chart .base {
  fill: none;
  stroke: var(--fg-faint);
  stroke-width: 1.6;
  stroke-dasharray: 1 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.track-chart .base-dot { fill: var(--fg-faint); }

/* The accuracy split by prediction shape under the chart (issue #479). */
.brief table.shape-split {
  width: 100%;
  margin: 10px 0 4px;
  border-collapse: collapse;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}
.brief table.shape-split th,
.brief table.shape-split td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--rule);
  text-align: right;
  white-space: nowrap;
}
.brief table.shape-split th[scope="row"],
.brief table.shape-split th:first-child {
  text-align: left;
  font-weight: 500;
  white-space: normal;
}
.brief table.shape-split thead th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.brief p.shape-note {
  margin: 8px 0 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--fg-faint);
}

.track-chart figcaption {
  margin-top: 8px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--fg-faint);
}

@media (max-width: 720px) {
  .track-chart .now { font-size: 20px; }
  .track-chart .tick { font-size: 14px; }
}

@media (max-width: 720px) {
  .layout {
    flex-direction: column;
    /* In column direction the row layout's align-items: flex-start stops the
       items stretching, so .content sized to its preferred width (--col =
       680px) and the whole article ran off the right edge of a phone
       (issue #452). Stretch: the items fill the viewport instead. */
    align-items: stretch;
    gap: 28px;
    padding: 32px 18px 72px;
  }
  .sidebar {
    position: static;
    width: auto;
    flex: none;
  }
  .brand { margin-bottom: 14px; }
  .updated { margin: 0 0 18px; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 16px; }
  .nav-sections { flex-direction: row; flex-wrap: wrap; gap: 12px 14px; margin-left: 0; }
  .home-link { margin-top: 20px; }
  body { font-size: 16px; }
}

/* ── Rendered news brief (issue #322) ──────────────────────────────────────
   The page is now the markdown the news-brief skill emits, rendered to HTML.
   Style its tags directly so the parchment-serif look carries over. */
.brief { max-width: var(--col); }

.brief h1 {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

/* The "_Last brief: … · N new of M_" line the skill renders as emphasis right
   under the title. */
.brief h1 + p em,
.brief > p:first-of-type em {
  font-style: italic;
  color: var(--fg-faint);
}

.brief h2 {
  scroll-margin-top: 16px;   /* room above an anchored section (issue #457) */
  margin: 40px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.brief h3 {
  margin: 24px 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.brief p { margin: 10px 0; }

.brief ul, .brief ol { margin: 10px 0; padding-left: 22px; }
.brief li { margin: 0 0 14px; }
.brief li::marker { color: var(--fg-faint); }

.brief strong { color: var(--fg); font-weight: 600; }

.brief a { color: var(--accent); word-break: break-word; }

.brief hr {
  margin: 32px 0 16px;
  border: 0;
  border-top: 1px solid var(--rule);
}

/* The footer "_Brief generated …_" line. */
.brief hr + p,
.brief > p:last-child em { color: var(--fg-faint); font-size: 14px; }

/* Collapsible prediction/results sections (issue #443): the section <h2> lives
   inside a <details><summary>. Keep the h2's full-width rule, replace the
   default disclosure triangle with a chevron on the heading line. */
.brief details.brief-section > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.brief details.brief-section > summary::-webkit-details-marker { display: none; }
.brief details.brief-section > summary h2::after {
  content: '▸';
  float: right;
  color: var(--fg-faint);
  letter-spacing: 0;
}
.brief details.brief-section[open] > summary h2::after { content: '▾'; }
.brief details.brief-section > summary:hover h2 { border-color: var(--accent); }

.brief code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--bg-soft);
  padding: 1px 5px;
  border-radius: 4px;
  /* The track-record sparkline is one unbreakable ~90-glyph run — wider than
     a phone, and it grows with every graded prediction (issue #452). Cap the
     box at the column and let it pan sideways rather than stretch the page. */
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  vertical-align: text-bottom;
}

@media (max-width: 720px) {
  .brief h1 { font-size: 25px; }
}

/* --- Reddit cookie admin form (issue #334) -------------------------------
   An unlisted, token-gated page for pasting a fresh anonymous Reddit cookie
   (which expires ~24h). Sans-serif UI chrome to set it apart from the serif
   brief body; on-brand parchment accent. */
.admin {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14.5px;
  max-width: 560px;
}
.admin h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 0.6rem;
}
.admin-lede { color: var(--fg-dim); line-height: 1.5; margin: 0 0 1.4rem; }
.admin-hint { color: var(--fg-faint); font-size: 12.5px; line-height: 1.5; margin: 0.2rem 0 0.6rem; }
.admin code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--bg-soft);
  padding: 1px 5px;
  border-radius: 4px;
}
.admin-messages { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.admin-msg {
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border-left: 3px solid var(--rule);
  background: var(--bg-soft);
  margin-bottom: 0.5rem;
}
.admin-msg.success { border-left-color: var(--ok); }
.admin-msg.error { border-left-color: var(--bad); }
.admin-status {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 1.4rem;
}
.admin-status p { margin: 0.2rem 0; }
.admin-keys { color: var(--fg-faint); font-size: 12.5px; }
.admin-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.admin-dot.ok { background: var(--ok); }
.admin-dot.off { background: var(--fg-faint); }
.admin-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.admin-form textarea,
.admin-form input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-soft);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.admin-form textarea:focus,
.admin-form input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}
.admin-actions { margin-top: 0.9rem; display: flex; gap: 0.6rem; }
.admin-form button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem 1.1rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #1a1710;
}
.admin-form button:hover { filter: brightness(1.08); }
.admin-form button.secondary {
  background: transparent;
  color: var(--fg-dim);
  border-color: var(--rule);
}
.admin-form button.secondary:hover { color: var(--fg); border-color: var(--fg-faint); }
