:root {
  color-scheme: light dark;
  /* Warm ivory instead of a cool blue-grey — the single biggest lever for
     making the whole app feel less clinical. Every neutral below (fg,
     muted, borders, card backgrounds) carries a touch of the same warm
     undertone so they read as one consistent, cared-for palette rather
     than "grey slapped on top of grey." */
  --bg: #faf7f2;
  --bg-glow: rgba(255, 205, 150, 0.16);
  --fg: #2a2420;
  --muted: #766c60;
  --muted-2: #a89c8c;
  --card-bg: #fffdfa;
  --card-bg-hover: #fffaf1;
  --input-bg: #fdfaf5;
  --border: #ecdfd0;
  --border-soft: #f2e9dd;
  --topbar-bg: rgba(255, 253, 249, 0.82);

  --accent: #7c4dd9;
  --accent-hover: #6c3fc7;
  --accent-2: #e8834f;
  --accent-fg: #ffffff;
  --accent-soft: rgba(124, 77, 217, 0.11);

  --danger: #d1503f;
  --danger-hover: #bd4433;
  --danger-soft: rgba(209, 80, 63, 0.11);

  --success: #227c5c;
  --success-soft: rgba(34, 124, 92, 0.12);

  --warn: #b3690a;
  --warn-soft: rgba(179, 105, 10, 0.14);

  --cat-game: #8b3fd6;
  --cat-game-soft: rgba(139, 63, 214, 0.12);
  --cat-tv: #1978a8;
  --cat-tv-soft: rgba(25, 120, 168, 0.12);
  --cat-sport: #b3401f;
  --cat-sport-soft: rgba(179, 64, 31, 0.12);

  /* Shadows tinted warm brown rather than pure black — pure-black shadows
     are what make flat UI read as "cold plastic"; a warm-toned shadow
     reads more like ink on paper. */
  --shadow: 0 1px 2px rgba(64, 40, 16, 0.05), 0 2px 12px rgba(64, 40, 16, 0.05);
  --shadow-hover: 0 14px 32px rgba(64, 40, 16, 0.13);
  --radius: 12px;
  /* Deliberately the plain system sans, not a rounded/display variant —
     the audience here wants to scan a list and know what needs attention,
     so clarity and directness matter more than personality in the
     typeface. Warmth comes from color, spacing, and shadow instead. */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Same idea in the dark palette: warm charcoal instead of blue-black,
       so the two themes feel like the same product rather than two
       different ones stitched together. */
    --bg: #14100d;
    --bg-glow: rgba(180, 110, 60, 0.14);
    --fg: #f3ece3;
    --muted: #a99d8e;
    --muted-2: #746a5d;
    --card-bg: #1e1814;
    --card-bg-hover: #251e18;
    --input-bg: #17120e;
    --border: #33291f;
    --border-soft: #241d17;
    --topbar-bg: rgba(20, 16, 13, 0.8);

    --accent: #a084ee;
    --accent-hover: #b198f2;
    --accent-2: #f0a06a;
    --accent-fg: #1c1512;
    --accent-soft: rgba(160, 132, 238, 0.18);

    --danger: #ef8177;
    --danger-hover: #f2988f;
    --danger-soft: rgba(239, 129, 119, 0.16);

    --success: #57d19c;
    --success-soft: rgba(87, 209, 156, 0.15);

    --warn: #f0b64c;
    --warn-soft: rgba(240, 182, 76, 0.16);

    --cat-game: #bb9bfc;
    --cat-game-soft: rgba(187, 155, 252, 0.16);
    --cat-tv: #5cc2f5;
    --cat-tv-soft: rgba(92, 194, 245, 0.16);
    --cat-sport: #f0855c;
    --cat-sport-soft: rgba(240, 133, 92, 0.18);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 14px rgba(0, 0, 0, 0.28);
    --shadow-hover: 0 18px 40px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  /* A very soft warm glow rising from the top of the page rather than one
     flat block of color — subtle enough not to read as "themed," but it
     gives the page a sense of light and depth instead of a flat fill. */
  background:
    radial-gradient(ellipse 1200px 600px at 50% -10%, var(--bg-glow), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { letter-spacing: -0.015em; line-height: 1.3; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.home-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.home-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-status {
  color: var(--muted);
  font-size: 0.85rem;
  margin-right: 0.15rem;
  white-space: nowrap;
}

.due-tag {
  display: inline-block;
  color: var(--warn);
  background: var(--warn-soft);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}

/* The header's small copy of the app mark (public/icons/mark.svg) — sized to
   sit on the same line as the "SideQuest" text next to it. */
.brand-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1.05rem;
  border-radius: 9px;
  /* A faint gradient instead of a flat fill gives the primary action a bit
     of depth/polish without shouting for attention — the kind of detail
     that reads as "cared about" rather than "decorative." */
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 100%, white 6%), var(--accent));
  color: var(--accent-fg);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover { background: var(--accent-hover); box-shadow: 0 6px 18px var(--accent-soft); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); box-shadow: none; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); box-shadow: 0 6px 18px var(--danger-soft); }

/* The notification bell's "already on" state (see pwa.js's syncButton) —
   a tinted fill rather than a totally different button style, so it reads
   as "this secondary button is currently active" rather than a whole new
   kind of control. */
.btn-secondary.btn-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
  transition: color 0.15s ease;
}
.back-link:hover { color: var(--accent); }

.category { margin-bottom: 2.5rem; }
.category h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: 1.05rem;
  font-weight: 700;
}
.cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0.32em 0.4em;
  border-radius: 8px;
  background: var(--border-soft);
  color: var(--fg);
  /* A hairline ring in the category's own color, on top of its soft tinted
     background — gives each chip a bit of definition instead of a flat
     wash, and doubles as an at-a-glance color key when scanning a page
     full of different categories. */
  box-shadow: inset 0 0 0 1px var(--border-soft);
}
.cat-icon.cat-game { background: var(--cat-game-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-game) 30%, transparent); }
.cat-icon.cat-tv { background: var(--cat-tv-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-tv) 30%, transparent); }
.cat-icon.cat-sport { background: var(--cat-sport-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-sport) 30%, transparent); }

.cat-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--border-soft);
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  font-family: var(--font-mono);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
}

.card {
  display: block;
  /* Padding used to live directly on .card, but now that a card can have a
     full-bleed cover image at the top, the image needs to reach the card's
     own edges/corners while the text below it stays padded — hence
     .card-body carrying the padding instead (see below). `overflow: hidden`
     is what makes the image respect the card's rounded corners. */
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  text-decoration: none;
  color: var(--fg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  background: var(--card-bg-hover);
}

.card.cat-game { border-left-color: var(--cat-game); }
.card.cat-tv { border-left-color: var(--cat-tv); }
.card.cat-sport { border-left-color: var(--cat-sport); }

.card-paused { opacity: 0.55; border-left-style: dashed; }

.card-body { padding: 1.25rem 1.35rem; }

/* A fixed aspect-ratio box (rather than a fixed pixel height) means the
   image looks right regardless of the source picture's real dimensions, and
   `object-fit: cover` crops it to fill that shape instead of stretching or
   letterboxing. But "the shape" isn't the same for both categories: Steam
   headers are wide/landscape (16:9-ish), while TVmaze posters are tall
   portraits — forcing a portrait poster into a 16:9 box crops away most of
   it (just a sliver across the middle), so the box shape itself needs to
   differ per category, not just share one ratio. Default (16:9) covers
   game cards; `.cat-tv` below overrides it for tv cards. */
.card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--border-soft);
}
.card.cat-tv .card-cover {
  /* Close to TVmaze's own "medium_portrait" image ratio (~210×295) — a
     portrait poster shown at roughly its native shape instead of cropped
     into a landscape sliver. */
  aspect-ratio: 2 / 3;
}

.card h3 { margin: 0 0 0.45rem; font-size: 1.02rem; font-weight: 700; }
.card .latest { margin: 0 0 0.35rem; font-size: 0.9rem; }

.paused-tag {
  display: inline-block;
  font-weight: 600;
  font-size: 0.78rem;
}

.meta { color: var(--muted); font-size: 0.85rem; margin: 0; font-family: var(--font-mono); }
.error-text { color: var(--danger); }
.muted { color: var(--muted); }
.empty { color: var(--muted); }
.subtitle { color: var(--muted); font-size: 0.92rem; line-height: 1.55; margin: 0 0 1.5rem; max-width: 62ch; }

.dashboard-summary {
  display: inline-block;
  margin: 0 0 1.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
}

.dashboard-toolbar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

#search-input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--fg);
  font-size: 0.92rem;
  font-family: var(--font-sans);
}
/* Same focus treatment as .btn:focus-visible (a plain outline) rather than
   the soft glow box-shadow this used to have — the two controls sit right
   next to each other in the toolbar, so a different focus style on each
   read as inconsistent rather than intentional. */
#search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

#sort-select {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--fg);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .dashboard-toolbar { flex-direction: column; }
}

.empty-state {
  text-align: center;
  padding: 4.5rem 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
}
.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  font-size: 2rem;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--accent-soft);
}
.empty-state h2 { margin: 0 0 0.4rem; }
.empty-state p { color: var(--muted); margin: 0 0 1.4rem; }

/* The landing page (index.html): clickable rows instead of a long scroll of
   every category at once — "Games" and "TV" each lead to their own full
   page. Deliberately reuses the same visual language as everywhere else in
   the app (the colored .cat-icon chip from category headings, the colored
   left border from .card) rather than inventing a separate "big centered
   icon card" look just for this page — a compact left-to-right row with a
   color-coded chip reads as part of the same product, not a generic bolted-
   on landing screen. `auto-fit` + `minmax` goes to one column on a narrow
   phone screen without a separate media query. */
.category-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}
.tile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  background: var(--card-bg);
  text-decoration: none;
  color: var(--fg);
  transition: background 0.15s ease, border-left-color 0.15s ease, transform 0.15s ease;
}
.tile:hover { background: var(--card-bg-hover); transform: translateX(2px); }
.tile.cat-game { border-left-color: var(--cat-game); }
.tile.cat-tv { border-left-color: var(--cat-tv); }
.tile.cat-sport { border-left-color: var(--cat-sport); }

.tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 11px;
  font-size: 1.4rem;
  flex-shrink: 0;
  background: var(--border-soft);
}
.tile.cat-game .tile-icon { background: var(--cat-game-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-game) 30%, transparent); }
.tile.cat-tv .tile-icon { background: var(--cat-tv-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-tv) 30%, transparent); }
.tile.cat-sport .tile-icon { background: var(--cat-sport-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-sport) 30%, transparent); }

.tile-text { display: flex; flex-direction: column; gap: 0.1rem; }
.tile-label { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; }
.tile-count { color: var(--muted); font-size: 0.8rem; font-family: var(--font-mono); }

/* A subtle "→" that slides in on hover — the one bit of motion that signals
   "this goes somewhere" without the heavier lift-and-shadow treatment. */
.tile-arrow {
  margin-left: auto;
  color: var(--muted);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.tile:hover .tile-arrow { opacity: 1; transform: translateX(0); }

.form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 500px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.form input, .form select {
  /* explicit width + min-width: 0 (rather than relying on flex stretch)
     because <select> sizes itself to fit its widest *option* text, not
     just the selected one — without this a long option (e.g. the Steam
     source type's description) forces the select wider than its flex
     container can shrink it, overflowing the page on narrow screens. */
  width: 100%;
  min-width: 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 400;
  font-family: var(--font-sans);
}

.form input:focus, .form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* Wraps the source-title input on the add-item form so its live-search
   dropdown (.suggestions, below) can be positioned directly under it —
   `position: relative` here is what makes the dropdown's `position:
   absolute` measure itself against this box instead of the whole page. */
.autocomplete { position: relative; }

.suggestions {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-hover);
  max-height: 280px;
  overflow-y: auto;
}

.suggestion {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 400;
}
.suggestion:hover, .suggestion.suggestion-active { background: var(--accent-soft); }

.suggestion-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--input-bg);
}

.suggestion-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.suggestion-title { font-size: 0.9rem; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-subtitle { font-size: 0.78rem; color: var(--muted); }

.form fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0;
}

.form legend {
  padding: 0 0.4rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.hint {
  margin: -0.6rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 400;
}

/* Wider and shorter than the dashboard card's 16:9 for a Steam header,
   since this sits at the top of a whole page rather than a small grid
   tile. A TVmaze portrait poster stretched across that same wide, short
   shape crops away almost all of it though (the same problem .card-cover
   has, just worse at this shape's more extreme ratio) — `.cat-tv` below
   gives it a narrower, taller box instead, closer to the poster's own
   shape, capped with max-width so it doesn't tower over the page. */
.detail-cover {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.detail-cover.cat-tv {
  width: auto;
  max-width: 320px;
  aspect-ratio: 2 / 3;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.detail-header h2 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.check-interval-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1.25rem;
}
.check-interval-row select {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
}

.recommendations {
  margin: 0 0 1.5rem;
}

.recommendation-cards {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.recommendation-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 110px;
  flex: 0 0 auto;
  color: inherit;
  text-decoration: none;
}

.recommendation-poster {
  width: 110px;
  height: 156px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--card-bg);
}

.recommendation-title {
  font-size: 0.8rem;
  line-height: 1.25;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 8, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 100;
}
.confirm-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 1.5rem;
  max-width: 380px;
  width: 100%;
}
.confirm-box p { margin: 0 0 1.25rem; color: var(--fg); line-height: 1.45; }
.confirm-box input {
  width: 100%;
  box-sizing: border-box;
  margin: -0.5rem 0 1.25rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--fg);
  font-size: 0.95rem;
  font-family: var(--font-sans);
}
.confirm-box input:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }

.updates {
  list-style: none;
  padding: 0 0 0 1.4rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  position: relative;
}

.updates::before {
  content: "";
  position: absolute;
  left: 0.3rem;
  top: 0.6rem;
  bottom: 0.6rem;
  width: 1px;
  background: var(--border);
}

.update {
  position: relative;
  display: flex;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

/* Fixed square thumbnail (for a per-update image, if any fetcher ever sets
   one — see item.js's renderUpdate) rather than matching the update's own
   image aspect ratio, since these sit in a narrow timeline column where a
   consistent small square reads better than
   variously-shaped tiles. */
.update-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border-soft);
}

/* min-width: 0 overrides flex's default "never shrink below content size,"
   which without this would let a long unbroken title push the thumbnail
   out of the card instead of wrapping normally. */
.update-body { flex: 1; min-width: 0; }

.update::before {
  content: "";
  position: absolute;
  left: -1.4rem;
  top: 1.35rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--bg);
}

.update-unread { border-color: var(--accent); }
.update-unread::before { background: var(--accent); }

.update h4 { margin: 0 0 0.35rem; font-size: 1rem; }
.update h4 a { color: var(--fg); }
.update h4 a:hover { color: var(--accent); }
.update .summary { font-size: 0.9rem; }

.summary-details summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
}
.summary-details summary::marker { color: var(--accent); }

.flashes { list-style: none; padding: 0; margin: 0 0 1rem; }
.flash {
  padding: 0.65rem 0.95rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.flash-success { background: var(--success-soft); color: var(--success); border-color: var(--success-soft); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-soft); }

.live-stats {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.live-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}

/* A small solid dot rather than a live-updating animation — this is a
   single-user local app with no websocket/polling loop backing it, so a
   pulsing "live" indicator would be promising freshness the app doesn't
   actually deliver every second. The dot just signals "current as of this
   page load," which is the truth. */
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.review-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}
.review-badge.review-positive { color: var(--success); background: var(--success-soft); }
.review-badge.review-mixed { color: var(--warn); background: var(--warn-soft); }
.review-badge.review-negative { color: var(--danger); background: var(--danger-soft); }

.patch-highlight {
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  margin-bottom: 1.75rem;
}
.patch-highlight h4 { margin: 0.3rem 0 0.35rem; font-size: 1.05rem; }
.patch-highlight h4 a { color: var(--fg); }
.patch-highlight h4 a:hover { color: var(--accent); }

.recap {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  margin-bottom: 1.75rem;
}
.recap-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}
.recap-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.recap-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.88rem;
}
.recap-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .topbar { padding: 0.75rem 1rem; flex-wrap: wrap; row-gap: 0.6rem; }
  /* `flex-wrap: wrap` here (not on .topbar's buttons directly) lets whole
     buttons drop to a second line as a group when they don't all fit,
     instead of the text *inside* a single button wrapping onto two lines —
     that's what was making "Enable notifications" and "+ Track something"
     balloon into tall, clumsy pills on a phone-width screen. Each button
     itself stays one line (`white-space: nowrap` below), so wrapping only
     ever happens between buttons, never inside one. */
  .nav-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; row-gap: 0.5rem; }
  .nav-actions .btn { padding: 0.45rem 0.8rem; font-size: 0.82rem; white-space: nowrap; }
  .container { padding: 1.25rem 1rem 3rem; }
  .detail-header { flex-direction: column; }
  .updates { padding-left: 1.1rem; }
  .update::before { left: -1.1rem; }
}
