html,
body {
	width: 100%;
	min-height: 100%;
	margin: 0;
}

body {
	background: #000;
	color: #fff;
	overflow: hidden;
	transition: background-color 1600ms ease;
}

body.memory-mode {
	background: #FFDAB9;
}

body.future-mode {
	background: #fdf4ed;
}

button {
	font: inherit;
}

.page-shell {
	position: relative;
	width: 100vw;
	height: 100vh;
	overflow: hidden;
}

.stage {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 1200ms ease;
}

.stage.is-active {
	opacity: 1;
	pointer-events: auto;
}

.loading-stage {
	z-index: 100;
	background: #000;
	transition-duration: 700ms;
}

.loading-stage.is-hidden {
	opacity: 0;
	pointer-events: none;
}

.loading-heart {
	position: relative;
	width: 48px;
	height: 44px;
	transform: rotate(-45deg);
	animation: loadingHeartPulse 1300ms ease-in-out infinite;
}

.loading-heart::before,
.loading-heart::after,
.loading-heart {
	background: #c4515c;
}

.loading-heart::before,
.loading-heart::after {
	content: '';
	position: absolute;
	width: 48px;
	height: 44px;
	border-radius: 50%;
}

.loading-heart::before {
	top: -24px;
	left: 0;
}

.loading-heart::after {
	top: 0;
	left: 24px;
}

.memory-stage.is-bridge-exit {
	opacity: 0;
	pointer-events: none;
	transition-duration: 1000ms;
}

.date-stage {
	z-index: 30;
	background: #000;
}

.date-stage.is-bridge {
	transition-duration: 5000ms;
}

.date-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 32px;
	padding: 24px;
	text-align: center;
}

.date-text {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
	font-size: clamp(42px, 10.6vw, 96px);
	font-weight: 600;
	line-height: 1.12;
	letter-spacing: 0;
	color: #fff;
	text-shadow: 0 0 18px rgba(255, 255, 255, 0.34);
}

.date-stage.is-date-page .date-text {
	font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
	font-variant-numeric: tabular-nums;
}

.start-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
	min-width: 112px;
	min-height: 56px;
	border: 1px solid rgba(255, 255, 255, 0.72);
	border-radius: 999px;
	padding: 0 22px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	transition: background-color 200ms ease, color 200ms ease, opacity 300ms ease;
}

.start-button-icon {
	width: 30px;
	height: 30px;
	stroke: currentColor;
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
	fill: none;
}

.start-button:hover,
.start-button:focus {
	background: #fff;
	color: #000;
	outline: none;
}

.start-button.is-hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.memory-stage {
	--memory-blank-start: 290px;
	--memory-content-center: calc(var(--memory-blank-start) + (100vh - var(--memory-blank-start)) * 0.42);
	z-index: 10;
	display: block;
	box-sizing: border-box;
	text-align: center;
}

.memory-decorations {
	position: absolute;
	inset: 0;
	overflow: hidden;
	pointer-events: none;
}

.balloon-border {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 4;
	width: 100%;
	opacity: 0.5;
}

.memory-stage.is-active .balloon-border {
	animation: balloonBorderFly 5500ms linear 1000ms forwards;
}

.memory-stage.is-debug .balloon-border {
	display: none;
	animation: none;
}

.bulb-row {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 2;
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	padding-right: 15px;
	box-sizing: border-box;
}

.bulb {
	width: 50px;
	height: 50px;
	margin: 0 auto;
	background-repeat: no-repeat;
	background-position: center top;
	background-size: 50px 50px;
	opacity: 1;
	animation: bulbFadeIn 1600ms ease both;
}

.bulb-yellow {
	background-image: url('../res/bulb_yellow.png');
}

.bulb-red {
	background-image: url('../res/bulb_red.png');
}

.bulb-blue {
	background-image: url('../res/bulb_blue.png');
}

.bulb-green {
	background-image: url('../res/bulb_green.png');
}

.bulb-pink {
	background-image: url('../res/bulb_pink.png');
}

.bulb-orange {
	background-image: url('../res/bulb_orange.png');
}

.legacy-banner {
	position: absolute;
	top: 70px;
	left: 0;
	z-index: 1;
	width: 100%;
	text-align: center;
}

.legacy-banner img {
	max-width: 100%;
	transform: translateY(0);
}

.memory-balloon {
	position: absolute;
	z-index: 1;
	width: 60px;
	height: 110px;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	opacity: 0.86;
	transform-origin: 50% 90%;
}

.memory-balloon span {
	display: block;
	margin-top: 16px;
	font-family: 'Signika', 'Helvetica Neue', Arial, sans-serif;
	font-size: 35px;
	font-weight: 700;
	line-height: 1;
	text-align: center;
	text-shadow: 5px 5px 5px #fff;
}

.memory-stage.is-active .memory-balloon {
	animation: balloonFloat 8s ease-in-out infinite;
}

.balloon-one {
	top: 180px;
	left: calc(50% - 190px);
	background-image: url('../res/b1.png');
	animation-delay: -1s;
}

.balloon-one span {
	color: #F2B300;
}

.balloon-two {
	top: 180px;
	left: calc(50% - 130px);
	background-image: url('../res/b2.png');
	animation-delay: -4s;
}

.balloon-two span {
	color: #0719D4;
}

.balloon-three {
	top: 180px;
	left: calc(50% - 80px);
	background-image: url('../res/b3.png');
	animation-delay: -2s;
}

.balloon-three span {
	color: #8FAD00;
}

.balloon-four {
	top: 180px;
	left: calc(50% - 30px);
	background-image: url('../res/b4.png');
	animation-delay: -5s;
}

.balloon-four span {
	color: #D14D39;
}

.balloon-five {
	top: 180px;
	left: calc(50% + 30px);
	background-image: url('../res/b5.png');
	animation-delay: -3s;
}

.balloon-five span {
	color: #8377E4;
}

.balloon-six {
	top: 180px;
	left: calc(50% + 80px);
	background-image: url('../res/b6.png');
	animation-delay: -6s;
}

.balloon-six span {
	color: #99C96A;
}

.balloon-seven {
	top: 180px;
	left: calc(50% + 130px);
	background-image: url('../res/b7.png');
	animation-delay: -2.8s;
}

.balloon-seven span {
	color: #20CFB4;
}

.message {
	position: absolute;
	top: var(--memory-content-center);
	left: 50%;
	z-index: 3;
	width: min(92vw, 720px);
	min-height: 84px;
	transform: translate(-50%, -50%);
}

.message p {
	display: none;
	margin: 0;
	font-family: 'Signika', 'Helvetica Neue', Arial, sans-serif;
	font-size: clamp(25px, 7vw, 48px);
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: 0;
	color: #C4515C;
	text-shadow: 2px 2px 2px #fff;
	opacity: 0;
	transition: opacity 900ms ease;
}

.message p.is-visible {
	opacity: 1;
}

.wish-photo {
	position: absolute;
	top: var(--memory-content-center);
	left: 50%;
	z-index: 3;
	width: 200px;
	height: 200px;
	object-fit: contain;
	opacity: 0;
	transform: translate(-50%, -50%);
	transition: opacity 1000ms ease;
}

.wish-photo.is-visible {
	opacity: 1;
}

.old-photo {
	position: absolute;
	top: var(--memory-content-center);
	left: 50%;
	z-index: 3;
	width: 200px;
	height: 300px;
	object-fit: contain;
	opacity: 0;
	transform: translate(-50%, -50%);
	transition: opacity 1000ms ease;
}

.old-photo.is-visible {
	opacity: 1;
}

@keyframes balloonFloat {
	0%,
	100% {
		transform: translateY(0) rotate(-8deg);
	}
	50% {
		transform: translateY(-24px) rotate(8deg);
	}
}

@keyframes balloonBorderFly {
	0% {
		top: 100%;
	}
	100% {
		top: -500px;
	}
}

@keyframes bulbFadeIn {
	0% {
		opacity: 0;
	}
	100% {
		opacity: 1;
	}
}

@keyframes loadingHeartPulse {
	0%,
	100% {
		opacity: 0.54;
		transform: rotate(-45deg) scale(0.92);
	}
	50% {
		opacity: 1;
		transform: rotate(-45deg) scale(1.08);
	}
}

.future-stage {
	z-index: 5;
	overflow: hidden;
	background: linear-gradient(180deg, #fff9f3 0%, #fdeee9 52%, #f8dfdd 100%);
	text-align: center;
	font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
}

.future-scene {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: clamp(28px, 5vh, 48px) 24px;
	opacity: 0;
	pointer-events: none;
	transform: translateY(12px);
	transition: opacity 900ms ease, transform 900ms ease;
}

.future-scene.is-active {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
}

.future-photo-frame {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	margin: 0 0 clamp(24px, 4vh, 34px);
	padding: 10px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.72);
	box-shadow: 0 18px 42px rgba(129, 80, 84, 0.18);
	overflow: hidden;
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 900ms ease, transform 900ms ease;
}

.future-photo-frame.is-visible {
	opacity: 1;
	transform: translateY(0);
}

.future-photo-frame img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 6px;
	object-fit: contain;
}

.future-photo-landscape {
	width: min(82vw, 720px);
	aspect-ratio: 4 / 3;
	max-height: 48vh;
}

.future-photo-portrait {
	width: min(58vw, 360px);
	aspect-ratio: 3 / 4;
	max-height: 50vh;
}

.future-copy {
	width: min(86vw, 720px);
	color: #74434a;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.82);
}

.future-copy p {
	margin: 0;
	font-size: clamp(18px, 3.6vw, 29px);
	font-weight: 500;
	line-height: 1.76;
	letter-spacing: 0;
}

.future-copy p + p {
	margin-top: 18px;
}

.future-line {
	display: block;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 700ms ease, transform 700ms ease;
}

.future-line.is-visible {
	opacity: 1;
	transform: translateY(0);
}

.future-scene-text .future-copy {
	width: min(84vw, 680px);
}

.future-scene-text .future-copy p {
	font-size: clamp(21px, 4.2vw, 34px);
	line-height: 1.82;
}

.future-scene-ending .future-copy p:last-child {
	color: #9f4050;
	font-weight: 700;
}

.future-scene-ending .future-copy p {
	font-size: clamp(32px, 7vw, 58px);
	line-height: 1.48;
}

.future-typewriter {
	min-height: 1.48em;
}

.future-type-char {
	display: inline-block;
	opacity: 0;
	transition: opacity 1200ms ease;
}

.future-type-char.is-visible {
	opacity: 1;
}

@media (max-width: 520px) {
	.date-card {
		gap: 24px;
	}

	.memory-stage {
		padding-top: 0;
	}

	.old-photo {
		width: 200px;
		height: 300px;
	}

	.wish-photo {
		width: 200px;
		height: 200px;
	}

	.legacy-banner {
		top: 64px;
	}

	.future-scene {
		padding: 28px 18px;
	}

	.future-photo-frame {
		margin-bottom: 22px;
		padding: 8px;
	}

	.future-photo-landscape {
		width: min(88vw, 420px);
		max-height: 40vh;
	}

	.future-photo-portrait {
		width: min(72vw, 300px);
		max-height: 44vh;
	}

	.future-copy p {
		font-size: clamp(17px, 5vw, 22px);
		line-height: 1.66;
	}

	.future-scene-text .future-copy p {
		font-size: clamp(19px, 5.6vw, 25px);
		line-height: 1.72;
	}

	.future-scene-ending .future-copy p {
		font-size: clamp(30px, 9vw, 42px);
		line-height: 1.48;
	}
}
