body {
	padding-top: max(12px, env(safe-area-inset-top, 0px));
	padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

.mh-screen {
	max-width: 1440px;
	min-height: calc(100vh - 24px);
	margin: 0 auto;
	display: grid;
	grid-template-rows: auto 1fr auto;
	gap: clamp(12px, 2.5vh, 28px);
}

.mh-screen-header,
.mh-screen-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}

.mh-screen-header h1 { font-size: clamp(2.9rem, min(6.3vw, 8.5vh), 6.2rem); line-height: .98; }
.mh-screen-header .eyebrow { color: var(--accent); font-size: clamp(.83rem, 1.3vw, 1.12rem); }
.mh-screen-header .row { gap: 7px; }
.mh-screen-header [aria-current="page"] { border-color: var(--accent); color: var(--accent); }

.mh-screen-board {
	display: grid;
	grid-template-columns: minmax(0, .85fr) minmax(0, 1.65fr);
	gap: clamp(10px, 2vw, 24px);
}

.mh-screen-board .panel { padding: clamp(16px, 2.5vw, 36px); }
.mh-screen-board h2 { font-size: clamp(1.6rem, min(3.1vw, 4.4vh), 3.1rem); text-wrap: initial; line-height: 1; }

.mh-screen-summary {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
	gap: clamp(8px, 2.5vh, 24px);
	background: var(--accent-soft);
	border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.mh-screen-total {
	max-width: 100%;
	font-size: clamp(2.75rem, min(7.1vw, 15vh), 7rem);
	font-weight: 600;
	letter-spacing: -.065em;
	line-height: 1.05;
	overflow-wrap: anywhere;
	color: var(--accent);
}

.mh-screen-runners { font-size: clamp(1.05rem, 2.05vw, 1.65rem); color: var(--mute); }
.mh-screen-runners:empty { display: none; }
.mh-screen-rank { display: flex; flex-direction: column; gap: clamp(10px, 2vh, 20px); }
.mh-screen-leaders { margin: auto 0; padding: 0; list-style: none; }

.mh-screen-leaders li {
	display: grid;
	grid-template-columns: minmax(3ch, auto) minmax(0, 1fr) auto;
	align-items: center;
	gap: clamp(8px, 1.5vw, 20px);
	padding: clamp(5px, 1.15vh, 15px) 0;
	font-size: clamp(1.35rem, min(2.9vw, 4.5vh), 2.75rem);
	line-height: 1.2;
	border-top: 1px solid var(--line);
}

.mh-screen-bib {
	background: var(--bib);
	color: var(--bib-ink);
	border-radius: 5px;
	padding: .08em .34em;
	font-size: .77em;
	font-weight: 600;
}

.mh-screen-person { min-width: 0; }
.mh-screen-name, .mh-screen-org { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-screen-name { font-family: var(--f-disp); font-weight: 600; }
.mh-screen-org { color: var(--mute); font-size: .64em; }
.mh-screen-laps { font-weight: 600; white-space: nowrap; }
.mh-screen-laps span { margin-left: .55em; font-family: var(--f-body); font-size: .48em; color: var(--mute); }
.mh-screen-empty { margin: auto 0; font-size: clamp(1.15rem, 2.25vw, 1.8rem); color: var(--mute); }
.mh-screen-footer { font-size: clamp(.92rem, 1.5vw, 1.25rem); }
.mh-screen-status { display: flex; gap: .5em; align-items: baseline; flex-wrap: wrap; }
.mh-screen-status::before { content: ""; background: currentColor; border-radius: 50%; width: .54em; height: .54em; }
.mh-screen-status[data-state="fresh"]::before { color: var(--ok); }
.mh-screen-status:is([data-state="stale"], [data-state="unavailable"]) { color: var(--warn); }
.mh-screen-status time { font-variant-numeric: tabular-nums; color: var(--mute); }
.mh-screen-status time:empty { display: none; }

.mh-field-frame {
	position: relative;
	margin: 1rem 0;
}

.mh-field-frame[data-editable="true"] { cursor: ns-resize; touch-action: none; }
.mh-field-frame img { display: block; width: 100%; height: auto; }
.mh-field-frame.mh-visualizing { aspect-ratio: 16 / 9; }
.mh-field-frame.mh-visualizing img { visibility: hidden; }
.mh-field-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mh-field-line {
	position: absolute;
	inset-inline: 0;
	border-top: 3px solid #ffc447;
	box-shadow: 0 1px 3px #000;
	pointer-events: none;
}

.mh-field-line span {
	position: absolute;
	left: .35rem;
	bottom: .35rem;
	padding: .2rem .4rem;
	border-radius: .25rem;
	background: #ffc447;
	color: #171100;
	font: 600 .85rem var(--f-body);
}
.mh-field-line span:empty { display: none; }

.mh-drift .mh-screen { grid-template-rows: auto 1fr auto auto; }
#calibration { padding: clamp(12px, 2vw, 22px); }
#calibration summary { cursor: pointer; font-weight: 600; }
#calibration label { display: block; margin-top: .75rem; }
#calibration input[type="range"] { width: min(85%, 28rem); }
#calibration #saveCalibration { display: block; margin-top: .75rem; }
.mh-field-options { margin-top: .35rem; gap: .45rem 1rem; }
.mh-field-options input { accent-color: var(--accent); }
.mh-recent-crossings {
	position: absolute;
	top: .45rem;
	right: .45rem;
	max-width: min(55%, 23rem);
	max-height: 84%;
	overflow: hidden;
	padding: .35rem .55rem;
	border-radius: .35rem;
	background: #101820e8;
	color: #f5f8fc;
	font-size: clamp(.65rem, 1.6vw, .9rem);
	pointer-events: none;
}
.mh-recent-crossings ol { list-style: none; margin: .25rem 0 0; padding: 0; }
.mh-recent-crossings li { margin-top: .1rem; }
.mh-recent-crossings li[data-accepted="true"] { color: #86f4a8; font-weight: 650; }

@media (max-width: 700px) {
	.mh-screen { grid-template-rows: auto auto auto; min-height: 0; }
	.mh-screen-board { grid-template-columns: minmax(0, 1fr); }
	.mh-screen-summary { gap: 8px; }
	.mh-screen-total { font-size: clamp(2.75rem, 10vw, 5.5rem); }
}
