/* ==========================================================================
   RaceLog+ — base.css  (shared design system)
   --------------------------------------------------------------------------
   Loaded BEFORE each page's own <style> block, so any page-specific rule
   still overrides these defaults (same specificity → later wins).
   Centralises the design-system tokens, the reset, and the standard dark nav
   so they no longer need to be copy-pasted into every page.
   ========================================================================== */

:root {
  /* Brand */
  --neon: #CCFF00;          /* RaceLog+ neon green */
  --neon-pale: #f5ffe0;     /* established muted-neon surface (stat-box.click, upcoming) */
  --ink: #111;              /* near-black */
  --white: #fff;
  --future: #f5ffe0;        /* light green — upcoming/future races */

  /* Greys (light → dark) */
  --page-bg: #f8f8f8;       /* default page background */
  --input-bg: #fafafa;
  --surface-2: #f0f0f0;
  --border-light: #eee;
  --border: #ddd;
  --muted-2: #aaa;          /* nav links, faint labels */
  --muted: #888;            /* subtitles */
  --label: #555;            /* form labels */
  --text-2: #666;
  --text-3: #333;

  /* Semantic */
  --error: #c0392b;
  --success: #2a6e2a;

  /* Sport colours (canonical — one per discipline; see racelogplus-brand skill).
     Pattern: light tint background + dark same-hue text. For a SOLID fill (chart
     bar, legend dot) use the -fg (strong) colour — the tint vanishes on white.
     Single source of truth: the .sb-/.rb-/.sp-/.tag-/.p- classes below + the
     analytics chart maps both read from these. */
  --sport-running-bg:   #e8f5e8;  --sport-running-fg:   #2a6e2a;
  --sport-triathlon-bg: #f0e8fb;  --sport-triathlon-fg: #5a2da0;
  --sport-swimrun-bg:   #fff8e1;  --sport-swimrun-fg:   #8a6000;
  --sport-swim-bg:      #e3f0fb;  --sport-swim-fg:      #1a5fa0;
  --sport-duathlon-bg:  #fce8e8;  --sport-duathlon-fg:  #a02020;
  --sport-aquathlon-bg: #e8f5f5;  --sport-aquathlon-fg: #1a6e6e;
  --sport-hybrid-bg:    #fbe6f0;  --sport-hybrid-fg:    #a01a66;
  --sport-cycling-bg:   #fef3e2;  --sport-cycling-fg:   #92400e;
  --sport-other-bg:     #f0f0f0;  --sport-other-fg:     #555;

  /* Type */
  --font-ui: 'Barlow Condensed', sans-serif;
  --font-mono: 'Space Mono', monospace;

  /* Layout */
  --nav-h: 52px;
  --breakpoint: 640px;
}

/* ---- Reset (identical across all pages) ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---- Form placeholders: keep them ghost-light so an example never reads as a
   filled value (esp. with the Space Mono monospace inputs). opacity:1 overrides
   Firefox's default placeholder dimming. ---- */
input::placeholder, textarea::placeholder { color: #c4c4c4; opacity: 1; }

/* ---- Standard dark navigation bar ----
   Used by every app page. The landing page (index.html) defines its own
   white nav in its <style>, which overrides this. */
nav {
  background: var(--ink);
  /* Inset the nav content to the same 1180px container as .rail-layout, so the
     logo aligns with the left rail and the right-side controls (Log out) align
     with the right rail (LinkedIn-style). Falls back to 16px below the cap. */
  padding: 0 max(16px, calc((100% - 1180px) / 2 + 24px));
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
/* NOTE: nav/menu LINK colors are hardcoded hex (not var()) on purpose. Safari/
   WebKit does NOT honour CSS custom properties for :visited link colors, so a
   visited link styled with color:var(--x) falls back to the inherited (dark)
   text colour — which made the mobile-menu links invisible (black on black).
   Literal hex matches the design tokens (--neon #CCFF00, --muted-2 #aaa,
   --white #fff, --ink #111) and renders correctly in every link state. */
.logo {
  color: #CCFF00;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-decoration: none;
}
.logo:visited { color: #CCFF00; }
.nav-link {
  color: #aaa;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
}
.nav-link:visited { color: #aaa; }
.nav-link:hover { color: #fff; }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-btn { background: #CCFF00; color: #111; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; border: none; padding: 7px 16px; border-radius: 4px; cursor: pointer; font-family: 'Barlow Condensed', sans-serif; text-decoration: none; }
.nav-btn:hover { opacity: 0.88; }
.nav-btn:visited { color: #111; }
/* Mobile hamburger + slide-down menu — shared by every app page. (Define here so
   new pages can't forget it; pages just need the markup + toggleMenu().) */
.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; background: none; border: none; padding: 4px; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--white); border-radius: 2px; transition: all 0.2s; }
.mobile-menu { display: none; position: fixed; inset: var(--nav-h) 0 0 0; background: var(--ink); z-index: 99; flex-direction: column; padding: 20px 24px; gap: 4px; }
.mobile-menu.open { display: flex; }
.mobile-menu a { color: #aaa; font-size: 16px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; text-decoration: none; padding: 14px 0; border-bottom: 0.5px solid #222; }
.mobile-menu a:visited { color: #aaa; }
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover, .mobile-menu a.active { color: #fff; }
.mobile-menu .mobile-btn { background: #CCFF00; color: #111; border-radius: 4px; padding: 14px 0; text-align: center; margin-top: 8px; border-bottom: none; }
.mobile-menu .mobile-btn:visited { color: #111; }
/* Nav controls rendered by js/nav.js — buttons need a reset to look like links.
   (Log out, PT toggle, contextual Back, Athletes pending badge.) */
nav button.nav-link { background: none; border: none; cursor: pointer; padding: 0; font-family: 'Barlow Condensed', sans-serif; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.nav-back-link, .nav-back-link:visited { color: #666; }
.nav-lang { background: none; border: 1px solid #444; color: #aaa; font-size: 11px; font-weight: 700; letter-spacing: 1px; padding: 4px 10px; border-radius: 3px; cursor: pointer; font-family: 'Barlow Condensed', sans-serif; }
.nav-lang:hover { color: #fff; border-color: #666; }
.nav-badge { background: #CCFF00; color: #111; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 10px; vertical-align: middle; }
.mobile-menu button { background: none; border: none; color: #aaa; font-size: 16px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; text-align: left; padding: 14px 0; border-top: 0.5px solid #222; cursor: pointer; font-family: 'Barlow Condensed', sans-serif; width: 100%; }
.mobile-menu .mobile-lang { width: auto; align-self: flex-start; border: 1px solid #444; border-radius: 3px; padding: 6px 14px; font-size: 13px; margin-top: 8px; }
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
}

/* ---- Notification bell + dropdown (shared; mounted by js/notifications.js) --
   The bell lives directly in <nav> (before .hamburger) so it shows at ALL
   widths. The panel is fixed-positioned and appended to <body>. */
.notif-bell {
  position: relative; background: none; border: none; cursor: pointer;
  color: #aaa; padding: 4px; display: inline-flex;
  align-items: center; line-height: 0;
}
/* Two bells (js/notifications.js): the desktop one sits inside the link row
   (between Athletes and + Add Race); the mobile one sits next to the hamburger
   because the link row collapses ≤640px. Show exactly one per breakpoint. */
.notif-bell-mob { display: none; }
@media (max-width: 640px) {
  .notif-bell-desk { display: none; }
  .notif-bell-mob { display: inline-flex; }
}
/* The mobile bell is a direct nav child, which would break the logo|links
   space-between. Give the LOGO margin-right:auto so it eats the free space and
   packs every following sibling (link group, mobile bell, hamburger) hard
   against the right edge. Scoped to .has-bell so index.html / race-add / edit
   are untouched. (Desktop is unaffected — its bell lives inside the link row.) */
nav.has-bell .logo { margin-right: auto; }
nav.has-bell .hamburger { margin-left: 6px; }
.notif-bell:hover, .notif-bell.open { color: #fff; }
.notif-badge {
  position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 8px; background: #CCFF00; color: #111;
  font-family: 'Space Mono', monospace; font-size: 10px; font-weight: 700;
  line-height: 16px; text-align: center; box-sizing: border-box;
}
.notif-panel {
  position: fixed; z-index: 200; width: 340px; max-width: calc(100vw - 16px);
  background: #fff; border: 0.5px solid var(--border, #ddd); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18); overflow: hidden;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 0.5px solid #f0f0f0;
  font-size: 13px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.5px; color: #111;
}
.notif-readall {
  background: none; border: none; cursor: pointer; color: #888;
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; padding: 0;
}
.notif-readall:hover { color: #111; }
.notif-list { max-height: min(60vh, 420px); overflow-y: auto; }
.notif-empty { padding: 28px 14px; text-align: center; color: #bbb; font-size: 13px; }
.notif-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px;
  text-decoration: none; border-bottom: 0.5px solid #f4f4f4;
  position: relative; transition: background 0.12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #fafafa; }
.notif-item.unread { background: #f7ffe0; }
.notif-item.unread:hover { background: #f0fbcf; }
.notif-av {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: #111; color: #CCFF00; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 13px; overflow: hidden;
}
.notif-av img { width: 100%; height: 100%; object-fit: cover; }
.notif-body { flex: 1; min-width: 0; }
.notif-msg {
  display: block; font-size: 13.5px; line-height: 1.3; color: #222;
}
.notif-msg b { color: #111; font-weight: 700; }
.notif-time {
  display: block; margin-top: 2px; font-family: 'Space Mono', monospace;
  font-size: 10.5px; color: #b0b0b0; letter-spacing: 0.3px;
}
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #CCFF00;
  flex-shrink: 0; border: 1px solid #aacb00;
}
.notif-seeall {
  display: block; text-align: center; padding: 11px; text-decoration: none;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: #111; border-top: 0.5px solid #f0f0f0;
}
.notif-seeall:hover { background: #fafafa; }

/* ==========================================================================
   Shared UI components (canonical — see the racelogplus-ui skill).
   Defined here so pages stop re-inventing toggles/pills in their own <style>.
   A page should only carry CSS that is genuinely unique to it.
   ========================================================================== */

/* ---- Segmented control: mutually-exclusive mode switch (Grid/List, My
   Activity/Friends). Underlined tab + neon active — light-led, neon-accent.
   (Replaces the retired filled-black toggle.) ---- */
.seg { display: flex; gap: 4px; border-bottom: 1px solid var(--border-light); margin: 18px 0 10px; }
.seg-btn {
  flex: 1; text-align: center; font-family: var(--font-ui);
  font-size: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  padding: 10px 0; border: none; background: none; color: var(--muted-2); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.seg-btn.active { color: var(--ink); border-bottom-color: var(--neon); }

/* ---- Filter pills: filter a list by category. Primary tier = squared 3px
   pill, ink active fill. ---- */
.pills { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 16px; border-bottom: 0.5px solid var(--border-light); }
.pill {
  font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; padding: 6px 14px; border: 1px solid var(--border); border-radius: 3px;
  color: var(--muted); background: transparent; cursor: pointer; transition: all 0.15s;
}
.pill:hover { border-color: var(--ink); color: var(--ink); background: var(--page-bg); }
.pill.active { background: var(--ink); color: var(--white); border-color: var(--ink); }
.pill .fcount { color: var(--border); margin-left: 4px; }
.pill.active .fcount { color: var(--muted); }

/* Secondary/sub tier — sits under a chosen primary pill (e.g. swimrun mode). */
.sub-pills { display: flex; flex-wrap: wrap; gap: 6px; background: var(--page-bg); border-bottom: 0.5px solid var(--border-light); padding: 8px 12px; }
.sub-pill {
  font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; padding: 4px 12px; border: 1px solid var(--border); border-radius: 3px;
  color: var(--text-2); background: var(--white); cursor: pointer;
}
.sub-pill:hover:not(.active) { border-color: var(--muted-2); color: var(--text-3); }
.sub-pill.active { background: var(--text-3); color: var(--white); border-color: var(--text-3); }

/* ---- Filter bar + boolean toggle: a single on/off filter (With connections,
   Raced together). Active = future-race light green. ---- */
.fbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
.fbar select, .fbar input { background: var(--input-bg); border: 1px solid var(--border); color: var(--label); font-size: 13px; padding: 7px 10px; outline: none; font-family: var(--font-ui); border-radius: 4px; height: 36px; }
.fbar select:focus, .fbar input:focus { border-color: var(--ink); }
.fbar-toggle { display: inline-flex; align-items: center; gap: 5px; height: 36px; font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; padding: 0 12px; border-radius: 4px; border: 1px solid var(--border); background: var(--input-bg); color: #777; cursor: pointer; white-space: nowrap; }
.fbar-toggle:hover { border-color: var(--ink); color: var(--ink); }
.fbar-toggle.active { background: #f5ffe0; border-color: #bcd66a; color: #5a7a00; }

/* ---- Reaction (like) bar — #25. Variant B: avatar stack + count on the left,
   borderless thumbs-up toggle on the right. Monochrome (neon stays for hero
   moments, not the feed). Used by feed.html; race-view/album in P2. ---- */
.like-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; border-top: 0.5px solid var(--border-light); padding: 10px 16px; }
.like-summary { display: flex; align-items: center; gap: 10px; min-width: 0; }
.like-avs { display: inline-flex; align-items: center; padding-left: 7px; flex-shrink: 0; }
.like-av { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--white); margin-left: -7px; background: var(--surface-2); object-fit: cover; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; font-size: 9px; font-weight: 700; color: var(--muted); font-family: var(--font-ui); flex-shrink: 0; }
.likes-count { font-family: var(--font-mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.like-bar.liked .likes-count { color: var(--ink); }
.like-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; cursor: pointer; padding: 6px 0; color: var(--muted); transition: color 0.12s; -webkit-tap-highlight-color: transparent; }
.like-btn svg { display: block; }
.like-btn:hover { color: var(--ink); }
.like-btn.liked { color: var(--ink); }
.like-btn:disabled { cursor: default; opacity: 0.6; }
/* Comment toggle button sits in the like-bar next to the like button */
.cmt-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; cursor: pointer; padding: 6px 0; color: var(--muted); font-family: var(--font-mono); font-size: 13px; transition: color 0.12s; -webkit-tap-highlight-color: transparent; }
.cmt-btn svg { display: block; }
.cmt-btn:hover, .cmt-btn.open { color: var(--ink); }
.like-actions { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }

/* ---- Comments thread + composer (feed cards & race-view) ---- */
.comments { border-top: 0.5px solid var(--border-light); padding: 12px 16px 14px; }
.comments.hidden { display: none; }
.cmt-load.hidden, .cmt-empty.hidden { display: none; }
.cmt-load { background: none; border: none; cursor: pointer; color: var(--muted); font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; padding: 0 0 10px; }
.cmt-load:hover { color: var(--ink); }
.cmt-list { display: flex; flex-direction: column; gap: 12px; }
.cmt-empty { color: var(--muted); font-size: 13px; padding: 2px 0 8px; }
.cmt { display: flex; gap: 10px; align-items: flex-start; }
.cmt-av { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; object-fit: cover; background: var(--ink); color: var(--neon); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; font-family: var(--font-ui); overflow: hidden; text-decoration: none; }
.cmt-main { flex: 1; min-width: 0; }
.cmt-top { display: flex; align-items: baseline; gap: 8px; }
.cmt-name { font-family: var(--font-ui); font-size: 13px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: 0.3px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmt-name:hover { text-decoration: underline; }
.cmt-time { font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex-shrink: 0; }
.cmt-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cmt-del { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; padding: 0 2px; }
.cmt-del:hover { color: #c0392b; }
.cmt-report { background: none; border: none; cursor: pointer; color: var(--muted); font-family: var(--font-ui); font-size: 11px; letter-spacing: 0.4px; text-transform: uppercase; padding: 0 2px; }
.cmt-report:hover { color: #c0392b; }
.cmt-reported { color: var(--muted); font-family: var(--font-ui); font-size: 11px; letter-spacing: 0.4px; text-transform: uppercase; }

/* Profile Connect + Block action stack */
.profile-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.block-btn { background: none; border: 1px solid var(--border-light); color: var(--muted); font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; padding: 7px 14px; border-radius: 6px; cursor: pointer; }
.block-btn:hover { border-color: #c0392b; color: #c0392b; }
.block-btn.blocked { border-color: #c0392b; color: #c0392b; }
.block-btn.blocked:hover { background: #c0392b; color: var(--white); }

/* Admin security bell (console/backlog/security nav) — count refreshed by js/admin-bell.js */
.sec-bell { position: relative; color: #aaa; display: inline-flex; align-items: center; line-height: 0; }
.sec-bell:hover { color: #fff; }
.sec-badge { position: absolute; top: -7px; right: -9px; background: #c0392b; color: #fff; font-size: 10px; font-weight: 700; font-family: var(--font-mono); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.cmt-body { font-size: 14px; color: var(--ink); line-height: 1.45; margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Threaded replies (#001) — one level deep, indented under their root. */
.cmt-foot { margin-top: 3px; }
.cmt-reply-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; padding: 0; -webkit-tap-highlight-color: transparent; }
.cmt-reply-btn:hover { color: var(--ink); }
.cmt-replies { display: flex; flex-direction: column; gap: 12px; margin-left: 40px; }
.cmt-replies:empty { display: none; }
.cmt-replies .cmt-av { width: 26px; height: 26px; font-size: 10px; }
.cmt-reply-form { margin-top: 0; }
.cmt-form { position: relative; display: flex; gap: 8px; align-items: flex-end; margin-top: 14px; }
.cmt-input { flex: 1; min-width: 0; resize: vertical; min-height: 38px; max-height: 160px; border: 0.5px solid var(--border-light); border-radius: 8px; padding: 9px 12px; font-family: var(--font-ui); font-size: 14px; color: var(--ink); background: var(--white); }
.cmt-input:focus { outline: none; border-color: var(--ink); }
.cmt-send-col { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.cmt-counter { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.cmt-counter-max { color: #c0392b; }
.cmt-send { background: var(--ink); color: var(--white); border: none; border-radius: 8px; padding: 9px 18px; font-family: var(--font-ui); font-size: 13px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; cursor: pointer; }
.cmt-send:disabled { opacity: 0.5; cursor: default; }
/* @-mention link inside a posted comment */
.cmt-mention { color: var(--ink); font-weight: 700; text-decoration: none; }
.cmt-mention:hover { text-decoration: underline; }
/* @-mention autocomplete popup — opens above the composer (it sits at the
   bottom of the thread). Anchored to .cmt-form (position:relative). */
.cmt-mention-pop { position: absolute; bottom: calc(100% + 6px); left: 0; right: 70px; z-index: 40; background: var(--white); border: 0.5px solid var(--border-light); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.14); padding: 4px; max-height: 240px; overflow-y: auto; }
.cmt-mention-opt { display: flex; align-items: center; gap: 9px; width: 100%; border: none; background: none; padding: 7px 9px; border-radius: 7px; cursor: pointer; text-align: left; font-family: var(--font-ui); font-size: 14px; color: var(--ink); }
.cmt-mention-opt:hover { background: var(--grey-100, #f2f2f2); }
.cmt-mention-opt img, .cmt-mention-ph { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.cmt-mention-ph { display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--white); font-family: var(--font-ui); font-weight: 700; font-size: 12px; }

/* ---- Info icon + tooltip: a small "(i)" that explains a label/field on hover
   or tap. Reusable anywhere a control needs a why/what. It's a <button> so tap
   = focus = tooltip shows on mobile (no JS); tap elsewhere blurs to hide. Add
   .tip-right / .tip-left on .info-tip if the centred bubble would clip an edge.
   Add .tip-down so the bubble opens BELOW the icon — needed when the icon sits at the
   top of a card with overflow:hidden (an upward bubble would be clipped). Pair tip-down
   with tip-left for a top-right-corner icon.
   Markup: <button class="info-i" aria-label="More info">i<span class="info-tip">…</span></button> ---- */
.info-i { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 5px; padding: 0; border: 1px solid var(--muted-2); border-radius: 50%; background: transparent; color: var(--muted-2); font-family: var(--font-ui); font-size: 11px; font-weight: 700; line-height: 1; cursor: help; position: relative; vertical-align: middle; flex-shrink: 0; -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent; }
.info-i:hover, .info-i:focus { border-color: var(--ink); color: var(--ink); outline: none; }
.info-tip { position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 250px; z-index: 60; background: var(--ink); color: var(--white); font-family: var(--font-ui); font-size: 12.5px; font-weight: 400; font-style: normal; letter-spacing: 0.2px; line-height: 1.45; text-transform: none; text-align: left; padding: 10px 12px; border-radius: 7px; box-shadow: 0 6px 20px rgba(0,0,0,0.2); opacity: 0; visibility: hidden; transition: opacity 0.12s; pointer-events: none; }
.info-tip.tip-right { left: 0; transform: none; }
.info-tip.tip-left { left: auto; right: 0; transform: none; }
.info-tip.tip-down { bottom: auto; top: calc(100% + 9px); }
.info-tip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); }
.info-tip.tip-right::after { left: 7px; transform: none; }
.info-tip.tip-left::after { left: auto; right: 7px; transform: none; }
.info-tip.tip-down::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--ink); }
.info-i:hover .info-tip, .info-i:focus .info-tip { opacity: 1; visibility: visible; }

/* ---- Sport colour chips (canonical — single source) ----
   One colour per discipline, tint bg + same-hue text. The five prefixes are the
   same colour on different surfaces: .sb- sport badge (profile header), .rb- race-row
   badge, .sp- athlete pill, .tag- race-view tag, .p- landing pill. Structural styles
   (padding/radius/font) stay on each page's base class; only the colour lives here so
   it can't drift. Values come from the --sport-*-bg/fg vars in :root. Legacy
   `OpenWaterSwim` aliases to Swim; feed's lowercase `rb-other` aliases to Other. ---- */
.sb-Running, .rb-Running, .sp-Running, .tag-run, .p-run { background: var(--sport-running-bg); color: var(--sport-running-fg); }
.sb-Triathlon, .rb-Triathlon, .sp-Triathlon, .tag-tri, .p-tri { background: var(--sport-triathlon-bg); color: var(--sport-triathlon-fg); }
.sb-Swimrun, .rb-Swimrun, .sp-Swimrun, .tag-swimrun, .p-sr { background: var(--sport-swimrun-bg); color: var(--sport-swimrun-fg); }
.sb-Swim, .sb-OpenWaterSwim, .rb-Swim, .rb-OpenWaterSwim, .sp-Swim, .sp-OpenWaterSwim, .tag-swim, .p-swim { background: var(--sport-swim-bg); color: var(--sport-swim-fg); }
.sb-Duathlon, .rb-Duathlon, .sp-Duathlon, .tag-duathlon, .p-duo { background: var(--sport-duathlon-bg); color: var(--sport-duathlon-fg); }
.sb-Aquathlon, .rb-Aquathlon, .sp-Aquathlon, .tag-aquathlon, .p-aqua { background: var(--sport-aquathlon-bg); color: var(--sport-aquathlon-fg); }
.sb-Hybrid, .rb-Hybrid, .sp-Hybrid, .tag-hybrid, .p-hybrid { background: var(--sport-hybrid-bg); color: var(--sport-hybrid-fg); }
.sb-Cycling, .rb-Cycling, .sp-Cycling, .tag-cycle, .p-cycle { background: var(--sport-cycling-bg); color: var(--sport-cycling-fg); }
.sb-Other, .rb-Other, .rb-other, .sp-Other, .tag-other, .p-other { background: var(--sport-other-bg); color: var(--sport-other-fg); }
/* Hyrox keeps its own black/neon identity (athlete pills) */
.sp-Hyrox { background: var(--ink); color: var(--neon); }

/* ---- Feedback launcher + modal (mounted by nav.js on every app page, #30) ----
   Floating "report a problem" affordance. Dark pill (ink as accent, per brand);
   the modal's Send is the one neon action. Category chips reuse the filter-pill
   ink-active pattern. ---- */
.fb-launch { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; align-items: center; gap: 7px;
  font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  background: var(--ink); color: var(--white); border: none; border-radius: 22px; padding: 10px 16px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.22); }
.fb-launch:hover { background: #000; }
.fb-launch svg { width: 15px; height: 15px; }
@media (max-width: 640px) { .fb-launch { right: 12px; bottom: 12px; padding: 9px 14px; } }

.fb-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.45); display: none; align-items: center; justify-content: center; padding: 16px; }
.fb-overlay.open { display: flex; }
.fb-modal { background: var(--white); border-radius: 14px; width: 100%; max-width: 420px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.fb-modal h3 { font-family: var(--font-ui); font-size: 20px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink); margin-bottom: 4px; }
.fb-modal .fb-sub { font-size: 13px; color: var(--muted); line-height: 1.45; margin-bottom: 16px; }
.fb-cats { display: flex; gap: 6px; margin-bottom: 14px; }
.fb-cat { flex: 1; font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  padding: 8px 0; border: 1px solid var(--border); border-radius: 3px; background: transparent; color: var(--muted); cursor: pointer; }
.fb-cat.active { background: var(--ink); color: var(--white); border-color: var(--ink); }
.fb-text { width: 100%; min-height: 110px; resize: vertical; font-family: var(--font-ui); font-size: 15px; color: var(--ink);
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.fb-text:focus { outline: none; border-color: var(--ink); }
.fb-msg { font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }
.fb-actions { display: flex; gap: 8px; margin-top: 6px; }
.fb-send { flex: 1; background: var(--neon); color: var(--ink); border: none; border-radius: 6px; font-family: var(--font-ui);
  font-size: 14px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 12px; cursor: pointer; }
.fb-send:disabled { opacity: 0.5; cursor: default; }
.fb-cancel { background: none; border: 1px solid var(--border); color: var(--label); border-radius: 6px; font-family: var(--font-ui);
  font-size: 14px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 12px 18px; cursor: pointer; }
.fb-cancel:hover { border-color: var(--ink); color: var(--ink); }

/* ==========================================================================
   Side rails (desktop-only) — left mini-profile + right "What's new".
   Mounted by js/rails.js on feed/friends. A page wraps its centre column in
   .rail-layout with .rail-left / .rail-main / .rail-right (see rails.js header).
   Below 1024px the rails are display:none (NOT laid out) and the centre column
   is full-width single-column — identical to a railless page, so the mobile
   view is never affected. Rails appear only ≥1024px (between 640–1024 a rail
   would squeeze the feed too much).
   ========================================================================== */
.rail-layout { max-width: 1180px; margin: 0 auto; }
.rail { display: none; }
@media (min-width: 1024px) {
  .rail-layout { display: grid; grid-template-columns: 224px minmax(0, 1fr) 264px; gap: 12px; align-items: start; padding: 28px 24px 60px; }
  .rail { display: block; position: sticky; top: calc(var(--nav-h) + 28px); }
  .rail-main { min-width: 0; }
  /* Let the centre content fill its column (no narrower max-width) so the only
     space to the rails is the 12px grid gap — not a wide wrap margin. */
  .rail-main .wrap { padding-top: 0; max-width: none; }
}

/* Rail card — white surface, matches the feed card look */
.rail-card { background: var(--white); border: 0.5px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.rail-card:last-child { margin-bottom: 0; }

/* Centre-column header card — marks the page (the "principal" column) with a
   soft muted-neon top bar (race-view-style accent), kept light so it doesn't
   shout. White card otherwise, matching the cards below. Shows at all widths. */
.main-head { background: var(--white); border: 0.5px solid var(--border); border-top: 3px solid var(--neon); border-radius: 12px; padding: 15px 20px; margin-bottom: 14px; }
.main-head .page-title { margin-bottom: 0; }
.main-head .main-sub { font-family: var(--font-ui); font-size: 13.5px; font-weight: 400; color: var(--muted); line-height: 1.5; margin-top: 4px; }

/* ---- Left rail: mini-profile ---- */
.rp-card { padding-bottom: 12px; }
.rp-top { display: block; text-decoration: none; }
.rp-cover { display: block; height: 46px; background: var(--ink); }
.rp-avatar { display: flex; align-items: center; justify-content: center; width: 68px; height: 68px; border-radius: 50%; border: 2px solid var(--white); background: var(--ink); color: var(--neon); font-family: var(--font-ui); font-weight: 700; font-size: 22px; overflow: hidden; margin: -34px 0 0 16px; }
.rp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rp-body { padding: 10px 16px 0; }
.rp-name { display: block; font-family: var(--font-ui); font-weight: 800; font-size: 20px; line-height: 1.15; text-transform: uppercase; letter-spacing: 0.3px; color: var(--ink); text-decoration: none; }
.rp-name:hover { text-decoration: underline; }
.rp-bio { font-family: var(--font-ui); font-size: 13.5px; font-weight: 400; color: var(--muted); line-height: 1.5; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rp-stats { display: flex; margin-top: 12px; border-top: 0.5px solid var(--border-light); border-bottom: 0.5px solid var(--border-light); }
/* Stat boxes are links (Races → dashboard, Countries → map). Kept neutral (the
   side rail shouldn't shout) — a small corner ↗ arrow signals the link instead
   of a coloured fill (matches dashboard .stat-box.click .stat-arrow). */
.rp-stat { flex: 1; text-align: center; padding: 11px 0; text-decoration: none; position: relative; }
.rp-stat + .rp-stat { border-left: 0.5px solid var(--border-light); }
.rp-stat:hover { background: var(--page-bg); }
.rp-num { display: block; font-family: var(--font-mono); font-weight: 700; font-size: 20px; color: var(--ink); }
.rp-lab { display: block; font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.rp-arrow { position: absolute; top: 6px; right: 7px; color: #9bb13a; }
/* Upcoming races — established muted-neon header (var(--neon-pale)) + neutral
   rows, up to 10. Names wrap fully (no ellipsis) so the whole name shows. */
.rp-up { margin: 14px 16px 0; border: 1px solid var(--border-light); border-radius: 8px; overflow: hidden; }
.rp-up-head { background: var(--neon-pale); color: var(--ink); font-family: var(--font-ui); font-size: 12px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase; padding: 8px 12px; }
.rp-up-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 9px 12px; text-decoration: none; border-top: 0.5px solid var(--border-light); }
.rp-up-row:first-of-type { border-top: none; }
.rp-up-row:hover { background: var(--page-bg); }
.rp-up-name { flex: 1; min-width: 0; font-family: var(--font-ui); font-size: 13px; font-weight: 600; line-height: 1.3; text-transform: uppercase; letter-spacing: 0.2px; color: var(--ink); }
.rp-up-date { flex-shrink: 0; font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
/* Tools are links → stacked rows with a leading icon. Kept neutral/understated. */
.rp-tools { display: flex; flex-direction: column; gap: 7px; padding: 14px 16px 0; }
.rp-tools a { display: flex; align-items: center; gap: 10px; font-family: var(--font-ui); font-size: 13px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-2); text-decoration: none; border: 1px solid var(--border-light); border-radius: 6px; padding: 9px 12px; }
.rp-tools a:hover { border-color: var(--ink); color: var(--ink); }
.rp-tools a svg { flex-shrink: 0; color: var(--muted); }

/* ---- Right rail: "What's new" feature spotlight ---- */
.wn-card { padding-top: 15px; }
.wn-head { display: block; font-family: var(--font-ui); font-size: 16px; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink); margin: 0 16px; padding-bottom: 10px; border-bottom: 2px solid var(--neon); }
.wn-intro { font-family: var(--font-ui); font-size: 13.5px; font-weight: 400; color: var(--muted); line-height: 1.5; padding: 12px 16px 4px; }
.wn-list { padding-bottom: 4px; }
.wn-item { display: block; text-decoration: none; padding: 12px 16px; border-top: 0.5px solid var(--border-light); }
.wn-item:hover { background: var(--page-bg); }
.wn-title { font-family: var(--font-ui); font-size: 15px; font-weight: 700; line-height: 1.2; text-transform: uppercase; letter-spacing: 0.2px; color: var(--ink); }
.wn-sub { font-family: var(--font-ui); font-size: 13.5px; font-weight: 400; color: var(--muted); line-height: 1.5; margin-top: 4px; }

/* ============================================================
   Component 7 — Product tour (first-run walkthrough, js/tour.js)
   Welcome/closing cards + spotlight steps. Light-led, one neon
   accent (card top-bar + active dot + primary button). No emoji.
   ============================================================ */
.tour { position: fixed; inset: 0; font-family: var(--font-ui); }
.tour-block { position: fixed; inset: 0; background: transparent; }
.tour-block.dim { background: rgba(17, 17, 17, 0.72); }

/* Spotlight ring — its huge box-shadow dims everything outside the target */
.tour-ring {
  position: fixed; border-radius: 10px; pointer-events: none;
  border: 2px solid var(--neon);
  box-shadow: 0 0 0 9999px rgba(17, 17, 17, 0.72), 0 0 0 4px rgba(204, 255, 0, 0.25);
  transition: top 0.18s ease, left 0.18s ease, width 0.18s ease, height 0.18s ease;
}

/* The instructional card */
.tour-pop {
  position: fixed; width: min(340px, calc(100vw - 24px));
  background: var(--white); border: 0.5px solid var(--border); border-top: 3px solid var(--neon);
  border-radius: 14px; padding: 20px 20px 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.30); color: var(--ink);
}
.tour-pop.center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.tour-pop.pinned { left: 12px; right: 12px; bottom: 12px; width: auto; }

.tour-x {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  font-size: 22px; line-height: 1; color: var(--muted-2); cursor: pointer; padding: 2px 4px;
}
.tour-x:hover { color: var(--ink); }
.tour-kicker { font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.tour-title { font-size: 23px; font-weight: 800; letter-spacing: -0.3px; text-transform: uppercase; line-height: 1.05; color: var(--ink); }
.tour-body { font-size: 15px; line-height: 1.5; color: var(--text-2); margin-top: 9px; }

.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.tour-dots { display: flex; gap: 6px; }
.tour-dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--border); background: transparent; }
.tour-dot.on { background: var(--neon); border-color: var(--neon); }
.tour-actions { display: flex; align-items: center; gap: 8px; }
.tour-actions button { font-family: var(--font-ui); font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; border-radius: 4px; }
.tour-skip, .tour-back { background: none; border: none; color: var(--muted); padding: 7px 6px; }
.tour-skip:hover, .tour-back:hover { color: var(--ink); }
.tour-next { background: var(--neon); color: var(--ink); border: none; padding: 8px 18px; }
.tour-next:hover { opacity: 0.88; }
