:root {
	/* Brand + surfaces */
	--bg: #05060a;
	--bg-elevated: #10121a;
	--bg-elevated-soft: #151824;

	/* Text */
	--text: #f5f7fb;
	--text-muted: #9aa3b5;

	/* Accent / status */
	--accent: #5df29c;
	--accent-soft: rgba(93, 242, 156, 0.12);
	--danger: #ff6b6b;

	/* Borders / lines */
	--border-subtle: rgba(255, 255, 255, 0.05);

	/* Radii & shadows */
	--radius-lg: 18px;
	--radius-pill: 999px;
	--shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.55);
	--shadow-subtle: 0 10px 25px rgba(0, 0, 0, 0.45);

	/* Motion */
	--transition-fast: 150ms ease-out;

	/* Backwards-compat old vars */
	--card: var(--bg-elevated-soft);
	--muted: var(--text-muted);
	--err: var(--danger);
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--text);
	background:
		radial-gradient(1200px 600px at 20% -10%, rgba(93, 242, 156, 0.07), transparent 60%),
		radial-gradient(800px 500px at 120% 10%, rgba(93, 242, 156, 0.04), transparent 55%),
		var(--bg);
}

/* Layout shell */

.container {
	max-width: 960px;
	margin: 0 auto;
	padding: 24px 20px 40px;
}

.muted {
	color: var(--muted);
}

/* --- Top nav & brand --- */

.top-nav {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 0 10px;
	position: sticky;
	top: 0;
	z-index: 20;
	background: linear-gradient(to bottom,
		rgba(5, 6, 10, 0.98),
		rgba(5, 6, 10, 0.9),
		transparent
	);
	backdrop-filter: blur(10px);
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
}

.brand-mark {
	font-size: 22px;
}

.brand-name {
	font-weight: 800;
	letter-spacing: .2px;
}

.nav-links {
	display: flex;
	gap: 12px;
}

.back {
	color: var(--muted);
	text-decoration: none;
	font-size: 0.9rem;
}

.nav-links .back {
	padding: 6px 10px;
	border-radius: var(--radius-pill);
	border: 1px solid transparent;
	color: var(--text-muted);
	text-decoration: none;
	transition:
		background var(--transition-fast),
		color var(--transition-fast),
		border-color var(--transition-fast),
		transform var(--transition-fast);
}

.nav-links .back:hover {
	background: rgba(255, 255, 255, 0.04);
	color: var(--text);
	border-color: rgba(255, 255, 255, 0.06);
	transform: translateY(-1px);
}

/* Disabled nav pill used on climb_stats when spectator */
.back.back-disabled {
	opacity: 0.5;
	cursor: default;
	pointer-events: none;
	border-color: transparent;
}

/* optional: when you add .active in templates */
.nav-links .back.active {
	background: var(--accent-soft);
	color: var(--accent);
	border-color: rgba(93, 242, 156, 0.5);
}

/* --- Global header + card basics --- */

.header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	flex-wrap: wrap;
	row-gap: 4px;
	margin-bottom: 16px;
}

/* header helper layout for Name/Competitor # vs Points/Position */
.header-column {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.header-column.right {
	text-align: right;
}

.header-line-main,
.header-line-sub {
	display: flex;
	align-items: baseline;
	gap: 6px;
}

.header-line-main {
	font-size: 1.9rem;
	font-weight: 700;
}

.header-line-sub {
	font-size: 1.1rem;
	color: var(--muted);
}

.header-column.right .header-line-main,
.header-column.right .header-line-sub {
	justify-content: flex-end;
}

.header-label {
	font-weight: 700;
}

.header-name {
	overflow-wrap: anywhere;
}

/* Unified card style */

.card,
.climb-card,
.stats-card,
.enter-card,
.info.card {
	background: var(--bg-elevated-soft);
	border-radius: var(--radius-lg);
	border: 1px solid var(--border-subtle);
	box-shadow: var(--shadow-soft);
}

/* Specific padding where needed */

.card,
.climb-card {
	padding: 16px;
}

.enter-card {
	margin-top: 16px;
	padding: 20px;
}

.info.card {
	padding: 16px;
}

/* --- Unified competitor header: big name + stat pills --- */

.comp-header {
	margin-bottom: 20px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Name line */
.comp-name {
	margin: 0;
	font-size: 1.4rem;
	font-weight: 800;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: baseline;
}

.comp-label {
	font-weight: 700;
}

.comp-value {
	overflow-wrap: anywhere;  /* long names won’t break layout */
}

/* Stats row (Competitor #, Points, Position) */
.comp-meta-row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

/* Pill style – centered label + value */

.comp-pill {
	background:
		radial-gradient(circle at top left, rgba(255, 255, 255, 0.06), transparent 55%),
		var(--bg-elevated);
	border-radius: 14px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
	padding: 10px 16px;
	min-width: 110px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	transition:
		transform var(--transition-fast),
		box-shadow var(--transition-fast),
		border-color var(--transition-fast);
}

.comp-pill:hover {
	transform: translateY(-1px);
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
	border-color: rgba(93, 242, 156, 0.5);
}

.comp-pill-label {
	font-size: 0.70rem;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 1px;
	margin-bottom: 2px;
}

.comp-pill-value {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--text);
}

/* On very small screens, keep things readable */
@media (max-width: 480px) {
	.comp-name {
		font-size: 1.25rem;
	}

	.comp-pill {
		padding: 8px 12px;
		min-width: 95px;
	}

	.comp-pill-value {
		font-size: 1rem;
	}
}

/* --- Forms & inputs --- */

.card label {
	display: block;
	margin-bottom: 8px;
	color: var(--muted);
}

.card input {
	width: 100%;
	padding: 10px 12px;
	border-radius: 8px;
	border: 1px solid #2a2f36;
	background: var(--bg-elevated);
	color: var(--text);
	outline: none;
	transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.card input:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 2px var(--accent-soft);
	background: #0b0d12;
}

.card button {
	margin-top: 12px;
	padding: 10px 14px;
	border: 0;
	border-radius: 10px;
	background: var(--accent);
	color: #0a0a0a;
	font-weight: 600;
	cursor: pointer;
	transition: filter var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.card button:hover {
	filter: brightness(1.05);
	transform: translateY(-1px);
	box-shadow: 0 14px 28px rgba(0, 0, 0, 0.6);
}

.error {
	margin: 12px 0;
	color: #fff;
	background: #8b1e1e;
	padding: 10px 12px;
	border-radius: 8px;
}

/* --- Grid of climbs --- */

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 12px;
}

/* Override climb logging cards: white box, dark text */
.climb-card {
	background: #ffffff;
	color: #05060a;
	border-radius: var(--radius-lg);
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: var(--shadow-soft);
}

.climb-card h3,
.climb-card p {
	color: #05060a;
}

.climb-card h3 {
	margin-top: 0;
	font-size: 1.1rem;
}

.climb-colour {
	margin: 4px 0 6px;
	color: var(--text);
	font-size: 1.1rem;
	font-weight: 600;
}

.row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 10px 0;
}

.row input[type=number] {
	width: 100%;
	padding: 8px;
	border-radius: 8px;
	border: 1px solid #333;
	background: var(--bg-elevated);
	color: var(--text);
}

/* checkbox + label inline */
.check {
	color: var(--muted);
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
}

/* override generic card label layout for checkbox rows */
.card label.check {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 0;
}

.save {
	width: 100%;
	padding: 8px 10px;
	border-radius: 8px;
	border: 0;
	background: var(--accent);
	font-weight: 700;
	cursor: pointer;
	transition: filter var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
	box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}

.save:hover {
	filter: brightness(1.06);
	transform: translateY(-1px);
	box-shadow: 0 12px 26px rgba(0, 0, 0, 0.6);
}

.status {
	min-height: 1em;
	font-size: 12px;
	color: var(--muted);
	margin-top: 6px;
}

.status.ok {
	color: var(--accent);
}

.status.err {
	color: var(--danger);
}

/* --- Summary --- */

.summary {
	margin-top: 24px;
}

.summary ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.summary li {
	padding: 8px 12px;
	border-bottom: 1px solid #262a30;
}

/* --- Section header inside competitor card --- */

.section-header {
	text-align: center;
	margin-bottom: 12px;
}

.section-title {
	margin: 0;
	font-size: 1.8rem;
}

.section-subtitle {
	margin: 4px 0 0;
	font-size: 0.9rem;
}

/* --- Hero (index page) --- */

.hero {
	margin: 24px 0 12px;
}

.hero h1 {
	margin: 0 0 8px;
	font-size: clamp(28px, 4vw, 36px);
}

.hero p {
	color: var(--muted);
	margin: 0;
}

/* --- Enter card (index) --- */

.enter-form label {
	color: var(--muted);
	display: block;
	margin-bottom: 8px;
}

.input-row {
	display: flex;
	gap: 10px;
	align-items: center;
}

.input-row input {
	flex: 1;
	padding: 12px 14px;
	border-radius: 10px;
	border: 1px solid #2a2f36;
	background: var(--bg-elevated);
	color: #fff;
	outline: none;
}

.input-row input:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary {
	padding: 12px 16px;
	border: 0;
	border-radius: 10px;
	background: var(--accent);
	color: #0a0a0a;
	font-weight: 800;
	cursor: pointer;
	transition: filter var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
	box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

.primary:hover {
	filter: brightness(1.05);
	transform: translateY(-1px);
	box-shadow: 0 14px 30px rgba(0, 0, 0, 0.6);
}

.form-hint {
	margin-top: 10px;
	color: var(--muted);
	font-size: 14px;
}

/* ghost link button */

.ghost {
	display: inline-block;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid #2a2f36;
	color: var(--text);
	text-decoration: none;
	transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.ghost:hover {
	background: #121418;
	border-color: var(--border-subtle);
	transform: translateY(-1px);
}

.quick-links {
	margin-top: 12px;
}

/* --- Info grid (index) --- */

.info-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 12px;
	margin-top: 20px;
}

.info.card h3 {
	margin: 0 0 6px;
}

.info.card p {
	margin: 0;
	color: var(--muted);
}

/* --- Leaderboard table --- */

.leaderboard {
	width: 100%;
	border-collapse: collapse;
	background: var(--bg-elevated-soft);
	border-radius: var(--radius-lg);
	overflow: hidden;
	box-shadow: var(--shadow-soft);
}

.leaderboard thead th {
	text-align: left;
	font-weight: 700;
	padding: 12px 14px;
	border-bottom: 1px solid var(--border-subtle);
	color: var(--muted);
	font-size: 0.9rem;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	background: rgba(255, 255, 255, 0.02);
}

.leaderboard tbody td {
	padding: 12px 14px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.04);
	color: var(--text);
	font-size: 0.95rem;
}

.leaderboard tbody tr:nth-child(even) {
	background: rgba(255, 255, 255, 0.01);
}

.leaderboard tbody tr:hover {
	background: rgba(93, 242, 156, 0.05);
}

/* Top 3 highlight */
.leaderboard tbody tr:nth-child(1) {
	box-shadow: inset 3px 0 0 var(--accent);
}
.leaderboard tbody tr:nth-child(2),
.leaderboard tbody tr:nth-child(3) {
	box-shadow: inset 3px 0 0 rgba(93, 242, 156, 0.5);
}

/* fix link colors inside tables */
.leaderboard a {
	color: var(--accent);
	text-decoration: none;
}

.leaderboard a:hover {
	color: #7fffa4;
	text-decoration: underline;
}

/* Center the numeric columns on the leaderboard:
   Tops (3), Attempts (4), Points (5) */
.leaderboard th:nth-child(3),
.leaderboard td:nth-child(3),
.leaderboard th:nth-child(4),
.leaderboard td:nth-child(4),
.leaderboard th:nth-child(5),
.leaderboard td:nth-child(5) {
	text-align: center;
}

/* Wrapper so the leaderboard fills the viewport nicely even with few rows */
.leaderboard-wrapper {
	min-height: calc(100vh - 160px);
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
}

/* --- Section tabs / buttons (competitor + section selection) --- */

.section-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 8px 0 16px;
}

.section-tab {
	display: inline-block;
	padding: 10px 14px;
	border-radius: var(--radius-pill);
	border: 1px solid #2a2f36;
	background: #121418;
	color: var(--text);
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	text-align: left;
	min-width: 160px;
	transition:
		background var(--transition-fast),
		border-color var(--transition-fast),
		transform var(--transition-fast),
		box-shadow var(--transition-fast);
}

.section-tab-title {
	font-weight: 600;
}

.section-tab-sub {
	font-size: 12px;
	color: var(--muted);
}

.section-tab:hover {
	background: #171b21;
	border-color: var(--border-subtle);
	transform: translateY(-1px);
	box-shadow: var(--shadow-subtle);
}

.section-tab:visited,
.section-tab:active,
.section-tab:focus {
	color: var(--text);
}

.section-tab.active {
	background: var(--accent);
	color: #0a0a0a;
	border-color: var(--accent);
	box-shadow: 0 10px 24px rgba(93, 242, 156, 0.45);
}

/* BIG section buttons on competitor_sections.html */
.section-btn-big {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	padding: 28px;
	border-radius: 16px;
	background: #1c1f24;
	border: 2px solid #2f353d;
	font-size: 1.8rem;
	color: var(--text);
	font-weight: 700;
	text-decoration: none;
	transition:
		background var(--transition-fast),
		border-color var(--transition-fast),
		color var(--transition-fast),
		transform var(--transition-fast),
		box-shadow var(--transition-fast);
	text-align: center;
}

/* read-only version of the big section button */
.section-btn-disabled {
	cursor: default;
	border-style: dashed;
	opacity: 0.85;
}

.section-btn-note {
	display: block;
	margin-top: 6px;
	font-size: 0.8rem;
	color: var(--text-muted);
}

/* small note above grid when in read-only mode */
.view-only-note {
	margin: 0 0 8px 0;
	font-size: 0.9rem;
	color: var(--text-muted);
}

.section-btn-big:hover {
	background: #24292f;
	border-color: var(--accent);
	color: #7fffa4;
	transform: translateY(-2px);
	box-shadow: var(--shadow-subtle);
}

/* Same grid but spaced for large buttons */
.section-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 18px;
	margin-top: 25px;
}

/* --- Points header (used on competitor + sections pages) --- */

.points-header {
	font-size: 1.8rem;
	font-weight: 700;
	color: var(--text);
}

/* STATS CARD LAYOUT */
.stats-card {
	padding: 16px 20px;
	margin-bottom: 20px;
	overflow: hidden;
}

.stats-title {
	margin: 0 0 12px 0;
	font-size: 1.3rem;
	color: var(--text);
}

/* TABLE – generic base */

.stats-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.stats-table th,
.stats-table td {
	padding: 8px 10px;
	text-align: left;
}

.stats-table th {
	font-weight: 600;
	color: var(--muted);
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-table tbody tr:nth-child(even) {
	background: rgba(255, 255, 255, 0.02);
}

/* Allow first column (usually names/sections) to wrap nicely */
.stats-table tbody td:first-child {
	white-space: normal;
	overflow-wrap: break-word;
	max-width: 180px;
}

/* --- Performance by Section table (competitor_stats) --- */

.section-performance-table th:nth-child(2),
.section-performance-table td:nth-child(2),
.section-performance-table th:nth-child(3),
.section-performance-table td:nth-child(3),
.section-performance-table th:nth-child(4),
.section-performance-table td:nth-child(4),
.section-performance-table th:nth-child(5),
.section-performance-table td:nth-child(5) {
	text-align: right;
	white-space: nowrap;
}

/* --- Per-competitor breakdown (climb_stats) --- */

.per-competitor-container .stats-table-wrapper {
	overflow-x: visible;
}

.per-competitor-container .stats-table {
	width: auto;
	min-width: 0;
}

.per-competitor-table th:nth-child(2),
.per-competitor-table td:nth-child(2) {
	text-align: right;
	white-space: nowrap;
}

.per-competitor-table th:nth-child(3),
.per-competitor-table td:nth-child(3) {
	text-align: left;
	white-space: normal;
}

/* Overview table: wrap labels, keep numbers snug on the right */
.overview-table {
	table-layout: fixed;
}

.overview-table th {
	white-space: normal;
	word-wrap: break-word;
	max-width: 70%;
}

.overview-table td {
	white-space: normal;
	text-align: right;
	width: 30%;
}

/* HEATMAP */

.heatmap-section-title {
	margin: 12px 0 6px 0;
	font-size: 1.05rem;
	color: var(--text);
}

.heatmap-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
	gap: 6px;
	margin-bottom: 10px;
}

.heat-cell {
	height: 36px;
	border-radius: 12px;
	border: 1px solid rgba(0, 0, 0, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text);
	opacity: 0.95;
	transition:
		transform var(--transition-fast),
		box-shadow var(--transition-fast),
		filter var(--transition-fast);
}

.heatmap-grid a.heat-cell-link {
	text-decoration: none;
	color: inherit;
}

.heat-cell:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
	filter: brightness(1.1);
	cursor: pointer;
}

/* ========================================================================= */
/* COLOUR-BLIND-SAFE PERSONAL HEATMAP (with patterns)                        */
/* Uses Okabe–Ito palette                                                    */
/* ========================================================================= */

/* Flashed – blue stripes */
.status-flashed {
	background: repeating-linear-gradient(
		45deg,
		#0072B2,
		#0072B2 6px,
		#005B8A 6px,
		#005B8A 12px
	);
	color: #ffffff;
}

/* Topped (multiple attempts) – teal stripes */
.status-topped-late {
	background: repeating-linear-gradient(
		45deg,
		#009E73,
		#009E73 6px,
		#007F5D 6px,
		#007F5D 12px
	);
	color: #ffffff;
}

/* Attempted but not topped – orange stripes */
.status-not-topped {
	background: repeating-linear-gradient(
		45deg,
		#D55E00,
		#D55E00 6px,
		#B74F00 6px,
		#B74F00 12px
	);
	color: #ffffff;
}

/* Not tried yet – grey stripes */
.status-skipped {
	background: repeating-linear-gradient(
		45deg,
		#BBBBBB,
		#BBBBBB 6px,
		#999999 6px,
		#999999 12px
	);
	color: #ffffff;
}

/* ============================
   LOGGING BUTTON ACTIVE STATES
   Using heatmap patterns
   ============================ */

/* Flashed (active) → blue striped pattern */
.flash-btn.is-active {
	background: repeating-linear-gradient(
		45deg,
		#0072B2,
		#0072B2 6px,
		#005B8A 6px,
		#005B8A 12px
	) !important;
	color: #ffffff !important;
	border-color: #0072B2 !important;
	box-shadow: 0 6px 16px rgba(0, 114, 178, 0.45) !important;
}

/* Topped + Attempts (active) → teal striped pattern */
.topped-toggle-btn.is-active,
.attempt-pill.is-active {
	background: repeating-linear-gradient(
		45deg,
		#009E73,
		#009E73 6px,
		#007F5D 6px,
		#007F5D 12px
	) !important;
	color: #ffffff !important;
	border-color: #009E73 !important;
	box-shadow: 0 6px 16px rgba(0, 158, 115, 0.45) !important;
}

/* Legend */

.heatmap-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 8px;
	font-size: 0.85rem;
	color: var(--muted);
}

.legend-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.legend-box {
	width: 14px;
	height: 14px;
	border-radius: 4px;
	display: inline-block;
}

/* ========================================================================= */
/* GLOBAL DIFFICULTY HEATMAP – COLOUR-BLIND-SAFE                             */
/* ========================================================================= */

.global-easy {
	background: repeating-linear-gradient(
		45deg,
		#009E73,
		#009E73 6px,
		#007F5D 6px,
		#007F5D 12px
	);
	color: #ffffff;
}

.global-medium {
	background: repeating-linear-gradient(
		45deg,
		#F0E442,
		#F0E442 6px,
		#C9C037 6px,
		#C9C037 12px
	);
	color: #ffffff;
}

.global-hard {
	background: repeating-linear-gradient(
		45deg,
		#D55E00,
		#D55E00 6px,
		#B74F00 6px,
		#B74F00 12px
	);
	color: #ffffff;
}

.global-no-data {
	background: repeating-linear-gradient(
		45deg,
		#CCCCCC,
		#CCCCCC 6px,
		#AAAAAA 6px,
		#AAAAAA 12px
	);
	color: #ffffff;
}

/* Legend boxes reuse same colours/patterns */

.legend-box.global-easy {
	background: repeating-linear-gradient(
		45deg,
		#009E73,
		#009E73 6px,
		#007F5D 6px,
		#007F5D 12px
	);
}

.legend-box.global-medium {
	background: repeating-linear-gradient(
		45deg,
		#F0E442,
		#F0E442 6px,
		#C9C037 6px,
		#C9C037 12px
	);
}

.legend-box.global-hard {
	background: repeating-linear-gradient(
		45deg,
		#D55E00,
		#D55E00 6px,
		#B74F00 6px,
		#B74F00 12px
	);
}

.legend-box.global-no-data {
	background: repeating-linear-gradient(
		45deg,
		#CCCCCC,
		#CCCCCC 6px,
		#AAAAAA 6px,
		#AAAAAA 12px
	);
}

/* Standardise climb-status pill text colours for readability */
.status-flashed,
.status-topped-late,
.status-topped,
.status-flash,
.status-ok {
	color: #ffffff !important;
}

.status-not-topped,
.status-attempted {
	color: #ffffff !important;
}

/* --- Responsive tweaks for stats table --- */

.stats-table-wrapper {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.stats-table-wrapper .stats-table {
	min-width: 480px;
}

@media (max-width: 600px) {
	.stats-table th,
	.stats-table td {
		padding: 6px 6px;
		font-size: 0.85rem;
	}
}

/* --- Filter buttons on climb_stats --- */

.filter-btn {
	padding: 6px 12px;
	font-size: 0.85rem;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	background: #151824;   /* neutral by default */
	color: var(--text-muted);
	cursor: pointer;
	font-weight: 600;
	transition:
		background var(--transition-fast),
		color var(--transition-fast),
		border-color var(--transition-fast),
		transform var(--transition-fast),
		box-shadow var(--transition-fast);
	box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}

.filter-btn:hover {
	background: #1f2430;
	border-color: var(--accent-soft);
	transform: translateY(-1px);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6);
}

.filter-btn.active {
	background: var(--accent);
	color: #0a0a0a;
	border-color: var(--accent);
	filter: brightness(1.08);
}

/* --- Global mobile pass --- */

@media (max-width: 640px) {
	.container {
		padding: 16px 14px 32px;
	}

	.comp-meta-row {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		gap: 8px;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 4px;
	}

	.comp-pill {
		flex: 1 1 0;
		min-width: 0;
	}

	.section-grid {
		grid-template-columns: 1fr;
	}

	.leaderboard thead th:nth-child(4),
	.leaderboard tbody td:nth-child(4) {
		display: none;
	}
}

/* Remove highlight from buttons */
a.back,
a.primary,
.nav-links a {
	text-decoration: none;
}

/* ================== WALL MAP (ADMIN + COMPETITOR) ================== */

.map-card {
	margin-bottom: 16px;
}

.map-wrapper {
	position: relative;
	width: 100%;
	border-radius: 14px;
	overflow: hidden;
	border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.05));
	background: #000;
}

.map-image {
	display: block;
	width: 100%;
	height: auto;
	user-select: none;
}

/* Dot style shared by admin + competitor */
.map-dot {
	position: absolute;
	min-width: 24px;
	min-height: 24px;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--accent, #5df29c);
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6);
	transform: translate(-50%, -50%);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 600;
	color: #000;
	border: none;
	cursor: pointer;
}

/* ghost dot in admin */
.map-dot--ghost {
	background: transparent;
	border: 2px dashed var(--accent, #5df29c);
	color: var(--accent, #5df29c);
}

/* hover state for clickable dots (competitor + admin) */
.map-dot-interactive:hover {
	transform: translate(-50%, -52%);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.85);
}

/* Highlight climb card when jumped to from map */
.climb-row-highlight {
	outline: 2px solid var(--accent);
	box-shadow: 0 0 0 1px rgba(93, 242, 156, 0.5);
	background: rgba(93, 242, 156, 0.08);
	transition: background 0.3s ease, box-shadow 0.3s ease, outline 0.3s ease;
}

/* ========= Wall map on competitor page ========= */

.map-card {
	margin-bottom: 18px;
}

.map-wrapper {
	position: relative;
	width: 100%;
	border-radius: 14px;
	overflow: hidden;
	border: 1px solid var(--border-subtle);
	background: #000;
}

.map-image {
	display: block;
	width: 100%;
	height: auto;
	user-select: none;
	pointer-events: none;
}

/* Base dot style – reused for admin + competitor */
.map-dot {
	position: absolute;
	width: 20px;
	height: 20px;
	border-radius: 999px;
	background: var(--accent);
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
	color: #000;
}

/* Clickable version on competitor page */
.map-dot-interactive {
	border: none;
	cursor: pointer;
}

/* Little flash when you scroll to a climb card */
.climb-row-highlight {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	box-shadow: 0 0 0 2px rgba(93, 242, 156, 0.5);
	transition: box-shadow 150ms ease-out, outline-color 150ms ease-out;
}

.back-to-map-bar {
	margin: 0 0 16px 0;
	display: flex;
	justify-content: flex-start;
}

/* Aligns the Back to Gym Map button to the right under the header pills */
.back-to-map-bar.right-align {
	width: 100%;
	display: flex;
	justify-content: flex-end;   /* moves button to the right */
	margin-top: -6px;            /* optional: adjust spacing tighter to header */
	margin-bottom: 12px;
}

/* Slight spacing tweak so it visually lines up with the pills row */
.back-to-map-btn {
	margin-left: auto;
}


.back-to-map-btn {
	display: inline-block;
	padding: 10px 18px;
	background: var(--accent);
	color: #000;
	border-radius: var(--radius-pill);
	font-size: 1rem;
	font-weight: 600;
	text-decoration: none;
	box-shadow: var(--shadow-subtle);
	transition: background 0.2s ease, transform 0.1s ease;
}

.back-to-map-btn:hover {
	background: #7fffb7;
	transform: translateY(-2px);
}

.back-to-map-btn:active {
	transform: translateY(0);
}

/* Wrapper row for Sections + Back to Gym button on competitor page */
.section-filter-row--with-button {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	margin: 12px 0 18px;
}

/* Stack label + pills nicely on the left */
.section-filter-left {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* Inline version of the Back to Gym button */
.back-to-map-btn-inline {
	margin: 0;                 /* remove any previous margin */
	white-space: nowrap;       /* keep it on one line */
}

.back-to-map-btn-inline.adjust-up {
	margin-top: 24px;   /* move the button slightly lower */
}

.section-filter-header {
	display: flex;
	justify-content: space-between;
	align-items: center;   /* this aligns the map button with the pills */
	margin: 12px 0 24px;
	gap: 16px;
}

.section-filter-left {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.back-to-map-btn-inline {
	margin: 0;        /* remove previous spacing */
}

.section-filter-row.section-filter-row--with-button {
	display: flex;
	justify-content: space-between;
	align-items: center;   
	margin: 16px 0 28px;
	gap: 20px;
}

.section-filter-left {
	display: flex;
	flex-direction: column;
	gap: 6px;
}


/* Mobile: stack button under the toggles */
@media (max-width: 640px) {
	.section-filter-row--with-button {
		flex-direction: column;
		align-items: flex-start;
	}
}


.section-filter-label {
	font-size: 0.95rem;
	color: var(--text);
	margin-bottom: 6px;
	margin-top: 8px;
	letter-spacing: 0.3px;
	font-weight: 600;
}

/* ====== section filter pill styling ====== */

/* -------- FILTER PILLS: MAX VISIBILITY MODE -------- */

.section-filter-pill {
	padding: 8px 14px;
	border-radius: var(--radius-pill);

	/* SUPER CLEAR BORDER  */
	border: 2px solid #ffffff !important;

	background: rgba(0,0,0,0.2) !important;   /* slightly dark so the border pops */
	color: #ffffff !important;
	font-size: 0.9rem;
	font-weight: 700;

	cursor: pointer;
	transition:
		background var(--transition-fast),
		color var(--transition-fast),
		transform var(--transition-fast),
		box-shadow var(--transition-fast);
}

/* Hover (NOT active) */
.section-filter-pill:hover:not(.is-active) {
	background: rgba(255,255,255,0.10) !important;
	border-color: #ffffff !important;       /* stays crisp */
	transform: translateY(-2px);
	box-shadow: 0 6px 14px rgba(0,0,0,0.6);
}

/* ACTIVE (clicked) */
.section-filter-pill.is-active,
.section-filter-pill.is-active:hover {
	background: var(--accent) !important;   /* bright green */
	border: 2px solid #ffffff !important;    /* BORDER STAYS WHITE */
	color: #000000 !important;               /* black text on green */
	transform: translateY(-2px);
	box-shadow: 0 12px 20px rgba(93,242,156,0.55);
}

/* Keyboard focus outline */
.section-filter-pill:focus-visible {
	outline: 3px solid #ffffff;
	outline-offset: 3px;
}

a.section-filter-pill,
.section-filter-pill {
	text-decoration: none !important;
}

/* ================== Compact climb logging controls ================== */

.climb-actions {
	margin-top: 10px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.climb-actions-row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.attempts-row {
	margin-top: 2px;
}

.attempts-label {
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #05060a; /* dark on white card */
}

.attempts-pill-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

/* Base pill style for all the small buttons – NEUTRAL (white) */
.action-pill,
.attempt-pill,
.topped-toggle-btn,
.flash-btn,
.log-btn {
	border-radius: var(--radius-pill);
	border: 1px solid rgba(255, 255, 255, 0.35);
	background: #ffffff;          /* white before clicked */
	color: #05060a;               /* dark text for contrast */
	font-size: 0.85rem;
	padding: 6px 10px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition:
		background var(--transition-fast),
		color var(--transition-fast),
		border-color var(--transition-fast),
		transform var(--transition-fast),
		box-shadow var(--transition-fast);
}

/* Hover state – still neutral until active */
.action-pill:hover,
.attempt-pill:hover,
.topped-toggle-btn:hover,
.flash-btn:hover,
.log-btn:hover {
	background: #f3f4f6;          /* light grey hover */
	border-color: rgba(255, 255, 255, 0.7);
	transform: translateY(-1px);
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

/* Flash base: neutral but slightly bolder text */
.flash-btn {
	font-weight: 600;
}

/* Save/log button (if used somewhere else) */
.log-btn {
	width: 100%;
	justify-content: center;
	text-align: center;
	margin-top: 4px;
}

/* Small-screen tweaks */
@media (max-width: 600px) {
	.climb-actions-row {
		flex-direction: row;
		align-items: flex-start;
	}
}

/* Header row inside each climb card */
.climb-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 6px;
}

/* “Climb #X” text */
.climb-title {
	font-size: 1.05rem;
	font-weight: 700;
	color: #05060a;
}

/* Colour pill – default style; actual colour comes from inline style or extra class */
.climb-colour-pill {
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.8rem;
	font-weight: 600;
	color: #05060a; /* assume lightish backgrounds, override via inline style if needed */
	border: 1px solid rgba(0, 0, 0, 0.15);
	white-space: nowrap;
	background: #e5e7eb; /* fallback if no specific colour set */
}

/* Prevent iPhone auto-zoom */
input, select, textarea {
	font-size: 16px !important;
}

label {
	font-size: 16px !important;
}

.comp-pill-link {
	text-decoration: none;
	color: inherit;
	display: block;
  }
  
  .comp-pill-link:hover {
	transform: translateY(-1px);
  }
  
  .comp-pill-link:focus {
	outline: 2px solid currentColor;
	outline-offset: 3px;
  }
  
  .comp-pill-link {
	text-decoration: none;
	color: inherit;
	display: block;
  }

  .comp-grid{
	display:grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 16px;
  }
  
  .comp-card{
	border-radius: 18px;
	padding: 18px;
	background: rgba(255,255,255,0.04);
	border: 1px solid rgba(255,255,255,0.08);
	box-shadow: 0 10px 30px rgba(0,0,0,0.25);
	color: inherit;
  }
  
  .comp-card--clickable{
	text-decoration: none;
	display:block;
	cursor:pointer;
	transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  }
  .comp-card--clickable:hover{
	transform: translateY(-2px);
	border-color: rgba(255,255,255,0.18);
	background: rgba(255,255,255,0.06);
  }
  
  .comp-card__top{
	display:flex;
	justify-content: space-between;
	align-items:flex-start;
	gap: 12px;
  }
  
  .comp-card__title{
	margin:0;
	font-size: 22px;
	line-height: 1.2;
  }
  
  .comp-card__gym{
	margin-top: 6px;
	opacity: 0.75;
	font-size: 14px;
  }
  
  .badge{
	display:inline-block;
	padding: 6px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.02em;
	border: 1px solid rgba(255,255,255,0.14);
  }
  .badge--live{ background: rgba(0,255,140,0.12); }
  .badge--upcoming{ background: rgba(255,255,255,0.06); }
  
  .comp-card__meta{
	margin-top: 12px;
	display:flex;
	flex-wrap: wrap;
	align-items:center;
	gap: 10px;
	font-size: 14px;
	opacity: 0.9;
  }
  .meta-label{ opacity: 0.65; margin-right: 6px; }
  .meta-dot{ opacity: 0.35; }
  
  .comp-card__bottom{
	margin-top: 14px;
  }
  
  .cta{
	display:inline-block;
	padding: 10px 12px;
	border-radius: 12px;
	font-weight: 700;
	font-size: 14px;
	border: 1px solid rgba(255,255,255,0.12);
  }
  .cta--primary{
	background: rgba(0,255,140,0.18);
  }
  .cta--muted{
	background: rgba(255,255,255,0.05);
	opacity: 0.85;
  }
  
  .comp-card__details{
	margin-top: 14px;
	opacity: 0.9;
  }
  .comp-card__details summary{
	cursor:pointer;
	font-weight: 600;
	opacity: 0.75;
  }
  .comp-card__desc{
	margin: 10px 0 0 0;
	opacity: 0.8;
	font-size: 14px;
	line-height: 1.4;
  }
  
  /* ================== ENHANCED COMPETITION CARDS ================== */

/* Enhanced Page Header for Upcoming Comps */
.page-header {
	text-align: center;
	margin-bottom: 48px;
	padding: 32px 0;
}

.page-title {
	margin: 0 0 16px;
	font-size: clamp(32px, 5vw, 48px);
	font-weight: 900;
	background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	letter-spacing: -0.02em;
}

.page-subtitle {
	font-size: 18px;
	color: var(--text-muted);
	margin: 0 0 12px;
	line-height: 1.5;
}

.page-hint {
	font-size: 14px;
	color: var(--text-muted);
	margin: 0;
	opacity: 0.8;
}

/* Enhanced Comp Card Grid */
.pill-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
	gap: 24px;
	margin-top: 32px;
}

/* Redesigned Comp Card/Pill */
.section-pill.comp-pill {
	background: 
		radial-gradient(circle at top right, rgba(93, 242, 156, 0.08), transparent 60%),
		var(--bg-elevated-soft);
	border-radius: 20px;
	border: 1px solid var(--border-subtle);
	padding: 24px;
	position: relative;
	overflow: hidden;
	transition: 
		transform 200ms ease,
		box-shadow 200ms ease,
		border-color 200ms ease;
	display: block;
	text-decoration: none;
	color: inherit;
}

/* Top accent bar that appears on hover */
.section-pill.comp-pill::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: linear-gradient(90deg, var(--accent), rgba(93, 242, 156, 0.3));
	opacity: 0;
	transition: opacity 200ms ease;
}

.section-pill.comp-pill:hover {
	transform: translateY(-4px);
	box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
	border-color: rgba(93, 242, 156, 0.3);
}

.section-pill.comp-pill:hover::before {
	opacity: 1;
}

/* Pill Header (title + gym) */
.pill-header {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 16px;
}

.pill-title {
	margin: 0;
	font-size: 22px;
	font-weight: 800;
	line-height: 1.3;
	color: var(--text);
}

.pill-subtitle {
	font-size: 14px;
	color: var(--text-muted);
	margin: 0;
}

/* Pill Meta Section (dates container) */
.pill-meta {
	margin: 16px 0;
	padding: 16px;
	background: rgba(0, 0, 0, 0.2);
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, 0.05);
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.pill-dates {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 14px;
	color: var(--text-muted);
}

.pill-dates--tbc {
	color: var(--text-muted);
	opacity: 0.7;
	font-style: italic;
}

.pill-date-label {
	font-weight: 600;
	color: var(--text-muted);
}

.pill-date-value {
	color: var(--text);
}

.pill-date-separator {
	display: none;
}

/* Status badge positioning */
.pill-status {
	display: flex;
	justify-content: flex-start;
	margin-top: 8px;
}

/* Enhanced Status Badges */
.status-badge {
	padding: 6px 12px;
	border-radius: var(--radius-pill);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	white-space: nowrap;
	border: 1px solid;
	display: inline-block;
}

.status-badge--live {
	background: rgba(93, 242, 156, 0.15);
	color: var(--accent);
	border-color: var(--accent);
	animation: pulse 2s ease-in-out infinite;
}

.status-badge--scheduled {
	background: rgba(255, 255, 255, 0.06);
	color: var(--text-muted);
	border-color: rgba(255, 255, 255, 0.1);
}

@keyframes pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.7; }
}

/* Description text */
.pill-description {
	font-size: 14px;
	color: var(--text-muted);
	line-height: 1.6;
	margin: 16px 0 8px;
}

/* Details Accordion */
.pill-details {
	margin-top: 16px;
	border-top: 1px solid rgba(255, 255, 255, 0.05);
	padding-top: 12px;
}

.pill-details-summary {
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-muted);
	padding: 4px 0;
	transition: color 150ms ease;
	list-style: none;
}

.pill-details-summary:hover {
	color: var(--accent);
}

.pill-details-summary::-webkit-details-marker {
	display: none;
}

.pill-details-body {
	margin-top: 12px;
	font-size: 14px;
	color: var(--text-muted);
	line-height: 1.6;
}

/* Pill Actions (button container) */
.pill-actions {
	margin-top: 14px;
}

.pill-actions .btn.primary,
.pill-actions .primary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 14px 20px;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	transition: all 200ms ease;
	gap: 8px;
	border: none;
	cursor: pointer;
}

/* Primary CTA (live/active comps) */
.pill-actions .btn.primary {
	background: var(--accent);
	color: #000;
	box-shadow: 0 10px 20px rgba(93, 242, 156, 0.3);
}

.pill-actions .btn.primary:hover {
	background: #7fffa4;
	transform: translateY(-2px);
	box-shadow: 0 14px 28px rgba(93, 242, 156, 0.4);
}

/* Note text for upcoming (non-clickable) comps */
.pill-note {
	font-size: 13px;
	color: var(--text-muted);
	text-align: center;
	margin: 0;
	font-style: italic;
}

/* Empty State */
.empty-state {
	text-align: center;
	padding: 80px 20px;
}

.empty-state .card {
	background: var(--bg-elevated-soft);
	border-radius: var(--radius-lg);
	border: 1px dashed var(--border-subtle);
	padding: 48px 32px;
	max-width: 500px;
	margin: 0 auto;
}

.empty-state h2 {
	margin: 0 0 16px;
	font-size: 24px;
	color: var(--text);
}

.empty-state p {
	margin: 0;
	color: var(--text-muted);
	line-height: 1.6;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.pill-grid {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.page-header {
		padding: 20px 0;
		margin-bottom: 32px;
	}

	.section-pill.comp-pill {
		padding: 20px;
	}

	.pill-title {
		font-size: 20px;
	}

	.pill-meta {
		padding: 14px;
	}

	.pill-dates {
		font-size: 13px;
	}
}

@media (max-width: 480px) {
	.page-title {
		font-size: 28px;
	}

	.page-subtitle {
		font-size: 16px;
	}
}