/* Ride-a-roo — browse layout. Light theme leans Luma (soft, airy cards),
   dark theme leans DICE (true black, bold white controls). */

:root {
  --bg: #f4f4f6;
  --bg-top: #ece8fb;
  --card: #ffffff;
  --text: #17171c;
  --muted: #6b6b76;
  --faint: #a3a3ad;
  --line: rgba(20, 20, 40, 0.09);
  --chip: #ebebf0;
  --chip-hover: #e1e1e8;
  --solid: #17171c;
  --on-solid: #ffffff;
  --accent: #ff5a1f;
  --accent-text: #c93f0e;
  --glass: rgba(244, 244, 246, 0.82);
  --shadow: 0 1px 2px rgba(20, 20, 40, 0.04), 0 6px 20px rgba(20, 20, 40, 0.05);
  --shadow-lg: 0 12px 40px rgba(20, 20, 40, 0.14), 0 2px 6px rgba(20, 20, 40, 0.06);
  --ok: #15803d;
  --warn: #b45309;

  --d-road: #3b82f6;
  --d-criterium: #8b5cf6;
  --d-time-trial: #0ea5a0;
  --d-track: #ef4444;
  --d-mtb: #16a34a;
  --d-bmx: #f59e0b;
  --d-gravel: #b7791f;
  --d-cyclocross: #ec4899;
  --d-triathlon: #64748b;

  --radius: 16px;
  --top-h: 0px;
  --bar-h: 0px;
  --stick: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-top: #16110f;
    --card: #131315;
    --text: #f5f5f7;
    --muted: #a1a1aa;
    --faint: #5f5f68;
    --line: rgba(255, 255, 255, 0.09);
    --chip: #1f1f23;
    --chip-hover: #2a2a2f;
    --solid: #ffffff;
    --on-solid: #000000;
    --accent-text: #ff8a55;
    --glass: rgba(0, 0, 0, 0.78);
    --shadow: none;
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
    --ok: #4ade80;
    --warn: #fbbf24;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg-top) 0, var(--bg) 460px) no-repeat, var(--bg);
  color: var(--text);
  font: 400 15px/1.45 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.ic { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[data-icon] { display: inline-flex; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--solid); color: var(--on-solid); padding: 8px 14px; border-radius: 999px; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- Top bar ---------- */
.top { position: sticky; top: 0; z-index: 30; background: var(--glass); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); }
.top-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; }
.logo-mark svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.logo-word { font-weight: 750; font-size: 18px; letter-spacing: -0.03em; }
.search { position: relative; flex: 1; max-width: 560px; margin: 0 auto; }
.search input {
  width: 100%; height: 42px; border: 1px solid transparent; border-radius: 999px; background: var(--chip);
  padding: 0 40px 0 42px; font-size: 15px; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.search input::placeholder { color: var(--muted); }
.search input:hover { background: var(--chip-hover); }
.search input:focus { outline: none; background: var(--card); border-color: var(--line); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.search-ic { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--muted); pointer-events: none; }
.search-kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 500 12px/1 "Inter", sans-serif; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; pointer-events: none; }
.search input:focus ~ .search-kbd { display: none; }
.top-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; flex: none; }
.top-link:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { padding-top: 36px; padding-bottom: 20px; }
.hero h1 { margin: 0; font-size: 36px; line-height: 1.1; font-weight: 750; letter-spacing: -0.035em; }
.hero-sub { margin: 8px 0 0; color: var(--muted); font-size: 16px; }
.section-label { margin: 28px 0 12px; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.tile {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); text-align: left; cursor: pointer; box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.tile:hover:not(:disabled) { transform: translateY(-2px); border-color: color-mix(in srgb, var(--dc) 45%, var(--line)); }
.tile:disabled { opacity: 0.4; cursor: default; }
.tile-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 22px; color: var(--dc); background: color-mix(in srgb, var(--dc) 13%, transparent); flex: none; transition: background 0.15s, color 0.15s; }
.tile-text { display: flex; flex-direction: column; min-width: 0; }
.tile-name { font-weight: 600; font-size: 15px; white-space: nowrap; }
.tile-n { font-size: 13px; color: var(--muted); }
.tile[aria-pressed="true"] { border-color: var(--dc); background: color-mix(in srgb, var(--dc) 9%, var(--card)); box-shadow: 0 0 0 1px var(--dc); }
.tile[aria-pressed="true"] .tile-ic { background: var(--dc); color: #fff; }

/* ---------- Filter bar ---------- */
.bar { position: sticky; top: var(--top-h); z-index: 25; background: var(--glass); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); border-bottom: 1px solid var(--line); }
.bar-inner { display: flex; align-items: center; gap: 8px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.pill-wrap { position: relative; display: inline-flex; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 13px; border: 0; border-radius: 999px;
  background: var(--chip); font-size: 14px; font-weight: 550; white-space: nowrap; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.pill:hover { background: var(--chip-hover); }
.pill > [data-icon]:first-child { font-size: 17px; }
.pill .chev { font-size: 15px; color: var(--muted); transition: transform 0.2s; }
.pill[aria-expanded="true"] .chev { transform: rotate(180deg); }
.pill-x { display: none; }
.pill-wrap.active .pill { background: var(--solid); color: var(--on-solid); padding-right: 42px; }
.pill-wrap.active .pill .chev { display: none; }
.pill-wrap.active .pill-x {
  display: grid; place-items: center; position: absolute; right: 5px; width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: color-mix(in srgb, var(--on-solid) 16%, transparent); color: var(--on-solid); font-size: 15px; cursor: pointer;
}
.pill-wrap.active .pill-x:hover { background: color-mix(in srgb, var(--on-solid) 28%, transparent); }
.reset { margin-left: 4px; }

.pop {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 40; width: 340px; padding: 18px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: pop-in 0.16s ease-out;
}
.pop-wide { width: 440px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.pop-title { margin: 0 0 12px; font-size: 15px; font-weight: 650; }
.pop-sub { margin: 16px 0 8px; font-size: 13px; color: var(--muted); }
.pop-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border: 0; border-radius: 999px;
  background: var(--chip); font-size: 14px; font-weight: 550; cursor: pointer; transition: background 0.12s, color 0.12s;
}
.chip:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--chip-hover); }
.chip[aria-pressed="true"]:hover { opacity: 0.88; }
.chip[aria-pressed="true"] { background: var(--solid); color: var(--on-solid); }
.chip .n { font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .n { color: inherit; opacity: 0.65; }
.chip:disabled { opacity: 0.38; cursor: default; }
.chip.disc .ic { font-size: 17px; color: var(--dc); }
.chip.disc[aria-pressed="true"] { background: var(--dc); color: #fff; }
.chip.disc[aria-pressed="true"] .ic { color: #fff; }

.date-range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.date-range label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.date-range input { height: 40px; border: 1px solid transparent; border-radius: 10px; background: var(--chip); padding: 0 10px; font-size: 14px; color: var(--text); min-width: 0; width: 100%; }
.date-range input:focus { outline: none; border-color: var(--accent); }

.switch { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; padding: 10px 0; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.switch-ui { width: 44px; height: 26px; border-radius: 999px; background: var(--chip-hover); position: relative; transition: background 0.18s; }
.switch-ui::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.18s; }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch b { display: block; font-weight: 600; font-size: 14px; }
.switch small { display: block; font-size: 13px; color: var(--muted); }

.text-btn { background: none; border: 0; padding: 6px 8px; font-size: 14px; font-weight: 550; color: var(--muted); cursor: pointer; border-radius: 8px; }
.text-btn:hover { color: var(--text); background: var(--chip); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 15px; border: 0; border-radius: 999px;
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-solid { background: var(--solid); color: var(--on-solid); }
.btn-solid:hover { opacity: 0.86; }
.btn-soft { background: var(--chip); color: var(--text); }
.btn-soft:hover { background: var(--chip-hover); }
.btn-icon { width: 36px; padding: 0; font-size: 18px; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-size: 18px; cursor: pointer; }
.icon-btn:hover { background: var(--chip-hover); }
.icon-btn.sm { width: 28px; height: 28px; font-size: 16px; }

/* ---------- Main layout ---------- */
.main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; padding-top: 8px; padding-bottom: 48px; }
body[data-view="calendar"] .main { grid-template-columns: minmax(0, 1fr); }
body[data-view="calendar"] .rail { display: none; }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 24px 0 4px; }
.results-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.count { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--chip); flex: none; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: none; font-size: 14px; font-weight: 550; color: var(--muted); cursor: pointer; }
.seg button [data-icon] { font-size: 16px; }
.seg button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

/* ---------- Timeline list ---------- */
.day { position: relative; padding-left: 28px; }
.day::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; border-left: 2px dotted color-mix(in srgb, var(--muted) 45%, transparent); }
.day-head {
  position: sticky; top: var(--stick); z-index: 5; margin: 0; padding: 14px 0 10px; background: var(--bg);
  display: flex; align-items: baseline; gap: 8px; font-size: 16px;
}
.day-dot { position: absolute; left: -28px; top: 19px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--faint); }
.day:first-child .day-dot, .day:has(.rel) .day-dot { border-color: var(--accent); background: var(--accent); }
.day-date { font-weight: 700; }
.day-week { color: var(--muted); }
.rel { font-size: 12px; font-weight: 650; color: var(--accent-text); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 2px 8px; border-radius: 999px; align-self: center; }
.day-n { margin-left: auto; font-size: 13px; color: var(--muted); }
.day-cards { display: grid; gap: 10px; padding-bottom: 18px; }

.ev {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "body art" "body actions"; gap: 12px 18px;
  padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.ev:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--text) 18%, transparent); }
.ev-body { grid-area: body; min-width: 0; }
.ev-side { display: contents; }
.ev-kicker { margin: 0 0 3px; font-size: 13px; font-weight: 600; color: var(--accent-text); }
.ev h3 { margin: 0 0 8px; font-size: 17px; line-height: 1.3; font-weight: 650; letter-spacing: -0.01em; }
.ev-link { text-decoration: none; }
.ev-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.ev-link:focus-visible { outline: none; }
.ev-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.ev-meta { display: flex; align-items: center; gap: 7px; margin: 2px 0 0; font-size: 14px; color: var(--muted); min-width: 0; }
.ev-meta .ic { font-size: 15px; }
.ev-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--chip); color: var(--muted); font-size: 12px; font-weight: 550; }
.tag .ic { font-size: 13px; }
.tag.disc { background: color-mix(in srgb, var(--dc) 14%, transparent); color: color-mix(in srgb, var(--dc) 72%, var(--text)); }
.tag.status-open { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); }
.tag.status-closing { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.tag.status-open::before, .tag.status-closing::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ev-art {
  grid-area: art; width: 96px; height: 96px; border-radius: 14px; display: grid; place-items: center; justify-self: end; font-size: 44px; color: #fff;
  background: radial-gradient(circle at 25% 20%, color-mix(in srgb, #fff 28%, var(--dc)), transparent 60%), linear-gradient(145deg, var(--dc), color-mix(in srgb, var(--dc) 55%, #000));
}
.ev-art .ic { stroke-width: 1.5; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18)); }
.ev-actions { grid-area: actions; position: relative; z-index: 2; display: flex; gap: 6px; align-self: end; justify-self: end; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 56px 20px; margin-top: 12px; border-radius: var(--radius); background: var(--card); border: 1px dashed var(--line); color: var(--muted); }
.empty-ic { font-size: 40px; color: var(--faint); margin-bottom: 6px; }
.empty strong { color: var(--text); font-size: 17px; font-weight: 650; }
.empty .btn { margin-top: 12px; }
.empty code { font-size: 13px; background: var(--chip); padding: 1px 6px; border-radius: 6px; }
.more { display: flex; margin: 8px auto 0; min-width: 200px; }

/* ---------- Rail mini calendar ---------- */
.rail { position: sticky; top: calc(var(--top-h) + var(--bar-h) + 24px); padding-top: 28px; }
.rail-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.rail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rail-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.cal-nav { display: flex; gap: 6px; }
.rail-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.rc-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0 6px; }
.rc-day {
  position: relative; aspect-ratio: 1; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent;
  font-size: 13px; font-variant-numeric: tabular-nums; color: var(--faint); padding: 0;
}
.rc-day.has { color: var(--text); font-weight: 600; cursor: pointer; }
.rc-day.has:hover { background: var(--chip); }
.rc-day i { position: absolute; bottom: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.rc-day.other { opacity: 0.45; }
.rc-day.range { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.rc-day.today { color: var(--accent-text); }
.rc-day.in-view { background: var(--solid); color: var(--on-solid); }
.rc-day.in-view i { background: var(--on-solid); }
.rail-hint { margin: 12px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- Mobile date strip ---------- */
.strip { position: sticky; top: calc(var(--top-h) + var(--bar-h)); z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.strip-track { display: flex; gap: 6px; overflow-x: auto; padding: 8px 16px; scroll-snap-type: x proximity; scrollbar-width: none; }
.strip-track::-webkit-scrollbar { display: none; }
.sd {
  flex: none; display: flex; flex-direction: column; align-items: center; min-width: 56px; padding: 6px 6px 7px; border: 0; border-radius: 12px;
  background: var(--chip); cursor: pointer; scroll-snap-align: start; line-height: 1.15;
}
.sd-w { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.sd-d { font-size: 18px; font-weight: 700; }
.sd-m { font-size: 10.5px; color: var(--muted); }
.sd.today .sd-w { color: var(--accent-text); }
.sd.in-view { background: var(--solid); color: var(--on-solid); }
.sd.in-view .sd-w, .sd.in-view .sd-m { color: inherit; opacity: 0.7; }

/* ---------- Month calendar view ---------- */
.calendar { margin-top: 12px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 14px; }
.cal-head h3 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-dow { padding: 10px 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.cal-cell {
  min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 3px; text-align: left; min-width: 0; border: 0;
  border-top: 1px solid var(--line); background: transparent; font-size: 12px; cursor: pointer; transition: background 0.12s;
}
.cal-cell:not(:nth-child(7n + 1)) { border-left: 1px solid var(--line); }
.cal-cell:hover { background: color-mix(in srgb, var(--chip) 60%, transparent); }
.cal-cell.other .cal-date, .cal-cell.past .cal-date { color: var(--faint); }
.cal-cell.past .cal-pill { opacity: 0.55; }
.cal-cell[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: inset 0 0 0 2px var(--accent); }
.cal-date { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.cal-date > span:first-child { min-width: 24px; height: 24px; display: inline-grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-date > span:first-child { background: var(--accent); color: #fff; }
.cal-date .n { font-size: 11px; font-weight: 500; color: var(--muted); }
.cal-pill { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px 6px; border-radius: 6px; font-size: 11.5px; font-weight: 550; background: color-mix(in srgb, var(--dc) 15%, transparent); color: color-mix(in srgb, var(--dc) 70%, var(--text)); }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; padding-left: 4px; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--dc); }
.cal-day { margin-top: 24px; }
.cal-day-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; font-size: 17px; font-weight: 700; }
.cal-day-head span { font-size: 14px; font-weight: 400; color: var(--muted); }
.hint { margin: 0; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Footer & sheet backdrop ---------- */
.foot { padding-top: 24px; padding-bottom: 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot p { margin: 4px 0; max-width: 72ch; }
.foot a:hover { color: var(--text); }
.backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, 0.45); animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Tablet & mobile ---------- */
@media (max-width: 1023px) {
  .wrap { padding: 0 16px; }
  .top { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; background: transparent; }
  .top-inner { flex-wrap: wrap; height: auto; padding-top: 14px; padding-bottom: 4px; gap: 12px; }
  .top-link { margin-left: auto; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .search-kbd { display: none; }
  .hero { padding-top: 22px; padding-bottom: 14px; }
  .hero h1 { font-size: 28px; }
  .hero-sub { font-size: 15px; }
  .section-label { margin-top: 20px; font-size: 15px; }
  .tiles { display: flex; overflow-x: auto; scroll-snap-type: x proximity; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
  .tiles::-webkit-scrollbar { display: none; }
  .tile { flex: none; width: 168px; scroll-snap-align: start; }

  /* No backdrop-filter here: it would trap the fixed-position sheets. */
  .bar { top: 0; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .bar-inner { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-left: 16px; padding-right: 16px; }
  .bar-inner::-webkit-scrollbar { display: none; }
  .pill-wrap { flex: none; }
  body.no-scroll .bar { z-index: 60; } /* lift the sheet's stacking context above the backdrop */
  .pop, .pop-wide {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 50; width: auto; max-height: 82vh; overflow: auto;
    border-radius: 22px 22px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); animation: sheet-in 0.22s ease-out;
  }
  .pop::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--chip-hover); margin: -8px auto 14px; }
  .pop-foot .pop-done { flex: 1; height: 46px; margin-left: 12px; font-size: 15px; }
  @keyframes sheet-in { from { transform: translateY(100%); } }

  .main { grid-template-columns: minmax(0, 1fr); padding-top: 0; }
  .rail { display: none; }
  .results-head { padding-top: 18px; }
  .day { padding-left: 22px; }
  .day-dot { left: -22px; }
  .day::before { left: 5px; }

  .ev { grid-template-columns: minmax(0, 1fr) 64px; grid-template-areas: "body art" "actions actions"; padding: 14px; gap: 10px 14px; }
  .ev-art { width: 64px; height: 64px; border-radius: 12px; font-size: 30px; }
  .ev-actions { justify-self: stretch; }
  .ev-actions .btn-solid { flex: 1; }
  .ev h3 { font-size: 16px; }

  .cal-cell { min-height: 58px; padding: 4px; }
  .cal-pill, .cal-more, .cal-date .n { display: none; }
  .cal-dots { display: flex; }
}
@media (min-width: 1024px) {
  .strip { display: none !important; }
}

.pop:focus { outline: none; }
