/* TOCA Games — public pages (catalog, genres, game pages). Private pages use site.css. */
:root {
	color-scheme: dark;
	--bg: #0d0e1a;
	--bg-raised: #14152b;
	--surface: #1d1f3a;
	--surface-2: #282b4d;
	--line: #2d3057;
	--text: #f4f4fb;
	--muted: #9ea2c6;
	--accent: #ff7a3d;
	--accent-hover: #ff9361;
	--accent-ink: #220e02;
	--violet: #7b5cff;
	--violet-deep: #4b2fd6;
	--hot: #ff4d5e;
	--new: #3ccf91;
	--radius: 12px;
	--header-h: 64px;
	--side-w: 232px;
	--rail-w: 72px;
	--gutter: 24px;
	--tile-w: 228px;
	--tile-h: 128px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
	margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
	font-family: "Nunito", "Segoe UI", system-ui, sans-serif; font-weight: 600; line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 900; line-height: 1.15; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
	position: sticky; top: 0; z-index: 50; height: var(--header-h);
	display: flex; align-items: center; gap: 16px; padding: 0 16px;
	background: rgba(13, 14, 26, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.icon-btn {
	display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
	border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
.lang-btn { width: auto; padding: 0 12px; gap: 6px; grid-auto-flow: column; border-radius: 999px; font-weight: 800; font-size: 14px; white-space: nowrap; }
.lang-btn .icon { width: 20px; height: 20px; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand svg { width: 36px; height: 36px; }
.brand b { font-size: 20px; font-weight: 900; letter-spacing: -0.02em; line-height: 1; }
.brand b span { color: var(--accent); }
.search { position: relative; flex: 1; max-width: 520px; margin: 0 auto; }
.search input {
	width: 100%; height: 42px; padding: 0 44px 0 18px; border-radius: 999px; border: 1px solid var(--line);
	background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: 15px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--violet); background: var(--surface-2); }
.search > .icon { position: absolute; right: 14px; top: 10px; color: var(--muted); pointer-events: none; }
.search-results {
	position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 6px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); max-height: 70vh; overflow: auto;
}
.search-results a { display: flex; align-items: center; gap: 12px; padding: 6px; border-radius: 8px; }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--surface-2); }
.search-results img { width: 72px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.search-results small { display: block; color: var(--muted); font-size: 12px; }
.search-results p { margin: 10px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
	border: 0; border-radius: 999px; font-weight: 800; font-size: 15px; cursor: pointer; white-space: nowrap;
	transition: background 0.15s, transform 0.15s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.search-toggle { display: none; }

/* ---------- Shell: sidebar + content ---------- */
.shell { display: flex; align-items: flex-start; }
.sidebar {
	position: sticky; top: var(--header-h); flex: none; width: var(--side-w); height: calc(100vh - var(--header-h));
	overflow-y: auto; padding: 12px 10px 24px; border-right: 1px solid var(--line); background: var(--bg);
	scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.sidebar a {
	display: flex; align-items: center; gap: 14px; height: 42px; padding: 0 12px; border-radius: 10px;
	color: var(--text); font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden;
}
.sidebar a:hover { background: var(--surface); }
.sidebar a[aria-current="page"] { background: var(--surface-2); }
.sidebar a .icon { color: var(--violet); }
.sidebar a[aria-current="page"] .icon, .sidebar a:hover .icon { color: var(--accent); }
.sidebar hr { border: 0; border-top: 1px solid var(--line); margin: 10px 4px; }
.sidebar .count { margin-left: auto; color: var(--muted); font-size: 12px; }
body.rail .sidebar { width: var(--rail-w); }
body.rail .sidebar a { justify-content: center; padding: 0; }
body.rail .sidebar a span, body.rail .sidebar .count { display: none; }
.scrim { display: none; }
.content { flex: 1; min-width: 0; padding: 20px var(--gutter) 0; }

/* ---------- Genre chips ---------- */
.chips { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
	position: relative; flex: none; width: 212px; height: 104px; padding: 14px 16px; border-radius: var(--radius);
	display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; scroll-snap-align: start;
	background: linear-gradient(135deg, var(--c1), var(--c2)); transition: transform 0.15s;
}
.chip:hover { transform: translateY(-3px); }
.chip strong { font-size: 17px; font-weight: 900; position: relative; }
.chip small { color: rgba(255, 255, 255, 0.75); font-size: 12px; position: relative; }
.chip .icon { position: absolute; right: 10px; top: 8px; width: 60px; height: 60px; stroke-width: 1.6; color: rgba(255, 255, 255, 0.9); transform: rotate(-8deg); }

/* ---------- Promo banner ---------- */
.promo {
	display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; margin: 22px 0 8px;
	border-radius: var(--radius); overflow: hidden; background: var(--accent); min-height: 92px;
}
.promo-left {
	align-self: stretch; display: flex; align-items: center; gap: 14px; padding: 14px 64px 14px 28px;
	background: var(--violet); clip-path: polygon(0 0, 100% 0, calc(100% - 48px) 100%, 0 100%);
	font-size: clamp(22px, 3vw, 40px); font-weight: 900; letter-spacing: -0.02em; text-transform: uppercase; line-height: 1;
}
.promo-left em { font-style: normal; color: var(--accent); }
.promo-left .icon { width: 1.1em; height: 1.1em; color: var(--accent); stroke-width: 3; }
.promo-right { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px 14px 8px; color: var(--accent-ink); }
.promo-text { font-weight: 800; font-size: 16px; }
.promo-right .btn { background: var(--violet-deep); color: #fff; }
.promo-right .btn:hover { background: var(--violet); }

/* ---------- Rows of tiles ---------- */
.row { margin: 28px 0 8px; }
.row-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.row-head h2 { font-size: 22px; }
.row-head .more { margin-left: auto; color: var(--muted); font-weight: 800; font-size: 14px; }
.row-head .more:hover { color: var(--text); }
.row-head .arrows { display: flex; gap: 6px; }
.row-head .more + .arrows { margin-left: 4px; }
.row-head h2 + .arrows { margin-left: auto; }
.arrows button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface); cursor: pointer; display: grid; place-items: center; }
.arrows button:hover { background: var(--surface-2); }
.arrows button:disabled { opacity: 0.35; cursor: default; }
.arrows .icon { width: 18px; height: 18px; }
.scroller {
	display: grid; grid-auto-flow: column; grid-auto-columns: var(--tile-w); gap: 12px;
	overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; padding: 4px 2px 8px;
}
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { scroll-snap-align: start; }
.scroller.featured { grid-template-rows: repeat(2, var(--tile-h)); }
.scroller.featured > :first-child { grid-row: span 2; grid-column: span 2; }
.scroller:not(.featured) .tile { height: var(--tile-h); }

.tile {
	position: relative; display: block; border-radius: var(--radius); overflow: hidden; background: var(--surface);
	isolation: isolate; transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.tile::after {
	content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
	background: linear-gradient(to top, rgba(8, 8, 20, 0.92), rgba(8, 8, 20, 0) 55%); opacity: 0; transition: opacity 0.18s;
}
.tile .tile-title {
	position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 2; font-weight: 900; font-size: 15px;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transform: translateY(6px); transition: 0.18s;
}
.tile:hover, .tile:focus-visible { transform: translateY(-3px); box-shadow: 0 0 0 3px var(--violet), 0 14px 30px rgba(0, 0, 0, 0.45); }
.tile:hover img { transform: scale(1.05); }
.tile:hover::after, .tile:focus-visible::after { opacity: 1; }
.tile:hover .tile-title, .tile:focus-visible .tile-title { opacity: 1; transform: none; }
.scroller.featured > :first-child .tile-title { font-size: 22px; left: 18px; bottom: 16px; }
.badge {
	position: absolute; top: 8px; left: 8px; z-index: 2; display: inline-flex; align-items: center; gap: 4px;
	height: 24px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.badge.hot { background: var(--hot); }
.badge.new { background: var(--new); color: #04210f; }

/* Grid of captioned cards (genre pages, "all games"). */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px 14px; }
.card .tile { aspect-ratio: 16 / 9; }
.card h3 { margin: 8px 2px 0; font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card p { margin: 2px 2px 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.page-head { display: flex; align-items: center; gap: 16px; margin: 8px 0 22px; }
.page-head .icon { width: 56px; height: 56px; padding: 12px; border-radius: 16px; background: var(--violet); }
.page-head h1 { font-size: 30px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

/* ---------- Footer ---------- */
.footer { margin: 56px calc(var(--gutter) * -1) 0; padding: 32px var(--gutter) 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.footer h2 { color: var(--text); font-size: 18px; margin-bottom: 8px; }
.footer p { max-width: 760px; margin: 0 0 16px; }
.footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer nav + nav { margin-top: 12px; }

.about .report { margin: 14px 0 0; font-size: 14px; }
.about .report a { color: var(--muted); text-decoration: underline; }
.about .report a:hover { color: var(--accent); }

/* About, Privacy, Terms, Contact, Copyright */
/* Centered reading column: left-aligned it left the whole right half of a wide screen empty. */
.doc { max-width: 800px; margin: 0 auto; padding: 8px 0 24px; line-height: 1.65; }
.doc h1 { font-size: 32px; margin-bottom: 6px; }
.doc h2 { font-size: 21px; margin: 32px 0 8px; }
.doc h3 { font-size: 16px; margin: 20px 0 4px; }
.doc p, .doc li { color: #d4d6ee; }
.doc li { margin: 6px 0; }
.doc ul, .doc ol { padding-left: 22px; }
.doc a { color: var(--accent); font-weight: 700; }
.doc a:hover { color: var(--accent-hover); }
.doc .lead { font-size: 18px; color: var(--text); }
.doc .meta { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.doc code { background: var(--bg-raised); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 14px; }
.doc .notice { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px; margin: 16px 0; }
.footer nav a { color: var(--text); font-weight: 800; }
.footer nav a:hover { color: var(--accent); }

/* ---------- Game page ---------- */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.player { border-radius: var(--radius); overflow: hidden; background: var(--bg-raised); border: 1px solid var(--line); }
.stage {
	position: relative; aspect-ratio: 16 / 9; max-height: calc(100vh - var(--header-h) - 100px); width: 100%; background: #000; overflow: hidden;
}
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.splash { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.splash-bg { position: absolute; inset: -40px; width: calc(100% + 80px); max-width: none; height: calc(100% + 80px); object-fit: cover; filter: blur(28px) brightness(0.45) saturate(1.3); }
.splash-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px; text-align: center; }
.splash-card img { width: min(360px, 60vw); aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6); }
.splash-card h2 { font-size: clamp(20px, 2.6vw, 30px); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.play-btn { height: 54px; padding: 0 34px; font-size: 19px; box-shadow: 0 8px 0 #9c3a0b, 0 14px 30px rgba(255, 122, 61, 0.35); }
.play-btn:hover { transform: translateY(-2px); }
.play-btn:active { transform: translateY(4px); box-shadow: 0 3px 0 #9c3a0b; }
.play-btn .icon { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.loading::before { content: ""; width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fs-exit {
	display: none; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5;
	height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(0, 0, 0, 0.55); color: #fff; font-weight: 800; cursor: pointer;
	align-items: center; gap: 6px;
}
.stage.pseudo-fs { position: fixed; inset: 0; z-index: 1000; max-height: none; aspect-ratio: auto; width: 100vw; height: 100vh; height: 100dvh; }
.stage:fullscreen { max-height: none; aspect-ratio: auto; }
.stage.pseudo-fs .fs-exit { display: inline-flex; }
@media (hover: none) { .stage:fullscreen .fs-exit { display: inline-flex; } }
.player-bar { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; }
.player-bar img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.player-bar .name { flex: 1; min-width: 0; }
.player-bar .name b { display: block; font-size: 17px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bar .name small { color: var(--muted); font-size: 13px; }
.player-actions { display: flex; gap: 4px; }
.player-actions .icon-btn { border-radius: 10px; background: var(--surface); }
.player-actions .icon-btn:hover { background: var(--surface-2); }
.toast {
	position: fixed; left: 50%; bottom: 24px; z-index: 2000; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
	padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 800; transition: 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 2px 0; color: var(--muted); font-size: 14px; font-weight: 700; }
.crumbs a:hover { color: var(--text); }
.crumbs span[aria-hidden] { opacity: 0.6; }
.about { margin-top: 14px; padding: 22px 24px; border-radius: var(--radius); background: var(--bg-raised); border: 1px solid var(--line); }
.about h1 { font-size: 28px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; padding: 0; list-style: none; }
.facts li { padding: 4px 12px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 800; }
.facts li a { color: var(--text); }
.about .desc { margin: 0; color: #d4d6ee; font-weight: 500; font-size: 16px; line-height: 1.65; white-space: pre-line; max-width: 820px; }

.side h2 { font-size: 18px; margin-bottom: 12px; }
.side-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.side-grid .tile { aspect-ratio: 16 / 9; }
.side-promo {
	display: block; margin-top: 18px; padding: 20px; border-radius: var(--radius); overflow: hidden; position: relative;
	background: linear-gradient(140deg, var(--violet), var(--violet-deep));
}
.side-promo strong { display: block; font-size: 22px; font-weight: 900; line-height: 1.15; max-width: 80%; }
.side-promo p { margin: 8px 0 14px; color: rgba(255, 255, 255, 0.8); font-size: 14px; max-width: 85%; }
.side-promo .btn { background: #fff; color: var(--violet-deep); height: 36px; }
.side-promo > .icon { position: absolute; right: -14px; bottom: -14px; width: 110px; height: 110px; color: rgba(255, 255, 255, 0.16); stroke-width: 1.5; }

.empty-state { text-align: center; padding: 48px 16px 8px; }
.empty-state h1 { font-size: 34px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); margin: 0 0 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
	.game-layout { grid-template-columns: minmax(0, 1fr); }
	.side-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (max-width: 1024px) {
	/* The sidebar becomes a drawer opened from the menu button. */
	.sidebar {
		position: fixed; top: 0; left: 0; bottom: 0; z-index: 90; height: 100vh; height: 100dvh; width: 270px;
		transform: translateX(-100%); transition: transform 0.22s ease; padding-top: 18px; background: var(--bg-raised);
	}
	body.rail .sidebar { width: 270px; }
	body.rail .sidebar a { justify-content: flex-start; padding: 0 12px; }
	body.rail .sidebar a span, body.rail .sidebar .count { display: inline; }
	body.drawer-open .sidebar { transform: none; box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5); }
	body.drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, 0.55); }
	body.drawer-open { overflow: hidden; }
}
@media (max-width: 760px) {
	:root { --gutter: 16px; --tile-w: 168px; --tile-h: 96px; --header-h: 58px; }
	.topbar { gap: 8px; padding: 0 8px; }
	.brand b { font-size: 18px; }
	.brand svg { width: 32px; height: 32px; }
	.search { display: none; position: absolute; left: 8px; right: 8px; top: 8px; max-width: none; }
	body.search-open .search { display: block; }
	body.search-open .search ~ * { visibility: hidden; }
	.search-toggle { display: inline-grid; margin-left: auto; }
	.lang-btn { width: 42px; padding: 0; }
	.lang-btn span { display: none; }
	.top-actions .btn-ghost { display: none; }
	.top-actions .btn { height: 36px; padding: 0 14px; font-size: 14px; }
	.chip { width: 156px; height: 84px; padding: 10px 12px; }
	.chip strong { font-size: 15px; }
	.chip .icon { width: 44px; height: 44px; }
	.promo { grid-template-columns: 1fr; }
	.promo-left { clip-path: none; padding: 16px 20px; }
	.promo-right { padding: 14px 20px; }
	.row-head h2 { font-size: 19px; }
	.row-head .arrows { display: none; }
	.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
	.content { padding-top: 14px; }
	.stage { aspect-ratio: 4 / 3; }
	.splash-card img { width: min(260px, 60vw); }
	.about { padding: 18px 16px; }
	.about h1 { font-size: 23px; }
	.player-bar .name small { display: none; }
}
@media (hover: none) {
	.tile::after { opacity: 1; }
	.tile .tile-title { opacity: 1; transform: none; font-size: 13px; left: 8px; bottom: 6px; }
	.tile:hover { transform: none; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}
