:root {
  --bg: #000000;
  --bg-deep: #0A0A0A;
  --card: #141414;
  --ink: #F3F1EC;
  --ink-soft: #C5C2BA;
  --ink-faint: #9C9890;
  --line: #2A2A2A;
  --sage: #8FB394;
  --sage-dark: #A8C9AC;
  --sage-soft: #1A241C;
  --sage-mid: #8AA48C;
  --sage-ink: #0A0A0A;
  --pill: #1C1C1C;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --header: 58px;
  --tabbar: 64px;
  --font-display: "Bricolage Grotesque", "Segoe UI", sans-serif;
  --font-sans: "Figtree", "Segoe UI", sans-serif;
  --max: 720px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
button, a { font-family: inherit; }
button { cursor: pointer; }
a { color: var(--sage); }

#app { min-height: 100%; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 20px 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "brand nav" "date nav";
  align-items: center;
  column-gap: 24px;
}
.wordmark {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}
.wordmark-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.leaf { color: var(--sage); display: inline-flex; margin-top: 1px; }
.dateline {
  grid-area: date;
  margin: 2px 0 0 26px;
  font-size: 0.78rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}
.desktop-nav {
  grid-area: nav;
  display: none;
  gap: 4px;
  align-items: center;
}
.desktop-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 999px;
}
.desktop-nav a.active {
  color: var(--sage);
  background: var(--sage-soft);
}

.ticker-wrap {
  border-top: 1px solid var(--line);
  background: #0A0A0A;
}
.ticker {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 8px;
  max-width: 1100px;
  margin: 0 auto;
}
.ticker::-webkit-scrollbar { display: none; }
.ticker-item {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--ink);
  white-space: nowrap;
  border-right: 1px solid var(--line);
  text-decoration: none;
}
.ticker-item:last-child { border-right: 0; }
.ticker-teams { font-weight: 600; letter-spacing: 0.01em; }
.ticker-score { font-variant-numeric: tabular-nums; font-weight: 600; }
.ticker-meta { color: var(--ink-faint); font-size: 0.72rem; }
.ticker-fav { color: var(--sage); }
.ticker-live .ticker-meta { color: var(--sage); font-weight: 600; }

#main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar) + 28px);
}
body.view-swipe #main,
body.view-story #main {
  max-width: none;
  padding: 0;
}
body.view-swipe .site-header,
body.view-swipe .tabbar { display: none; }
body.view-story .ticker-wrap,
body.view-story .site-header { display: none; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0 16px;
  margin: 0 -4px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 500;
}
.chip[aria-pressed="true"] {
  background: var(--sage);
  border-color: var(--sage);
  color: var(--sage-ink);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
  text-decoration: none;
  color: inherit;
  display: block;
  padding: 0;
  width: 100%;
  text-align: left;
}
.card:hover { border-color: color-mix(in srgb, var(--sage) 35%, var(--line)); }
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.mono {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sage-soft);
  color: var(--sage);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  flex: 0 0 auto;
}
.outlets { color: var(--ink-faint); }
.card-image {
  margin: 12px 16px 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-deep);
  aspect-ratio: 16 / 10;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-body { padding: 12px 16px 16px; }
.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.22rem;
  line-height: 1.28;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
  color: var(--ink);
}
.card-summary {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pill {
  display: inline-block;
  background: var(--pill);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.stopping {
  text-align: center;
  padding: 36px 20px;
  margin: 8px 0 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: transparent;
}
.stopping h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  margin: 0 0 8px;
}
.stopping p { margin: 0 0 16px; color: var(--ink-soft); }
.btn {
  appearance: none;
  border: 0;
  background: var(--sage);
  color: var(--sage-ink);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 999px;
  padding: 10px 20px;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--sage-dark); color: var(--sage-ink); }
.btn-ghost {
  background: transparent;
  color: var(--sage);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--sage-soft); }

.end-note {
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.88rem;
  padding: 12px 0 24px;
}

/* Expanded story */
.story {
  min-height: 100dvh;
  background: var(--bg);
  padding-bottom: calc(var(--tabbar) + 32px);
}
.story-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.story-bar .card-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--bg-deep); }
.story-hero {
  width: 100%;
  background: var(--bg-deep);
  overflow: hidden;
}
.story-hero img {
  width: 100%;
  height: 24vh;
  max-height: 180px;
  object-fit: cover;
  object-position: center 20%;
}
@media (min-width: 860px) {
  .story-hero img { height: 42vh; max-height: 420px; }
}
.story-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 20px 40px;
}
@media (min-width: 860px) {
  .story-inner { padding: 20px 20px 40px; }
}
.story-inner h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.55rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}
@media (min-width: 860px) {
  .story-inner h1 { font-size: 1.7rem; }
}
.story-summary {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0 0 14px;
}
.confirmed {
  font-size: 0.88rem;
  color: var(--ink-faint);
  margin: 0 0 22px;
}
.disclosure {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  margin: 0 0 12px;
}
.disclosure summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.6px solid var(--ink-soft);
  border-bottom: 1.6px solid var(--ink-soft);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.disclosure[open] summary::after { transform: rotate(-135deg); }
.disclosure-body {
  padding: 0 16px 16px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.attr { font-size: 0.8rem; color: var(--ink-faint); margin-top: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  padding: 10px 0 10px 16px;
  border-left: 2px solid var(--sage-soft);
  margin-left: 4px;
}
.timeline time {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-faint);
}
.timeline .t-source { font-weight: 600; color: var(--ink); font-size: 0.88rem; }
.timeline a { text-decoration: none; color: inherit; }
.story-actions { margin-top: 24px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Swipe */
.swipe {
  position: relative;
  height: 100dvh;
  background: #000000;
  color: #F3F1EC;
  overflow: hidden;
}
.swipe-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.swipe-bg {
  position: absolute;
  inset: 0;
  background: #000000 center / cover no-repeat;
}
.swipe-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,.2) 35%, rgba(0,0,0,.88) 100%);
}
.swipe-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
}
.swipe-top .icon-btn { color: #F3F1EC; }
.swipe-copy {
  position: relative;
  z-index: 2;
  padding: 0 24px calc(32px + env(safe-area-inset-bottom));
  max-width: 640px;
}
.swipe-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 8px;
  font-weight: 600;
}
.swipe-copy h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.85rem;
  line-height: 1.2;
  margin: 0 0 10px;
}
.swipe-copy p { margin: 0 0 16px; color: var(--ink-soft); font-size: 1.02rem; }
.swipe-nav {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.swipe-nav .icon-btn {
  background: rgba(255,255,255,.08);
  color: #F3F1EC;
  width: 44px;
  height: 44px;
}
.swipe-progress {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top));
  left: 20%;
  right: 20%;
  height: 3px;
  z-index: 4;
  display: flex;
  gap: 3px;
}
.swipe-progress i {
  flex: 1;
  background: rgba(243,241,236,.22);
  border-radius: 2px;
  height: 3px;
}
.swipe-progress i.on { background: var(--sage); }
.swipe-empty {
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

/* Local / sports / settings */
.page-intro { margin: 4px 0 18px; }
.page-intro h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.7rem;
  margin: 0 0 6px;
}
.page-intro p { margin: 0; color: var(--ink-soft); }
.empty {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.empty h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--ink);
  margin: 0 0 6px;
}
.score-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.score-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.score-league { font-size: 0.72rem; color: var(--ink-faint); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; margin-bottom: 6px; }
.score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 600;
  font-size: 1.05rem;
  gap: 12px;
}
.score-row .pts { font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.score-row.winner { color: var(--ink); }
.score-row.loser { color: var(--ink-soft); font-weight: 500; }
.score-status { margin-top: 6px; font-size: 0.8rem; color: var(--ink-faint); }
.fav-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.68rem;
  color: var(--sage);
  background: var(--sage-soft);
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 600;
  vertical-align: middle;
}

.settings-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.settings-block h2 {
  font-size: 1rem;
  margin: 0 0 10px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.98rem;
}
.choice input { accent-color: var(--sage); width: 16px; height: 16px; }
.hint { font-size: 0.85rem; color: var(--ink-faint); margin: 8px 0 0; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  text-decoration: none;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 0;
}
.tabbar a.active { color: var(--sage); }

@media (min-width: 860px) {
  .header-inner { padding: 12px 28px 10px; }
  .desktop-nav { display: flex; }
  .tabbar { display: none; }
  #main { padding: 22px 24px 60px; }
  .card-title { font-size: 1.32rem; }
  .story { padding-bottom: 60px; }
  .wordmark-text { font-size: 1.6rem; }
  /* Keep the first card's headline on screen at 1280x800 */
  .card-image {
    aspect-ratio: 16 / 9;
    max-height: 300px;
  }
}

@media (max-width: 859px) {
  .header-inner {
    grid-template-columns: 1fr;
    grid-template-areas: "brand" "date";
    padding: 10px 16px 8px;
  }
  .dateline { margin-left: 26px; }
}
