* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }

.st-header {
	position: absolute; top: 0; left: 0; right: 0; z-index: 1000;
	display: flex; align-items: center; gap: 16px;
	background: rgba(13, 34, 53, 0.92); color: #fff; padding: 10px 16px;
}
.st-header h1 { font-size: 18px; margin: 0; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.st-header .st-headerlogo { height: 34px; display: block; }
.st-header a { color: #9fd3ff; text-decoration: none; font-size: 14px; }
.st-header .st-count { margin-left: auto; font-size: 13px; opacity: 0.85; }
/* quiet manage-console cog in the top-left corner */
.st-header .st-cog { color: #fff; opacity: 0.55; display: flex; }
.st-header .st-cog:hover { opacity: 1; }
.st-header .st-cog svg { width: 17px; height: 17px; display: block; }

/* public-page footer (hidden when printing certificates) */
.st-footer { margin: 30px auto 18px; padding: 0 16px; text-align: center; color: #64748b; font-size: 12.5px; }
.st-footer a { color: inherit; }
@media print { .st-footer { display: none; } }

/* social share icon buttons on the track header - brand colours, fill on hover */
.st-share-icon {
	display: inline-flex; align-items: center; justify-content: center;
	width: 36px; height: 36px; border-radius: 8px; border: 1px solid #dbe4ec;
	background: #fff; color: #5a6b7b; cursor: pointer; text-decoration: none;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.st-share-icon svg { width: 18px; height: 18px; display: block; }
.st-sh-wa { color: #25d366; } .st-sh-fb { color: #1877f2; }
.st-sh-x { color: #101418; } .st-sh-li { color: #0a66c2; }
.st-share-icon:hover { color: #fff; border-color: transparent; }
.st-sh-wa:hover { background: #25d366; } .st-sh-fb:hover { background: #1877f2; }
.st-sh-x:hover { background: #101418; } .st-sh-li:hover { background: #0a66c2; }
.st-sh-em:hover, .st-sh-cp:hover, .st-sh-native:hover { background: #0d2235; }

/* transient "Link copied" toast for the share menu */
.st-copytoast {
	position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
	background: #0d2235; color: #fff; padding: 10px 18px; border-radius: 8px;
	font-size: 14px; z-index: 3000; box-shadow: 0 4px 16px rgba(10, 20, 35, 0.35);
	max-width: 90vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* admin PJAX action feedback toast (wraps; auto-fades) */
.st-admin-toast {
	position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
	background: #0d2235; color: #fff; padding: 12px 20px; border-radius: 8px;
	font-size: 14px; line-height: 1.4; z-index: 3000; max-width: min(560px, 92vw);
	box-shadow: 0 6px 22px rgba(10, 20, 35, 0.4); transition: opacity 0.3s, transform 0.3s;
}
.st-admin-toast.st-hide { opacity: 0; transform: translate(-50%, 8px); }

/* admin loading overlay shown while an action rebuilds the panel */
.st-busy-overlay {
	position: fixed; inset: 0; z-index: 2500; display: flex;
	align-items: center; justify-content: center; background: rgba(13, 34, 53, 0.28);
}
.st-busy-card {
	background: #fff; border-radius: 12px; padding: 18px 26px; display: flex;
	align-items: center; gap: 14px; color: #0d2235; font-weight: 600;
	box-shadow: 0 10px 30px rgba(10, 20, 35, 0.32);
}
.st-busy-card .spinner-border { color: #0d2235; width: 1.5rem; height: 1.5rem; }

/* photo gallery strip under the track map */
.st-gallery-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 8px; }
.st-gallery-strip .st-thumb {
	height: 96px; border-radius: 8px; cursor: pointer; flex: 0 0 auto;
	box-shadow: 0 1px 4px rgba(10, 20, 35, 0.25);
}
.st-gallery-strip .st-thumb:hover { outline: 2px solid #3a6ea5; }
.st-popphoto { cursor: pointer; }

/* full-screen photo lightbox */
.st-lightbox {
	position: fixed; inset: 0; z-index: 2000; background: rgba(4, 10, 18, 0.92);
	display: flex; align-items: center; justify-content: center;
}
.st-lightbox[hidden] { display: none; }
.st-lightbox figure { margin: 0; text-align: center; max-width: 100vw; padding: 0 56px; }
.st-lightbox img { max-width: 100%; max-height: 84vh; border-radius: 8px; }
.st-lightbox figcaption { color: #cfe0ee; font-size: 13.5px; margin-top: 10px; }
.st-lightbox button {
	background: none; border: 0; color: #fff; cursor: pointer;
	padding: 10px 14px; opacity: 0.8; font-size: 42px; line-height: 1;
}
.st-lightbox button:hover { opacity: 1; }
.st-lightbox .st-lightbox-close { position: absolute; top: 8px; right: 12px; font-size: 34px; }
.st-lightbox .st-lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); }
#lightboxPrev { left: 4px; }
#lightboxNext { right: 4px; }

/* live-map empty state: quiet card floating over the water */
.st-mapempty {
	position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
	z-index: 500; background: rgba(255, 255, 255, 0.93); border-radius: 12px;
	padding: 18px 26px; text-align: center; color: #16283a; font-size: 15px;
	box-shadow: 0 6px 24px rgba(10, 20, 35, 0.25);
}
.st-mapempty a { color: #3a6ea5; }

#map { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }
/* the map underlaps the fixed header - keep Leaflet's controls below it */
#map .leaflet-top { top: 56px; }

.st-marker {
	display: flex; align-items: center; gap: 5px; white-space: nowrap;
}
.st-marker .st-dot {
	width: 14px; height: 14px; border-radius: 50%;
	border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.st-marker .st-label {
	background: rgba(255,255,255,0.9); border-radius: 3px; padding: 1px 5px;
	font-size: 11px; font-weight: 600; color: #123;
	box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.st-marker.st-stale { opacity: 0.55; }
.st-marker.st-closed { opacity: 0.7; filter: grayscale(1); }

.st-tooltip { font-size: 12px; line-height: 1.5; }
.st-tooltip .st-warn { color: #b00; font-weight: 600; }

.st-panel {
	position: absolute; top: 56px; right: 10px; z-index: 1000; width: 280px;
	background: #fff; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,0.35);
	padding: 14px 16px; font-size: 13px; display: none;
}
.st-panel h2 { margin: 0 0 8px; font-size: 16px; }
.st-panel table { width: 100%; border-collapse: collapse; }
.st-panel td { padding: 3px 0; }
.st-panel td:first-child { color: #667; }
.st-panel .st-close { float: right; cursor: pointer; border: none; background: none; font-size: 16px; }
.st-panel a { color: #06c; }

.st-page { max-width: 900px; margin: 0 auto; padding: 70px 16px 40px; }
.st-page table.st-list { width: 100%; border-collapse: collapse; font-size: 14px; }
.st-page table.st-list th, .st-page table.st-list td {
	text-align: left; padding: 8px 10px; border-bottom: 1px solid #dde;
}
.st-page .st-header { position: fixed; }

/* Track page (Bootstrap grid does the layout; these are brand components) */
.st-track { padding-top: 64px; }
.st-track h2 { margin: 0; font-size: 24px; }
.st-track-meta { color: #4a5a68; font-size: 13.5px; margin: 2px 0 0; }
#trackMap { height: calc(100vh - 200px); min-height: 460px; border-radius: 10px; }
@media (max-width: 991px) { #trackMap { height: 58vh; min-height: 320px; } }

.st-cardtitle { font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
	color: #62778a; margin: 0 0 10px; }
.st-statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.st-statgrid div b { display: block; font-size: 20px; }
.st-statgrid div span { font-size: 11px; color: #62778a; text-transform: uppercase; letter-spacing: 0.5px; }

.st-cond-row { display: flex; align-items: center; gap: 10px; padding: 7px 0;
	border-bottom: 1px solid #eef2f6; font-size: 13.5px; color: #4a5a68; }
.st-cond-row:last-of-type { border-bottom: 0; }
.st-cond-row svg { width: 20px; height: 20px; flex: 0 0 20px; color: #3a6ea5; }
.st-cond-row b { margin-left: auto; color: #16283a; white-space: nowrap; }
.st-cond-row b svg { width: 14px; height: 14px; color: #3a6ea5; vertical-align: -2px; }
.st-tides { font-size: 12.5px; color: #4a5a68; margin: 10px 0 0; }
.st-weather-credit { font-size: 10.5px; color: #99a; margin: 8px 0 0; }
.st-weather-credit a { color: #99a; }

.st-toast { position: fixed; right: 16px; bottom: 16px; z-index: 3000; display: none;
	align-items: center; gap: 12px; background: #fff; border: 1px solid #d5dfe8;
	border-radius: 10px; padding: 13px 16px; font-size: 14px; max-width: 340px; }
.st-toast .st-btn { padding: 6px 12px; }

.st-replay { display: none; align-items: center; gap: 12px; margin: 10px 0 0; }
.st-replay input[type=range] { flex: 1; }
.st-replay span { font-size: 13px; color: #345; white-space: nowrap; min-width: 240px; text-align: right; }

.st-logo { max-height: 64px; max-width: 220px; display: block; margin-bottom: 8px; }
.st-logocard img { max-height: 130px; max-width: 100%; }

/* Certificate page - landscape layout: text left, map right */
.st-cert { max-width: 1100px; margin: 0 auto; padding: 40px 30px; text-align: center;
	font-family: Georgia, "Times New Roman", serif; color: #16283a; }
.st-cert-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 30px; align-items: center; }
@media (max-width: 800px) { .st-cert-grid { grid-template-columns: 1fr; } }
.st-cert .st-logo { margin: 0 auto 14px; display: block; }
.st-cert h1 { font-size: 26px; letter-spacing: 3px; text-transform: uppercase; margin: 0 0 4px;
	color: #0d2235; }
.st-cert .st-cert-rule { width: 120px; border: 0; border-top: 2px solid #b7c6d4; margin: 14px auto; }
.st-cert .st-cert-name { font-size: 40px; margin: 10px 0 2px; }
.st-cert .st-cert-tag { font-size: 20px; font-style: italic; margin: 0 0 12px; }
.st-cert .st-cert-meta { font-size: 15px; margin: 4px 0; }
.st-cert .st-stats { justify-content: center; margin: 18px 0; }
.st-cert #certMap { height: 420px; border: 1px solid #cdd9e4; }
.st-cert .st-cert-footer { font-size: 12px; color: #667; margin-top: 14px; }
/* --- Mobile: spectators arrive on phones via shared links --- */
@media (max-width: 600px) {
	.st-header { padding: 8px 10px; gap: 10px; }
	.st-header .st-headerlogo { height: 26px; }
	.st-header a { font-size: 13px; }
	.st-header .st-count { font-size: 12px; }

	/* bigger touch targets */
	.st-btn { padding: 10px 16px; }

	/* live-map click-through panel becomes a bottom sheet */
	.st-panel {
		top: auto; bottom: 10px; left: 10px; right: 10px; width: auto;
		max-height: 45vh; overflow-y: auto;
	}
	.st-panel .st-close { font-size: 22px; padding: 2px 10px; }

	.st-page { padding: 62px 10px 30px; }

	.st-stats { gap: 10px; }
	.st-stats .st-stat { padding: 8px 12px; }
	.st-stats .st-stat b { font-size: 17px; }

	.st-track { padding: 58px 10px 24px; }
	.st-replay { flex-wrap: wrap; }
	.st-replay input[type=range] { flex: 1 1 100%; order: 3; }
	.st-replay span { min-width: 0; flex: 1; text-align: right; font-size: 12px; }

	.st-cert { padding: 70px 12px 30px; }
	.st-cert .st-cert-name { font-size: 30px; }
	.st-cert #certMap { height: 300px; }
}

@media print {
	@page { size: A4 landscape; margin: 10mm; }
	.st-header, .st-noprint { display: none !important; }
	body { margin: 0; }
	.st-cert { padding: 0 !important; max-width: none; }
	.st-cert-grid { grid-template-columns: 1fr 1.1fr !important; gap: 8mm; }
	.st-cert #certMap { height: 160mm; border-radius: 0; }
	.st-cert .st-cert-footer { margin-top: 6mm; }
}
.st-stats { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.st-stats .st-stat { background: #f2f6fa; border-radius: 8px; padding: 10px 18px; }
.st-stats .st-stat b { display: block; font-size: 20px; }
.st-stats .st-stat span { font-size: 12px; color: #667; }
.st-btn {
	display: inline-block; background: #0d2235; color: #fff; border-radius: 6px;
	padding: 8px 14px; text-decoration: none; font-size: 14px; border: none; cursor: pointer;
}
