:root {
	--fondo: #000000;
	--cornice: #1f2020;
	--campo: #282828;
	--attiva: #3c3c3c;
	--attiva-sopra: #464646;
	--superficie: #1f1f1f;
	--orlo: #3c3c3c;
	--testo: #e3e3e3;
	--testo-spento: #c7c7c7;
	--sopra: rgba(253, 252, 251, 0.1);
	--premuto: rgba(227, 227, 227, 0.12);
	--anello: #a8c7fa;
	--glifo: #ffffff;
	--rosso: #e81123;
	--raggio: 26px;
	--alto-testata: 48px;
	--alto-schede: 32px;
	--margine-x: clamp(10px, 13vw, 260px);
	--margine-y: clamp(10px, 9vh, 96px);
	--uscita: cubic-bezier(0.2, 0.8, 0.2, 1);
	color-scheme: dark;
}

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

html,
body {
	margin: 0;
	height: 100%;
	overflow: hidden;
	overscroll-behavior: none;
	background: var(--fondo);
}

body {
	font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
	color: var(--testo);
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}

.per-lettori {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.finestra {
	position: fixed;
	top: calc(var(--margine-y) + env(safe-area-inset-top));
	bottom: calc(var(--margine-y) + env(safe-area-inset-bottom));
	left: calc(var(--margine-x) + env(safe-area-inset-left));
	right: calc(var(--margine-x) + env(safe-area-inset-right));
	display: flex;
	flex-direction: column;
	border-radius: var(--raggio);
	background: var(--cornice);
	box-shadow: 0 0 0 1px var(--orlo);
	transform: translate(var(--x, 0px), var(--y, 0px));
	transition: opacity 0.28s ease-out, transform 0.32s var(--uscita), visibility 0s;
	--presa: 10px;
	--dentro: 3px;
	--angolo: 8px;
}

.miniatura .finestra {
	--presa: 64px;
	--dentro: 6px;
	--angolo: 12px;
}

.finestra.libera {
	top: var(--t);
	left: var(--l);
	width: var(--w);
	height: var(--h);
	right: auto;
	bottom: auto;
}

.finestra.grande {
	top: env(safe-area-inset-top);
	bottom: env(safe-area-inset-bottom);
	left: env(safe-area-inset-left);
	right: env(safe-area-inset-right);
	width: auto;
	height: auto;
	border-radius: 0;
	box-shadow: none;
	transform: none;
	transition: none;
}

.finestra.via {
	opacity: 0;
	visibility: hidden;
	transform: translate(var(--x, 0px), calc(var(--y, 0px) + 28px)) scale(0.96);
	transition: opacity 0.18s ease-in, transform 0.2s ease-in, visibility 0s linear 0.2s;
}

.finestra.grande.via {
	transform: translateY(28px) scale(0.96);
}

.trascina .finestra,
.allarga .finestra {
	transition: none;
}

.trascina iframe,
.allarga iframe {
	pointer-events: none;
}

.bordo {
	position: absolute;
	z-index: 3;
	touch-action: none;
	-webkit-touch-callout: none;
	user-select: none;
	-webkit-user-select: none;
}

.bordo[data-lato="n"],
.bordo[data-lato="s"] {
	left: var(--angolo);
	right: var(--angolo);
	height: calc(var(--presa) + var(--dentro));
	cursor: ns-resize;
}

.bordo[data-lato="n"] {
	top: calc(-1 * var(--presa));
}

.bordo[data-lato="s"] {
	bottom: calc(-1 * var(--presa));
}

.bordo[data-lato="e"],
.bordo[data-lato="w"] {
	top: var(--angolo);
	bottom: var(--angolo);
	width: calc(var(--presa) + var(--dentro));
	cursor: ew-resize;
}

.bordo[data-lato="e"] {
	right: calc(-1 * var(--presa));
}

.bordo[data-lato="w"] {
	left: calc(-1 * var(--presa));
}

.bordo[data-lato="nw"],
.bordo[data-lato="ne"],
.bordo[data-lato="sw"],
.bordo[data-lato="se"] {
	width: calc(var(--presa) + var(--angolo));
	height: calc(var(--presa) + var(--angolo));
}

.bordo[data-lato="nw"] {
	top: calc(-1 * var(--presa));
	left: calc(-1 * var(--presa));
	cursor: nwse-resize;
}

.bordo[data-lato="se"] {
	bottom: calc(-1 * var(--presa));
	right: calc(-1 * var(--presa));
	cursor: nwse-resize;
}

.bordo[data-lato="ne"] {
	top: calc(-1 * var(--presa));
	right: calc(-1 * var(--presa));
	cursor: nesw-resize;
}

.bordo[data-lato="sw"] {
	bottom: calc(-1 * var(--presa));
	left: calc(-1 * var(--presa));
	cursor: nesw-resize;
}

.grande .bordo,
.via .bordo {
	display: none;
}

.testata {
	position: relative;
	flex: 0 0 var(--alto-testata);
	height: var(--alto-testata);
	display: grid;
	grid-template-columns: minmax(0, 1fr) clamp(40px, 14%, 220px) auto;
	align-items: center;
	padding-left: 10px;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
	cursor: default;
}

.miniatura .testata {
	touch-action: pinch-zoom;
}

.schede {
	position: relative;
	min-width: 0;
	height: var(--alto-schede);
	display: flex;
	align-items: center;
	padding: 0 2px;
	border-radius: calc(var(--alto-schede) / 2);
	background: var(--campo);
	container: barra / inline-size;
}

.pillola {
	position: absolute;
	top: 2px;
	left: 0;
	width: 0;
	height: calc(var(--alto-schede) - 4px);
	border-radius: calc(var(--alto-schede) / 2 - 2px);
	background: var(--attiva);
	transition: transform 0.24s var(--uscita), width 0.24s var(--uscita);
}

.pillola.subito {
	transition: none;
}

.scheda {
	position: relative;
	z-index: 1;
	flex: 1 1 0;
	min-width: 0;
	height: calc(var(--alto-schede) - 4px);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 0 12px;
	margin: 0;
	border: 0;
	border-radius: calc(var(--alto-schede) / 2 - 2px);
	container-type: inline-size;
	background: transparent;
	color: var(--testo-spento);
	font: inherit;
	font-size: 13px;
	font-weight: 400;
	cursor: default;
	transition: color 0.15s ease, background-color 0.15s ease;
}

@container barra (max-width: 480px) {
	.scheda {
		gap: 5px;
		padding: 0 8px;
	}
}

.scheda[aria-selected="true"] {
	color: var(--testo);
}

@media (hover: hover) and (pointer: fine) {
	.scheda[aria-selected="false"]:hover {
		background: var(--sopra);
	}
}

.scheda[aria-selected="false"]:active {
	background: var(--premuto);
}

.scheda:focus-visible,
.comando:focus-visible,
.ridotta:focus-visible {
	outline: 2px solid var(--anello);
	outline-offset: -2px;
}

.segno {
	position: relative;
	flex: 0 0 16px;
	width: 16px;
	height: 16px;
	display: grid;
	place-items: center;
}

.segno img {
	width: 16px;
	height: 16px;
	border-radius: 4px;
	object-fit: contain;
	transition: opacity 0.15s ease;
}

.segno::after {
	content: "";
	position: absolute;
	inset: 1px;
	border-radius: 50%;
	border: 1.6px solid rgba(168, 199, 250, 0.22);
	border-top-color: var(--anello);
	opacity: 0;
	transition: opacity 0.15s ease;
}

.carica .segno img {
	opacity: 0;
}

.carica .segno::after {
	opacity: 1;
	animation: gira 0.8s linear infinite;
}

@keyframes gira {
	to {
		transform: rotate(360deg);
	}
}

.titolo {
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.titolo .corto {
	display: none;
}

@container (max-width: 165px) {
	.titolo .intero {
		display: none;
	}

	.titolo .corto {
		display: inline;
	}
}

@container (max-width: 64px) {
	.titolo {
		display: none;
	}
}

.comandi {
	grid-column: 3;
	align-self: stretch;
	display: flex;
}

.comando {
	width: 46px;
	height: 100%;
	display: grid;
	place-items: center;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--glifo);
	cursor: default;
	transition: background-color 0.1s ease, color 0.1s ease;
}

.comando svg {
	width: 10px;
	height: 10px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1;
	shape-rendering: geometricPrecision;
}

.comando.chiudi {
	border-top-right-radius: var(--raggio);
}

.grande .comando.chiudi {
	border-top-right-radius: 0;
}

.comando .rientra,
.grande .comando .pieno {
	display: none;
}

.grande .comando .rientra {
	display: block;
}

@media (hover: hover) and (pointer: fine) {
	.comando:hover {
		background: var(--sopra);
	}

	.comando.chiudi:hover {
		background: var(--rosso);
		color: #ffffff;
	}
}

.comando:active {
	background: var(--premuto);
}

.comando.chiudi:active {
	background: var(--rosso);
	color: rgba(255, 255, 255, 0.85);
}

.riquadro {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	border-radius: 0 0 var(--raggio) var(--raggio);
	background: var(--superficie);
}

.grande .riquadro {
	border-radius: 0;
}

.riquadro > iframe,
.riquadro > .fermo {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	border: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.18s ease, visibility 0s linear 0.18s;
}

.riquadro > iframe {
	display: block;
}

.riquadro > .attivo {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.18s ease, visibility 0s;
}

.fermo {
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 14px;
	text-align: center;
	background: var(--superficie);
}

.fermo img {
	width: 40px;
	height: 40px;
	border-radius: 10px;
}

.fermo img.largo {
	width: auto;
	border-radius: 0;
}

.fermo p {
	margin: 0;
	font-size: 15px;
	color: var(--testo);
}

.fermo a {
	display: inline-flex;
	align-items: center;
	height: 32px;
	padding: 0 16px;
	border-radius: 16px;
	background: var(--attiva);
	color: var(--testo);
	font-size: 13px;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
	.fermo a:hover {
		background: var(--attiva-sopra);
	}
}

.fermo a:focus-visible {
	outline: 2px solid var(--anello);
	outline-offset: 2px;
}

.ridotta {
	position: fixed;
	left: 50%;
	bottom: calc(24px + env(safe-area-inset-bottom));
	display: flex;
	align-items: center;
	gap: 8px;
	height: 36px;
	max-width: calc(100% - 32px);
	padding: 0 16px 0 12px;
	margin: 0;
	border: 0;
	border-radius: 18px;
	background: var(--cornice);
	box-shadow: 0 0 0 1px var(--orlo);
	color: var(--testo);
	font: inherit;
	font-size: 13px;
	cursor: default;
	opacity: 0;
	transform: translate(-50%, 12px);
	transform-origin: 50% 100%;
	transition: opacity 0.22s ease-out, transform 0.28s var(--uscita), background-color 0.15s ease;
}

.ridotta[hidden] {
	display: none;
}

.ridotta.vista {
	opacity: 1;
	transform: translate(-50%, 0);
}

.miniatura .ridotta {
	transform: translate(-50%, 12px) scale(2.6);
}

.miniatura .ridotta.vista {
	transform: translate(-50%, 0) scale(2.6);
}

@media (hover: hover) and (pointer: fine) {
	.ridotta:hover {
		background: var(--campo);
	}
}

@media (prefers-reduced-motion: reduce) {
	.finestra,
	.finestra.via,
	.pillola,
	.ridotta {
		transition-property: opacity, visibility;
	}

	.finestra.via {
		transform: translate(var(--x, 0px), var(--y, 0px));
	}

	.carica .segno::after {
		animation-duration: 2.4s;
	}
}
