/* tgg-game-importer — Frontend single-game + archive styles */

.tgg-single-wrap,
.tgg-archive-wrap {
	max-width: 1080px;
	margin: 0 auto;
	padding: 24px 16px 48px;
	box-sizing: border-box;
}

.tgg-title {
	font-size: clamp(1.5rem, 2.4vw, 2rem);
	line-height: 1.25;
	margin: 0 0 16px;
}

/* Iframe container — keep aspect ratio responsive */
.tgg-game-frame {
	margin: 0 0 16px;
}

.tgg-game-frame-inner {
	position: relative;
	width: 100%;
	background: #000;
	border-radius: 8px;
	overflow: hidden;
	aspect-ratio: 16 / 10;
}

.tgg-game-frame-inner iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

@media (max-width: 600px) {
	.tgg-game-frame-inner {
		aspect-ratio: 4 / 3;
		border-radius: 4px;
	}
}

.tgg-game-controls {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-top: 8px;
}

.tgg-fullscreen-btn {
	background: #2271b1;
	color: #fff;
	border: 0;
	padding: 8px 16px;
	border-radius: 4px;
	font-size: 14px;
	cursor: pointer;
	font-weight: 600;
}

.tgg-fullscreen-btn:hover,
.tgg-fullscreen-btn:focus {
	background: #135e96;
}

/* iOS pseudo-fullscreen — Safari/Chrome iOS block iframe requestFullscreen,
   so we pin the wrapper to the viewport via CSS instead. */
.tgg-pseudo-fullscreen {
	position: fixed !important;
	inset: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	height: 100dvh !important;
	z-index: 99999 !important;
	background: #000 !important;
	margin: 0 !important;
	padding: 0 !important;
	border-radius: 0 !important;
	aspect-ratio: auto !important;
}

.tgg-pseudo-fullscreen iframe {
	width: 100% !important;
	height: 100% !important;
	border: 0 !important;
}

.tgg-pseudo-close {
	position: absolute;
	top: max(env(safe-area-inset-top), 12px);
	right: max(env(safe-area-inset-right), 12px);
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	border: 2px solid rgba(255, 255, 255, 0.3);
	font-size: 22px;
	font-weight: 700;
	cursor: pointer;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.tgg-pseudo-close:hover,
.tgg-pseudo-close:active,
.tgg-pseudo-close:focus {
	background: rgba(0, 0, 0, 0.9);
	border-color: rgba(255, 255, 255, 0.6);
	outline: none;
}

.tgg-no-game {
	background: #fff3cd;
	border-left: 4px solid #f0b849;
	padding: 12px 16px;
	border-radius: 4px;
	margin: 0 0 16px;
}

/* Content sections */
.tgg-section {
	margin: 28px 0;
}

.tgg-section h2 {
	font-size: clamp(1.2rem, 1.8vw, 1.4rem);
	margin: 0 0 14px;
	padding: 4px 0 4px 12px;
	border-left: 4px solid #2271b1;
	line-height: 1.3;
}

.tgg-section p {
	line-height: 1.7;
	margin: 0 0 12px;
}

.tgg-section ol,
.tgg-section ul {
	line-height: 1.65;
}

/* Intro: no H2, larger lead paragraph */
.tgg-intro {
	margin-top: 16px;
}

.tgg-intro p:first-child {
	font-size: 1.15rem;
	line-height: 1.6;
	font-weight: 500;
	color: var(--wp--preset--color--contrast, #1d2327);
	margin-bottom: 16px;
}

.tgg-tips ul {
	margin: 0;
	padding-left: 20px;
}

.tgg-tips li {
	line-height: 1.6;
	margin-bottom: 6px;
}

/* FAQ accordion */
.tgg-faq-list {
	border-top: 1px solid #e2e4e7;
}

.tgg-faq-item {
	border-bottom: 1px solid #e2e4e7;
	padding: 0;
}

.tgg-faq-item summary {
	padding: 14px 16px 14px 36px;
	font-weight: 600;
	cursor: pointer;
	list-style: none;
	position: relative;
	transition: background 0.15s ease;
	user-select: none;
}

.tgg-faq-item summary::-webkit-details-marker {
	display: none;
}

.tgg-faq-item summary::before {
	content: "›";
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%) rotate(0deg);
	font-size: 1.4rem;
	color: #2271b1;
	transition: transform 0.18s ease;
	line-height: 1;
}

.tgg-faq-item[open] summary::before {
	transform: translateY(-50%) rotate(90deg);
}

.tgg-faq-item summary:hover,
.tgg-faq-item summary:focus {
	background: #f3f6fa;
	outline: none;
}

.tgg-faq-answer {
	padding: 0 16px 16px 36px;
	color: #3c434a;
}

.tgg-faq-answer p {
	margin: 0;
	line-height: 1.65;
}

.tgg-related-hint {
	font-style: italic;
	color: #50575e;
	margin: 0 0 16px;
}

/* Related games grid (matches archive grid for visual consistency) */
.tgg-related .tgg-grid,
.tgg-archive-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 16px;
}

.tgg-card {
	display: block;
	text-decoration: none;
	color: inherit;
	background: #fff;
	border: 1px solid #e2e4e7;
	border-radius: 8px;
	overflow: hidden;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tgg-card:hover,
.tgg-card:focus {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	text-decoration: none;
}

.tgg-card-thumb {
	aspect-ratio: 1 / 1;
	background: #f3f4f6;
	overflow: hidden;
}

.tgg-card-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.tgg-card-title {
	font-size: 0.92rem;
	font-weight: 600;
	margin: 0;
	padding: 10px 12px;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: calc(3 * 0.92rem * 1.35);
}

/* Archive / taxonomy */
.tgg-archive-header {
	margin: 0 0 24px;
}

.tgg-archive-header h1 {
	font-size: clamp(1.6rem, 2.6vw, 2.1rem);
	margin: 0 0 8px;
}

.tgg-archive-description {
	color: #50575e;
	margin: 0;
}

.tgg-archive-empty {
	background: #f6f7f7;
	border: 1px dashed #c3c4c7;
	padding: 24px;
	border-radius: 8px;
	text-align: center;
	color: #50575e;
}

.tgg-pagination {
	margin: 32px 0 0;
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	justify-content: center;
}

.tgg-pagination .page-numbers {
	padding: 6px 12px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	color: #2271b1;
	text-decoration: none;
}

.tgg-pagination .page-numbers.current {
	background: #2271b1;
	color: #fff;
	border-color: #2271b1;
}

/* Ad placeholders — keep layout stable while empty */
.tgg-ad {
	margin: 24px 0;
	min-height: 90px;
}

.tgg-ad:empty {
	display: none;
}

/* Force 2-column grid on narrow screens so cards stay legible */
@media (max-width: 480px) {
	.tgg-related .tgg-grid,
	.tgg-archive-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 12px;
	}

	.tgg-card-title {
		font-size: 0.85rem;
		padding: 8px 10px;
	}
}
