* {
	box-sizing: border-box;
}

html, body {
	background-color: #E7E7E7;
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	font-family: Arial, Helvetica, sans-serif;
	-webkit-font-smoothing: antialiased;
}

#stage-wrapper {
	position: relative;
	width: 100vw;
	height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

#flashcontent {
	position: relative;
	width: 720px;
	height: 484px;
	background-color: #E7E7E7;
	overflow: hidden;
	user-select: none;
	transform-origin: center center;
	/* keep the full 720px layout size; JS scales it down instead of flexbox squeezing it */
	flex-shrink: 0;
}

/* Paper unfolding layers */
.paper-layer {
	position: absolute;
	pointer-events: none;
	opacity: 0;
	display: none;
}

/* Preloader (preloader_mc) */
.preloader-mc {
	position: absolute;
	width: 270px;
	height: 60px;
	pointer-events: none;
	z-index: 50;
	display: none;
}

.preloader-mc svg {
	overflow: visible;
	display: block;
}

.preloader-mc .loader-txt {
	position: absolute;
	left: 2px;
	top: 29.5px;
	font-family: "Courier New", Courier, monospace;
	font-size: 20px;
	font-weight: bold;
	color: #653825;
	line-height: 1;
	white-space: nowrap;
}

/* Left navigation buttons */
.nav-btn {
	position: absolute;
	cursor: pointer;
	display: none;
	z-index: 20;
	background: none;
	border: none;
	padding: 0;
	outline: none;
}

.nav-btn img {
	display: block;
	pointer-events: none;
}

.nav-btn:hover img,
.nav-btn:active img,
.nav-btn.active-shift img {
	transform: translate(3px, 3px);
}

/* Bottom-left credit */
#credit-box {
	position: absolute;
	left: 50.95px;
	top: 415.8px;
	width: 172px;
	z-index: 20;
	display: none;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	line-height: 14px;
	color: #583003;
	text-align: left;
	user-select: text;
}

#credit-box a {
	color: #583003;
	text-decoration: none;
}

#credit-box a:hover {
	text-decoration: underline;
}

/* Tiny black dot from Frame 32 Char #58 */
#frame32-dot {
	position: absolute;
	left: 174.45px;
	top: 391.4px;
	width: 1.5px;
	height: 1.6px;
	background: #000000;
	z-index: 20;
	display: none;
	pointer-events: none;
}

/* Right section container */
.section-panel {
	position: absolute;
	left: 0;
	top: 0;
	width: 720px;
	height: 484px;
	z-index: 15;
	display: none;
	pointer-events: none;
}

.section-panel.active {
	display: block;
}

.section-panel * {
	pointer-events: auto;
}

/* Semi-transparent white backing box (Char #62, alpha 110/256 = 0.43) */
.white-backing {
	position: absolute;
	background-color: rgba(255, 255, 255, 0.43);
	pointer-events: none;
}

/* Section Titles (_typewriter 28px) */
.sec-title {
	position: absolute;
	font-family: "Courier New", Courier, monospace;
	font-size: 28px;
	font-weight: normal;
	color: #000000;
	line-height: 32px;
	margin: 0;
	white-space: nowrap;
	letter-spacing: 0px;
}

/* Typewriter body text (11px) */
.typewriter-text {
	position: absolute;
	font-family: "Courier New", Courier, monospace;
	font-size: 11px;
	color: #000000;
	line-height: 14.2px;
	text-align: left;
	user-select: text;
}

.typewriter-text p {
	margin: 0 0 8px 0;
}

.typewriter-text p:last-child {
	margin-bottom: 0;
}

.typewriter-text a {
	color: #013958;
	font-weight: bold;
	text-decoration: none;
}

.typewriter-text a:hover {
	text-decoration: underline;
}

/* Section 2: QUADRI */
#quadri-image-container {
	position: absolute;
	left: 244.95px;
	top: 41.0px;
	width: 434px;
	height: 357px;
	display: flex;
	align-items: flex-start;
	justify-content: flex-start;
	pointer-events: none;
}

#quadri-image-container img {
	display: block;
	max-height: 357px;
	width: auto;
}

#quadri-numbers-img {
	position: absolute;
	left: 242.25px;
	top: 404.85px;
	width: 442px;
	height: 32px;
	z-index: 18;
	pointer-events: none;
}

.quadri-num-btn {
	position: absolute;
	width: 25.55px;
	height: 25.55px;
	margin-left: -12.8px;
	margin-top: -12.0px;
	background-color: #f7f5d9;
	border: none;
	padding: 0;
	cursor: pointer;
	z-index: 16;
	transition: background-color 0.1s;
}

.quadri-num-btn:hover,
.quadri-num-btn.active {
	background-color: #e6dfb0;
}

/* Section 3: CARTOLINE thumbnails */
.cartolina-thumb {
	position: absolute;
	border: none;
	padding: 0;
	background: none;
	cursor: pointer;
	display: none;
}

.cartolina-thumb img {
	display: block;
	pointer-events: none;
}

.cartolina-thumb:hover img,
.cartolina-thumb:active img {
	transform: translate(3.5px, 3.8px);
}

/* Section 6: LASCIATE COMMENTI */
.gb-borders-svg {
	position: absolute;
	left: 0;
	top: 0;
	width: 720px;
	height: 484px;
	pointer-events: none;
}

.gb-label {
	position: absolute;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #000000;
	line-height: 15px;
	pointer-events: none;
}

.gb-input {
	position: absolute;
	background: transparent;
	border: none;
	outline: none;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	color: #000000;
	padding: 1px 3px;
}

.gb-textarea {
	position: absolute;
	background: transparent;
	border: none;
	outline: none;
	resize: none;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	color: #000000;
	padding: 2px 3px;
	line-height: 14px;
}

.img-action-btn {
	position: absolute;
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
}

.img-action-btn:disabled {
	cursor: wait;
	opacity: 0.5;
}

.hp-field {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.img-action-btn img {
	display: block;
}

.img-action-btn:hover img,
.img-action-btn:active img {
	transform: translate(3.4px, 3.4px);
}

#gb-result-tf,
#card-result-tf {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	color: #ff0000;
}

/* Confirmation (comment saved / postcard sent) */
#gb-result-tf.result-ok,
#card-result-tf.result-ok {
	color: #1d8b08;
}

#gb-result-tf {
	position: absolute;
	left: 442.25px;
	top: 329.95px;
	width: 232.8px;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	color: #ff0000;
	pointer-events: none;
}

/* Modal Overlays (Postcard Popup, Guestbook Visual Popup) */
.angeli-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

.angeli-modal-backdrop.open {
	display: flex;
}

/* Postcard 484x550 window */
#postcard-window {
	position: relative;
	flex-shrink: 0;
	transform-origin: center center;
	width: 484px;
	height: 550px;
	background-color: #E7E7E7;
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
	overflow: hidden;
	user-select: none;
}

.modal-close-btn {
	position: absolute;
	right: 10px;
	top: 8px;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: rgba(88, 48, 3, 0.85);
	color: #fff;
	border: none;
	font-size: 16px;
	line-height: 26px;
	text-align: center;
	cursor: pointer;
	z-index: 100;
	padding: 0;
}

.modal-close-btn:hover {
	background: #000;
}

#card-contenuto-mc {
	position: absolute;
	left: 24.3px;
	top: 4.95px;
	width: 434px;
	height: 357px;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	pointer-events: none;
	z-index: 20;
}

#card-contenuto-mc img {
	display: block;
	max-height: 357px;
	width: auto;
}

#card-form-layer {
	position: absolute;
	inset: 0;
	z-index: 25;
	display: none;
}

/* Guestbook comments viewer (484x550 as in spawnWindow) */
#guestbook-window {
	position: relative;
	flex-shrink: 0;
	transform-origin: center center;
	width: 484px;
	height: 550px;
	background-color: #E7E7E7;
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
	padding: 18px 20px;
	overflow-y: auto;
	color: #142941;
}

#guestbook-window h1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-weight: bold;
	color: #142941;
	text-align: left;
	margin: 4px 0;
}

#guestbook-window h2 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10px;
	font-weight: normal;
	color: #003366;
	text-align: left;
	margin: 4px 0;
}

#guestbook-window hr {
	border: none;
	border-top: 1px solid #b8b8b8;
	margin: 10px 0;
}

/* =========================================================
   MOBILE SITE (screens up to 700px wide)
   ========================================================= */
#mobile-site {
	display: none;
}

@media (max-width: 700px) {
	html, body {
		height: auto;
		min-height: 100%;
		overflow: auto;
	}

	#stage-wrapper,
	.angeli-modal-backdrop {
		display: none !important;
	}

	#mobile-site {
		display: block;
		padding: 8px;
		font-family: "Courier New", Courier, monospace;
		color: #000000;
	}

	.m-sheet {
		box-sizing: border-box;
		max-width: 480px;
		min-height: calc(100vh - 16px);
		min-height: calc(100dvh - 16px);
		margin: 0 auto;
		padding: 46px 18px 26px;
		display: flex;
		flex-direction: column;
		gap: 18px;
		background: url(assets/ui/card_paper_3.jpg) center / 100% 100% no-repeat;
	}

	/* Menu: all dark, the current one pale and pressed in */
	.m-nav {
		display: flex;
		flex-wrap: wrap;
		gap: 4px 8px;
		align-items: center;
	}

	.m-nav a {
		display: block;
		padding: 6px 0;
		-webkit-tap-highlight-color: transparent;
	}

	.m-nav img {
		display: block;
		/* shrinks a little on narrow phones so the menu stays on two rows */
		height: min(32px, 8.4vw);
		width: auto;
	}

	.m-nav a[aria-current="page"] {
		opacity: 0.4;
		transform: translate(2px, 2px);
	}

	.m-sec {
		display: none;
		flex-direction: column;
		gap: 18px;
		flex-grow: 1;
		padding: 0 6px; /* keep content clear of the torn paper edge */
	}

	.m-sec.active {
		display: flex;
	}

	/* Semi-transparent white panel with typewriter text */
	.m-panel {
		background: rgba(255, 255, 255, 0.43);
		padding: 16px 16px 18px;
		display: flex;
		flex-direction: column;
		gap: 10px;
	}

	.m-panel h1 {
		margin: 0;
		font-size: 26px;
		font-weight: normal;
		line-height: 30px;
	}

	.m-panel h1.m-h1-small {
		font-size: 24px;
		line-height: 28px;
	}

	.m-panel p {
		margin: 0;
		font-size: 14px;
		line-height: 21px;
	}

	.m-panel a,
	.m-link {
		color: #013958;
	}

	.m-link {
		align-self: flex-start;
		display: flex;
		align-items: center;
		min-height: 44px;
		font-size: 16px;
		font-weight: bold;
		text-decoration: none;
	}

	.m-hero,
	.m-card-img,
	.m-painting {
		display: flex;
		justify-content: center;
	}

	.m-hero img {
		display: block;
		width: 100%;
		max-width: 300px;
		aspect-ratio: 300 / 246;
		object-fit: cover;
		box-shadow: 0 2px 6px rgba(88, 48, 3, 0.25);
	}

	.m-credit {
		margin: auto 0 26px 12px;
		font-family: Arial, Helvetica, sans-serif;
		font-size: 12px;
		line-height: 16px;
		color: #583003;
	}

	.m-credit a {
		color: #583003;
	}

	/* Quadri */
	.m-painting {
		min-height: 300px;
		touch-action: pan-y;
	}

	.m-painting img {
		display: block;
		max-width: 100%;
		max-height: 60vh;
		width: auto;
		height: auto;
		box-shadow: 0 2px 6px rgba(88, 48, 3, 0.25);
		user-select: none;
		-webkit-user-drag: none;
	}

	.m-pager {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		max-width: 306px;
		margin: -4px auto 0;
		font-size: 18px;
	}

	.m-arrow {
		width: 44px;
		height: 44px;
		border: 2px solid #000000;
		border-radius: 6px 9px 5px 8px;
		background: transparent;
		font-family: inherit;
		font-size: 22px;
		line-height: 1;
		color: #000000;
		cursor: pointer;
		padding: 0;
	}

	.m-arrow-alt {
		border-radius: 8px 5px 9px 6px;
	}

	.m-hint {
		margin: -4px 0 0;
		font-family: Arial, Helvetica, sans-serif;
		font-size: 12px;
		line-height: 16px;
		color: #583003;
		text-align: center;
	}

	/* Cartoline grid */
	.m-cards {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 14px 12px;
		justify-items: center;
		align-items: center;
	}

	.m-cards a {
		display: block;
		padding: 4px;
	}

	.m-cards img {
		display: block;
		max-width: 100%;
		height: auto;
		box-shadow: 0 1px 4px rgba(88, 48, 3, 0.3);
	}

	/* Invia cartolina */
	.m-back {
		align-self: flex-start;
		display: flex;
		align-items: center;
		min-height: 44px;
		margin-top: -20px;
		font-size: 16px;
		font-weight: bold;
		text-decoration: none;
		color: #000000;
	}

	.m-card-img img {
		display: block;
		max-width: 100%;
		max-height: 300px;
		width: auto;
		height: auto;
		box-shadow: 0 2px 6px rgba(88, 48, 3, 0.25);
	}

	/* Forms */
	.m-form {
		display: flex;
		flex-direction: column;
		gap: 12px;
		font-family: Arial, Helvetica, sans-serif;
	}

	.m-field {
		display: flex;
		flex-direction: column;
		gap: 5px;
	}

	.m-field label {
		font-size: 14px;
	}

	.m-field input,
	.m-field textarea {
		box-sizing: border-box;
		width: 100%;
		border: 1.5px solid #000000;
		border-radius: 5px 9px 6px 8px;
		background: rgba(255, 255, 255, 0.35);
		font-family: inherit;
		font-size: 16px; /* 16px stops iOS zooming into the field */
		color: #000000;
		outline: none;
	}

	.m-field input {
		height: 44px;
		padding: 0 12px;
	}

	.m-field textarea {
		height: 112px;
		padding: 10px 12px;
		line-height: 22px;
		border-radius: 8px 5px 9px 6px;
		resize: none;
	}

	#m-gb-mess {
		height: 96px;
	}

	.m-field input:focus,
	.m-field textarea:focus {
		background: rgba(255, 255, 255, 0.6);
	}

	.m-send {
		display: flex;
		align-items: center;
		gap: 14px;
	}

	.m-invia {
		padding: 0;
		border: none;
		background: transparent;
		cursor: pointer;
		flex-shrink: 0;
	}

	.m-invia img {
		display: block;
	}

	.m-invia:disabled {
		opacity: 0.5;
		cursor: wait;
	}

	.m-status {
		font-size: 14px;
		line-height: 18px;
		color: #ff0000;
	}

	.m-status.result-ok {
		color: #1d8b08;
	}

	/* Comments list */
	.m-comments {
		display: flex;
		flex-direction: column;
		gap: 12px;
		border-top: 1.5px solid rgba(0, 0, 0, 0.6);
		padding-top: 12px;
		padding-bottom: 18px; /* clear of the torn bottom edge */
		font-family: Arial, Helvetica, sans-serif;
	}

	.m-comments > img {
		display: block;
	}

	#m-gb-list {
		display: flex;
		flex-direction: column;
		gap: 14px;
	}

	.m-comment {
		display: flex;
		flex-direction: column;
		gap: 3px;
	}

	/* thin divider between comments */
	.m-comment + .m-comment {
		border-top: 1px solid rgba(0, 0, 0, 0.18);
		padding-top: 14px;
	}

	.m-comment-date {
		font-size: 12px;
		color: #4a4a4a;
	}

	.m-comment-name {
		font-size: 14px;
		font-weight: bold;
		color: #142941;
	}

	.m-comment-text {
		font-size: 14px;
		line-height: 19px;
		color: #142941;
		white-space: pre-line;
		overflow-wrap: anywhere;
	}
}
