/*
 * MeroScore theme: layout and app shell. No colour literals (all colours are
 * var(--token) from the plugin's assets/css/tokens.css). Sizes come from
 * bin/scales.json: spacing 0 2 4 8 10 12 16 20 24 32 40 48 64 80, radii
 * 0 5 10 14 16 20 999, controls 44, header 56/64, tab bar 56.
 *
 * Phones: header on top, bottom tab bar (fixed). From 900px: a top bar under
 * the brand row (items flagged `bar`, with mega menus) and no tab bar. The
 * drawer holds everything that is not a tab.
 */

:root {
	--ms-header-h: 56px;
	--ms-tabbar-h: 56px;
		--ms-gutter: 16px;
	--ms-section-gap: 24px;
	--ms-max: 1280px;
	--ms-safe-top: env(safe-area-inset-top, 0px);
	--ms-safe-right: env(safe-area-inset-right, 0px);
	--ms-safe-bottom: env(safe-area-inset-bottom, 0px);
	--ms-safe-left: env(safe-area-inset-left, 0px);
	--ms-font-body: var(--wp--preset--font-family--body, system-ui, sans-serif);
	--ms-font-display: var(--wp--preset--font-family--display, system-ui, sans-serif);
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	/* Anchors and focused fields never hide under the sticky header. */
	scroll-padding-top: calc(var(--ms-header-h) + var(--ms-safe-top) + 8px);
	-webkit-tap-highlight-color: transparent;
}

a,
button,
summary,
[role="button"],
input,
select,
textarea {
	touch-action: manipulation;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--ms-font-body);
	font-size: 14px;
	line-height: 20px;
	font-weight: 500;
	-webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
	font-family: var(--ms-font-display);
	font-weight: 700;
	margin: 0;
}

h1 {
	font-size: 24px;
	line-height: 32px;
}

h2 {
	font-size: 18px;
	line-height: 24px;
}

h3 {
	font-size: 16px;
	line-height: 24px;
}

a {
	color: var(--accent-text);
}

p {
	margin: 0 0 12px;
}

img,
svg {
	max-width: 100%;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Focus: visible on every interactive element, never removed. */
:focus-visible {
	outline: 2px solid var(--accent-text);
	outline-offset: 2px;
}

/* Skip link */
.ms-skip {
	position: absolute;
	left: 8px;
	top: -80px;
	z-index: 100;
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 20px;
	border-radius: 10px;
	background: var(--accent);
	color: var(--on-accent);
	font-weight: 700;
	text-decoration: none;
}

.ms-skip:focus {
	top: 8px;
}

/* ---------- Shell grid ---------- */

.ms-shell {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: auto 1fr auto;
	grid-template-areas:
		"header"
		"main"
		"footer";
	min-height: 100vh;
	min-height: 100dvh;
	padding-bottom: calc(var(--ms-tabbar-h) + var(--ms-safe-bottom));
}

/* Template-part wrappers and the nav root add no box of their own. */
.ms-part,
.ms-appnav {
	display: contents;
}

.ms-header {
	grid-area: header;
	position: sticky;
	top: 0;
	z-index: 20;
	background: var(--surface);
	border-bottom: 1px solid var(--line);
}

/* WordPress adds a block-gap margin to every child after the first of a layout group: the bar has none. */
.ms-header > *,
.ms-header__row > *,
.ms-header__tools > * {
	margin-block: 0;
}

.ms-header__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	max-width: var(--ms-max);
	min-height: calc(var(--ms-header-h) + var(--ms-safe-top));
	margin: 0 auto;
	padding: var(--ms-safe-top) calc(var(--ms-gutter) + var(--ms-safe-right)) 0 calc(var(--ms-gutter) + var(--ms-safe-left));
}

.ms-brand {
	margin: 0;
	font-family: var(--ms-font-display);
	font-size: 18px;
	line-height: 24px;
	font-weight: 700;
}

.ms-brand a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--text);
	text-decoration: none;
}

.ms-header__tools {
	display: flex;
	align-items: center;
	gap: 4px;
}

.ms-header__controls {
	display: none;
}

.ms-menu {
	display: flex;
	align-items: center;
	gap: 4px;
}

/* Search: an icon link on phones, a field on desktop. */
form.ms-search,
.ms-topnav {
	display: none;
}

.ms-wordmark {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--text);
	font-family: var(--ms-font-display);
	font-size: 24px;
	line-height: 28px;
	font-weight: 800;
	letter-spacing: -0.03em;
	text-decoration: none;
}

.ms-wordmark__text span {
	color: var(--accent-text);
}

.ms-menu__controls,
.ms-chipacct {
	display: none;
}

.ms-main {
	grid-area: main;
	width: 100%;
	max-width: var(--ms-max);
	margin: 0 auto;
	padding: var(--ms-section-gap) calc(var(--ms-gutter) + var(--ms-safe-right)) var(--ms-section-gap) calc(var(--ms-gutter) + var(--ms-safe-left));
}

.ms-main > .wp-block-post-title,
.ms-main > .wp-block-query-title {
	margin-bottom: 16px;
}

.ms-main > * + * {
	margin-block-start: var(--ms-section-gap);
}

.ms-main > .wp-block-post-title + *,
.ms-main > .wp-block-query-title + * {
	margin-block-start: 0;
}

/* Home: the hidden page title is the only thing before the block (no sponsor above), so the block starts at the page padding. */
.ms-main > .wp-block-site-title + .wp-block-meroscore-home {
	margin-block-start: 0;
}

/* Page content shares the page column with the title: no extra global padding, wide blocks start at the left edge, and prose keeps a readable line length. */
.ms-main .entry-content.has-global-pad {
	padding-inline: 0;
}

/* WordPress's constrained layout centres children with !important margins, so these must match. */
.ms-main .entry-content > * {
	margin-inline: 0 !important;
}

.ms-main .entry-content > .alignwide,
.ms-main .entry-content > .alignfull {
	max-width: none;
}

.ms-main .entry-content > .prose,
.ms-main .entry-content > :where(p, h2, h3, h4, ul, ol, blockquote) {
	max-width: 720px;
}

/* Heading rhythm: a heading sits closer to the text it introduces than to the text before it. */
.ms-main .entry-content :where(h2, h3, h4) + :where(p, ul, ol, blockquote) {
	margin-block-start: 8px;
}

.ms-main .entry-content :where(p, ul, ol) + :where(h2, h3) {
	margin-block-start: 28px;
}

.ms-footer {
	grid-area: footer;
	padding: 32px 0 24px;
	border-top: 1px solid var(--line);
	background: var(--surface);
	color: var(--muted);
	font-size: 14px;
	line-height: 20px;
}

/* Footer content lines up with the header and the page column: the same box, the same gutter inside it. */
.ms-footer > * {
	box-sizing: border-box;
	width: 100%;
	max-width: var(--ms-max);
	margin-inline: auto;
	padding-inline: calc(var(--ms-gutter) + var(--ms-safe-left)) calc(var(--ms-gutter) + var(--ms-safe-right));
}

.ms-footer__groups {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 24px;
	margin-block: 0 8px;
}

.ms-footer__brand {
	grid-column: 1 / -1;
	order: 99;
}

.ms-footer__brand .ms-footer__note {
	margin-top: 8px;
	max-width: 36ch;
}

.ms-footer__title {
	margin: 0 0 8px;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 20px;
	text-transform: uppercase;
	color: var(--text);
}

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

.ms-footer__nav a {
	display: inline-flex;
	align-items: center;
	justify-content: flex-start;
	min-height: 44px;
	color: var(--muted);
	text-decoration: none;
}

.ms-footer__nav a:hover {
	color: var(--text);
}

.ms-footer__note {
	margin-block: 0;
}

/* With a mouse the footer links need no 44px tall row: 32px keeps the menu compact. Touch screens keep the 44px target. */
@media (hover: hover) and (pointer: fine) {
	.ms-footer__nav a {
		min-height: 32px;
	}
}

/* Left aligned, so the first column starts where the logo and the page content start. */
.ms-footer,
.ms-footer__groups,
.ms-footer__nav,
.ms-footer__note {
	text-align: left;
}

@media (min-width: 768px) {
	.ms-footer__groups {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		align-items: start;
	}

	.ms-footer__brand {
		grid-column: auto;
		order: 0;
	}
}

/* ---------- Buttons and icon buttons ---------- */

.ms-iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--text);
	cursor: pointer;
}

.ms-iconbtn:hover {
	background: var(--surface-2);
}

.ms-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 20px;
	border: 2px solid var(--accent);
	border-radius: 10px;
	background: var(--accent);
	color: var(--on-accent);
	font-weight: 700;
	text-decoration: none;
}

.ms-button--secondary {
	background: transparent;
	border-color: var(--control-line);
	color: var(--text);
}

.ms-notfound h1 {
	margin-bottom: 12px;
}

/* ---------- Navigation: shared link look ---------- */

.ms-nav__list,
.ms-tabbar__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ms-nav__link {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
	padding: 0 12px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--text);
	font: inherit;
	font-weight: 600;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}

.ms-nav__link:hover {
	background: var(--surface-2);
}

.ms-nav__link[aria-current="page"] {
	background: var(--accent-tint);
	color: var(--accent-text);
	font-weight: 700;
}

.ms-icon {
	flex: none;
	width: 24px;
	height: 24px;
}

/* ---------- Bottom tab bar (phones) ---------- */

.ms-tabbar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 30;
	height: calc(var(--ms-tabbar-h) + var(--ms-safe-bottom));
	padding: 0 var(--ms-safe-right) var(--ms-safe-bottom) var(--ms-safe-left);
	background: var(--surface);
	border-top: 1px solid var(--line);
}

.ms-tabbar__list {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 1fr);
	height: var(--ms-tabbar-h);
}

.ms-tabbar__list > li {
	display: flex;
}

.ms-tabbar .ms-nav__link {
	flex: 1;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	min-width: 0;
	padding: 0 4px;
	border-radius: 0;
	font-size: 12px;
	line-height: 16px;
	font-weight: 600;
	text-align: center;
}

.ms-tabbar .ms-nav__link[aria-current="page"] {
	background: transparent;
	box-shadow: inset 0 2px 0 var(--accent);
}

.ms-tabbar .ms-nav__label {
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* App feel: pressed feedback, a firmer active tab, and the icon stays put. */
.ms-tabbar .ms-nav__link:active {
	background: var(--surface-2);
}

.ms-tabbar .ms-nav__link[aria-current="page"] {
	color: var(--accent-text);
	font-weight: 700;
}

.ms-iconbtn:active,
.ms-ctl:active,
.ms-nav__link:active {
	background: var(--surface-2);
}

/* Phones and tablets: 16px fields stop iOS zooming the page on focus. */
@media (max-width: 899px) {
	input,
	select,
	textarea {
		font-size: 16px;
	}

	.ms-header {
		box-shadow: 0 1px 0 var(--line);
	}
}

/* Landscape phones: keep the page, not the chrome. */
@media (max-height: 480px) and (orientation: landscape) {
	:root {
		--ms-tabbar-h: 48px;
	}

	.ms-tabbar .ms-nav__link {
		flex-direction: row;
		justify-content: center;
		gap: 6px;
	}
}

/* ---------- Drawer ---------- */

.ms-drawer-backdrop {
	position: fixed;
	inset: 0;
	z-index: 40;
	background: var(--scrim);
}

.ms-drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 50;
	display: flex;
	flex-direction: column;
	gap: 16px;
	width: min(100%, 320px);
	padding: calc(8px + var(--ms-safe-top)) calc(16px + var(--ms-safe-right)) calc(16px + var(--ms-safe-bottom)) 16px;
	overflow-y: auto;
	background: var(--surface);
	border-left: 1px solid var(--line);
	animation: ms-drawer-in 0.18s ease-out;
}

.ms-drawer[hidden],
.ms-drawer-backdrop[hidden] {
	display: none;
}

@keyframes ms-drawer-in {
	from {
		transform: translateX(24px);
		opacity: 0;
	}

	to {
		transform: none;
		opacity: 1;
	}
}

html.ms-drawer-open {
	overflow: hidden;
}

.ms-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.ms-drawer__title {
	margin: 0;
	font-family: var(--ms-font-display);
	font-size: 18px;
	line-height: 24px;
	font-weight: 700;
}

.ms-drawer__controls {
	margin-top: auto;
	padding-top: 16px;
	border-top: 1px solid var(--line);
}

.ms-drawer__account {
	padding-bottom: 16px;
	border-bottom: 1px solid var(--line);
}

/* ---------- Display controls (language, theme, text-only) ---------- */

.ms-controls {
	display: flex;
	align-items: center;
	gap: 4px;
}

.ms-controls--list {
	flex-direction: column;
	align-items: stretch;
	gap: 8px;
}

.ms-ctl {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 44px;
	min-height: 44px;
	padding: 0 10px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.ms-ctl:hover {
	background: var(--surface-2);
}

.ms-ctl .ms-icon {
	width: 20px;
	height: 20px;
}

.ms-controls--list .ms-ctl {
	justify-content: flex-start;
	width: 100%;
	padding: 0 12px;
	border: 1px solid var(--line-strong);
}

.ms-ctl__label {
	flex: 1;
	text-align: left;
}

.ms-ctl__state {
	font-size: 13px;
	line-height: 20px;
	font-weight: 700;
}

/* The visible state is picked from <html>, so a cached page is never wrong. */
.ms-lang--to-en,
.ms-theme--to-light,
.ms-state--on,
.ms-textonly--on {
	display: none;
}

html:lang(ne) .ms-lang--to-ne,
html[data-theme="dark"] .ms-theme--to-dark,
html[data-theme="dark"] .ms-state--off,
html.ms-text-only .ms-textonly--off {
	display: none;
}

html:lang(ne) .ms-lang--to-en,
html[data-theme="dark"] .ms-theme--to-light,
html[data-theme="dark"] .ms-state--on,
html.ms-text-only .ms-textonly--on {
	display: inline;
}

.ms-ctl[aria-pressed="true"] {
	background: var(--accent-tint);
}

/* ---------- Tablet ---------- */

@media (min-width: 768px) {
	:root {
		--ms-gutter: 24px;
		--ms-section-gap: 28px;
	}

	h1 {
		font-size: 26px;
		line-height: 32px;
	}

	.ms-tabbar .ms-nav__link {
		font-size: 13px;
	}
}

/* ---------- Desktop: top bar with mega menus, no tab bar ---------- */

@media (min-width: 900px) {
	:root {
		--ms-header-h: 64px;
		--ms-gutter: 32px;
		--ms-section-gap: 32px;
	}

	h1 {
		font-size: 28px;
		line-height: 36px;
	}

	.ms-shell {
		padding-bottom: 0;
	}

	/* One row: wordmark, main menu, then search, display controls and the account chip. */
	.ms-header__row {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr) auto;
		gap: 24px;
	}

	.ms-header__tools {
		justify-content: flex-end;
		justify-self: end;
		gap: 12px;
	}

	.ms-menu__controls {
		display: flex;
		align-items: center;
	}

	.ms-chipacct {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		min-height: 44px;
		padding: 0 4px;
		color: var(--text);
		font-weight: 600;
		text-decoration: none;
	}

	.ms-chipacct__av {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 32px;
		height: 32px;
		border-radius: 999px;
		background: var(--surface-2);
		font-weight: 700;
	}

	.ms-chipacct--login {
		padding: 0 20px;
		border-radius: 10px;
		background: var(--accent);
		color: var(--on-accent);
	}

	/* The signed-in chip is a button with a dropdown: Profile and Log out. */
	.ms-chipacct--menu {
		position: relative;
		padding: 0;
	}

	.ms-chipacct__btn {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		min-height: 44px;
		padding: 0 4px;
		border: 0;
		background: none;
		color: inherit;
		font: inherit;
		font-weight: 600;
		cursor: pointer;
	}

	.ms-chipacct__caret {
		flex: none;
		color: var(--muted);
	}

	.ms-acctmenu {
		position: absolute;
		top: calc(100% + 6px);
		right: 0;
		z-index: 60;
		display: flex;
		flex-direction: column;
		min-width: 160px;
		padding: 6px;
		border: 1px solid var(--line);
		border-radius: var(--radius-sm);
		background: var(--surface);
	}

	.ms-acctmenu[hidden] {
		display: none;
	}

	.ms-acctmenu__item {
		display: flex;
		align-items: center;
		min-height: 44px;
		padding: 0 12px;
		border-radius: 8px;
		color: var(--text);
		font-weight: 600;
		text-decoration: none;
	}

	.ms-acctmenu__item:hover,
	.ms-acctmenu__item:focus-visible {
		background: var(--surface-2);
	}

	.ms-tabbar,
	.ms-menu__btn,
	.ms-menu__search,
	.ms-drawer__account {
		display: none;
	}

	.ms-menu {
		gap: 12px;
	}

	form.ms-search {
		display: flex;
		align-items: center;
		width: clamp(160px, 15vw, 260px);
		height: 44px;
		border: 1px solid var(--line-strong);
		border-radius: var(--radius-sm);
		background: var(--surface-2);
	}

	/* No focus ring or highlight on the header search. */
	form.ms-search:focus-within {
		border-color: var(--line-strong);
		outline: none;
	}

	form.ms-search :focus,
	form.ms-search :focus-visible {
		outline: none;
		box-shadow: none;
	}

	form.ms-search .ms-search__input {
		flex: 1;
		min-width: 0;
		height: 100%;
		padding: 0 4px 0 16px;
		border: 0;
		background: transparent;
		color: var(--text);
		font: inherit;
		outline: none;
	}

	form.ms-search .ms-search__btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 100%;
		padding: 0;
		border: 0;
		border-radius: var(--radius-sm);
		background: transparent;
		color: var(--text);
		cursor: pointer;
	}

	form.ms-search .ms-search__btn .ms-icon {
		width: 20px;
		height: 20px;
	}

	/* Top bar */
	.ms-topnav {
		display: block;
		align-self: stretch;
		justify-self: start;
	}

	.ms-topnav__list {
		display: flex;
		align-items: stretch;
		gap: 4px;
		height: 100%;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.ms-topnav__item {
		display: flex;
		align-items: stretch;
	}

	.ms-topnav__link {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		min-height: 48px;
		padding: 0 12px;
		border: 0;
		border-bottom: 2px solid transparent;
		background: transparent;
		color: var(--muted);
		font: inherit;
		font-family: var(--ms-font-display);
		font-size: 14px;
		line-height: 20px;
		font-weight: 600;
		text-decoration: none;
		cursor: pointer;
	}

	/* The label and its arrow are one control: the background covers both, not just the label. */
	.ms-topnav__item:hover,
	.ms-topnav__item.is-open {
		background: var(--surface-2);
	}

	/* An open menu is a neutral state only; the red underline marks the one current page. */
	.ms-topnav__item.is-open .ms-topnav__link:not([aria-current="page"]),
	.ms-topnav__link[aria-expanded="true"]:not([aria-current="page"]) {
		border-bottom-color: transparent;
		color: var(--text);
	}

	.ms-topnav__link[aria-current="page"] {
		border-bottom-color: var(--accent);
		color: var(--accent-text);
	}

	.ms-topnav__toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 28px;
		margin-inline-start: -10px;
		padding: 0;
		border: 0;
		background: transparent;
		color: var(--muted);
		cursor: pointer;
	}

	.ms-topnav__toggle:hover {
		color: var(--text);
	}

	.ms-topnav__toggle .ms-icon,
	.ms-topnav__more .ms-icon {
		width: 16px;
		height: 16px;
		transition: transform 0.15s ease;
	}

	.ms-topnav__item.is-open .ms-topnav__toggle .ms-icon,
	.ms-topnav__item.is-open .ms-topnav__more .ms-icon {
		transform: rotate(180deg);
	}

	/* Mega panel: full width under the bar. */
	.ms-mega {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		z-index: 25;
		background: var(--surface);
		border-bottom: 1px solid var(--line-strong);
		box-shadow: 0 16px 24px -16px var(--scrim);
	}

	.ms-mega[hidden] {
		display: none;
	}

	.ms-mega__inner {
		width: 100%;
		max-width: var(--ms-max);
		margin: 0 auto;
		padding: 24px calc(var(--ms-gutter) + var(--ms-safe-right)) 28px calc(var(--ms-gutter) + var(--ms-safe-left));
	}

	.ms-mega__grid {
		display: grid;
		gap: 32px;
	}

	.ms-mega__grid--news {
		grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) minmax(0, 0.8fr);
	}

	.ms-mega__grid--cols {
		grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
		margin-bottom: 8px;
	}

	.ms-mega__heading {
		margin: 0 0 8px;
		color: var(--muted);
		font-size: 12px;
		line-height: 20px;
		font-weight: 700;
		letter-spacing: 0.06em;
		text-transform: uppercase;
	}

	.ms-mega__lead {
		display: flex;
		flex-direction: column;
		gap: 6px;
		color: var(--text);
		text-decoration: none;
	}

	.ms-mega__lead-media {
		display: block;
		overflow: hidden;
		border-radius: var(--radius-card);
		background: var(--surface-2);
	}

	.ms-mega__lead-title {
		font-family: var(--ms-font-display);
		font-size: 24px;
		line-height: 28px;
		font-weight: 700;
	}

	.ms-mega__lead:hover .ms-mega__lead-title {
		text-decoration: underline;
		text-underline-offset: 3px;
	}

	.ms-mega__kicker,
	.ms-mega__meta {
		white-space: nowrap; /* the date and time stay on one line too */
		color: var(--muted);
		font-size: 13px;
		line-height: 20px;
	}

	.ms-mega__list,
	.ms-mega__matches {
		margin: 0 0 8px;
		padding: 0;
		list-style: none;
	}

	.ms-mega__list--cols {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
		column-gap: 32px;
	}

	.ms-mega__list a,
	.ms-mega__matches a {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		min-height: 44px;
		padding: 6px 0;
		border-bottom: 1px solid var(--line);
		color: var(--text);
		font-weight: 600;
		text-decoration: none;
	}

	.ms-mega__list a:hover,
	.ms-mega__matches a:hover {
		color: var(--accent-text);
	}

	.ms-mega__list a[aria-current="page"] {
		color: var(--accent-text);
	}

	.ms-mega__matches {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
		column-gap: 32px;
	}

	.ms-mega__teams {
		white-space: nowrap; /* "POK v SUD" always stays on one line */
		flex: none;
		font-family: var(--ms-font-display);
		font-size: 20px;
		line-height: 24px;
		font-weight: 700;
	}

	.ms-mega__live {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		color: var(--accent-text);
		font-size: 13px;
		font-weight: 700;
	}

	.ms-mega .ms-badge__dot {
		display: inline-block;
		width: 8px;
		height: 8px;
		border-radius: 50%;
		background: var(--accent);
	}

	.ms-mega__all {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		min-height: 44px;
		color: var(--text);
		font-weight: 700;
		text-decoration: underline;
		text-underline-offset: 3px;
	}
}

@media (min-width: 900px) and (max-width: 1199px) {
	.ms-topnav__link {
		padding: 0 8px;
	}

	form.ms-search {
		width: 160px;
	}

	.ms-chipacct__name {
		display: none;
	}
}

/* ---------- News article: the featured picture is 16:9, and the share bar sits in the reading column ---------- */

.single-ms_news .ms-media {
	margin: 16px 0 0;
	overflow: hidden;
	border-radius: var(--radius-md);
	background-color: var(--surface-2);
}

.single-ms_news .ms-media img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.single-ms_news .ms-share {
	max-width: 720px;
}

/* ---------- Text-only mode (weak connections) ---------- */

html.ms-text-only img,
html.ms-text-only picture,
html.ms-text-only video,
html.ms-text-only canvas,
html.ms-text-only .ms-media {
	display: none !important;
}

html.ms-text-only *,
html.ms-text-only *::before,
html.ms-text-only *::after {
	animation: none !important;
	transition: none !important;
	scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}

/* ---------- Side navigation (a plugin's pages, via the filter meroscore_side_nav): left sidebar and a slim top bar on desktop ---------- */

.ms-sidenav,
.ms-sidebar-bar {
	display: none;
}

@media (min-width: 900px) {
	.ms-side-nav {
		--ms-side-w: 248px;
		--ms-bar-top: var(--wp-admin--admin-bar--height, 0px);
	}

	.ms-side-nav .ms-shell {
		padding-left: var(--ms-side-w);
	}

	.ms-side-nav .ms-header {
		top: var(--ms-bar-top);
	}

	.ms-side-nav .ms-header__row {
		display: none;
	}

	/* The slim bar: display controls, profile and menu at the right. */
	.ms-side-nav .ms-sidebar-bar {
		display: flex;
		align-items: center;
		justify-content: flex-end;
		gap: 8px;
		min-height: 64px;
		padding: 0 var(--ms-gutter);
	}

	.ms-side-nav .ms-sidenav {
		position: fixed;
		top: var(--ms-bar-top);
		bottom: 0;
		left: 0;
		z-index: 21;
		display: flex;
		flex-direction: column;
		gap: 20px;
		width: var(--ms-side-w);
		padding: 20px 16px 16px;
		overflow-y: auto;
		border-right: 1px solid var(--line);
		background: var(--surface);
	}

	.ms-side-nav .ms-sidenav .ms-wordmark {
		padding: 0 12px;
	}

	.ms-sidenav__list {
		display: flex;
		flex-direction: column;
		gap: 4px;
	}

	.ms-sidenav__foot {
		display: flex;
		flex-direction: column;
		gap: 8px;
		margin-top: auto;
	}

	/* The tab bar is a phone control; the sidebar replaces it. */
	.ms-side-nav .ms-tabbar {
		display: none;
	}
}

.ms-wordmark__tag {
	margin-left: 2px;
	font-size: 0.6em;
	font-weight: 700;
	letter-spacing: 0.02em;
}

/* ---------- Interaction layer: one look for every button, tab, chip and link ---------- */

/* Motion: colour changes ease in; a press moves the control down 1px. */
body :is(a, button, summary, select, input, textarea, [role="tab"], [role="button"]) {
	transition:
		background-color var(--dur-fast) var(--ease-out),
		border-color var(--dur-fast) var(--ease-out),
		color var(--dur-fast) var(--ease-out),
		box-shadow var(--dur-fast) var(--ease-out),
		opacity var(--dur-fast) var(--ease-out),
		transform var(--dur-fast) var(--ease-out);
}

/* Focus: the same blue ring on every control, light and dark. Keyboard only. */
body :is(a, button, summary, select, input, textarea, [tabindex], [role="tab"], [role="button"]):focus-visible {
	outline: 2px solid var(--info);
	outline-offset: 2px;
}

body :is(input, select, textarea):focus-visible {
	border-color: var(--info);
}

/* Buttons: 44px, 10px radius, 14px / 600 label. */
body :is(.ms-button, .ms-btn, .ms-auth__btn, .ms-fb-btn, .msf-btn, .ms-th__btn, .ms-hero2__open) {
	min-height: 44px;
	border-radius: var(--radius-sm);
	font-size: 14px;
	font-weight: 600;
	line-height: 20px;
	cursor: pointer;
}

/* Solid buttons darken a little; outline buttons fill with the quiet surface. */
body :is(.ms-button, .ms-btn--primary, .ms-auth__btn--primary, .ms-fb-btn--primary, .msf-btn--primary, .ms-th__btn--solid, .ms-hero2__open):hover {
	filter: brightness(0.92);
	opacity: 1;
}

body :is(.ms-auth__btn--outline, .ms-fb-btn--outline, .msf-btn--outline, .ms-th__btn:not(.ms-th__btn--solid)):hover {
	border-color: var(--control-line);
	background-color: var(--surface-2);
}

body :is(.ms-button, .ms-btn, .ms-auth__btn, .ms-fb-btn, .msf-btn, .ms-th__btn, .ms-hero2__open, .ms-iconbtn, .ms-chip, .ms-tabs__tab, .ms-fx__tab, .ms-th__tab):active {
	transform: translateY(1px);
	filter: brightness(0.88);
}

body :is(button, [aria-disabled="true"], .is-disabled)[disabled],
body :is(.ms-button, .ms-btn, .ms-auth__btn, .ms-fb-btn, .msf-btn)[aria-disabled="true"] {
	opacity: 0.5;
	filter: none;
	cursor: not-allowed;
	transform: none;
}

/* Icon buttons: a quiet fill on hover. */
body .ms-iconbtn:hover {
	background-color: var(--surface-2);
}

/* Chips and tabs: pills, 44px, 14px / 600; the selected one is the ink pill. */
body :is(.ms-chip, .ms-tabs__tab, .ms-fx__tab, .ms-th__tab, .ms-search__chip, .msf-matches__chip) {
	min-height: 44px;
	border-radius: var(--radius-pill);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

body :is(.ms-tabs__tab, .ms-fx__tab, .ms-th__tab, .ms-search__chip, .msf-matches__chip):hover {
	border-color: var(--control-line);
	background-color: var(--surface-2);
	color: var(--text);
}

body :is(.ms-chip):hover:not([aria-pressed="true"]) {
	background-color: var(--surface-2);
}

body :is(.ms-tabs__tab, .ms-fx__tab, .ms-th__tab)[aria-current="page"],
body :is(.ms-tabs__tab, .ms-fx__tab, .ms-th__tab)[aria-current="page"]:hover {
	border-color: var(--ink);
	background-color: var(--ink);
	color: var(--on-ink);
}

/* Text links: plain, an underline on hover, and the arrow slides a little. */
body :is(.ms-link, .ms-cm__link, .ms-fb-link, .ms-auth__link, .ms-hc__link, .msf-section__link, .msf-btn-link, .msf-news__link, .msf-top-performers__link, .msf-season-leaders__link, .msf-points-table__link, .msf-matches__more-link):hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

body .ms-link [aria-hidden="true"] {
	display: inline-block;
	transition: transform var(--dur-fast) var(--ease-out);
}

body .ms-link:hover [aria-hidden="true"] {
	transform: translateX(3px);
}

/* Nav items fade to full ink on hover. */
body :is(.ms-nav__link, .ms-side__link, .ms-topbar__link):hover {
	color: var(--text);
}

/* Footer: the time zone switch sits under the note. */
.ms-footer__brand .ms-tz {
	margin-top: var(--sp-3);
}

/* ---------- Header search suggestions (combobox + listbox) ---------- */

.ms-search {
	position: relative;
}

.ms-suggest {
	position: absolute;
	top: calc(100% + var(--sp-1));
	left: 0;
	z-index: 40;
	width: max(100%, 320px);
	max-height: min(70vh, 420px);
	overflow-y: auto;
	padding: var(--sp-2);
	border: var(--card-border);
	border-radius: var(--radius-card);
	background: var(--surface);
	box-shadow: var(--shadow-pop);
}

.ms-suggest[hidden] {
	display: none;
}

.ms-suggest__head {
	padding: var(--sp-2) var(--sp-2) var(--sp-1);
	color: var(--muted);
	font-size: var(--fs-label);
	font-weight: 700;
	letter-spacing: var(--ls-label);
	text-transform: uppercase;
}

.ms-suggest__item,
.ms-suggest__all {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: 44px;
	padding: var(--sp-1) var(--sp-2);
	border-radius: var(--radius-sm);
	color: var(--text);
	text-decoration: none;
}

.ms-suggest__item.has-photo {
	flex-direction: row;
	justify-content: flex-start;
	align-items: center;
	gap: var(--sp-2);
}

.ms-suggest__text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ms-suggest__photo {
	flex: none;
	background: var(--surface-2);
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
}

.ms-suggest__initials {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--muted);
	font-size: var(--fs-small);
	font-weight: 700;
}

.ms-suggest__item.is-active,
.ms-suggest__item:hover,
.ms-suggest__all:hover {
	background: var(--surface-2);
}

.ms-suggest__title {
	font-size: var(--fs-body);
}

.ms-suggest__meta,
.ms-suggest__empty {
	color: var(--muted);
	font-size: var(--fs-small);
}

.ms-suggest__empty {
	margin: 0;
	padding: var(--sp-2);
}

.ms-suggest__all {
	margin-top: var(--sp-1);
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---------- News pictures (MeroScore\Core\News\Thumb): a 16:9 photo, or a generated branded card when a story has none ---------- */

.ms-thumb {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	background-color: var(--surface-2);
}

.ms-thumb--fallback {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--sp-2);
	padding: var(--sp-4);
	overflow: hidden;
	background-image: linear-gradient(135deg, var(--accent), var(--accent-deep));
	color: var(--on-accent);
}

.ms-thumb--team {
	background-image: linear-gradient(135deg, var(--team-bg), var(--team-bg2, color-mix(in srgb, var(--team-bg) 60%, var(--ink))));
	color: var(--team-fg, var(--on-accent));
}

.ms-thumb__crests {
	display: flex;
	gap: var(--sp-2);
}

.ms-thumb__mark {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	font-family: var(--ms-font-display);
	font-size: var(--fs-h3);
	font-weight: 800;
	letter-spacing: -0.03em;
}

.ms-thumb__m {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--crest-lg);
	height: var(--crest-lg);
	border-radius: var(--radius-sm);
	background-color: var(--on-accent);
	color: var(--accent);
}

.ms-thumb__label {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-family: var(--ms-font-display);
	font-size: var(--fs-h3);
	line-height: var(--lh-heading);
	font-weight: 700;
}

.ms-thumb__chip {
	padding: 2px var(--sp-2);
	border: 1px solid currentColor;
	border-radius: 999px;
	font-size: var(--fs-label);
	font-weight: 700;
	letter-spacing: var(--ls-label);
	text-transform: uppercase;
}

.ms-thumb--thumb.ms-thumb--fallback {
	justify-content: center;
	align-items: center;
	padding: var(--sp-1);
}

.ms-thumb--thumb .ms-thumb__word {
	display: none;
}

.ms-thumb--thumb .ms-thumb__m {
	width: var(--crest-md);
	height: var(--crest-md);
}

html.ms-text-only .ms-thumb {
	display: none !important;
}

/* Team A v team B never breaks across lines in the Live menu, on any screen. */
.ms-mega__teams {
	white-space: nowrap;
}

/* Live menu matches: one column on phones, two on tablets, as many as fit on wide screens. */
.ms-mega__matches {
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 600px) {
	.ms-mega__matches {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1200px) {
	.ms-mega__matches {
		grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	}
}

/* The header search has no focus ring (this beats the global focus rule above). */
body form.ms-search :is(input, button):focus,
body form.ms-search :is(input, button):focus-visible {
	outline: none;
	box-shadow: none;
}

/* Tournaments menu, "More tournaments": two columns of three rows, filled down each column. */
@media (min-width: 900px) {
	.ms-mega__grid--cols:has(.ms-mega__col--wide) {
		grid-template-columns: repeat(2, minmax(0, 1fr)); /* Featured keeps its half; the two columns sit in the other half */
	}

	.ms-mega__list--two {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-template-rows: repeat(3, auto);
		grid-auto-flow: column;
		column-gap: 32px;
	}
}

/* ---------- Footer time zone switch: lives in every footer, so it is styled here and not only with the Live blocks ---------- */

.ms-tz {
	display: inline-flex;
	overflow: hidden;
	border: 1px solid var(--control-line);
	border-radius: var(--radius-sm);
}

.ms-tz__btn {
	min-height: 44px;
	padding: 0 var(--sp-3, 12px);
	border: 0;
	background: transparent;
	color: var(--muted);
	font: inherit;
	font-size: var(--fs-small, 13px);
	font-weight: 600;
	cursor: pointer;
}

.ms-tz__btn:hover {
	background-color: var(--surface-2);
	color: var(--text);
}

.ms-tz__btn[aria-pressed="true"],
.ms-tz__btn[aria-pressed="true"]:hover {
	background-color: var(--ink);
	color: var(--on-ink);
}

.ms-tz__btn:focus-visible {
	outline: 2px solid var(--text);
	outline-offset: -2px;
}

/* ---------- Section headings sit clear of the block above them ---------- */

.mse > .ms-section__head:not(:first-child),
.ms-team-page > .ms-section__head:not(:first-child) {
	margin-top: var(--sp-6, 32px);
	margin-bottom: var(--sp-3, 12px);
}

/* ---------- Hover and press feedback: pictures, cards, rows, crests and links ---------- */

/* A picture inside a link is clipped by its frame, so it can ease in without spilling out. */
:is(.ms-news__lead-media, .ms-news__card-media, .ms-lead__media, .ms-art__hero, .ms-art__card-media) {
	display: block;
	overflow: hidden;
}

.ms-thumb,
:is(.mse-crest, .mse-avatar) {
	transition:
		transform 0.4s var(--ease-out, ease),
		filter var(--dur-fast, 150ms) var(--ease-out, ease);
}

/* Titles are links but never sit underlined until pointed at. */
:is(.ms-news__title, .ms-news__lead-title, .ms-news__side-title, .ms-lead__title, .ms-hof__label, .ms-hof__sub) a,
a:is(.ms-news__side-title, .ms-lead__title) {
	text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
	/* News cards, the lead story and the home lead: the border firms up, the picture zooms, the headline turns red. */
	.ms-news__card,
	.ms-news__lead,
	.ms-lead {
		cursor: pointer;
		transition: border-color var(--dur-fast, 150ms) var(--ease-out, ease), transform var(--dur-fast, 150ms) var(--ease-out, ease);
	}

	.ms-news__card:hover {
		border-color: var(--control-line);
		transform: translateY(-2px);
	}

	:is(.ms-news__card, .ms-news__lead, .ms-lead):hover .ms-thumb {
		transform: scale(1.04);
	}

	:is(.ms-news__card, .ms-news__lead, .ms-lead):hover :is(.ms-news__title, .ms-news__lead-title, .ms-lead__title) a,
	:is(.ms-news__title, .ms-news__lead-title) a:hover {
		color: var(--accent-text);
		text-decoration: underline;
		text-underline-offset: 3px;
	}

	/* Side stories and lists with a small picture: the picture brightens, the headline turns red. */
	li:hover > a:has(> .ms-thumb) .ms-thumb,
	a:has(> .ms-thumb):hover .ms-thumb {
		filter: brightness(1.08);
	}

	li:hover > a:has(.ms-news__side-title) .ms-news__side-title,
	li > a:hover .ms-news__side-title {
		color: var(--accent-text);
		text-decoration: underline;
		text-underline-offset: 3px;
	}

	/* Match cards and rows. */
	a.ms-match:hover,
	a.mse-match:hover,
	a.mse-card:hover {
		border-color: var(--control-line);
		background-color: var(--surface-2);
	}

	a:is(.ms-match, .mse-match):hover :is(.mse-crest, .ms-crest) {
		transform: scale(1.08);
	}

	/* Anything that links from a crest or an avatar: it grows a little. */
	a:hover > :is(.mse-crest, .mse-avatar) {
		transform: scale(1.08);
	}

	/* Squad rows: the row tints, the name turns red, the photo grows. */
	.ms-squad__player {
		transition: background-color var(--dur-fast, 150ms) var(--ease-out, ease);
	}

	.ms-squad__player:hover {
		background-color: var(--surface-2);
	}

	.ms-squad__player:hover .mse-avatar {
		transform: scale(1.08);
	}

	.ms-squad__name:hover {
		color: var(--accent-text);
		text-decoration: underline;
		text-underline-offset: 3px;
	}

	/* Tables: a row that links somewhere tints under the pointer. */
	tbody tr:has(a[href]):hover > :is(td, th) {
		background-color: var(--surface-2);
	}

	/* Hall of Fame cards and lists on team and tournament pages. */
	.ms-hof__season,
	.ms-hof__stat,
	:is(.ms-th__teams, .ms-th__news) li > a,
	.mse-links a {
		transition: border-color var(--dur-fast, 150ms) var(--ease-out, ease), background-color var(--dur-fast, 150ms) var(--ease-out, ease);
	}

	.ms-hof__season:hover,
	.ms-hof__stat:hover {
		border-color: var(--control-line);
		background-color: var(--surface-2);
	}

	:is(.ms-hof__label, .ms-hof__sub) a:hover {
		color: var(--accent-text);
		text-decoration: underline;
		text-underline-offset: 3px;
	}

	:is(.ms-th__teams, .ms-th__news) li > a:hover {
		background-color: var(--surface-2);
		color: var(--text);
	}

	.mse-links a:hover {
		background-color: var(--surface-2);
	}

	/* Header: the wordmark dims, Log in darkens, the search button fills. */
	.ms-wordmark:hover {
		opacity: 0.75;
	}

	.ms-chipacct--login:hover {
		filter: brightness(0.92);
	}

	form.ms-search .ms-search__btn:hover {
		background-color: var(--surface-2);
	}

	/* Team and player chips. */
	a.mse-chip:hover {
		border-color: var(--control-line);
		background-color: var(--surface-2);
	}

	/* Links in running text. */
	.ms-main p a:not([class]):hover,
	.ms-main li a:not([class]):hover {
		color: var(--accent-text);
		text-decoration-thickness: 2px;
	}
}

/* Pressed: the same one pixel dip everywhere, on touch screens as well. */
a.ms-match:active,
a.mse-match:active,
a.mse-card:active,
.ms-news__card:active,
.ms-squad__player:active {
	transform: translateY(1px);
}

@media (prefers-reduced-motion: reduce) {
	.ms-thumb,
	:is(.mse-crest, .mse-avatar),
	.ms-news__card,
	.ms-news__lead,
	.ms-lead {
		transition: none;
	}

	.ms-news__card:hover,
	:is(.ms-news__card, .ms-news__lead, .ms-lead):hover .ms-thumb,
	a:hover > :is(.mse-crest, .mse-avatar) {
		transform: none;
	}
}

/* ---------- Empty states: a message, a hint and the way on, centred in a quiet card ---------- */

.ms-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	margin: var(--sp-4, 16px) 0;
	padding: 40px 20px;
	border: 1px dashed var(--line-strong, var(--line));
	border-radius: var(--radius-md);
	background: var(--surface);
	text-align: center;
}

.ms-empty__title {
	margin: 0;
	color: var(--text);
	font-size: 16px;
	line-height: 24px;
	font-weight: 700;
}

.ms-empty__hint {
	max-width: 36ch;
	margin: 0;
	color: var(--muted);
	font-size: 14px;
	line-height: 20px;
}

.ms-empty__link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin-top: 4px;
	font-weight: 600;
}
