/* SyntVision Rotate tiles */
.sv-rotate-body {
	overflow: hidden;
}

.sv-rotate-app {
	height: calc(100vh - 48px);
	height: calc(100dvh - 48px);
	max-height: calc(100vh - 48px);
	max-height: calc(100dvh - 48px);
	display: flex;
	flex-direction: column;
	padding: 10px 12px 12px;
	gap: 10px;
	overflow: hidden;
}

.sv-rotate-top {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 10px 12px;
	background: var(--svp-panel);
	border: 1px solid var(--svp-panel-border);
	border-radius: var(--svp-radius);
	backdrop-filter: blur(14px);
	flex: 0 0 auto;
}

.sv-rotate-top__main {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	min-width: 0;
}

.sv-rotate-brand {
	min-width: 0;
	flex: 1 1 auto;
}

.sv-rotate-kicker {
	margin: 0 0 2px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--svp-fun, #14b8a6);
}

.sv-rotate-heading h1 {
	margin: 0;
	font-family: var(--svp-display);
	font-size: clamp(14px, 1.5vw, 18px);
	font-weight: 700;
	line-height: 1.25;
	white-space: normal;
	overflow: hidden;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.sv-rotate-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: flex-end;
	align-items: stretch;
	flex: 0 0 auto;
}

.sv-rotate-stat {
	min-width: 68px;
	padding: 6px 10px;
	border-radius: 10px;
	background: rgba(0, 0, 0, 0.22);
	border: 1px solid var(--svp-panel-border);
	text-align: center;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.sv-rotate-stat__label {
	display: block;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--svp-muted);
	margin-bottom: 2px;
}

.sv-rotate-stat strong {
	font-size: 18px;
	font-variant-numeric: tabular-nums;
}

.sv-rotate-controls {
	--sv-ctrl-h: 36px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	justify-content: flex-start;
	width: 100%;
	padding-top: 10px;
	border-top: 1px solid var(--svp-panel-border);
}

.sv-rotate-diff {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: var(--sv-ctrl-h);
	font-size: 12px;
	color: var(--svp-muted);
	font-weight: 600;
}

.sv-rotate-ctrl-label {
	white-space: nowrap;
}

.sv-rotate-diff select {
	appearance: none;
	height: var(--sv-ctrl-h);
	box-sizing: border-box;
	background: rgba(0, 0, 0, 0.28);
	border: 1px solid var(--svp-panel-border);
	color: var(--svp-text);
	border-radius: 10px;
	padding: 0 30px 0 12px;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	background-image: linear-gradient(45deg, transparent 50%, var(--svp-muted) 50%),
		linear-gradient(135deg, var(--svp-muted) 50%, transparent 50%);
	background-position: calc(100% - 14px) calc(50% - 2px), calc(100% - 9px) calc(50% - 2px);
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
}

.sv-rotate-btn {
	appearance: none;
	height: var(--sv-ctrl-h);
	box-sizing: border-box;
	border: 1px solid var(--svp-panel-border);
	background: rgba(255, 255, 255, 0.06);
	color: var(--svp-text);
	border-radius: 10px;
	padding: 0 14px;
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
	transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.sv-rotate-btn:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.18);
}

.sv-rotate-btn:active {
	transform: translateY(1px);
}

.sv-rotate-btn--primary {
	background: linear-gradient(180deg, #0ea5e9, #0284c7);
	border-color: transparent;
	box-shadow: 0 8px 22px rgba(14, 165, 233, 0.28);
}

.sv-rotate-btn--primary:hover {
	background: linear-gradient(180deg, #38bdf8, #0ea5e9);
}

.sv-rotate-main {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.sv-rotate-hint {
	margin: 0;
	font-size: 13px;
	color: var(--svp-muted);
	font-weight: 500;
	text-align: center;
}

.sv-rotate-board-wrap {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sv-rotate-board {
	position: relative;
	/* width/height set by JS to match image aspect (like jigsaw) */
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	margin: 0 auto;
	border-radius: 18px;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.35);
	border: 1px solid var(--svp-panel-border);
	box-shadow: var(--svp-shadow);
	touch-action: manipulation;
	user-select: none;
	flex: 0 0 auto;
}

.sv-rotate-board.is-complete {
	box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.55), var(--svp-shadow);
}

.sv-rotate-tile {
	position: absolute;
	padding: 0;
	margin: 0;
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: transparent;
	cursor: pointer;
	transition: box-shadow 0.15s ease, border-color 0.15s ease;
	border-radius: 2px;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
	overflow: hidden;
	-webkit-tap-highlight-color: transparent;
}

.sv-rotate-tile__face {
	position: absolute;
	inset: 0;
	background-repeat: no-repeat;
	transform-origin: center center;
	transition: transform 0.18s ease;
	pointer-events: none;
}

.sv-rotate-tile:hover {
	z-index: 2;
	box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.sv-rotate-tile.is-correct {
	box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.12);
	border-color: rgba(52, 211, 153, 0.35);
}

.sv-rotate-board.has-reveal .sv-rotate-tile {
	border-color: transparent;
	box-shadow: none;
}

.sv-rotate-pause-veil {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	background: rgba(11, 18, 32, 0.72);
	backdrop-filter: blur(6px);
	border-radius: 18px;
	z-index: 5;
}

.sv-rotate-pause-veil[hidden] {
	display: none !important;
}

.sv-rotate-pause-veil p {
	margin: 0;
	font-family: var(--svp-display);
	font-size: 28px;
}

.sv-rotate-loading {
	position: fixed;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	background: rgba(11, 18, 32, 0.88);
	z-index: 40;
}

.sv-rotate-app[data-loading="0"] .sv-rotate-loading {
	display: none;
}

.sv-rotate-spinner {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.15);
	border-top-color: var(--svp-accent-2);
	animation: sv-rotate-spin 0.7s linear infinite;
}

@keyframes sv-rotate-spin {
	to {
		transform: rotate(360deg);
	}
}

.sv-rotate-peek {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(11, 18, 32, 0.82);
	z-index: 50;
	padding: 24px;
}

.sv-rotate-peek[hidden] {
	display: none !important;
}

.sv-rotate-peek img {
	max-width: min(920px, 100%);
	max-height: 85vh;
	border-radius: 16px;
	box-shadow: var(--svp-shadow);
	object-fit: contain;
}

.sv-rotate-win {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(11, 18, 32, 0.78);
	backdrop-filter: blur(8px);
	z-index: 60;
	padding: 20px;
}

.sv-rotate-win[hidden] {
	display: none !important;
}

.sv-rotate-win__card h2 {
	font-family: var(--svp-display);
}

.sv-rotate-win__stats {
	display: flex;
	gap: 12px;
	margin: 0 0 14px;
	text-align: center;
}

.sv-rotate-win__stats div {
	flex: 1;
	min-width: 0;
	padding: 10px 12px;
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.25);
	border: 1px solid var(--svp-panel-border);
}

.sv-rotate-win__stats span {
	display: block;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--svp-muted);
	margin-bottom: 4px;
}

.sv-rotate-win__stats strong {
	font-size: 20px;
	font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
	.sv-rotate-top__main {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
	}

	.sv-rotate-stats {
		justify-content: flex-start;
	}

	.sv-rotate-heading h1 {
		font-size: clamp(13px, 3.6vw, 16px);
	}
}

@media (max-width: 640px) {
	.sv-rotate-app {
		padding: 8px;
		height: calc(100dvh - 42px);
		max-height: calc(100dvh - 42px);
	}

	.sv-rotate-stat {
		min-width: 58px;
		padding: 5px 8px;
	}

	.sv-rotate-controls {
		--sv-ctrl-h: 34px;
		gap: 6px;
	}

	.sv-rotate-ctrl-label {
		display: none;
	}

	.sv-rotate-btn,
	.sv-rotate-diff select {
		font-size: 11px;
		padding-left: 10px;
		padding-right: 10px;
	}
}
