/* Recess Arcade
   Layout: header, leaderboard ad, then a three-column page (left ad rail · content · right ad rail).
   The rails collapse below 1100px and the leaderboard shrinks to a mobile banner.
   Look: a school chalkboard (deep green, chalk white) with school-bus yellow as the one loud colour. */
:root {
  --board: #10241d;
  --board-2: #173329;
  --board-3: #1f4136;
  --chalk: #f2efe4;
  --chalk-dim: #a9b8ad;
  --line: rgba(242, 239, 228, 0.14);
  --bus: #ffc629;
  --bus-ink: #1d1704;
  --apple: #ef4b3f;
  --sky: #5cc8ff;
  --display: "Bungee", "Arial Black", Impact, sans-serif;
  --body: "Lexend", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 14px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--board);
  background-image: radial-gradient(circle at 20% -10%, rgba(255, 255, 255, 0.05), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(92, 200, 255, 0.05), transparent 40%);
  color: var(--chalk);
  font: 16px/1.6 var(--body);
}
img { max-width: 100%; display: block; }
a { color: var(--bus); text-underline-offset: 3px; }
a:hover { color: #ffd65c; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--bus); color: var(--bus-ink); padding: 8px 12px; }

/* ── Header ─────────────────────────────────────────────────────────── */
.site-header { border-bottom: 1px solid var(--line); background: rgba(10, 26, 20, 0.7); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.site-header .inner { max-width: 1400px; margin: 0 auto; padding: 10px var(--gutter-r) 10px var(--gutter-l); display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--chalk); font: 400 22px/1 var(--display); letter-spacing: 0.02em; }
.logo b { background: var(--bus); color: var(--bus-ink); padding: 4px 8px 3px; border-radius: 6px; font-weight: 400; transform: rotate(-3deg); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--chalk-dim); text-decoration: none; font-weight: 600; font-size: 15px; padding: 6px 10px; border-radius: 8px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--chalk); background: var(--board-3); }
.search { margin-left: auto; position: relative; min-width: 0; flex: 0 1 260px; }
.search input { width: 100%; font: inherit; font-size: 15px; color: var(--chalk); background: var(--board-2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px 8px 36px; }
.search input::placeholder { color: var(--chalk-dim); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--chalk-dim); }

/* ── Ads ─────────────────────────────────────────────────────────────── */
.ad { display: grid; place-items: center; margin-inline: auto; position: relative; }
.ad-placeholder { width: 100%; height: 100%; display: grid; place-items: center; text-align: center; border: 1px dashed rgba(242, 239, 228, 0.22); border-radius: 8px; color: var(--chalk-dim); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; background: repeating-linear-gradient(-45deg, transparent 0 10px, rgba(255, 255, 255, 0.02) 10px 20px); }
.ad-label { display: block; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--chalk-dim); text-align: center; margin-bottom: 4px; }
.ad-top { max-width: 1400px; margin: 14px auto 0; padding-inline: var(--gutter-l) var(--gutter-r); }
.ad[data-ad="leaderboard"] { width: 728px; max-width: 100%; height: 90px; }
.ad[data-ad="skyscraperLeft"], .ad[data-ad="skyscraperRight"] { width: 160px; height: 600px; }
.ad[data-ad="rectangle"] { width: 300px; max-width: 100%; height: 250px; }
.ad[data-ad="banner"] { width: 728px; max-width: 100%; height: 90px; }
.ad[data-ad="railSmall"] { width: 160px; height: 300px; }
.ad[data-ad="native"] { display: block; width: 100%; min-height: 120px; }
.rail-small { margin-top: 16px; }
/* The rails are sticky, so the second rail ad only shows when both fit on screen. */
@media (max-height: 1050px) { .rail-small { display: none; } }
@media (max-width: 760px) {
  .ad[data-ad="leaderboard"], .ad[data-ad="banner"] { width: 320px; height: 50px; }
}

/* ── Page frame ─────────────────────────────────────────────────────── */
.page { max-width: 1400px; margin: 0 auto; padding: 20px var(--gutter-r) 48px var(--gutter-l); display: grid; grid-template-columns: 160px minmax(0, 1fr) 160px; gap: 28px; }
.rail { position: sticky; top: 78px; align-self: start; }
main { min-width: 0; display: grid; gap: 36px; align-content: start; }
@media (max-width: 1100px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
}

/* ── Type ───────────────────────────────────────────────────────────── */
h1, h2, h3 { margin: 0; line-height: 1.1; text-wrap: balance; }
h1 { font: 400 clamp(30px, 4.6vw, 52px)/1.02 var(--display); letter-spacing: 0.01em; }
h2 { font: 400 clamp(22px, 2.6vw, 30px)/1.1 var(--display); }
h3 { font-size: 18px; font-weight: 700; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--bus); }
.lede { color: var(--chalk-dim); font-size: 18px; max-width: 62ch; margin: 0; }
.prose { max-width: 70ch; display: grid; gap: 14px; }
.prose p, .prose ul, .prose ol { margin: 0; }
.prose li + li { margin-top: 4px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ── Featured ───────────────────────────────────────────────────────── */
.featured { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.carousel { position: relative; display: grid; min-height: 340px; }
.carousel .feature { grid-area: 1 / 1; opacity: 0; visibility: hidden; transition: opacity 0.7s, visibility 0.7s; }
.carousel .feature.on { opacity: 1; visibility: visible; }
.feature.drone img { object-position: 30% center; }
.feature.zombies img { object-position: center 72%; }
.carousel .dots { position: absolute; right: 16px; bottom: 18px; z-index: 2; display: flex; gap: 8px; }
.carousel .dots button { width: 12px; height: 12px; padding: 0; border-radius: 50%; border: 2px solid #fff; background: rgba(255, 255, 255, 0.25); cursor: pointer; }
.carousel .dots button[aria-selected="true"] { background: var(--bus); border-color: var(--bus); width: 28px; border-radius: 999px; }
.carousel .dots button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (max-width: 820px) { .featured { grid-template-columns: 1fr; } }
.feature { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 300px; display: flex; align-items: flex-end; text-decoration: none; color: var(--chalk); border: 2px solid var(--line); background: var(--board-2); }
.feature img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.feature::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(6, 16, 12, 0.92)); }
.feature.bright::after { background: linear-gradient(180deg, rgba(6, 16, 12, 0.15) 0%, rgba(6, 16, 12, 0.55) 30%, rgba(6, 16, 12, 0.94) 72%); }
.feature .body { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.feature:hover img { transform: scale(1.04); }
.feature:hover { color: var(--chalk); border-color: var(--bus); }
.feature .body { position: relative; z-index: 1; padding: 22px; display: grid; gap: 8px; }
.feature h2 { font-size: clamp(26px, 3.4vw, 40px); }
.feature p { margin: 0; color: #d5dccf; max-width: 46ch; }
.play-pill { justify-self: start; display: inline-flex; align-items: center; gap: 8px; background: var(--bus); color: var(--bus-ink); font-weight: 800; padding: 8px 16px; border-radius: 999px; font-size: 15px; }
.play-pill::before { content: ""; border-left: 10px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }

/* ── Game grid ──────────────────────────────────────────────────────── */
.games-layout { display: grid; grid-template-columns: 210px 1fr; gap: 20px; align-items: start; }
.games-layout > * { min-width: 0; }
.cats { position: sticky; top: 14px; display: flex; flex-direction: column; gap: 10px; }
.cat { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; font: inherit; font-size: 18px; font-weight: 800; text-align: left;
  color: var(--bus-ink); background: var(--bus); border: 0; border-radius: 12px; padding: 15px 18px; cursor: pointer; box-shadow: 0 4px 0 #a07400; transition: transform 0.1s, filter 0.1s; }
.cat:hover { filter: brightness(1.08); transform: translateX(3px); }
.cat:active { transform: translateY(2px); box-shadow: 0 2px 0 #a07400; }
.cat .n { font-size: 13px; font-weight: 800; background: rgba(0, 0, 0, 0.14); border-radius: 999px; padding: 2px 9px; }
.cat[aria-pressed="true"] { background: #fff; color: #1a1300; box-shadow: 0 4px 0 #a07400, inset 0 0 0 3px var(--bus); }
.cat:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (max-width: 760px) {
  .games-layout { grid-template-columns: 1fr; }
  .cats { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
  .cat { width: auto; flex: none; font-size: 16px; padding: 13px 16px; }
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 14px; font-weight: 600; color: var(--chalk-dim); background: var(--board-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--chalk); color: var(--board); border-color: var(--chalk); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { display: grid; grid-template-rows: auto 1fr; text-decoration: none; color: var(--chalk); background: var(--board-2); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform 0.15s, border-color 0.15s; }
.card:hover { transform: translateY(-3px) rotate(-0.6deg); border-color: var(--bus); color: var(--chalk); }
.card img { aspect-ratio: 16 / 9; width: 100%; height: auto; object-fit: cover; background: var(--board-3); }
.card .meta { padding: 12px 14px 14px; display: grid; gap: 4px; align-content: start; }
.card h3 { font-size: 17px; }
.card p { margin: 0; color: var(--chalk-dim); font-size: 14px; line-height: 1.45; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--chalk-dim); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.card.soon { place-content: center; text-align: center; padding: 24px; border-style: dashed; color: var(--chalk-dim); grid-template-rows: none; }
.card.soon:hover { transform: none; border-color: var(--line); color: var(--chalk-dim); }
.empty { color: var(--chalk-dim); }

/* ── Game page ──────────────────────────────────────────────────────── */
.game-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.game-nav .btn { display: inline-flex; align-items: center; min-height: 40px; }
.crumbs { font-size: 14px; color: var(--chalk-dim); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--chalk-dim); }
.game-head { display: grid; gap: 10px; }
.player { position: relative; aspect-ratio: 16 / 9; width: 100%; max-width: 100%; border-radius: var(--radius); overflow: hidden; background: #000; border: 2px solid var(--line); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .poster { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; cursor: pointer; background: #000; color: var(--chalk); }
.player .poster img { width: 100%; height: 100%; object-fit: cover; opacity: 0.75; transition: opacity 0.2s; }
.player .poster:hover img { opacity: 0.9; }
.player .poster span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 12px; background: var(--bus); color: var(--bus-ink); font: 400 clamp(18px, 2.6vw, 28px)/1 var(--display); padding: 16px 28px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.player .poster span::before { content: ""; border-left: 16px solid currentColor; border-top: 10px solid transparent; border-bottom: 10px solid transparent; }
.player-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.btn { font: inherit; font-size: 14px; font-weight: 700; color: var(--chalk); background: var(--board-3); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; cursor: pointer; text-decoration: none; }
.btn:hover { background: #2a5446; color: var(--chalk); }
.btn.primary { background: var(--bus); color: var(--bus-ink); border-color: transparent; }
.note { color: var(--chalk-dim); font-size: 14px; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 15px; }
.keys dt { font-weight: 700; white-space: nowrap; }
.keys dd { margin: 0; color: var(--chalk-dim); }
kbd { font: 600 13px ui-monospace, Menlo, Consolas, monospace; background: var(--board-3); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--chalk); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.faq details { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; background: var(--board-2); }
.faq details + details { margin-top: 10px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin: 10px 0 0; color: var(--chalk-dim); }

/* ── Footer ─────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); color: var(--chalk-dim); font-size: 14px; }
.site-footer .inner { max-width: 1400px; margin: 0 auto; padding: 24px var(--gutter-r) 32px var(--gutter-l); display: flex; gap: 18px 28px; flex-wrap: wrap; justify-content: space-between; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { color: var(--chalk-dim); }

@media (prefers-reduced-motion: reduce) {
  .card, .feature img { transition: none; }
  .card:hover { transform: none; }
}

/* ── Visible search-phrase lines (scripts/seo.py) ───────────────────── */
.seo-tagline { margin: 10px 0 0; max-width: 70ch; color: var(--chalk); font-weight: 600; font-size: 15px; }
.seo-tags { margin-top: 10px; }
.seo-searches { color: var(--chalk-dim); font-size: 14px; }
.seo-foot { flex-basis: 100%; order: 3; font-size: 12px; color: var(--chalk-dim); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Note about third-party ads ─────────────────────────────────────── */
/* Game pages: .top sits in the spare space beside the intro on wide screens, .mobile after
   the player on narrower ones. Home: .top.home beside the intro (wider and shorter, so the
   featured games barely move) on very wide screens, .narrow after the games otherwise.
   A plain .ad-notice (pages without games) shows at every size. */
.ad-notice { background: rgba(31, 41, 55, 0.4); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 10px; padding: 12px 18px; font-size: 12px; color: #9ca3af; text-align: center; margin: 20px auto; max-width: min(800px, calc(100% - 32px)); box-sizing: border-box; }
.ad-notice strong { color: #f3f4f6; font-size: 13px; }
.ad-notice p { margin: 6px 0 0; }
main > .ad-notice { margin: 0 auto; max-width: min(800px, 100%); width: 100%; }
.ad-notice.top { display: none; }
.game-head > .ad-notice.top { grid-column: 2; grid-row: span var(--rows, 3); align-self: start; margin: 0; max-width: none; text-align: left; }
@media (min-width: 1280px) {
  .ad-notice.mobile { display: none; }
  .game-head:has(> .ad-notice.top:not(.home)) { grid-template-columns: minmax(0, 1fr) 280px; column-gap: 32px; grid-auto-flow: row dense; }
  .game-head:has(> .ad-notice.top:not(.home)) > * { grid-column: 1; }
  .game-head:has(> .ad-notice.top:not(.home)) > :is(h1, .eyebrow, .game-nav, .crumbs) { grid-column: 1 / -1; }
  .game-head > .ad-notice.top:not(.home) { display: block; grid-column: 2; }
}
@media (min-width: 1400px) {
  .ad-notice.narrow { display: none; }
  .game-head:has(> .ad-notice.top.home) { grid-template-columns: minmax(0, 1fr) 360px; column-gap: 32px; grid-auto-flow: row dense; }
  .game-head:has(> .ad-notice.top.home) > * { grid-column: 1; }
  .game-head:has(> .ad-notice.top.home) > :is(h1, .eyebrow) { grid-column: 1 / -1; }
  .game-head > .ad-notice.top.home { display: block; grid-column: 2; padding: 12px 16px; }
}

/* Embed code panel under the game player (js/site.js) */
.embed-box { display: grid; gap: 8px; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--board-2, rgba(0,0,0,.2)); }
.embed-box[hidden] { display: none; }
.embed-box label { color: var(--chalk-dim); font-size: 14px; }
.embed-box textarea { width: 100%; box-sizing: border-box; font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace; color: var(--chalk); background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 10px; padding: 8px; resize: vertical; }
.embed-box .btn { justify-self: start; }

/* Page banners switched off in js/ads.js (pageBanners: false): hide the slots, their labels and the rails. */
.no-page-ads .ad-top, .no-page-ads .rail, .no-page-ads .ad-label, .no-page-ads .ad[data-ad] { display: none; }
.no-page-ads div:has(> .ad-label + .ad[data-ad]):not(:has(h1, h2, p, .player)) { display: none; }
.no-page-ads .page { grid-template-columns: minmax(0, 1fr); }

/* "Check out our sponsor" header button (scripts/add_monetag.py) */
.sponsor-btn { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: 14px; font-weight: 700; color: var(--bus); text-decoration: none; padding: 7px 14px; border: 1.5px solid var(--bus); border-radius: 999px; background: rgba(255, 198, 41, 0.08); white-space: nowrap; transition: background .15s, color .15s; }
.sponsor-btn:hover, .sponsor-btn:focus-visible { background: var(--bus); color: var(--bus-ink); }
.nav + .sponsor-btn { margin-left: auto; }
.sponsor-btn .short { display: none; }
/* Short label where the header is tight: the home page's longer menu, and phones (where it shares the search row). */
@media (max-width: 1500px) { .site-header .inner:has(.nav > a:nth-child(6)) .sponsor-btn :is(.long, .short) { display: none; } .site-header .inner:has(.nav > a:nth-child(6)) .sponsor-btn .short { display: inline; } .site-header .inner:has(.nav > a:nth-child(6)) .search { flex-basis: 170px; } }
/* If it still has to wrap, it lines up on the right under the search box. */
.search + .sponsor-btn { margin-left: auto; }
.search:has(+ .sponsor-btn) { margin-left: auto; }
@media (max-width: 760px) {
  .sponsor-btn { font-size: 13px; padding: 6px 12px; }
  .sponsor-btn .long { display: none; } .sponsor-btn .short { display: inline; }
  .search:has(+ .sponsor-btn) { flex: 1 1 150px; }
}
