/* Racing Fans Tipping Cup — member dashboard. Everything is scoped under .rfc. */
.rfc {
	--rf-navy: #0A1628;
	--rf-navy-2: #12233d;
	--rf-teal: #258AA6;
	--rf-teal-bright: #5CC3DE;
	--rf-green: #1E9E63;
	--rf-gold: #E8B24A;
	--rf-red: #C2413A;

	--rfc-bg: #F3F6F9;
	--rfc-card: #FFFFFF;
	--rfc-ink: #0A1628;
	--rfc-muted: #5B6B80;
	--rfc-line: #DCE3EA;
	--rfc-sel: #E3F3F8;
	--rfc-sel-line: #258AA6;
	--rfc-chip: #EEF2F6;
	--rfc-good: #17804F;
	--rfc-radius: 14px;

	font-size: 16px;
	line-height: 1.45;
	color: var(--rfc-ink);
	max-width: 760px;
	margin: 0 auto;
	-webkit-font-smoothing: antialiased;
	box-sizing: border-box;
}
.rfc *, .rfc *::before, .rfc *::after { box-sizing: inherit; }
@media (prefers-color-scheme: dark) {
	.rfc:not([data-theme="light"]) {
		--rfc-bg: #0A1628;
		--rfc-card: #12233d;
		--rfc-ink: #EAF1F7;
		--rfc-muted: #9FB0C4;
		--rfc-line: #24395A;
		--rfc-sel: #173D52;
		--rfc-sel-line: #5CC3DE;
		--rfc-chip: #1A2E4B;
		--rfc-good: #39D98A;
	}
}
.rfc button, .rfc input, .rfc select { font: inherit; color: inherit; }
/* Headings follow the body font, not the theme's display font, so the dashboard reads as one piece. */
.rfc h2, .rfc h3, .rfc h4 { font-family: inherit; letter-spacing: normal; text-transform: none; }
.rfc h3, .rfc h4 { color: inherit; }
.rfc button { cursor: pointer; }
.rfc :focus-visible { outline: 3px solid var(--rf-gold); outline-offset: 2px; }
.rfc .rfc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rfc-loading { padding: 40px 16px; text-align: center; color: var(--rfc-muted); }

/* ---------- header ---------- */
.rfc-head {
	background: linear-gradient(135deg, var(--rf-navy) 0%, #0f2a45 100%);
	color: #fff;
	border-radius: var(--rfc-radius);
	padding: 18px 16px 14px;
	position: relative;
	overflow: hidden;
}
.rfc-head::after {
	content: ""; position: absolute; right: -40px; top: -30px; width: 180px; height: 120px;
	background: repeating-linear-gradient(-20deg, rgba(92,195,222,.18) 0 6px, transparent 6px 16px);
	transform: skewX(-20deg); pointer-events: none;
}
.rfc-kicker { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--rf-teal-bright); font-weight: 700; }
.rfc-title { margin: 2px 0 12px; font-size: 22px; line-height: 1.2; font-weight: 800; font-style: italic; color: #fff; }
.rfc-rounds { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.rfc-rounds::-webkit-scrollbar { display: none; }
.rfc-round-chip {
	flex: 0 0 auto; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.06);
	color: #fff; border-radius: 999px; padding: 6px 12px; font-size: 14px; line-height: 1.2; text-align: left;
}
.rfc-round-chip small { display: block; font-size: 11px; opacity: .75; }
.rfc-round-chip[aria-current="true"] { background: var(--rf-teal); border-color: var(--rf-teal); }
.rfc-round-chip.is-final small::before { content: "✓ "; }

/* ---------- stat tiles ---------- */
.rfc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 0; }
.rfc-stat { background: var(--rfc-card); border: 1px solid var(--rfc-line); border-radius: 12px; padding: 10px 8px; text-align: center; min-width: 0; }
.rfc-stat b { display: block; font-size: 22px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.rfc-stat span { display: block; font-size: 12px; color: var(--rfc-muted); margin-top: 2px; }
.rfc-qual { margin: 8px 2px 0; font-size: 13px; color: var(--rfc-muted); }
.rfc-qual.is-ok { color: var(--rfc-good); }
@media (max-width: 380px) { .rfc-stat b { font-size: 18px; } .rfc-stat span { font-size: 11px; } }

/* ---------- tabs ---------- */
.rfc-tabs {
	display: flex; gap: 4px; margin: 14px 0 12px; background: var(--rfc-chip); padding: 4px; border-radius: 12px;
	position: sticky; top: var(--rfc-sticky-top, 0px); z-index: 5;
}
.rfc-tab { flex: 1; border: 0; background: transparent; padding: 9px 4px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--rfc-muted); }
.rfc-tab[aria-selected="true"] { background: var(--rfc-card); color: var(--rfc-ink); box-shadow: 0 1px 3px rgba(10,22,40,.12); }

/* ---------- round banner ---------- */
.rfc-banner { background: var(--rfc-card); border: 1px solid var(--rfc-line); border-radius: var(--rfc-radius); padding: 14px 16px; margin-bottom: 10px; }
.rfc-banner h3 { margin: 0; font-size: 18px; line-height: 1.25; }
.rfc-banner p { margin: 2px 0 0; color: var(--rfc-muted); font-size: 14px; }
.rfc-progress { height: 6px; background: var(--rfc-chip); border-radius: 99px; margin: 12px 0 6px; overflow: hidden; }
.rfc-progress i { display: block; height: 100%; background: var(--rf-teal); border-radius: 99px; transition: width .25s; }
.rfc-banner-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--rfc-muted); }
.rfc-banner-row strong { color: var(--rfc-ink); }
.rfc-final { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-top: 10px; font-size: 14px; }
.rfc-final b { font-size: 22px; }

/* ---------- race cards ---------- */
.rfc-race { scroll-margin-top: 72px; background: var(--rfc-card); border: 1px solid var(--rfc-line); border-radius: var(--rfc-radius); margin-bottom: 8px; overflow: hidden; }
.rfc-race.has-error { border-color: var(--rf-red); }
.rfc-race-head { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; text-align: left; background: none; border: 0; padding: 12px 14px; }
.rfc-race-meta { font-size: 13px; color: var(--rfc-muted); font-weight: 600; }
.rfc-race-meta .rfc-banker-flag { color: var(--rf-gold); margin-left: 4px; }
.rfc-race-name { grid-column: 1 / 2; font-size: 15px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.rfc-race-pick { grid-column: 1 / 3; font-size: 14px; color: var(--rfc-muted); display: flex; align-items: center; gap: 6px; min-width: 0; }
.rfc-race-pick strong { color: var(--rfc-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rfc-race-pick.is-empty { color: var(--rf-teal); font-weight: 600; }
.rfc-pill { grid-row: 1 / 3; grid-column: 2; justify-self: end; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 99px; background: var(--rfc-chip); color: var(--rfc-muted); white-space: nowrap; }
.rfc-pill.is-soon { background: #FDF1D8; color: #8A5A00; }
.rfc-pill.is-locked { background: var(--rfc-chip); }
.rfc-pill.is-won { background: #DDF3E8; color: #0F6A40; }
.rfc-pill.is-placed { background: #E3F3F8; color: #1A6075; }
.rfc-pill.is-lost { background: var(--rfc-chip); color: var(--rfc-muted); }
@media (prefers-color-scheme: dark) {
	.rfc:not([data-theme="light"]) .rfc-pill.is-soon { background: #4A3A12; color: #F6D48A; }
	.rfc:not([data-theme="light"]) .rfc-pill.is-won { background: #123F2B; color: #7FE3B1; }
	.rfc:not([data-theme="light"]) .rfc-pill.is-placed { background: #173D52; color: #9ADCEE; }
}
.rfc-race-body { border-top: 1px solid var(--rfc-line); padding: 6px 8px 10px; }
.rfc-runners { list-style: none; margin: 0; padding: 0; }
.rfc-runner {
	width: 100%; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center;
	text-align: left; background: none; border: 2px solid transparent; border-radius: 10px; padding: 8px 8px; min-height: 52px;
}
.rfc-runner:hover:not([disabled]) { background: var(--rfc-chip); }
.rfc-runner[aria-pressed="true"] { background: var(--rfc-sel); border-color: var(--rfc-sel-line); }
.rfc-runner[disabled] { cursor: default; }
.rfc-no { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; background: var(--rf-navy); color: #fff; font-size: 15px; }
.rfc-runner[aria-pressed="true"] .rfc-no { background: var(--rf-teal); }
.rfc-rname { min-width: 0; }
.rfc-rname b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rfc-rname small { display: block; font-size: 12px; color: var(--rfc-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rfc-price { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; text-align: right; }
.rfc-price small { display: block; font-weight: 500; font-size: 11px; color: var(--rfc-muted); }
.rfc-runner.is-scr { opacity: .5; }
.rfc-runner.is-scr b { text-decoration: line-through; }
.rfc-pos { display: inline-block; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: var(--rf-gold); color: var(--rf-navy); margin-right: 4px; vertical-align: 1px; }
.rfc-share { display: block; height: 3px; background: var(--rfc-chip); border-radius: 3px; margin-top: 4px; }
.rfc-share i { display: block; height: 100%; background: var(--rf-teal-bright); border-radius: 3px; }

.rfc-banker-btn {
	display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px; margin: 8px 0 0;
	border: 1px dashed var(--rf-gold); background: transparent; color: var(--rfc-ink); border-radius: 10px; padding: 10px; font-weight: 600; font-size: 14px;
}
.rfc-banker-btn[aria-pressed="true"] { background: var(--rf-gold); color: var(--rf-navy); border-style: solid; }
.rfc-race-note { font-size: 13px; color: var(--rfc-muted); margin: 8px 6px 0; }
.rfc-race-error { font-size: 13px; color: var(--rf-red); margin: 8px 6px 0; font-weight: 600; }
.rfc-points { font-weight: 800; color: var(--rfc-good); }

/* ---------- tie-breaker ---------- */
.rfc-card { background: var(--rfc-card); border: 1px solid var(--rfc-line); border-radius: var(--rfc-radius); padding: 14px 16px; margin-bottom: 10px; }
.rfc-card h4 { margin: 0 0 4px; font-size: 16px; }
.rfc-card p { margin: 0 0 8px; font-size: 14px; color: var(--rfc-muted); }
.rfc-field { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rfc-input { border: 1px solid var(--rfc-line); background: var(--rfc-bg); border-radius: 10px; padding: 10px 12px; font-size: 16px; min-width: 0; flex: 1 1 160px; }
.rfc-input:focus { border-color: var(--rf-teal); outline: none; box-shadow: 0 0 0 3px rgba(37,138,166,.25); }

/* ---------- buttons ---------- */
.rfc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; padding: 11px 16px; font-weight: 700; font-size: 15px; border: 1px solid transparent; text-decoration: none; min-height: 44px; }
.rfc-btn-primary { background: var(--rf-teal); color: #fff; }
.rfc-btn-primary:hover { background: #1E7690; color: #fff; }
.rfc-btn-primary[disabled] { opacity: .55; cursor: default; }
.rfc-btn-ghost { background: transparent; border-color: var(--rfc-line); color: var(--rfc-ink); }
.rfc-btn-small { padding: 7px 12px; min-height: 36px; font-size: 14px; }
.rfc-link { background: none; border: 0; padding: 0; color: var(--rf-teal); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- save bar ---------- */
.rfc-savebar {
	position: sticky; bottom: 0; z-index: 6; margin: 12px -4px 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
	background: var(--rf-navy); color: #fff; border-radius: 14px 14px 0 0; display: flex; align-items: center; gap: 10px;
	box-shadow: 0 -6px 20px rgba(10,22,40,.25);
}
.rfc-savebar-text { flex: 1; font-size: 14px; line-height: 1.3; min-width: 0; }
.rfc-savebar-text small { display: block; opacity: .7; font-size: 12px; }
.rfc-savebar .rfc-link { color: var(--rf-teal-bright); font-size: 14px; }
.rfc-savebar.is-clean { background: var(--rfc-card); color: var(--rfc-ink); border: 1px solid var(--rfc-line); box-shadow: none; }

/* ---------- toast ---------- */
.rfc-toast {
	position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); opacity: 0;
	background: var(--rf-navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
	transition: all .2s; z-index: 99999; max-width: calc(100vw - 32px); pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.rfc-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.rfc-toast.is-bad { background: var(--rf-red); }

/* ---------- leaderboard ---------- */
.rfc-seg { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.rfc-seg button, .rfc-seg select { border: 1px solid var(--rfc-line); background: var(--rfc-card); border-radius: 99px; padding: 7px 14px; font-size: 14px; font-weight: 600; }
.rfc-seg button[aria-pressed="true"] { background: var(--rf-navy); color: #fff; border-color: var(--rf-navy); }
.rfc-seg select { max-width: 100%; }
.rfc-board { list-style: none; margin: 0; padding: 0; background: var(--rfc-card); border: 1px solid var(--rfc-line); border-radius: var(--rfc-radius); overflow: hidden; }
.rfc-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--rfc-line); }
.rfc-row:first-child { border-top: 0; }
.rfc-row.is-me { background: var(--rfc-sel); }
.rfc-row.is-engine { background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(37,138,166,.06) 8px 16px); }
.rfc-rank { font-weight: 800; font-size: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.rfc-rank.is-top { color: #fff; background: var(--rf-gold); color: var(--rf-navy); border-radius: 8px; padding: 4px 0; }
.rfc-who { min-width: 0; }
.rfc-who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.rfc-who small { color: var(--rfc-muted); font-size: 12px; }
.rfc-tag { display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 5px; margin-left: 6px; vertical-align: 2px; background: var(--rfc-chip); color: var(--rfc-muted); }
.rfc-tag.is-me { background: var(--rf-teal); color: #fff; }
.rfc-tag.is-engine { background: var(--rf-navy); color: var(--rf-teal-bright); }
.rfc-pts { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; text-align: right; }
.rfc-pts small { display: block; font-weight: 500; font-size: 11px; color: var(--rfc-muted); }
.rfc-gap { text-align: center; color: var(--rfc-muted); padding: 4px 0; font-size: 18px; letter-spacing: .2em; border-top: 1px solid var(--rfc-line); }
.rfc-board-foot { font-size: 12px; color: var(--rfc-muted); margin: 8px 2px 0; }
.rfc-empty { padding: 26px 16px; text-align: center; color: var(--rfc-muted); font-size: 14px; }

/* ---------- leagues ---------- */
.rfc-league { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.rfc-league h4 { margin: 0; }
.rfc-league-actions { grid-column: 1 / 3; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.rfc-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .12em; background: var(--rfc-chip); padding: 2px 8px; border-radius: 6px; }
.rfc-invite { border: 2px solid var(--rf-teal); }
.rfc-toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.rfc-toggle input { width: 20px; height: 20px; accent-color: var(--rf-teal); }

/* ---------- rules ---------- */
.rfc-rules h4 { margin: 14px 0 4px; font-size: 16px; }
.rfc-rules h4:first-child { margin-top: 0; }
.rfc-rules p, .rfc-rules li { font-size: 14px; color: var(--rfc-ink); }
.rfc-rules ul { margin: 4px 0 8px 18px; padding: 0; }
.rfc-formula { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--rfc-chip); border-radius: 8px; padding: 10px 12px; font-size: 13px; overflow-x: auto; }
.rfc-ex { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.rfc-ex th, .rfc-ex td { border-bottom: 1px solid var(--rfc-line); padding: 6px 4px; text-align: left; }
.rfc-ex td:last-child, .rfc-ex th:last-child { text-align: right; font-weight: 700; }

/* ---------- compliance ---------- */
.rfc-compliance { font-size: 12px; color: var(--rfc-muted); margin: 16px 2px 8px; line-height: 1.5; }
.rfc-compliance a { color: inherit; }
.rfc-note { font-size: 14px; color: var(--rfc-muted); }

/* ---------- gate (signed out) ---------- */
.rfc-hero { background: linear-gradient(135deg, var(--rf-navy), #0f2a45); color: #fff; border-radius: var(--rfc-radius); padding: 24px 18px; }
.rfc-hero-title { color: #fff; margin: 4px 0 8px; font-size: 26px; line-height: 1.15; font-style: italic; font-weight: 800; }
.rfc-hero-sub { margin: 0 0 16px; color: #D6E2EE; }
.rfc-hero-invite { background: rgba(92,195,222,.15); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
.rfc-hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.rfc-hero .rfc-btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.rfc-gate-points { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.rfc-gate-points li { background: var(--rfc-card); border: 1px solid var(--rfc-line); border-radius: 12px; padding: 12px 14px; }
.rfc-gate-points strong { display: block; }
.rfc-gate-points span { color: var(--rfc-muted); font-size: 14px; }
@media (min-width: 640px) { .rfc-gate-points { grid-template-columns: repeat(3, 1fr); } }
