html:has(.screen),
body:has(.screen) {
	height: 100%;
	overflow: hidden;
}

.screen {
	position: fixed;
	left: 50%;
	top: 50%;
	width: 1280px;
	height: 720px;
	overflow: hidden;
	transform: translate(-50%, -50%) scale(var(--screen-scale, 1));
	transform-origin: center;
}

html.is-rotated .screen {
	transform: translate(-50%, -50%) rotate(90deg) scale(var(--screen-scale, 1));
}

.game {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 16px 32px 48px;
	background: linear-gradient(180deg, #4b3478 0%, #6f559c 100%);
}

.screen .sub-footer {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 8px;
	z-index: 1;
	padding: 0;
	color: var(--lavender-pale);
	opacity: .7;
	font-size: 16px;
	line-height: 1.35;
}

.screen .sub-footer p {
	margin: 0;
}

.screen .sub-footer .fiction-notice {
	font-size: inherit;
	opacity: 1;
}

.hud {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	max-width: 1200px;
}

.hud-label {
	font-size: 22px;
	color: var(--lavender-pale);
	letter-spacing: .06em;
}

.hud-right {
	display: flex;
	margin-left: auto;
	align-items: center;
	gap: 16px;
}

.hud-timer {
	min-width: 150px;
	padding: 8px 24px;
	border-radius: 999px;
	background: var(--apricot);
	color: var(--ink);
	font-size: 36px;
	font-weight: 700;
	text-align: center;
	font-variant-numeric: tabular-nums;
	box-shadow: 0 4px 0 var(--apricot-deep);
}

.hud-button {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	border: 0;
	background: var(--apricot);
	color: var(--ink);
	font-size: 28px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 4px 0 var(--apricot-deep);
}

.penalty {
	position: fixed;
	z-index: 30;
	color: #ff8a7a;
	font-size: calc(22px / var(--screen-scale, 1));
	font-weight: 700;
	-webkit-text-stroke: calc(1px / var(--screen-scale, 1)) #fff;
	paint-order: stroke fill;
	pointer-events: none;
	animation: penalty-rise .8s ease-out forwards;
}

@keyframes penalty-rise {
	from { transform: translate(-50%, -50%); opacity: 1; }
	to { transform: translate(-50%, -140%); opacity: 0; }
}

.overlay {
	position: absolute;
	inset: 0;
	z-index: 40;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(37, 26, 61, .72);
}

.overlay[hidden] {
	display: none;
}

.overlay-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 28px;
	width: min(760px, 100%);
	max-height: 100%;
	overflow-y: auto;
	padding: 48px 56px;

	background: url("../img/overlay-bg.png") center / 100% 100% no-repeat;
	filter: drop-shadow(0 12px 16px rgba(0, 0, 0, .35));
	text-align: center;
}

.overlay-buttons {
	display: flex;
	justify-content: center;
	gap: 20px;
}

.overlay-buttons .pill-button {
	min-width: 220px;
}

.overlay-title {
	margin: 0;
	font-size: 48px;
	font-weight: 700;
}

.name-en {
	display: block;
	font-size: .5em;
	font-weight: 700;
	letter-spacing: .08em;
	opacity: .8;
}

.overlay-text {
	margin: 0;
	font-size: 28px;
	line-height: 1.8;
}

.pill-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 320px;
	padding: 20px 40px;
	border-radius: 999px;
	border: 0;
	background: var(--apricot);
	color: var(--ink);
	font: inherit;
	font-size: 30px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 4px 0 var(--apricot-deep);
}

.pill-button.is-dark {
	width: 100%;
	background: var(--night-deep);
	color: #fff;
	box-shadow: 0 4px 0 #120c20;
}

.overlay.is-result {
	background: rgba(37, 26, 61, .45);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

.result-layout {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 48px;
	width: min(960px, 100%);
	max-height: 100%;
}

.result-hero {
	flex: 0 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
}

.result-hero img {
	max-width: 100%;
	height: 420px;
	object-fit: contain;
	filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .3));
}

.result-card {
	flex: 0 0 auto;
	width: 460px;
	gap: 14px;
	background-image: url("../img/result-bg.png");
}

.result-title {
	margin: 0;
	font-size: 56px;
	font-weight: 700;
	line-height: 1.25;
}

.result-logo {
	display: block;
	width: 380px;
	max-width: 100%;
	height: auto;
}

.result-title-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.result-time {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 4px 24px;
	border-radius: 16px;
	background: var(--cream);
	color: var(--ink);
	font-size: 80px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.result-stopwatch {
	width: .8em;
	height: .8em;
}

.result-label {
	padding: 2px 14px;
	border-radius: 999px;
	background: #7d65a8;
	font-size: 24px;
}

.result-actions {
	display: flex;
	gap: 16px;
}

.round-button {
	width: 88px;
	height: 88px;
	border-radius: 50%;
	border: 0;
	background: #6a5494;
	color: #fff;
	display: grid;
	place-items: center;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 4px 0 #34264f;
}

.round-button svg {
	width: 40px;
	height: 40px;
}

.result-post svg {
	width: 32px;
	height: 32px;
}

.round-button:focus-visible,
.pill-button:focus-visible,
.hud-button:focus-visible {
	outline: 3px solid var(--apricot);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.penalty {
		animation: none;
	}
}
