@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	min-height: 100vh;
	overflow-x: hidden;
	font-family: "Press Start 2P", monospace;
}

body.pre-start-lock,
body.info-open {
	overflow: hidden;
}

.screen {
	min-height: 100vh;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	display: flex;
	align-items: center;
	justify-content: center;
}

.first-screen {
	background-image: url("pic/index.png");
	position: relative;
}

.second-screen {
	background-image: url("pic/background.png");
	position: relative;
}

.hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	text-align: center;
}

.start-button {
	display: inline-block;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	margin-top: -52px;
	transition: transform 0.2s ease;
}

.start-button img {
	width: min(50vw, 440px);
	height: auto;
	display: block;
}

.start-button:hover {
	transform: translateY(-2px);
}

.instruction-copy {
	width: min(86vw, 1040px);
	color: #fff6de;
	text-align: left;
	line-height: 1.6;
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}

.instruction-copy h2 {
	margin: 0 0 18px;
	font-size: clamp(18px, 2vw, 32px);
	line-height: 1.4;
}

.instruction-copy p {
	margin: 0 0 14px;
	font-size: clamp(10px, 1.1vw, 18px);
	line-height: 1.75;
}

.instruction-copy p:last-child {
	margin-bottom: 0;
}


.first-team-links {
	position: absolute;
	top: clamp(16px, 3.2vh, 36px);
	left: clamp(16px, 2.8vw, 34px);
	z-index: 6;
	display: grid;
	gap: 10px;
}

.first-team-heading {
	margin: 0;
	font-size: clamp(8px, 0.85vw, 11px);
	line-height: 1.45;
	color: #fff2d0;
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}

.first-team-link {
	display: grid;
	gap: 5px;
	width: clamp(148px, 15vw, 220px);
	padding: 11px 12px;
	text-decoration: none;
	border: 2px solid rgba(255, 233, 188, 0.55);
	border-radius: 9px;
	background: rgba(255, 238, 205, 0.14);
	color: #fff8e5;
	backdrop-filter: blur(1.5px);
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.first-team-link:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 16px rgba(0, 0, 0, 0.28);
	border-color: rgba(255, 240, 210, 0.82);
}

.first-team-title {
	font-size: clamp(9px, 0.98vw, 13px);
	line-height: 1.35;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #fff0c9;
}

.first-team-subtitle {
	font-size: clamp(8px, 0.78vw, 10px);
	line-height: 1.4;
	color: #f9dfb0;
}

.game-button {
	position: absolute;
	right: clamp(16px, 3vw, 48px);
	bottom: clamp(16px, 4vh, 56px);
	display: inline-block;
	line-height: 0;
	transition: transform 0.2s ease;
}

.game-button img {
	width: min(46vw, 400px);
	height: auto;
	display: block;
}

.game-button:hover {
	transform: translateY(-2px);
}

.back-home-button {
	position: absolute;
	left: clamp(16px, 3vw, 48px);
	bottom: clamp(16px, 4vh, 56px);
	display: inline-block;
	line-height: 0;
	transition: transform 0.2s ease;
}

.back-home-button img {
	width: min(42vw, 340px);
	height: auto;
	display: block;
}

.back-home-button:hover {
	transform: translateY(-2px);
}

.transition-panel {
	position: fixed;
	inset: 0;
	background-image: url("pic/game.png");
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	transform: translateX(100%);
	pointer-events: none;
	z-index: 999;
}

body.to-game .screen {
	animation: currentPageOut 0.7s ease forwards;
}

body.to-game .transition-panel {
	animation: gamePageIn 0.7s ease forwards;
}

@keyframes currentPageOut {
	from {
		transform: translateX(0);
	}

	to {
		transform: translateX(-100%);
	}
}

@keyframes gamePageIn {
	from {
		transform: translateX(100%);
	}

	to {
		transform: translateX(0);
	}
}

.game-page {
	width: 100%;
	min-height: 100vh;
	background-image: url("pic/game.png");
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	position: relative;
	overflow-x: hidden;
	overflow-y: auto;
}

.game-top-bar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: clamp(10px, 1.4vw, 18px) clamp(12px, 2vw, 24px);
	box-sizing: border-box;
	background: transparent;
	border-bottom: 0;
	pointer-events: none;
}

.game-top-bar > * {
	pointer-events: auto;
}

.collection-btn {
	position: fixed;
	top: clamp(12px, 2vh, 20px);
	right: clamp(12px, 2vw, 24px);
	z-index: 30;
	font-family: "Press Start 2P", monospace;
	font-size: clamp(8px, 0.8vw, 11px);
	padding: 10px 12px;
	border: 2px solid #f5f5f5;
	border-radius: 10px;
	background: #ffffff;
	color: #2a1a18;
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.collection-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 16px rgba(0, 0, 0, 0.28);
}

.game-top-bar .collection-btn {
	position: static;
	top: auto;
	right: auto;
	z-index: auto;
}

.back-btn {
	display: inline-block;
	line-height: 0;
	transition: transform 0.15s ease;
}

.back-btn img {
	width: min(34vw, 220px);
	height: auto;
	display: block;
}

.back-btn:hover {
	transform: translateY(-2px);
}

.story-shell {
	width: min(84vw, 900px);
	margin: clamp(16px, 2.5vh, 40px) auto 0;
	transform: translateX(10px);
	padding: clamp(16px, 2.6vh, 30px);
	display: grid;
	gap: 14px;
	position: relative;
	z-index: 2;
}

.story-header {
	background: rgba(20, 8, 8, 0.72);
	border: 2px solid rgba(255, 214, 153, 0.75);
	border-radius: 14px;
	padding: clamp(14px, 2vw, 20px);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
	color: #fff0c9;
}

.story-header h1 {
	margin: 0;
	font-size: clamp(12px, 1.7vw, 22px);
	line-height: 1.4;
	white-space: nowrap;
}

.chapter-label {
	margin: 0 0 10px;
	font-size: clamp(8px, 1vw, 12px);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #ffd188;
}

.story-card {
	background: rgba(24, 17, 16, 0.82);
	border: 2px solid rgba(255, 220, 170, 0.65);
	border-radius: 14px;
	padding: clamp(16px, 2vw, 24px);
	color: #fff8e5;
	backdrop-filter: blur(3px);
	box-shadow: 0 14px 26px rgba(0, 0, 0, 0.35);
	min-height: clamp(390px, 48vh, 540px);
}

.story-card h2 {
	margin: 0 0 12px;
	font-size: clamp(14px, 2vw, 24px);
	line-height: 1.4;
}

.story-card p {
	margin: 0;
	font-size: clamp(10px, 1.1vw, 16px);
	line-height: 1.9;
	color: #fff2d0;
}

.choice-list {
	margin-top: 22px;
	display: grid;
	gap: 12px;
}

.choice-btn,
.restart-btn {
	font-family: "Press Start 2P", monospace;
	font-size: clamp(8px, 0.92vw, 12px);
	line-height: 1.6;
	padding: 12px 14px;
	text-align: left;
	border: 2px solid #f5f5f5;
	border-radius: 10px;
	background: #ffffff;
	color: #2a1a18;
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.choice-btn:hover,
.restart-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 16px rgba(0, 0, 0, 0.28);
}

.restart-btn {
	margin-top: 20px;
	text-align: center;
	width: 100%;
}

.hud-stats {
	position: fixed;
	left: clamp(10px, 1.8vw, 24px);
	top: clamp(108px, 14vh, 162px);
	z-index: 5;
	display: grid;
	gap: 7px;
	font-size: clamp(8px, 0.85vw, 12px);
	max-width: min(42vw, 360px);
}

.hud-stats span {
	display: block;
	padding: 8px 10px;
	border-radius: 8px;
	background: rgba(17, 9, 8, 0.82);
	border: 1px solid rgba(255, 233, 188, 0.55);
	color: #fff2d0;
	box-shadow: 0 8px 14px rgba(0, 0, 0, 0.25);
}

.ending-page {
	background-image: url("pic/background.png") !important;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: clamp(84px, 10vh, 112px) clamp(14px, 2vw, 24px) clamp(120px, 17vh, 180px);
	box-sizing: border-box;
}

.ending-team-links {
	position: absolute;
	top: clamp(16px, 3.2vh, 36px);
	left: clamp(16px, 2.8vw, 34px);
	z-index: 6;
	display: grid;
	gap: 10px;
}

.ending-team-heading {
	margin: 0;
	font-size: clamp(8px, 0.85vw, 11px);
	line-height: 1.45;
	color: #fff2d0;
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}

.ending-shell {
	width: min(94vw, 900px);
	margin: 0;
	padding: 0;
	display: flex;
	justify-content: center;
	position: relative;
	z-index: 2;
}

.ending-focus {
	width: min(92vw, 760px);
	display: grid;
	gap: clamp(10px, 1.6vh, 14px);
	justify-items: center;
	text-align: center;
}

.ending-image-card {
	background: rgba(24, 17, 16, 0.82);
	border: 2px solid rgba(255, 220, 170, 0.65);
	border-radius: 14px;
	padding: clamp(8px, 1.1vw, 12px);
	box-shadow: 0 14px 26px rgba(0, 0, 0, 0.35);
	display: flex;
	align-items: center;
	justify-content: center;
	width: fit-content;
}

.ending-image-card img {
	display: block;
	width: auto;
	height: auto;
	max-width: min(74vw, 520px);
	max-height: min(48vh, 360px);
	border-radius: 8px;
}

.ending-copy-card {
	width: min(88vw, 760px);
	padding: clamp(12px, 1.8vh, 16px) clamp(12px, 1.6vw, 18px);
	background: rgba(24, 17, 16, 0.82);
	border: 2px solid rgba(255, 220, 170, 0.65);
	border-radius: 14px;
	box-shadow: 0 14px 26px rgba(0, 0, 0, 0.35);
	text-align: left;
}

.ending-title-banner {
	margin: 0;
	font-size: clamp(14px, 2vw, 24px);
	line-height: 1.4;
	color: #fff8e5;
	text-align: center;
}

.ending-text-strip {
	margin: 10px 0 0;
	font-size: clamp(10px, 1.1vw, 16px);
	line-height: 1.9;
	color: #fff2d0;
}

.ending-corner-action {
	position: fixed;
	z-index: 5;
	bottom: clamp(18px, 4.2vh, 42px);
	padding: 0;
	border: 0;
	background: transparent;
	line-height: 0;
	cursor: pointer;
	transition: transform 0.15s ease;
}

.ending-corner-action img {
	width: min(29vw, 280px);
	height: auto;
	display: block;
}

.ending-left {
	left: clamp(12px, 3vw, 40px);
}

.ending-right {
	right: clamp(12px, 3vw, 40px);
}

.ending-corner-action:hover {
	transform: translateY(-2px);
}

.ending-modal {
	position: fixed;
	inset: 0;
	z-index: 10;
	display: grid;
	place-items: center;
	padding: 18px;
}

.ending-modal[hidden] {
	display: none;
}

.ending-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.62);
}

.ending-modal-panel {
	position: relative;
	width: min(92vw, 760px);
	max-height: min(82vh, 680px);
	overflow: auto;
	background: rgba(25, 16, 15, 0.95);
	border: 2px solid rgba(255, 220, 170, 0.8);
	border-radius: 14px;
	padding: clamp(16px, 2vw, 24px);
	box-shadow: 0 16px 30px rgba(0, 0, 0, 0.36);
	color: #fff8e5;
}

.ending-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.ending-modal-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.ending-modal-header h2 {
	margin: 0;
	font-size: clamp(13px, 1.4vw, 20px);
	line-height: 1.4;
}

.close-modal-btn {
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	line-height: 0;
}

.close-modal-btn img {
	display: block;
	width: clamp(24px, 4.2vw, 54px);
	height: auto;
}

.reset-collection-btn {
	font-family: "Press Start 2P", monospace;
	font-size: clamp(8px, 0.78vw, 10px);
	padding: 8px 10px;
	border: 2px solid #f5f5f5;
	border-radius: 8px;
	background: #ffffff;
	color: #2a1a18;
	cursor: pointer;
}

.reset-collection-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 16px rgba(0, 0, 0, 0.28);
}

.ending-count {
	margin: 14px 0 12px;
	font-size: clamp(9px, 1vw, 13px);
	color: #ffe6b3;
}

.ending-collection-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	gap: 10px;
}

.ending-collection-list li {
	border: 1px solid rgba(255, 220, 170, 0.5);
	border-radius: 10px;
	padding: 12px;
	background: rgba(255, 234, 196, 0.08);
	font-size: clamp(8px, 0.9vw, 12px);
	line-height: 1.7;
}

.ending-link-btn {
	font-family: "Press Start 2P", monospace;
	font-size: inherit;
	line-height: inherit;
	color: #fff8e5;
	background: transparent;
	border: 0;
	padding: 0;
	text-align: left;
	width: 100%;
	cursor: pointer;
}

.ending-link-btn:hover {
	text-decoration: underline;
}

.ending-collection-list .locked {
	color: #d6c4a0;
	opacity: 0.8;
}

.info-button {
	position: fixed;
	top: clamp(12px, 2vh, 20px);
	right: clamp(12px, 2vw, 24px);
	z-index: 7;
	font-family: "Press Start 2P", monospace;
	font-size: clamp(10px, 1.05vw, 14px);
	padding: 12px 18px;
	border: 3px solid #f5f5f5;
	border-radius: 10px;
	background: #ffffff;
	color: #2a1a18;
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.info-button:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 16px rgba(0, 0, 0, 0.28);
}

.info-popup {
	position: fixed;
	inset: 0;
	z-index: 20;
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding: clamp(76px, 10vh, 126px) clamp(8px, 2vw, 20px) clamp(8px, 2vh, 20px);
}

.info-popup[hidden] {
	display: none;
}

.info-popup-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 0.22s ease;
}

.info-popup-panel {
	position: relative;
	width: min(94vw, 980px);
	aspect-ratio: 1024 / 768;
	max-height: 92vh;
	background-image: url("pic/board.png");
	background-size: 100% 100%;
	background-position: center;
	background-repeat: no-repeat;
	padding: clamp(104px, 11vw, 156px) clamp(60px, 6.4vw, 84px) clamp(48px, 5.4vw, 68px);
	box-sizing: border-box;
	transform: translateY(-72px);
	opacity: 0;
	transition: transform 0.24s ease, opacity 0.24s ease;
}

.info-popup.is-open .info-popup-backdrop {
	opacity: 1;
}

.info-popup.is-open .info-popup-panel {
	transform: translateY(0);
	opacity: 1;
}

.info-popup-close {
	position: absolute;
	top: clamp(138px, 14vw, 182px);
	right: clamp(58px, 5.8vw, 82px);
	padding: 0;
	border: 0;
	background: transparent;
	line-height: 0;
	cursor: pointer;
	filter: drop-shadow(0 1px 1px rgba(255, 243, 208, 0.65));
}

.info-popup-close img {
	width: clamp(28px, 4.2vw, 62px);
	height: auto;
	display: block;
}

.info-popup-content {
	width: min(850px, 100%);
	height: 450px;
	margin-top: clamp(88px, 8.5vw, 116px);
	color: #f6f0e2;
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
	max-height: 450px;
	overflow-y: auto;
	overflow-x: hidden;
	padding-right: clamp(4px, 1vw, 10px);
	scrollbar-color: rgba(84, 57, 37, 0.9) rgba(208, 173, 125, 0.35);
	scrollbar-width: thin;
}

.info-popup-content::-webkit-scrollbar {
	width: 10px;
}

.info-popup-content::-webkit-scrollbar-track {
	background: rgba(208, 173, 125, 0.3);
	border-radius: 999px;
}

.info-popup-content::-webkit-scrollbar-thumb {
	background: rgba(84, 57, 37, 0.9);
	border-radius: 999px;
}

.info-popup-content h2 {
	margin: 0;
	font-size: clamp(16px, 2.7vw, 56px);
	line-height: 1.45;
}

.info-popup-content p {
	margin: clamp(12px, 1.8vh, 18px) 0 clamp(42px, 9vh, 92px);
	font-size: clamp(10px, 1.1vw, 16px);
	line-height: 1.8;
	min-height: 1.8em;
}

@media (max-width: 1100px) {
	.game-page {
		height: auto;
		min-height: 100vh;
		overflow-x: hidden;
		overflow-y: auto;
	}

	.game-top-bar {
		padding: 10px 12px;
	}

	.collection-btn {
		font-size: 8px;
		padding: 9px 10px;
	}

	.back-btn img {
		width: min(34vw, 220px);
	}

	.hud-stats {
		top: clamp(76px, 10vh, 118px);
		max-width: min(52vw, 320px);
		font-size: 8px;
		gap: 6px;
	}

	.story-shell {
		width: min(92vw, 760px);
		margin-top: clamp(14px, 2vh, 36px);
		transform: translateX(8px);
		padding-bottom: clamp(120px, 16vh, 180px);
	}

	.story-card {
		min-height: auto;
	}

	.choice-list {
		margin-top: 18px;
	}

	.choice-btn,
	.restart-btn {
		font-size: 8px;
		line-height: 1.5;
	}

	.restart-btn {
		margin-top: 16px;
	}
}

@media (max-width: 860px) {
	.ending-page {
		padding-top: clamp(78px, 12vh, 100px);
		padding-bottom: clamp(92px, 14vh, 130px);
		align-items: flex-start;
	}

	.ending-team-links {
		top: 10px;
		left: 10px;
		gap: 6px;
	}

	.ending-team-heading {
		font-size: 7px;
		max-width: min(46vw, 156px);
	}

	.ending-shell {
		width: min(96vw, 620px);
	}

	.ending-focus {
		gap: 10px;
	}

	.ending-image-card img {
		max-width: min(86vw, 460px);
		max-height: min(42vh, 290px);
	}

	.ending-title-banner {
		font-size: clamp(14px, 4.6vw, 20px);
	}

	.ending-text-strip {
		font-size: clamp(9px, 2.5vw, 12px);
		line-height: 1.65;
	}

	.ending-corner-action {
		bottom: clamp(14px, 3vh, 24px);
	}

	.ending-corner-action img {
		width: min(42vw, 200px);
	}

	.game-top-bar {
		padding: 8px 10px;
	}

	.collection-btn {
		font-size: 7px;
		padding: 8px 9px;
	}

	.back-btn img {
		width: min(38vw, 170px);
	}

	.hud-stats {
		top: 92px;
		max-width: none;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		margin: 0 10px 12px;
		font-size: 7px;
		gap: 6px;
	}

	.hud-stats span {
		font-size: 7px;
		padding: 7px 8px;
	}

	.story-shell {
		width: min(94vw, 640px);
		margin-top: 44px;
		transform: translateX(6px);
		padding: 0 10px 140px;
	}

	.story-header {
		padding: 12px;
	}

	.story-header h1 {
		font-size: clamp(10px, 3.2vw, 15px);
	}

	.story-card {
		padding: 14px;
		min-height: auto;
	}

	.story-card h2 {
		font-size: clamp(12px, 3.6vw, 18px);
	}

	.story-card p {
		font-size: clamp(8px, 2.6vw, 11px);
		line-height: 1.7;
	}

	.choice-list {
		margin-top: 14px;
		gap: 10px;
	}

	.choice-btn,
	.restart-btn {
		font-size: 7px;
		padding: 10px 12px;
		line-height: 1.5;
	}

	.info-button {
		font-size: 9px;
		padding: 11px 13px;
	}

	.first-team-links {
		top: 10px;
		left: 10px;
		gap: 6px;
	}

	.first-team-heading {
		font-size: 7px;
		max-width: min(46vw, 156px);
	}

	.first-team-link {
		width: min(46vw, 156px);
		padding: 8px 9px;
	}

	.first-team-title {
		font-size: 8px;
	}

	.first-team-subtitle {
		font-size: 7px;
	}

	.info-popup {
		padding-top: clamp(64px, 9vh, 90px);
	}

	.info-popup-panel {
		width: 97vw;
		aspect-ratio: 4 / 3;
		padding: clamp(78px, 20vw, 112px) clamp(24px, 6vw, 38px) clamp(30px, 5vw, 44px);
	}

	.info-popup-close {
		top: clamp(66px, 18vw, 104px);
		right: clamp(24px, 6vw, 36px);
	}

	.info-popup-close img {
		width: clamp(24px, 4.8vw, 48px);
	}

	.info-popup-content {
		width: 100%;
		height: auto;
		margin-top: clamp(56px, 12vw, 82px);
		max-height: calc(92vh - clamp(78px, 20vw, 112px) - clamp(30px, 5vw, 44px));
	}

	.info-popup-content h2 {
		font-size: clamp(11px, 5.4vw, 24px);
	}

	.info-popup-content p {
		font-size: clamp(8px, 2.4vw, 11px);
		line-height: 1.7;
		margin: clamp(9px, 1.4vh, 12px) 0 clamp(16px, 3vh, 26px);
	}
}
