:root {
  --bg: #fafaf9;
  --surface: #fff;
  --subtle: #f4f4f2;
  --border: #e7e7e4;
  --text: #1c1c1a;
  --muted: #63635d;
  --faint: #6b6b65;
  --accent: #f0663a;
  --accent-soft: #fef0ea;
  --accent-ink: #b93d10; /* orange for text: 5.4:1 on white */
  --green: #2f7a52;
  --green-soft: #ebf5ef;
  --radius: 12px;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
h1, h2, h3 { letter-spacing: -0.02em; margin: 0; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 24px 14px; background: var(--surface); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px; }
.brand-mark { position: relative; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); overflow: hidden; flex: none; }
.brand-track { position: absolute; width: 22px; height: 12px; border: 2.5px solid #fff; border-radius: 50%; transform: rotate(-35deg); top: 9px; left: 4px; }
.brand-dot { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; left: 14px; top: 7px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong { font-size: 15px; font-weight: 800; }
.brand-period { color: var(--accent-ink); }
.brand-copy small { font-size: 11px; color: var(--faint); font-weight: 600; }
.sidebar-label { display: none; }
.side-nav { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 14px; font-weight: 600; text-align: left; }
.nav-item:hover { background: var(--subtle); color: var(--text); }
.nav-item.active { background: var(--subtle); color: var(--text); }
.nav-item.active svg { color: var(--accent); }

.page-wrap { flex: 1; min-width: 0; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--border); background: var(--surface); position: relative; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }
.crumb { display: none; }
.top-date { font-size: 13px; color: var(--muted); }
.top-divider { width: 1px; height: 20px; background: var(--border); }
.menu-button { display: none; }
.icon-button { border: 0; background: none; padding: 6px; border-radius: 8px; color: var(--muted); }
.avatar-button { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; color: var(--muted); }
.avatar-button > span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--subtle) center/cover; color: var(--text); font-size: 12px; font-weight: 700; }
.avatar-button svg { width: 14px; }
.account-menu { position: absolute; z-index: 30; right: 24px; top: 58px; width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgb(0 0 0 / 0.08); }
.menu-person { font-size: 13px; font-weight: 700; padding: 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.account-menu button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; background: none; text-align: left; font-size: 13px; }
.account-menu button:hover { background: var(--subtle); }
.account-menu button.danger { color: #c2410c; }
.community-picker { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.community-picker span { display: none; }
.community-picker select, .year-filter select { min-width: 140px; max-width: 220px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 13px; font-weight: 600; text-overflow: ellipsis; }

.content { max-width: 1280px; margin: 0 auto; padding: 32px; }

/* Shared bits */
.eyebrow, .section-overline { display: none; }
.welcome-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.welcome-row h1 { font-size: 28px; font-weight: 800; }
.welcome-row h1 em { font-style: normal; }
.welcome-row p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.welcome-actions { display: flex; align-items: center; gap: 12px; }
.preview-pill { font-size: 12px; font-weight: 600; color: #b45309; background: #fef3e2; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.preview-pill.live { color: var(--green); background: var(--green-soft); }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; font-weight: 700; white-space: nowrap; transition: background .15s, opacity .15s; }
.button svg { width: 16px; height: 16px; }
.button-dark { background: var(--text); color: #fff; }
.button-dark:hover { background: #3a3a37; }
.button-light { background: var(--surface); color: var(--text); border-color: var(--border); }
.button-light:hover { background: var(--subtle); }
.text-button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.text-button svg { width: 14px; height: 14px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-header h2, .rules-panel h2 { font-size: 17px; font-weight: 700; }
.section-header p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.section-header.compact { margin-bottom: 12px; }
.heading-spark, .laurel, .star-burst { display: none; }
.empty-state { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6; }
.empty-state strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }

/* Hero */

/* Overview focal block: the club's distance this week. Dark so it is the one thing the eye lands on;
   the oversized tight numeral is the same motif as the landing page and story cards. */
.week-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 24px 48px; align-items: end; margin-bottom: 20px; padding: 32px 36px; border-radius: 16px; background: var(--text); color: #fff; }
.week-label { margin: 0; font-size: 14px; font-weight: 600; color: #c9c9c4; }
.week-figure { margin: 10px 0 0; font-size: clamp(64px, 9vw, 120px); line-height: .9; font-weight: 800; letter-spacing: -0.05em; }
.week-figure small { font-size: .3em; font-weight: 600; letter-spacing: 0; color: #c9c9c4; }
.week-meta { margin: 10px 0 0; font-size: 15px; color: #c9c9c4; }
.week-stats { display: flex; gap: 40px; margin: 0; }
.week-stats dt { font-size: 14px; color: #c9c9c4; }
.week-stats dd { margin: 4px 0 0; font-size: 40px; font-weight: 800; letter-spacing: -0.03em; }
.week-link { grid-column: 1 / -1; justify-self: start; min-height: 44px; padding: 0 18px; border: 1px solid #ffffff4d; border-radius: 10px; background: none; color: #fff; font-size: 14px; font-weight: 700; }
.week-link:hover { background: #ffffff14; }
@media (max-width: 760px) {
  .week-hero { grid-template-columns: 1fr; padding: 24px 20px; }
  .week-stats { gap: 32px; }
  .week-link { width: 100%; }
}

/* Dashboard */
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; }
.main-column, .right-column { min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.leaderboard-panel { padding: 20px 20px 0; }
.segment { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--subtle); }
.period-tab { border: 0; background: none; border-radius: 6px; padding: 6px 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
.period-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.leaderboard-head, .leaderboard-row { display: grid; grid-template-columns: minmax(150px, 1.6fr) .8fr .7fr .6fr; align-items: center; gap: 8px; }
.leaderboard-head { padding-bottom: 10px; border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--faint); }
.leaderboard-head span:not(:first-child) { text-align: right; }
.leaderboard-row { min-height: 60px; border-bottom: 1px solid var(--border); }
.leaderboard-row:last-child { border-bottom: 0; }
.runner-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rank-number { width: 18px; flex: none; font-size: 13px; font-weight: 700; color: var(--faint); }
.leaderboard-row:first-child .rank-number { color: var(--accent-ink); }
.runner-avatar, .feed-avatar, .community-avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--subtle) center/cover; color: var(--text); font-size: 11px; font-weight: 700; }
.runner-name { min-width: 0; }
.runner-name strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.runner-name small { display: block; font-size: 12px; color: var(--faint); margin-top: 1px; }
.row-data { text-align: right; font-size: 14px; font-weight: 600; }
.row-data small { font-size: 12px; font-weight: 500; color: var(--faint); }
.point-badge { justify-self: end; min-width: 44px; padding: 4px 8px; border-radius: 6px; background: var(--subtle); text-align: center; font-size: 13px; font-weight: 700; }
.leaderboard-row:first-child .point-badge { background: var(--accent-soft); color: var(--accent-ink); }
.panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.panel-footer > span { display: flex; align-items: center; gap: 6px; }
.panel-footer svg { width: 15px; height: 15px; }
.share-board { margin-left: auto; }

.activity-panel { padding: 20px 20px 6px; }
.activity-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.activity-row:first-child { border-top: 0; }
.feed-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.feed-icon svg { width: 16px; height: 16px; }
.feed-detail { flex: 1; min-width: 0; }
.feed-detail strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-detail small { display: block; font-size: 12px; color: var(--faint); margin-top: 1px; }
.feed-distance { text-align: right; font-size: 14px; font-weight: 700; white-space: nowrap; }
.feed-distance small { display: block; font-size: 12px; font-weight: 500; color: var(--faint); margin-top: 1px; }
.feed-share { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); }
.feed-share:hover { color: var(--accent-ink); }
.feed-share svg { width: 14px; height: 14px; }

.champions-panel, .rules-panel { padding: 20px; }
.champion-card { text-align: center; padding: 20px 16px; border-radius: 10px; background: var(--subtle); }
.champion-top { font-size: 12px; font-weight: 600; color: var(--muted); }
.champion-avatar { width: 60px; height: 60px; margin: 14px auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--surface) center/cover; border: 1px solid var(--border); color: var(--text); font-size: 20px; font-weight: 800; }
.champion-card strong { display: block; font-size: 16px; font-weight: 700; line-height: 1.3; }
.champion-card p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.monthly-row { display: flex; align-items: center; gap: 12px; padding-top: 16px; }
.monthly-row div { flex: 1; min-width: 0; }
.monthly-row small { display: block; font-size: 12px; color: var(--faint); }
.monthly-row strong { display: block; font-size: 14px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.monthly-row > span:last-child { font-size: 13px; font-weight: 700; color: var(--accent-ink); }

.rules-panel > p { margin: 4px 0 12px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.rule-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.rule-index { display: none; }
.rule-row div { flex: 1; }
.rule-row strong { display: block; font-size: 14px; font-weight: 600; }
.rule-row small { display: block; font-size: 12px; color: var(--faint); margin-top: 1px; }
.rule-points { font-size: 13px; font-weight: 700; color: var(--green); background: var(--green-soft); padding: 3px 9px; border-radius: 999px; }
.rule-footer { padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--faint); line-height: 1.5; }

/* Recap */
.recap-intro { margin-bottom: 20px; }
.recap-intro h2, .runs-intro h2 { font-size: 20px; font-weight: 800; }
.recap-intro p, .runs-intro p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.recap-years { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.recap-year { padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; }
.recap-year.active { background: var(--text); border-color: var(--text); color: #fff; }
.recap-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.recap-stats > div { padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.recap-stats small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.recap-stats strong { display: block; margin-top: 8px; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.recap-stats strong span { margin-left: 4px; font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.recap-lower { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; }
.recap-chart-panel { padding: 20px; }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 200px; border-bottom: 1px solid var(--border); }
.bar { flex: 1; min-height: 4px; border-radius: 4px 4px 0 0; background: #f8c9b6; position: relative; }
.bar.highlight { background: var(--accent); }
.bar:hover::after { content: attr(data-value); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 4px 7px; border-radius: 6px; background: var(--text); color: #fff; font-size: 12px; }
.chart-months { display: flex; gap: 8px; padding-top: 8px; }
.chart-months span { flex: 1; text-align: center; font-size: 11px; color: var(--faint); }
.recap-share { padding: 24px; border-radius: var(--radius); background: var(--text); color: #fff; }
.recap-share small { font-size: 12px; color: #a8a8a2; }
.recap-share h2 { font-size: 20px; font-weight: 800; margin: 6px 0; }
.recap-share p { margin: 0 0 18px; font-size: 14px; line-height: 1.5; color: #c9c9c4; }

/* Runs */
.runs-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.year-filter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.runs-tip { margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; background: var(--subtle); color: var(--muted); font-size: 13px; }
.run-archive { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.run-card { display: flex; flex-direction: column; min-width: 0; padding: 16px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s; }
.run-card:hover { border-color: #d4d4cf; box-shadow: 0 4px 16px rgb(0 0 0 / 0.05); }
.run-card-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.run-card-top svg { width: 16px; height: 16px; color: var(--accent); }
.run-card strong { display: block; margin: 12px 0 4px; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-card-stats { display: flex; align-items: baseline; gap: 6px; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.run-card-stats small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.run-card-route { display: block; position: relative; height: 110px; margin-top: 12px; overflow: hidden; border-radius: 8px; background: var(--subtle); }
.run-card-route-label { position: absolute; top: 8px; left: 10px; font-size: 11px; color: var(--faint); }
.run-card-route svg { display: block; width: 100%; height: 86px; margin-top: 22px; }
.run-route-halo, .run-route-line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.run-route-halo { stroke: #fff; stroke-width: 7; }
.run-route-line { stroke: var(--accent); stroke-width: 3.5; }
.run-route-start { fill: var(--text); stroke: #fff; stroke-width: 2; }
.run-route-end { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.run-card-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 12px; font-size: 12px; color: var(--muted); }
.run-card-route + .run-card-bottom, .run-card-stats + .run-card-bottom { margin-top: 12px; }
.runs-actions { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 20px; }

/* Community */
.community-hub { display: grid; gap: 20px; margin-bottom: 20px; }
.community-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.community-action-card { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.community-action-icon { display: none; }
.community-action-card > small { font-size: 12px; font-weight: 600; color: var(--accent-ink); }
.community-action-card h3, .invite-guest h3 { font-size: 17px; font-weight: 700; margin: 4px 0; }
.community-action-card p, .invite-guest p, .community-owner-panel > p { margin: 0 0 16px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.community-action-card label { display: block; width: 100%; margin-bottom: 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.community-action-card label span { font-weight: 400; color: var(--faint); }
.community-action-card input, .community-action-card textarea, .invite-link-row input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 14px; resize: vertical; }
.community-action-card input:focus, .community-action-card textarea:focus, .invite-link-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.community-action-card .button { margin-top: auto; }
.community-directory-panel, .community-owner-panel, .invite-guest { padding: 20px; }
.invite-guest { margin-bottom: 20px; }
.community-directory, .join-request-list { display: grid; gap: 8px; }
.community-directory-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; }
.community-directory-copy { min-width: 0; }
.community-directory-copy strong { display: block; font-size: 14px; font-weight: 700; }
.community-directory-copy p { margin: 3px 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.community-directory-copy small { font-size: 12px; color: var(--faint); }
.community-directory-item button, .join-request-actions button, .invite-link-row button { padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 13px; font-weight: 600; white-space: nowrap; }
.community-directory-item button:hover, .join-request-actions button:hover, .invite-link-row button:hover { background: var(--subtle); }
.community-directory-item button:disabled { color: var(--faint); background: var(--subtle); cursor: default; }
.community-owner-panel h3 { font-size: 14px; font-weight: 700; margin: 20px 0 10px; }
.invite-link-row { display: flex; gap: 8px; margin-top: 12px; }
.invite-link-row input { margin-top: 0; min-width: 0; }
.invite-warning { display: block; margin-top: 8px; font-size: 12px; color: #b45309; }
.join-request-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.join-request-item strong { flex: 1; font-size: 14px; font-weight: 600; }
.join-request-actions { display: flex; gap: 6px; }
.join-request-actions button[data-decision="decline"] { color: #c2410c; }
.community-leave-row { display: flex; justify-content: flex-end; }
.community-leave-row .text-button { color: #c2410c; }
.community-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.community-list:not([hidden]) { margin-top: 16px; }
.community-card { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.community-avatar { width: 44px; height: 44px; font-size: 14px; }
.community-card strong { display: block; font-size: 14px; }
.community-card small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Footer + toast */
.site-footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--faint); }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 100; transform: translate(-50%, 16px); padding: 10px 16px; border-radius: 8px; background: var(--text); color: #fff; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* Story + recap dialogs */
.story-dialog { width: min(880px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgb(0 0 0 / 0.2); }
.story-dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.story-dialog-shell { padding: 24px; }
.story-dialog-top { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.story-dialog-top h2 { font-size: 20px; font-weight: 800; }
.story-dialog-top p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.story-close { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border: 0; border-radius: 8px; background: var(--subtle); color: var(--muted); }
.story-close svg { width: 16px; height: 16px; }
.story-dialog-body { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 24px; }
.story-preview-wrap { display: grid; place-items: center; padding: 10px; border-radius: 12px; background: var(--subtle); }
.story-preview-wrap canvas { width: 100%; height: auto; max-height: calc(100vh - 180px); object-fit: contain; border-radius: 6px; box-shadow: 0 6px 16px rgb(0 0 0 / 0.12); }
.story-preview-wrap.transparent-light { background: linear-gradient(145deg, #435c51, #bc8f71 58%, #1c382f); }
.story-preview-wrap.transparent-dark { background: linear-gradient(145deg, #f4f1e9, #d6e3d2 58%, #f7dfca); }
.story-options { display: flex; flex-direction: column; min-width: 0; }
.story-options-label { margin-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.story-groups { display: flex; gap: 2px; padding: 3px; margin-bottom: 12px; border-radius: 8px; background: var(--subtle); }
.story-group { flex: 1; padding: 8px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.story-group.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.story-template-list { display: grid; gap: 6px; }
#recapDialog .story-template-list { margin-top: 4px; }
.story-template { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: left; }
.story-template:hover { border-color: #d4d4cf; }
.story-template.active { border-color: var(--accent); background: var(--accent-soft); }
.story-template:disabled { opacity: .45; cursor: not-allowed; }
.story-template-number { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 6px; background: var(--subtle); color: var(--muted); font-size: 12px; font-weight: 700; }
.story-template.active .story-template-number { background: var(--accent); color: #fff; }
.story-template-text { flex: 1; min-width: 0; }
.story-template strong { display: block; font-size: 14px; font-weight: 600; }
.story-template small { display: block; margin-top: 1px; font-size: 12px; color: var(--muted); }
.story-template-check { color: var(--accent-ink); }
.story-ink { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.story-ink span { margin-right: auto; font-size: 12px; font-weight: 600; color: var(--muted); }
.ink-choice { min-width: 60px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 13px; font-weight: 600; }
.ink-choice.active { background: var(--text); border-color: var(--text); color: #fff; }
.story-option-note { min-height: 34px; margin: 12px 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.story-save { width: 100%; min-height: 44px; margin-top: auto; }
.story-save-note { margin: 8px 0 0; text-align: center; font-size: 12px; color: var(--faint); }

/* Responsive */
@media (max-width: 1080px) {
  .run-archive { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .recap-lower { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 980px) {
  .sidebar { position: fixed; z-index: 50; left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 8px 0 32px rgb(0 0 0 / 0.08); }
  .sidebar.open { transform: none; }
  .menu-button { display: grid; place-items: center; }
  .topbar, .content { padding-left: 24px; padding-right: 24px; }
  .community-action-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .dashboard-grid, .recap-lower { grid-template-columns: 1fr; }
  .welcome-row, .runs-intro { flex-direction: column; align-items: flex-start; }
  .recap-stats { grid-template-columns: repeat(2, 1fr); }
  .community-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .topbar { padding: 0 16px; }
  .content { padding: 24px 16px; }
  .top-date, .top-divider { display: none; }
  .community-picker select { min-width: 110px; max-width: 150px; }
  .welcome-row h1 { font-size: 24px; }
  .leaderboard-panel, .activity-panel { padding-left: 14px; padding-right: 14px; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .leaderboard-head, .leaderboard-row { grid-template-columns: minmax(120px, 1.5fr) .8fr .6fr; }
  .leaderboard-head span:nth-child(3), .leaderboard-row .row-days { display: none; }
  .panel-footer > span { display: none; }
  .share-board { margin-left: 0; }
  .run-archive, .community-list { grid-template-columns: 1fr; }
  .community-directory-item { flex-direction: column; align-items: stretch; }
  .join-request-item { flex-wrap: wrap; }
  .join-request-actions { width: 100%; }
  .join-request-actions button { flex: 1; }
  .site-footer { flex-wrap: wrap; }
  .story-dialog { overflow-y: auto; }
  .story-dialog-shell { padding: 16px; }
  .story-dialog-body { grid-template-columns: 1fr; gap: 14px; }
  .story-preview-wrap { max-height: 50vh; overflow: hidden; }
  .story-preview-wrap canvas { max-height: 47vh; width: auto; max-width: 100%; }
  .story-template-list { grid-template-columns: 1fr 1fr; }
  .story-template { padding: 8px; gap: 6px; }
  .story-template-number { display: none; }
}

/* Guest landing page.
   Bold, sporty: oversized tight numerals are the motif (they match the story cards).
   Orange appears once as a full band, carrying the scoring rules, with dark text for contrast. */
.landing { min-height: 100vh; background: var(--bg); color: var(--text); }
.lp-wrap { max-width: 1200px; margin: 0 auto; }
.lp-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1200px; margin: 0 auto; padding: 20px 32px; }
.lp-brand { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.lp-brand span { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.lp-bar-actions { display: flex; align-items: center; gap: 24px; }
.lp-link { color: var(--text); font-size: 15px; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.lp-link:hover { color: var(--muted); }
.lp-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 24px; border-radius: 10px; font-size: 16px; font-weight: 700; text-decoration: none; transition: background .15s, transform .15s; }
.lp-btn:active { transform: translateY(1px); }
.lp-btn-dark { background: var(--text); color: #fff; }
.lp-btn-dark:hover { background: #3a3a37; }
.lp-btn-light { background: #fff; color: var(--text); }
.lp-btn-light:hover { background: #e7e7e4; }
.lp-bar .lp-btn { min-height: 44px; padding: 0 18px; font-size: 14px; }

.lp-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; gap: 64px; max-width: 1200px; margin: 0 auto; padding: 48px 32px 96px; }
.lp-hero h1 { font-size: clamp(48px, 7.4vw, 104px); line-height: .95; font-weight: 800; letter-spacing: -0.045em; }
.lp-lede { max-width: 520px; margin: 28px 0 0; font-size: 19px; line-height: 1.55; color: #3f3f3c; }
.lp-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; margin-top: 36px; }
.lp-fine { margin: 20px 0 0; font-size: 14px; color: var(--muted); }
.lp-card { margin: 0; justify-self: center; width: min(100%, 360px); }
.lp-canvas { aspect-ratio: 9 / 16; border-radius: 18px; overflow: hidden; background: #e7e7e4; box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.35); }
.lp-canvas canvas { display: block; width: 100%; height: 100%; }
.lp-styles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.lp-styles button { min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 14px; font-weight: 600; color: var(--muted); }
.lp-styles button:hover { color: var(--text); border-color: #c9c9c4; }
.lp-styles button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.lp-card figcaption { margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--muted); }

.lp-points { background: var(--accent); color: var(--text); padding: 96px 32px; }
.lp-points h2 { font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.03em; max-width: 520px; }
.lp-points-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin: 48px 0; }
.lp-points-grid p { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; max-width: 320px; }
.lp-points-grid strong { display: block; font-size: clamp(120px, 18vw, 240px); line-height: .82; font-weight: 800; letter-spacing: -0.06em; margin-bottom: 16px; }
.lp-points-note { max-width: 620px; margin: 0; padding-top: 24px; border-top: 2px solid var(--text); font-size: 17px; line-height: 1.55; font-weight: 500; }

.lp-inside { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 64px; max-width: 1200px; margin: 0 auto; padding: 112px 32px; }
.lp-inside h2 { font-size: clamp(32px, 4vw, 52px); line-height: 1; font-weight: 800; letter-spacing: -0.04em; }
.lp-list { list-style: none; margin: 0; padding: 0; }
.lp-list li { padding: 28px 0; border-top: 1px solid var(--border); }
.lp-list li:last-child { border-bottom: 1px solid var(--border); }
.lp-list h3 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.lp-list p { margin: 8px 0 0; max-width: 560px; font-size: 16px; line-height: 1.6; color: #52524e; }

.lp-close { background: var(--text); color: #fff; padding: 112px 32px; }
.lp-close h2 { font-size: clamp(40px, 6vw, 80px); line-height: .98; font-weight: 800; letter-spacing: -0.045em; max-width: 760px; }
.lp-close p { max-width: 520px; margin: 24px 0 36px; font-size: 18px; line-height: 1.55; color: #c9c9c4; }
.lp-foot { display: flex; justify-content: space-between; gap: 16px; max-width: 1200px; margin: 0 auto; padding: 24px 32px; font-size: 13px; color: var(--muted); }

@media (max-width: 860px) {
  .lp-hero { grid-template-columns: 1fr; gap: 48px; padding: 24px 20px 72px; }
  .lp-card { width: min(100%, 320px); }
  .lp-inside { grid-template-columns: 1fr; gap: 24px; padding: 80px 20px; }
  .lp-points, .lp-close { padding: 72px 20px; }
  .lp-bar, .lp-foot { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 560px) {
  .lp-bar-actions .lp-link { display: none; }
  .lp-points-grid { grid-template-columns: 1fr; gap: 40px; margin: 40px 0; }
  .lp-lede { font-size: 17px; }
  .lp-cta .lp-btn { width: 100%; }
  .lp-foot { flex-direction: column; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
.boot { min-height: 100vh; display: grid; place-items: center; margin: 0; font-size: 15px; color: var(--muted); }
.lp-brand, .lp-link { display: inline-flex; align-items: center; min-height: 44px; }
/* Phone tap targets: 44px minimum for every control in the dashboard. */
@media (max-width: 620px) {
  .period-tab, .text-button, .icon-button, .avatar-button { min-height: 44px; }
  .period-tab { padding: 0 14px; }
  .feed-share { width: 44px; height: 44px; }
  .icon-button { min-width: 44px; }
}

/* My recap highlights: a two-column list rather than more tiles, so the totals above stay the focal point. */
.recap-highlights { padding: 20px 20px 8px; margin-bottom: 20px; }
.recap-highlights h2 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.highlight-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; margin: 0; }
.highlight-list > div:not(.empty-state) { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.highlight-list > .empty-state { grid-column: 1 / -1; }
.highlight-list dt { font-size: 14px; color: var(--muted); }
.highlight-list dd { margin: 0; text-align: right; font-size: 18px; font-weight: 700; }
.highlight-list dd small { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--muted); }
@media (max-width: 760px) { .highlight-list { grid-template-columns: 1fr; } }

/* Owner tools: list or hide the crew from the All communities browse list. */
.visibility-toggle { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; margin: 0 0 18px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.visibility-toggle input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--text); cursor: pointer; }
.visibility-toggle input:disabled { cursor: not-allowed; }
.visibility-toggle strong { display: block; font-size: 14px; font-weight: 700; }
.visibility-toggle small { display: block; margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.visibility-toggle:hover { border-color: #c9c9c4; }

/* Pull-to-refresh indicator (installed app only). The page itself does not stretch while it shows. */
.pull-refresh { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; z-index: 90; transform: translate(-50%, -40px); padding: 8px 14px; border-radius: 8px; background: var(--text); color: #fff; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .15s; }
.pull-refresh.show { opacity: 1; }
@media (display-mode: standalone) { body { overscroll-behavior-y: contain; } }
