/*
 * CC Menu — slots open a pop-out "game panel" card.
 * The base look of .menu-cat / .menu-slot lives in the theme (front.css). This
 * file makes each slot a tap target and styles the arcade-bezel modal it opens.
 * Built on the theme's tokens (--ink, --bone, neon vars) with safe fallbacks.
 */

/* ── The slot is a <button> trigger; strip native chrome, keep the card look ── */
.menu-slot {
	display: block;
	width: 100%;
	margin: 0;
	text-align: left;
	font: inherit;
	color: inherit;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
}
.menu-slot:focus-visible {
	outline: 2px solid var(--accent, #00e8ff);
	outline-offset: 2px;
}
.menu-slot-name { display: block; }
.menu-slot-desc { display: block; }
.menu-slot.has-more .menu-slot-tag::after { content: ' \25B8'; }

/* ───────────────────────── Pop-out game panel ──────────────────────────── */
.cc-modal[hidden] { display: none; }
.cc-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	--accent: var(--cyan, #00e8ff);
}
.cc-modal.c-cyan    { --accent: var(--cyan, #00e8ff); }
.cc-modal.c-magenta { --accent: var(--magenta, #ff1f9c); }
.cc-modal.c-violet  { --accent: var(--violet, #9b6bff); }
.cc-modal.c-yellow  { --accent: var(--yellow, #ffd23f); }
.cc-modal.c-green   { --accent: var(--green, #54ffb0); }

.cc-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(2, 4, 12, 0.8);
	backdrop-filter: blur(7px);
	-webkit-backdrop-filter: blur(7px);
	animation: cc-modal-fade 0.28s ease;
}

.cc-modal-panel {
	position: relative;
	z-index: 1;
	width: min(540px, 100%);
	max-height: 88vh;
	overflow: auto;
	background:
		radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
		linear-gradient(180deg, var(--ink-2, #0a0e1f), var(--ink, #05081a));
	border: 1px solid var(--accent);
	box-shadow:
		0 0 0 1px rgba(0, 0, 0, 0.5),
		0 40px 120px -30px rgba(0, 0, 0, 0.9),
		0 0 60px -12px var(--accent),
		inset 0 0 70px color-mix(in srgb, var(--accent) 7%, transparent);
	animation: cc-modal-in 0.3s cubic-bezier(0.2, 0.85, 0.25, 1);
}
/* CRT scanline overlay over the whole panel. */
.cc-modal-panel::after {
	content: '';
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0, rgba(0, 0, 0, 0.18) 1px, transparent 2px, transparent 4px);
	opacity: 0.5;
}

.cc-modal-bar {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 13px 14px;
	border-bottom: 1px solid var(--hair, rgba(0, 232, 255, 0.12));
	background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.cc-modal-level {
	font-family: var(--f-pixel, monospace);
	font-size: 11px;
	color: var(--accent);
	text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent);
}
.cc-modal-section {
	font-family: var(--f-pixel, monospace);
	font-size: 9px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--bone-dim, #7e8aa0);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.cc-modal-x {
	margin-left: auto;
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	font: inherit;
	font-size: 15px;
	line-height: 1;
	color: var(--accent);
	background: transparent;
	border: 1px solid var(--accent);
	cursor: pointer;
	transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.cc-modal-x:hover,
.cc-modal-x:focus-visible {
	background: var(--accent);
	color: var(--ink, #05081a);
	box-shadow: 0 0 18px var(--accent);
	outline: none;
}

.cc-modal-body {
	position: relative;
	z-index: 1;
	padding: clamp(24px, 5vw, 36px);
}
.cc-modal-name {
	font-family: var(--f-head, sans-serif);
	font-weight: 800;
	font-size: clamp(28px, 6vw, 44px);
	line-height: 1.04;
	text-transform: uppercase;
	color: var(--bone, #eaf6ff);
	margin: 0 0 14px;
	text-shadow: 0 0 20px color-mix(in srgb, var(--accent) 45%, transparent);
}
.cc-modal-tag {
	font-family: var(--f-body, system-ui, sans-serif);
	font-size: clamp(16px, 4.4vw, 19px);
	line-height: 1.5;
	color: var(--accent);
	margin: 0 0 20px;
}
.cc-modal-tag:empty { display: none; }
.cc-modal-more {
	font-family: var(--f-body, system-ui, sans-serif);
	font-size: clamp(15px, 4vw, 17px);
	line-height: 1.65;
	color: var(--bone, #eaf6ff);
}
.cc-modal-more:empty { display: none; }
.cc-modal-more p { margin: 0 0 0.7em; }
.cc-modal-more p:last-child { margin-bottom: 0; }
/* When there's extra info, divide it from the tagline with a neon hairline. */
.cc-modal-more:not(:empty) {
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.cc-modal-foot {
	position: relative;
	z-index: 1;
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	border-top: 1px solid var(--hair, rgba(0, 232, 255, 0.12));
	font-family: var(--f-pixel, monospace);
	font-size: 8px;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--bone-dim, #7e8aa0);
}

@keyframes cc-modal-in {
	from { opacity: 0; transform: translateY(16px) scale(0.95); }
	to   { opacity: 1; transform: none; }
}
@keyframes cc-modal-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

/* Exit: reverse the entrance, a hair quicker so dismissing feels snappy. JS adds
   .is-closing, then removes the modal once the animation ends. */
@keyframes cc-modal-out {
	from { opacity: 1; transform: none; }
	to   { opacity: 0; transform: translateY(14px) scale(0.95); }
}
@keyframes cc-modal-fade-out {
	from { opacity: 1; }
	to   { opacity: 0; }
}
.cc-modal.is-closing .cc-modal-panel {
	animation: cc-modal-out 0.22s cubic-bezier(0.4, 0, 1, 1) forwards;
}
.cc-modal.is-closing .cc-modal-backdrop {
	animation: cc-modal-fade-out 0.22s ease forwards;
}

@media (max-width: 600px) {
	.cc-modal { padding: 16px; align-items: flex-end; }
	.cc-modal-panel { width: 100%; max-height: 90vh; }
}

@media (prefers-reduced-motion: reduce) {
	.cc-modal-panel,
	.cc-modal-backdrop,
	.cc-modal.is-closing .cc-modal-panel,
	.cc-modal.is-closing .cc-modal-backdrop { animation: none; }
}
