/* Retro Games – game page /<slug> (inc/game-page.php); same colours as the menu (css/app.css) */
:root {
	--bg: #0e1014;
	--panel: #161a22;
	--line: rgba(255, 255, 255, .1);
	--fg: #f2f3f5;
	--muted: #9aa1ad;
	--accent: #f5b82e;
	--accent-ink: #1a1306;
	--radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-tap-highlight-color: transparent;
}
html.playing, html.playing body { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
.wrap {
	max-width: 1120px;
	margin: 0 auto;
	padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}

/* ---------- header / footer ---------- */
header.site { padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--line); background: rgba(14, 16, 20, .92); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
header.site .wrap { display: flex; align-items: center; gap: 18px; min-height: 52px; }
.brand { flex: none; display: flex; align-items: center; }
.brand img { display: block; height: 24px; width: auto; }
@media (max-width: 560px) { .brand img { height: 18px; } }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); white-space: nowrap; }
.crumbs a:hover { color: var(--fg); }
.crumbs span[aria-current] { color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
footer.site { margin-top: 56px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; padding: 24px 0 calc(24px + env(safe-area-inset-bottom)); }
footer.site p { margin: 4px 0; }
.credit { font-size: 12px; }

/* ---------- hero ---------- */
.hero {
	display: grid;
	grid-template-columns: minmax(220px, 340px) 1fr;
	gap: 36px;
	align-items: start;
	padding: 32px 0 8px;
}
.cover {
	aspect-ratio: 1;
	border-radius: var(--radius);
	overflow: hidden;
	background: #fff;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
.cover img { width: 100%; height: 100%; object-fit: contain; }
.noimg { display: flex; align-items: center; justify-content: center; height: 100%; padding: 16px; text-align: center; color: #222; font-weight: 700; }
h1 { margin: 0 0 6px; font-size: clamp(28px, 4.2vw, 44px); line-height: 1.12; letter-spacing: -.01em; }
.line { margin: 0; color: var(--muted); }
.platforms { margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--fg); background: rgba(255, 255, 255, .05); }
.lead { margin: 16px 0 0; color: #d6d9df; max-width: 60ch; }
.plays { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.play {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 12px 22px 12px 16px;
	border-radius: 12px;
	background: var(--accent);
	color: var(--accent-ink);
	font-weight: 700;
	font-size: 17px;
	line-height: 1.25;
	box-shadow: 0 6px 20px rgba(245, 184, 46, .25);
	transition: transform .12s, box-shadow .12s;
}
.play:hover, .play:focus-visible { text-decoration: none; transform: translateY(-1px); box-shadow: 0 10px 26px rgba(245, 184, 46, .35); }
.play:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.play svg { width: 28px; height: 28px; flex: none; fill: currentColor; }
.play small { display: block; font-weight: 500; font-size: 12px; opacity: .78; }
.play b { font-weight: 800; }
.play.small { font-size: 15px; padding: 9px 16px 9px 12px; box-shadow: none; }
.play.small svg { width: 20px; height: 20px; }
.hint { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- sections ---------- */
.block { margin-top: 44px; }
.block h2 { margin: 0 0 14px; font-size: 22px; line-height: 1.25; }
.block h2 .count { font-size: 14px; font-weight: 700; color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 1px 8px; vertical-align: 3px; }
.block p { margin: 0 0 12px; max-width: 75ch; color: #d6d9df; }
.block .sub { color: var(--muted); font-size: 14px; }
kbd { font: 600 13px/1 ui-monospace, Consolas, monospace; padding: 3px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: rgba(255, 255, 255, .06); }

.versions { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.version { display: flex; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.vimg { flex: none; width: 112px; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #fff; }
.vimg img { width: 100%; height: 100%; object-fit: contain; }
.vbody { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.vbody h3 { margin: 0 0 2px; font-size: 18px; }
.vline { margin: 0 !important; font-size: 13px; color: var(--muted) !important; }
.vdesc { margin: 8px 0 0 !important; font-size: 14px; }
.vbody .play { margin-top: auto; }
.vbody .vline + .play, .vbody .vdesc + .play { margin-top: 12px; }

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.shot { position: relative; display: block; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.shot img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: transform .2s; }
.shot:hover img { transform: scale(1.03); }
.shot span { position: absolute; left: 8px; bottom: 8px; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .65); padding: 2px 7px; border-radius: 999px; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0; max-width: 760px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.details dt, .details dd { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); }
.details dt:first-of-type, .details dt:first-of-type + dd { border-top: 0; }
.details dt { color: var(--muted); background: var(--panel); font-size: 14px; }

.keys { display: flex; flex-wrap: wrap; gap: 16px; margin: 6px 0 14px; }
.keyset { flex: 1 1 280px; max-width: 420px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.keyset h3 { margin: 0 0 8px; font-size: 15px; }
.keyset table { width: 100%; border-collapse: collapse; font-size: 14px; }
.keyset th, .keyset td { text-align: left; padding: 5px 0; border-top: 1px solid var(--line); }
.keyset tr:first-child th, .keyset tr:first-child td { border-top: 0; }
.keyset th { width: 46%; font: 600 13px ui-monospace, Consolas, monospace; color: var(--accent); }

/* ---------- comments ---------- */
.cform { display: flex; flex-direction: column; gap: 10px; max-width: 760px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.cform label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.cform input, .cform textarea {
	font: inherit;
	font-size: 16px;
	color: var(--fg);
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 9px 12px;
	resize: vertical;
}
.cform input:focus, .cform textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.cform .row { display: flex; gap: 10px; }
.cform .row label { flex: 1; max-width: 320px; }
.cform .row.end { justify-content: flex-end; align-items: center; }
.cform button { font: 700 15px system-ui, sans-serif; color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 10px; padding: 10px 18px; cursor: pointer; }
.cform button:disabled { opacity: .6; cursor: default; }
.cform .msg { flex: 1; font-size: 14px; color: var(--muted); }
.cform .msg.ok { color: #7ddc8b; }
.cform .msg.err { color: #ff8a7a; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.clist { list-style: none; margin: 18px 0 0; padding: 0; max-width: 760px; }
.clist li { padding: 12px 0; border-top: 1px solid var(--line); }
.clist li.new { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: rgba(245, 184, 46, .15); } to { background: transparent; } }
.chead { display: flex; gap: 10px; align-items: baseline; }
.chead time { font-size: 12px; color: var(--muted); }
.clist p { margin: 4px 0 0; overflow-wrap: anywhere; }

/* ---------- related ---------- */
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.rcard { display: flex; flex-direction: column; gap: 8px; color: var(--fg); }
.rcard:hover { text-decoration: none; }
.rimg { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #fff; transition: transform .15s; }
.rimg img { width: 100%; height: 100%; object-fit: contain; }
.rcard:hover .rimg { transform: translateY(-2px); }
.rname { font-size: 14px; font-weight: 600; line-height: 1.3; }
.more { font-weight: 700; display: inline-block; margin-top: 14px; }

/* ---------- all games /games (inc/games-page.php) ---------- */
.glist-head { margin-top: 28px; }
.glist-head h1 .count { font-size: 15px; font-weight: 800; color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 2px 10px; vertical-align: middle; letter-spacing: 0; }
.gtools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 18px; }
.gsearch { position: relative; flex: 1 1 260px; max-width: 420px; }
.gsearch svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.gsearch input, .gsort select {
	font: 15px system-ui, sans-serif; color: var(--fg);
	background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.gsearch input { width: 100%; padding: 10px 12px 10px 38px; }
.gsearch input:focus, .gsort select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.gsort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.gsort select { padding: 9px 10px; }
.gchips { display: flex; flex-wrap: wrap; gap: 8px; order: 3; flex-basis: 100%; }
.chip { font: 600 13px/1 system-ui, sans-serif; color: var(--fg); background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; cursor: pointer; }
.chip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.chip:hover { border-color: rgba(245, 184, 46, .6); }
.chip.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.chip.on span { color: var(--accent-ink); opacity: .7; }
.chip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.glist { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 10px; margin-top: 22px; }
.gcard { display: flex; align-items: center; gap: 14px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--fg); transition: border-color .15s, transform .15s; }
.gcard:hover, .gcard:focus-visible { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); outline: none; }
.gcard .rimg { flex: none; width: 64px; border-radius: 8px; }
.gcard[hidden] { display: none; }
.gcard:hover .rimg { transform: none; }
.gbody { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gbody .rname { font-size: 15px; }
.gline { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gempty { margin-top: 18px; }
.gconsoles { display: flex; flex-wrap: wrap; gap: 8px; }
.gconsoles .tag:hover { text-decoration: none; border-color: var(--accent); }
@media (max-width: 560px) {
	.glist { grid-template-columns: 1fr; }
	.gsearch { max-width: none; }
	.gchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
	.gchips::-webkit-scrollbar { display: none; }
	.chip { flex: none; }
}

/* ---------- play layer (js/game.js) ---------- */
#playlayer { position: fixed; inset: 0; z-index: 100; background: #000; }
#playlayer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.pl-load { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; color: var(--muted); font-size: 15px; }

/* ---------- screenshot viewer ---------- */
#lightbox { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 48px 56px; background: rgba(0, 0, 0, .92); }
#lightbox img { max-width: 100%; max-height: calc(100% - 40px); object-fit: contain; image-rendering: pixelated; }
.lb-cap { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
#lightbox button { position: absolute; border: 0; background: rgba(255, 255, 255, .1); color: #fff; font-size: 30px; line-height: 1; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; }
#lightbox button:hover { background: rgba(255, 255, 255, .2); }
.lb-close { top: 12px; right: 12px; }
.lb-nav.prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-nav.next { right: 8px; top: 50%; transform: translateY(-50%); }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
	.hero { grid-template-columns: 1fr; gap: 20px; padding-top: 20px; }
	.cover { width: min(260px, 70vw); margin: 0 auto; }
	.intro { text-align: center; }
	.platforms, .plays { justify-content: center; }
	.lead { margin-left: auto; margin-right: auto; }
	.play { width: 100%; justify-content: center; }
	.crumbs a:not(:last-of-type), .crumbs span[aria-hidden]:first-of-type { display: none; }
	.versions { grid-template-columns: 1fr; }
	.shots { grid-template-columns: repeat(2, 1fr); gap: 8px; }
	.version { flex-direction: column; }
	.vimg { width: 96px; }
	.vbody .play { width: 100%; }
	.details { grid-template-columns: 1fr; }
	.details dt { border-top: 1px solid var(--line); padding-bottom: 2px; background: none; }
	.details dd { border-top: 0; padding-top: 0; }
	.details dt:first-of-type { border-top: 0; }
	.cform .row label { max-width: none; }
	.block { margin-top: 34px; }
	#lightbox { padding: 48px 8px; }
}
/* landscape phones: smaller cover so the Play buttons fit on the first screen */
@media (max-height: 520px) and (min-width: 761px) {
	.hero { grid-template-columns: 200px 1fr; gap: 24px; padding-top: 16px; }
	h1 { font-size: 28px; }
	.lead { margin-top: 10px; }
	.plays { margin-top: 14px; gap: 8px; }
	.play { padding: 8px 16px 8px 12px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
	.play, .shot img, .rimg { transition: none; }
	.clist li.new { animation: none; }
}

/* ---------- own page text (retro_page_text): article, FAQ, sources ---------- */
.lead.versions-lead { margin-top: 8px; font-size: 14px; color: var(--muted); }
.article h3, .faq h3 { margin: 26px 0 8px; font-size: 18px; line-height: 1.3; color: var(--fg); max-width: 75ch; }
.article h2 + h3 { margin-top: 4px; }
.faq h3 { font-size: 16px; margin-top: 20px; }
.faq h2 + h3 { margin-top: 0; }
.article .sources { margin-top: 20px; font-size: 12px; color: var(--muted); }
.article .sources a { color: var(--muted); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .25); }
.article .sources a:hover { color: var(--fg); }

/* ---------- footer links (inc/site.php emu_site_footer) ---------- */
.foot-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 14px; }
.foot-nav a { color: var(--fg); font-weight: 600; }
.foot-nav a:hover { color: var(--accent); }
