/* Keep preparation and mode switching beside the scores. */
.mode-switch {
	display: flex;
	align-items: stretch;
	gap: 6px;
	flex-wrap: wrap;
	min-width: 0;
}
.mode-switch a,
.mode-switch > span,
#vs-entry {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 9px 13px;
	border: 1px solid #b8ceef;
	border-radius: 10px;
	background: #fff;
	color: #235cbd;
	font:
		700 14px/1.3 system-ui,
		-apple-system,
		sans-serif;
	text-decoration: none;
	white-space: normal;
	text-align: center;
}
.mode-switch .active {
	background: #225fcf;
	color: #fff;
	border-color: #225fcf;
}
.mode-switch a:hover {
	background: #eef5ff;
	text-decoration: none;
}
.solo-tools {
	padding: 8px 11px 4px;
	scroll-margin-top: 8px;
}
.game-selector > summary {
	padding: 10px 5px;
	font-size: 14px;
	font-weight: 750;
	color: #1e528b;
	cursor: pointer;
	min-height: 40px;
}
.game-selector > summary:focus-visible {
	outline: 3px solid #2468d9;
	outline-offset: 2px;
	border-radius: 8px;
}
.solo-settings-body {
	padding-top: 3px;
}
.settings-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	width: 100%;
	grid-column: 1/-1;
	margin-top: 8px;
}
.settings-actions button {
	flex: 1;
	min-height: 44px;
	padding: 9px 12px;
	border: 1px solid #b8ceef;
	border-radius: 10px;
	background: #fff;
	color: #235aaf;
	font-size: 14px;
	font-weight: 750;
}
.settings-actions button:first-child {
	background: #245fd0;
	color: #fff;
	border-color: #245fd0;
}
.game-selector .language-line {
	margin-top: 0;
	padding-top: 4px;
	border-top: 0;
}
.calculator #play-controls[inert] {
	opacity: 0.6;
}
.vs-page .match-toolbar {
	display: grid;
	grid-template-columns: minmax(165px, 1fr) minmax(320px, 1.6fr) minmax(100px, 0.6fr);
	align-items: center;
	gap: 40px;
	margin: 22px 0 40px;
}
.vs-page .match-toolbar > strong {
	margin: 0;
	line-height: 1.8;
	font-size: 13px;
	overflow-wrap: anywhere;
}
.vs-page .match-toolbar > label {
	justify-self: end;
}
.vs-page .vs-ad-toolbar {
	margin: 0;
	width: 100%;
	max-width: 468px;
	justify-self: center;
	font-size: 12px;
}
.vs-ad-toolbar .ad-space {
	height: 60px;
}
.play-tools {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	padding: 8px 0 12px;
	scroll-margin-top: 8px;
}
.play-tools > .mode-switch {
	margin-right: auto;
}
.play-tools > button,
.play-tools summary {
	font-size: 14px;
	min-height: 44px;
}
.play-tools summary {
	cursor: pointer;
	padding: 10px 12px;
	border: 1px solid #c5d6ed;
	border-radius: 10px;
	background: #fff;
}
.play-tools details[open] {
	flex-basis: 100%;
	min-width: 0;
}
.play-tools details[open] > summary {
	width: fit-content;
	margin-left: auto;
}
.settings-content {
	padding: 12px;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}
.settings-content p {
	font-size: 13px;
	line-height: 1.7;
}
.player-setting {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
	gap: 10px;
	grid-column: 1/-1;
	padding: 10px;
	border-radius: 10px;
	border: 1px solid #c8d9ff;
	background: #f3f7ff;
}
.player-setting-two {
	border-color: #ddcaf3;
	background: #faf6ff;
}
.settings-content label {
	font-size: 14px;
}
.settings-content .settings-actions button {
	grid-column: auto;
}
#vs-pad {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}
#vs-pad:disabled {
	opacity: 0.5;
}
.match-grid {
	position: relative;
	isolation: isolate;
}
.match-grid > .player-one {
	grid-column: 1;
	grid-row: 1;
}
.match-grid > .input-card {
	grid-column: 2;
	grid-row: 1;
}
.match-grid > .player-two {
	grid-column: 3;
	grid-row: 1;
}
.match-grid::before {
	content: "";
	grid-column: 1/3;
	grid-row: 1;
	align-self: stretch;
	min-width: 0;
	z-index: -1;
	pointer-events: none;
	border: 3px solid #2864d6;
	border-radius: 25px;
	margin: -6px;
	background: #edf4ff66;
}
.match-grid[data-active="1"]::before {
	grid-column: 2/4;
	border-color: #8146c8;
	background: #f7efff66;
}
.match-grid[data-state="finished"]::before {
	display: none;
}
.player-card.is-active {
	box-shadow:
		0 0 0 3px var(--tint),
		inset 0 4px 0 var(--player);
}
.player-card.is-active .player-heading {
	padding: 8px;
	margin: -4px -4px 4px;
	border-radius: 9px;
	background: var(--tint);
}
.player-card .turn-badge {
	font-size: 12px;
}
.active-player-line {
	border: 2px solid var(--active);
	border-radius: 10px;
	padding: 8px 10px;
	background: var(--active-tint);
}
.active-player-line span {
	font-size: 12px;
}
.active-player-line strong {
	font-size: 20px;
}
.player-stats {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
}
.player-stats > span {
	display: block;
	border-radius: 9px;
	background: #f5f8fd;
	padding: 8px;
	font-size: 10px;
	white-space: nowrap;
}
.player-stats small {
	display: block;
	font:
		600 12px/1.5 system-ui,
		sans-serif;
	color: #566b88;
	white-space: normal;
}
.player-stats strong {
	font-size: 25px;
}
.player-meta {
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 12px;
	color: #5d7190;
	margin-top: 8px;
}
.ppd-note {
	font-size: 12px;
	line-height: 1.5;
	color: #526986;
	margin: 7px 0;
}
.player-arrangements > strong {
	display: block;
	font-size: 13px;
}
.route-option strong {
	font-size: 14px;
}
.route-option small {
	font-size: 11px;
}
.vs-page .vs-ad-bottom {
	max-width: 336px;
	margin: 64px auto;
	font-size: 12px;
}
.vs-ad-bottom .ad-space {
	height: 280px;
}
@media (max-width: 1000px) {
	.vs-page .match-toolbar {
		grid-template-columns: minmax(150px, 1fr) minmax(280px, 1.7fr) auto;
		gap: 32px;
	}
	.player-stats strong {
		font-size: 22px;
	}
	.player-stats > span {
		padding: 6px;
	}
	.player-stats {
		gap: 5px;
	}
}
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
	.vs-page .match-toolbar {
		grid-template-columns: minmax(0, 1fr) auto;
		gap: 36px 24px;
		margin: 20px 0 16px;
	}
	.vs-page .vs-ad-toolbar {
		grid-column: 1/-1;
		grid-row: 1;
	}
	.vs-page .match-toolbar > strong,
	.vs-page .match-toolbar > label {
		grid-row: 2;
	}
	.match-grid > .player-one {
		grid-column: 1;
		grid-row: 1;
	}
	.match-grid > .player-two {
		grid-column: 2;
		grid-row: 1;
	}
	.match-grid > .input-card {
		grid-column: 1/-1;
		grid-row: 2;
	}
	.match-grid::before {
		display: none;
	}
	.player-card.is-active {
		outline: 3px solid var(--player);
		outline-offset: 2px;
	}
	.settings-content {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.settings-content > label:last-of-type {
		grid-column: 1/-1;
	}
	.play-tools > .mode-switch {
		flex: 1 0 100%;
	}
	.play-tools > .mode-switch > * {
		flex: 1;
	}
	.play-tools > button {
		margin-left: auto;
	}
	.player-stats {
		gap: 3px;
	}
	.player-stats > span {
		padding: 5px 3px;
		font-size: 9px;
	}
	.player-stats strong {
		font-size: 21px;
	}
}
@media (max-width: 430px) {
	.solo-tools {
		padding: 6px 6px 2px;
	}
	.solo-tools .mode-switch > * {
		flex: 1;
	}
	.player-setting {
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
		gap: 6px;
		padding: 8px;
	}
	.settings-actions {
		flex-direction: column;
	}
	.player-stats strong {
		font-size: 19px;
	}
}
/* Compact game header, with a separate ad column and button-based settings. */
.vs-page {
	padding-top: 12px;
}
.vs-page .title-row h1 {
	font-size: 18px;
}
.vs-page .play-tools {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 1.55fr) minmax(0, 1fr);
	align-items: end;
	gap: 14px 32px;
	padding: 0 0 28px;
	margin-top: 12px;
}
.mode-area {
	min-width: 0;
	display: grid;
	gap: 6px;
}
#game-summary {
	font-size: 13px;
	line-height: 1.6;
	overflow-wrap: anywhere;
}
.settings-controls {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	min-width: 0;
}
.settings-controls button {
	min-height: 44px;
	font-size: 14px;
	padding: 9px 10px;
}
#settings-toggle::before {
	content: "▸ ";
	font-size: 12px;
}
#settings-toggle[aria-expanded="true"]::before {
	content: "▾ ";
}
.vs-page .play-tools > .vs-ad-toolbar {
	align-self: center;
	margin: 0;
	width: 100%;
	max-width: 468px;
	justify-self: center;
	grid-column: 2;
	grid-row: 1;
	font-size: 12px;
}
.vs-page #match-settings {
	grid-column: 1/-1;
	grid-row: 2;
	min-width: 0;
}
.vs-page #match-settings:not([open]) {
	display: none;
}
.vs-page #match-settings > summary {
	display: none;
}
.vs-page .settings-content {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	margin-top: 8px;
	padding: 16px;
}
.setting-group {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}
.setting-group legend {
	font-size: 14px;
	font-weight: 750;
	margin: 0 0 7px;
	padding: 0;
	color: #254367;
}
.setting-wide {
	grid-column: 1/-1;
}
.choice-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
.settings-content .choice-buttons button {
	min-height: 44px;
	flex: 1 1 auto;
	padding: 9px 12px;
	font-size: 14px;
	line-height: 1.4;
	white-space: normal;
	text-align: center;
}
.choice-buttons button[aria-pressed="true"] {
	background: #225fcf;
	border-color: #225fcf;
	color: #fff;
	box-shadow: inset 0 0 0 1px #fff6;
}
.choice-buttons button[data-value="0"][aria-pressed="true"],
.choice-buttons button[data-value="fixed-0"][aria-pressed="true"] {
	background: #2459d7;
}
.choice-buttons button[data-value="1"][aria-pressed="true"],
.choice-buttons button[data-value="fixed-1"][aria-pressed="true"] {
	background: #793ac6;
	border-color: #793ac6;
}
.choice-buttons button:disabled {
	opacity: 0.5;
	cursor: default;
}
.vs-page .settings-content .player-setting {
	grid-column: auto;
	grid-template-columns: 1fr;
	gap: 8px;
}
.out-help {
	margin: 0;
	color: #526986;
	font-size: 13px;
	line-height: 1.65;
}
.vs-page .out-help {
	grid-column: 1/-1;
	margin-top: -6px;
}
.calculator .rule-line {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
}
.calculator .rule-line > span {
	flex-basis: 100%;
	font-size: 14px;
	font-weight: 750;
}
.calculator .rule-buttons {
	width: 100%;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
.calculator .rule-buttons button {
	flex: 1 1 140px;
	font-size: 14px;
	line-height: 1.5;
	white-space: normal;
	min-height: 44px;
	padding: 7px;
}
.calculator .rule-buttons [data-rule="single"] {
	order: -1;
}
.calculator .out-help {
	margin: 8px 0;
}
.inline-confirm {
	border: 2px solid #9bb8e8;
	background: #fff;
	border-radius: 12px;
	padding: 14px;
	margin: 0 0 16px;
	color: #203a60;
}
.inline-confirm p {
	font-size: 16px;
	line-height: 1.7;
	margin: 0 0 12px;
}
.confirm-actions {
	display: flex;
	justify-content: flex-end;
	flex-wrap: wrap;
	gap: 8px;
}
.confirm-actions button {
	min-height: 44px;
	font-size: 14px;
}
#confirm-accept {
	background: #2459d7;
	color: #fff;
	border-color: #2459d7;
}
#scoreboard[inert] {
	opacity: 0.6;
}
.vs-page .player-card h2 {
	margin-top: 10px;
}
.vs-page .win-count {
	margin-bottom: 12px;
}
@media (max-width: 1050px) and (orientation: landscape) {
	.vs-page .play-tools {
		column-gap: 28px;
		grid-template-columns: minmax(0, 1fr) minmax(240px, 1.45fr) minmax(0, 1fr);
	}
	.vs-page .mode-switch a,
	.vs-page .mode-switch > span {
		padding: 9px;
		font-size: 13px;
	}
}
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
	.vs-page .play-tools {
		grid-template-columns: 1fr;
		gap: 10px;
		padding-bottom: 18px;
		margin-top: 16px;
	}
	.vs-page .play-tools > .vs-ad-toolbar {
		grid-column: 1;
		grid-row: 1;
		margin-bottom: 24px;
	}
	.mode-area {
		grid-row: 2;
	}
	.settings-controls {
		grid-row: 3;
	}
	.vs-page #match-settings {
		grid-column: 1;
		grid-row: 4;
	}
	.vs-page .mode-area .mode-switch > * {
		flex: 1;
	}
	.vs-page .settings-content {
		padding: 12px;
	}
	.vs-page .out-options button {
		flex-basis: 100%;
	}
}
@media (max-width: 430px) {
	.vs-page .settings-content {
		gap: 12px 8px;
		padding: 10px;
	}
	.settings-content .choice-buttons button {
		padding: 8px;
		font-size: 14px;
	}
	.vs-page .player-setting {
		padding: 8px;
	}
	.starter-options .choice-buttons button {
		flex-basis: 100%;
	}
}
.settings-content .starter-policy-buttons {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 6px;
}
.settings-content .starter-policy-buttons button {
	grid-column: auto;
	min-width: 0;
}
.settings-content .starter-policy-buttons [data-value="alternate"] {
	grid-column: 1/-1;
}
#finished-rounds {
	width: 100%;
	min-width: 0;
	text-align: left;
}
#finished-rounds .history {
	margin: 6px 0;
}
#finished-rounds table {
	table-layout: fixed;
}
#finished-rounds th:first-child {
	width: 54px;
}
#finished-rounds th,
#finished-rounds td {
	padding: 8px 5px;
	font-size: 12px;
}
#vs-history td > strong,
#vs-history td > span,
#vs-history td > small {
	display: block;
	line-height: 1.6;
}
#vs-history td > small {
	font-size: 12px;
	color: #365a92;
	font-weight: 700;
}
.history-ppd-help {
	font-size: 12px;
	line-height: 1.6;
	color: #526986;
	padding: 0 8px;
}
#last-turn-summary {
	overflow-wrap: anywhere;
}
/* BULL is taller on tablet/desktop; phone scoring stays compact. */
@media (min-width: 601px) {
	.extra-row {
		align-items: center;
	}
	#vs-bull50,
	#vs-bull25 {
		height: 88px;
		min-height: 88px;
		font-size: 16px;
	}
	.calculator #bull-buttons button {
		height: 100px;
		min-height: 100px;
		font-size: 24px;
	}
}
.mobile-arrangements {
	margin-top: 14px;
	border: 1px solid #d5e2f5;
	border-radius: 12px;
	background: #fff;
	padding: 12px;
}
@media (max-width: 600px) and (orientation: portrait) {
	.vs-page .player-card {
		position: relative;
		padding: 8px;
		border-radius: 12px;
	}
	.vs-page .player-heading {
		position: absolute;
		right: 6px;
		top: 6px;
		background: none !important;
		padding: 0 !important;
		margin: 0 !important;
	}
	.vs-page .player-heading .player-id {
		display: none;
	}
	.vs-page .turn-badge {
		min-height: 18px;
		padding: 2px 4px;
		font-size: 10px;
	}
	.vs-page .player-card h2 {
		font-size: 14px;
		line-height: 1.35;
		margin: 2px 0 3px;
		padding-right: 42px;
	}
	.vs-page .win-count {
		font-size: 11px;
		margin: 0 0 3px;
	}
	.vs-page .round-row strong {
		font-size: 22px;
	}
	.vs-page .vs-score {
		font-size: 50px;
		line-height: 1;
		margin: 4px 0;
	}
	.vs-page .player-stats > span {
		padding: 3px;
		font-size: 8px;
	}
	.vs-page .player-stats small {
		font-size: 10px;
		line-height: 1.2;
	}
	.vs-page .player-stats strong {
		font-size: 16px;
	}
	.vs-page .player-meta {
		font-size: 10px;
		margin-top: 4px;
	}
	.vs-page .turn-darts {
		margin: 5px 0 0;
		gap: 3px;
	}
	.vs-page .turn-darts li {
		padding: 3px 1px;
		font-size: 11px;
	}
	.vs-page .turn-darts small {
		font-size: 9px;
		margin-bottom: 1px;
	}
	.vs-page .input-card {
		padding: 8px;
		border-radius: 12px;
	}
	.vs-page .active-player-line {
		display: none;
	}
	.vs-page .input-card #turn-message {
		font-size: 12px;
		line-height: 1.3;
		min-height: 0;
		margin: 0 0 5px;
	}
	.vs-page .multiplier-row button {
		min-height: 32px;
		padding: 5px 2px;
	}
	.vs-page .number-grid {
		gap: 4px;
		margin: 5px 0;
	}
	.vs-page .number-grid button {
		height: clamp(32px, 4.8svh, 40px);
		min-height: 32px;
		padding: 1px;
		font-size: 28px;
	}
	.vs-page .extra-row button {
		min-height: 36px;
		padding: 6px 2px;
		font-size: 12px;
	}
	.vs-page .pending-label {
		min-height: 0;
		margin: 4px 0;
	}
	.vs-page .pending-label:empty {
		display: none;
	}
	.vs-page #manual-form {
		margin-top: 7px;
	}
	.vs-page #manual-form input,
	.vs-page #manual-form button,
	.vs-page .recovery-row button {
		min-height: 36px;
		padding: 6px 8px;
		font-size: 13px;
	}
	.vs-page .recovery-row {
		margin-top: 7px;
	}
	.vs-page .match-grid {
		gap: 8px;
	}
	.vs-page .mobile-arrangements .player-arrangements {
		border: 0;
		padding: 0;
	}
	#solo-ad {
		scroll-margin-top: 8px;
	}
	.calculator .numbers button {
		height: 34px;
		min-height: 34px;
		font-size: 28px;
	}
}
/* Avoid iOS input auto-zoom and contain long setting labels without disabling pinch zoom. */
.vs-page .settings-content > *,
.vs-page .settings-content label,
.settings-controls > *,
.choice-buttons > * {
	min-width: 0;
	max-width: 100%;
}
.choice-buttons button,
.settings-controls button {
	overflow-wrap: anywhere;
}
@media (max-width: 760px) {
	html,
	body {
		width: 100%;
		max-width: 100%;
		overflow-x: clip;
	}
	.vs-page,
	.calculator,
	.solo-settings-body {
		max-width: 100%;
		min-width: 0;
	}
	.vs-page input,
	.calculator input,
	.vs-page #manual-form input {
		font-size: 16px !important;
	}
	.vs-page .settings-content input {
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
	}
	.vs-page .player-card h2 {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.vs-page .active-player-line strong {
		min-width: 0;
		overflow-wrap: anywhere;
	}
}
.bust-notice {
	margin: 12px 0 0;
	padding: 12px;
	border: 2px solid #d89848;
	border-radius: 10px;
	background: #fff5e8;
	color: #854406;
	text-align: center;
}
.bust-notice strong {
	display: block;
	font-size: 22px;
	font-weight: 850;
	line-height: 1.4;
}
.bust-notice span {
	display: block;
	margin-top: 4px;
	font-size: 14px;
	line-height: 1.5;
}
@media (max-width: 600px) and (orientation: portrait) {
	#handoff {
		min-height: 180px;
		padding: 16px 6px;
	}
	.bust-notice {
		margin-top: 8px;
		padding: 8px;
	}
}
