/* ==========================================================================
   DVD-style main menu overlay
   ========================================================================== */

.cyber-menu {
	--cm-accent: #ff5c5c;
	--cm-accent-dim: rgba(255, 92, 92, 0.2);
	--cm-accent-glow: rgba(255, 92, 92, 0.35);
	--cm-sub: #a8c4e0;
	--cm-bg: #0c1a2e;
	--cm-panel: rgba(12, 26, 46, 0.72);
	--cm-text: #f2f6fb;
	--cm-tech: "JetBrains Mono", "Courier New", Consolas, monospace, "Hiragino Sans", sans-serif;

	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: stretch;
	justify-content: stretch;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.35s ease, visibility 0.35s ease;
	font-family: "Helvetica Neue", Arial, "Hiragino Sans", sans-serif;
	color: var(--cm-text);
}

.cyber-menu.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.cyber-menu__backdrop {
	position: absolute;
	inset: 0;
	background: transparent;
	border: none;
	cursor: pointer;
}

/* ---------- background ---------- */

.cyber-menu__bg {
	position: absolute;
	inset: 0;
	overflow: hidden;
	z-index: 0;
}

.cyber-menu__bg-hero {
	position: absolute;
	inset: -4%;
	background-size: cover;
	background-position: center bottom;
	filter: blur(2px) saturate(1.05);
	opacity: 1;
}

.cyber-menu__bg-overlay {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(
			180deg,
			rgba(255, 255, 255, 0.84) 0%,
			rgba(255, 255, 255, 0.72) 45%,
			rgba(255, 255, 255, 0.8) 100%
		);
}

/* ---------- top actions ---------- */

.cyber-menu__top-actions {
	position: fixed;
	top: var(--header-action-y);
	right: clamp(1.25rem, 4vw, 3rem);
	z-index: 50;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 15px;
	pointer-events: auto;
	transform: translateY(-50%);
}

.cyber-menu__action {
	background: rgba(12, 26, 46, 0.78);
	color: #f0f9ff;
	border: 1px solid var(--cm-accent);
	padding: 10px 25px;
	cursor: pointer;
	font-weight: bold;
	font-size: 12px;
	letter-spacing: 2px;
	font-family: var(--cm-tech);
	clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
	transition: all 0.2s;
	text-transform: uppercase;
	text-decoration: none;
	line-height: 1.2;
	box-shadow: 0 0 14px rgba(255, 92, 92, 0.12);
	backdrop-filter: blur(6px);
}

.cyber-menu__action:hover {
	background: var(--cm-accent-dim);
	box-shadow: 0 0 15px var(--cm-accent);
	text-shadow: 0 0 8px var(--cm-accent);
	color: var(--cm-text);
}

.cyber-menu__action--line {
	border-color: #8fc6a8;
}

.cyber-menu__action--line:hover {
	background: rgba(143, 198, 168, 0.18);
	box-shadow: 0 0 15px rgba(143, 198, 168, 0.45);
	text-shadow: 0 0 8px rgba(143, 198, 168, 0.75);
}

.cyber-menu__action--donation {
	border-color: #d4a8d0;
}

.cyber-menu__action--donation:hover {
	background: rgba(212, 168, 208, 0.18);
	box-shadow: 0 0 15px rgba(212, 168, 208, 0.45);
	text-shadow: 0 0 8px rgba(212, 168, 208, 0.75);
}

/* ---------- main (DVD: scene | character | menu) ---------- */

.cyber-menu__main {
	position: relative;
	z-index: 10;
	display: grid;
	grid-template-columns: minmax(280px, 340px);
	grid-template-areas: "menu";
	justify-content: end;
	align-items: end;
	gap: clamp(0.75rem, 2vw, 1.75rem);
	width: 100%;
	height: 100%;
	padding: 0 clamp(1rem, 4vw, 3rem) clamp(1rem, 6vh, 4rem);
	box-sizing: border-box;
	pointer-events: none;
}

.cyber-menu.is-scene-open .cyber-menu__main {
	grid-template-columns: minmax(0, 1fr) minmax(240px, 380px) minmax(280px, 340px);
	grid-template-areas: "scene character menu";
	justify-content: stretch;
}

.cyber-menu.is-open .cyber-menu__main {
	pointer-events: auto;
}

/* ---------- menu list ---------- */

.cyber-menu__panel--list {
	grid-area: menu;
	position: relative;
	bottom: auto;
	right: auto;
	z-index: 20;
	background: var(--cm-panel);
	border: 1px solid rgba(255, 92, 92, 0.35);
	border-left: 4px solid var(--cm-accent);
	padding: 40px 60px;
	width: 100%;
	max-width: 340px;
	justify-self: end;
	box-shadow: 0 0 24px rgba(0, 0, 0, 0.45), inset 0 0 20px var(--cm-accent-dim);
	backdrop-filter: blur(8px);
}

.cyber-menu__panel--list::before {
	content: "MAIN MENU";
	position: absolute;
	top: -12px;
	left: 10px;
	background: var(--cm-bg);
	color: var(--cm-accent);
	padding: 0 10px;
	font-size: 12px;
	font-family: var(--cm-tech);
	letter-spacing: 2px;
}

.cyber-menu__divider {
	width: 100%;
	height: 1px;
	background: linear-gradient(90deg, var(--cm-accent), transparent);
	margin: 20px 0;
}

.cyber-menu__list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 25px;
}

.cyber-menu__item-btn {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
	padding: 0 0 0 40px;
	margin: 0;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 22px;
	font-weight: bold;
	letter-spacing: 4px;
	transition: all 0.2s;
	font-family: var(--cm-tech);
	color: rgba(242, 246, 251, 0.58);
	text-align: left;
}

a.cyber-menu__item-btn {
	text-decoration: none;
	color: rgba(242, 246, 251, 0.58);
}

a.cyber-menu__item-btn:hover {
	color: #fff;
}

.cyber-menu__item-btn::before {
	content: "▷";
	position: absolute;
	left: 8px;
	color: var(--cm-accent);
	font-size: 14px;
	opacity: 0;
	transition: all 0.2s;
}

.cyber-menu__item-btn:hover,
.cyber-menu__item-btn.is-active {
	color: #fff;
	text-shadow: 0 0 10px var(--cm-accent), 0 0 24px var(--cm-accent-glow);
	transform: translateX(12px);
}

.cyber-menu__item-btn:hover::before,
.cyber-menu__item-btn.is-active::before {
	opacity: 1;
}

/* ---------- scene panels ---------- */

.cyber-menu__panel-base {
	grid-area: scene;
	position: relative;
	bottom: auto;
	left: auto;
	z-index: 15;
	align-self: end;
	width: 100%;
	max-width: min(960px, 100%);
	opacity: 0;
	transform: translateY(28px);
	transition:
		opacity 0.45s cubic-bezier(0.19, 1, 0.22, 1),
		transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
	pointer-events: none;
}

.cyber-menu__panel-base:not([hidden]) {
	pointer-events: none;
}

.cyber-menu__panel-base.is-active {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.cyber-menu__scene-panel {
	max-width: none;
}

.cyber-menu__scene {
	width: 100%;
	background: var(--cm-panel);
	border: 1px solid rgba(255, 92, 92, 0.35);
	display: flex;
	flex-direction: column;
	position: relative;
	box-shadow:
		0 0 30px rgba(0, 0, 0, 0.4),
		inset 0 0 40px rgba(255, 92, 92, 0.04);
	clip-path: polygon(0 20px, 20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%);
	backdrop-filter: blur(6px);
}

.cyber-menu__scene-label {
	position: absolute;
	top: 5px;
	left: 30px;
	color: var(--cm-accent);
	font-size: 10px;
	font-family: var(--cm-tech);
	letter-spacing: 2px;
	z-index: 1;
}

.cyber-menu__scene-main {
	flex: 1;
	display: flex;
	padding: 28px 24px 12px;
	gap: 0;
	min-height: 0;
}

.cyber-menu__scene-monitor {
	flex: 1;
	width: 100%;
	background: #000;
	border: 1px solid rgba(255, 92, 92, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
	aspect-ratio: 16 / 9;
	min-height: clamp(220px, 32vh, 400px);
}

.cyber-menu__scene-media {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.cyber-menu__scene-media img,
.cyber-menu__scene-media video,
.cyber-menu__scene-media iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	object-fit: cover;
}

.cyber-menu__scene-media--video {
	background: #000;
}

.cyber-menu__scene-monitor::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(rgba(255, 92, 92, 0.05) 1px, transparent 1px);
	background-size: 100% 3px;
	pointer-events: none;
	animation: cyber-menu-scan 4s linear infinite;
}

@keyframes cyber-menu-scan {
	0% { transform: translateY(-100%); }
	100% { transform: translateY(100%); }
}

.cyber-menu__scene-monitor-text {
	position: relative;
	z-index: 1;
	color: var(--cm-accent);
	font-size: clamp(16px, 2.8vw, 26px);
	font-family: var(--cm-tech);
	letter-spacing: 4px;
	text-align: center;
	line-height: 1.5;
	text-shadow: 0 0 10px var(--cm-accent);
	pointer-events: none;
}

.cyber-menu__scene-content {
	min-height: 90px;
	background: rgba(255, 92, 92, 0.04);
	border-top: 1px solid rgba(255, 92, 92, 0.3);
	display: flex;
	flex-direction: column;
	justify-content: center;
	position: relative;
	flex-shrink: 0;
	padding: 15px 25px 20px;
}

.cyber-menu__scene-content-header {
	background: var(--cm-accent);
	color: #000;
	display: inline-block;
	padding: 0.35em 1.1em 0.4em;
	font-family: var(--cm-tech);
	font-size: 11px;
	font-weight: bold;
	letter-spacing: 1px;
	line-height: 1.35;
	position: absolute;
	top: -0.85em;
	left: 0;
	max-width: calc(100% - 1rem);
	box-sizing: border-box;
	overflow: visible;
	white-space: nowrap;
}

.cyber-menu__scene-content-body {
	padding: 8px 0;
}

.cyber-menu__scene-title {
	font-size: 18px;
	font-weight: bold;
	margin: 0 0 8px;
}

.cyber-menu__scene-title a {
	color: #fff;
	text-decoration: none;
	transition: color 0.2s, text-shadow 0.2s;
}

.cyber-menu__scene-title a:hover {
	color: var(--cm-accent);
	text-shadow: 0 0 8px var(--cm-accent);
}

.cyber-menu__scene-desc {
	font-size: 13px;
	color: #94a3b8;
	line-height: 1.4;
	margin: 0;
}

/* ---------- scene navigation links ---------- */

.cyber-menu__scene-nav {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 8px 0;
}

.cyber-menu__scene-nav-link {
	font-size: 15px;
	font-weight: 500;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	color: rgba(242, 246, 251, 0.82);
	text-decoration: none;
}

.cyber-menu__scene-nav-link::before {
	content: "▸ ";
	color: var(--cm-accent);
	margin-right: 10px;
	font-size: 13px;
	transition: transform 0.2s;
}

.cyber-menu__scene-nav-link:hover {
	color: #fff;
	text-shadow: 0 0 8px var(--cm-accent);
	transform: translateX(8px);
}

.cyber-menu__scene-nav-link:hover::before {
	transform: translateX(4px);
}

/* ---------- scene CTA ---------- */

.cyber-menu__scene-cta {
	position: absolute;
	bottom: 20px;
	right: 20px;
	background: transparent;
	color: var(--cm-accent);
	border: 1px solid var(--cm-accent);
	padding: 8px 20px;
	font-size: 12px;
	font-family: var(--cm-tech);
	letter-spacing: 1px;
	text-decoration: none;
	transition: all 0.2s;
	clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.cyber-menu__scene-cta:hover {
	background: var(--cm-accent);
	color: #000;
	box-shadow: 0 0 15px var(--cm-accent);
}

/* ---------- body state ---------- */

body.cyber-menu-open {
	overflow: hidden;
}

body.cyber-menu-open .cyber-menu {
	z-index: 10002;
}

body.cyber-menu-open .cyber-menu__top-actions {
	z-index: 10003;
}

body.cyber-menu-open .site-header {
	z-index: 10004;
	pointer-events: none;
	background: transparent;
}

body.cyber-menu-open .site-header a,
body.cyber-menu-open .site-header button {
	pointer-events: auto;
}

body.cyber-menu-open .site-header__lang {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

/* Header trigger button */
.site-header__menu-label {
	margin: 0;
	padding: 0.4em 0.95em;
	background: none;
	border: 1px solid transparent;
	font-family: var(--font-oswald);
	font-size: 0.78125rem;
	font-weight: 500;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: #ffffff;
	cursor: pointer;
	transition:
		color 0.25s ease,
		text-shadow 0.25s ease,
		border-color 0.25s ease,
		background 0.25s ease,
		box-shadow 0.25s ease,
		letter-spacing 0.25s ease;
}

.site-header__menu-label:hover,
.site-header__menu-label:focus-visible {
	color: #ffffff;
	border-color: rgba(255, 255, 255, 0.35);
	background: rgba(255, 255, 255, 0.08);
	letter-spacing: 0.22em;
	box-shadow: 0 0 18px rgba(255, 92, 92, 0.2);
	text-shadow: 0 0 12px rgba(255, 255, 255, 0.75);
	outline: none;
}

.site-header__menu-label.is-menu-open,
.site-header__menu-label.is-menu-open:hover,
.site-header__menu-label.is-menu-open:focus-visible {
	border-color: rgba(255, 92, 92, 0.55);
	background: rgba(255, 92, 92, 0.1);
	color: var(--cm-accent);
	box-shadow: 0 0 20px rgba(255, 92, 92, 0.25);
	text-shadow: 0 0 10px rgba(255, 92, 92, 0.45);
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
	.cyber-menu.is-scene-open .cyber-menu__main {
		grid-template-columns: minmax(0, 1fr) minmax(200px, 300px) minmax(260px, 320px);
	}

	.cyber-menu__panel--list {
		padding: 32px 40px;
	}
}

@media (max-width: 980px) {
	.cyber-menu.is-scene-open .cyber-menu__main {
		grid-template-columns: minmax(0, 1fr) minmax(180px, 260px) minmax(240px, 300px);
		gap: 0.75rem;
	}

	.char-carousel__frame {
		height: 480px;
	}

	.char-carousel__stage {
		width: 300px;
		height: 440px;
	}
}

@media (max-width: 800px) {
	.cyber-menu__top-actions {
		top: calc(var(--header-height) + 0.55rem + env(safe-area-inset-top, 0px));
		right: 1rem;
		left: 1rem;
		justify-content: flex-end;
		gap: 0.5rem;
		transform: none;
	}

	.cyber-menu__action {
		padding: 0.45rem 0.7rem;
		font-size: 0.65rem;
		letter-spacing: 0.1em;
	}

	/* No character carousel on SP */
	.cyber-menu__carousel-wrap {
		display: none !important;
	}

	/*
	 * Keep MAIN MENU pinned to the bottom.
	 * Scene opens above it so the menu doesn't jump.
	 */
	.cyber-menu__main,
	.cyber-menu.is-scene-open .cyber-menu__main {
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		align-items: stretch;
		gap: 0.75rem;
		width: 100%;
		height: 100%;
		max-height: 100%;
		overflow-x: hidden;
		overflow-y: auto;
		padding:
			calc(var(--header-height) + 2.75rem + env(safe-area-inset-top, 0px))
			1rem
			max(1.25rem, env(safe-area-inset-bottom, 0px));
		-webkit-overflow-scrolling: touch;
	}

	.cyber-menu__panel--list {
		order: 2;
		flex: 0 0 auto;
		width: 100%;
		max-width: none;
		margin: 0;
		padding: 1.35rem 1.25rem 1.35rem 1.5rem;
		z-index: 25;
		box-sizing: border-box;
		justify-self: stretch;
	}

	.cyber-menu__list {
		gap: 1rem;
	}

	.cyber-menu__item-btn {
		font-size: 1.05rem;
		letter-spacing: 0.14em;
		padding-left: 1.75rem;
	}

	.cyber-menu__item-btn:hover,
	.cyber-menu__item-btn.is-active {
		transform: translateX(6px);
	}

	.cyber-menu__divider {
		margin: 0.85rem 0;
	}

	.cyber-menu__panel-base {
		order: 1;
		flex: 0 1 auto;
		align-self: stretch;
		width: 100%;
		max-width: none;
		min-height: 0;
		z-index: 18;
		/* Don't reserve space while hidden / inactive */
		margin: 0;
	}

	.cyber-menu__panel-base[hidden],
	.cyber-menu__panel-base:not(.is-active) {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		border: 0;
		opacity: 0;
		pointer-events: none;
		transform: none;
	}

	.cyber-menu__panel-base.is-active:not([hidden]) {
		position: relative;
		width: 100%;
		height: auto;
		padding: 0;
		margin: 0;
		overflow: visible;
		clip: auto;
		opacity: 1;
		pointer-events: auto;
		transform: none;
	}

	.cyber-menu__scene {
		max-height: none;
		/* Avoid clipping the absolute content header on SP */
		clip-path: none;
		overflow: hidden;
	}

	/* Hide scene video on SP to avoid overlap with MAIN MENU */
	.cyber-menu__scene-main {
		display: none;
	}

	.cyber-menu__scene-label {
		position: static;
		display: block;
		margin: 0.65rem 0.85rem 0;
	}

	.cyber-menu__scene-content {
		padding: 1.65rem 1rem 1rem;
	}

	.cyber-menu__scene-content-header {
		position: static;
		display: inline-block;
		top: auto;
		left: auto;
		margin: 0 0 0.75rem;
		max-width: 100%;
		white-space: normal;
		line-height: 1.4;
		padding: 0.4em 0.85em;
	}

	.cyber-menu__scene-title {
		font-size: 1rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cyber-menu,
	.cyber-menu__panel-base,
	.cyber-menu__carousel-wrap {
		transition: none;
	}
}
