/* oldflashgames.com — main stylesheet */
:root {
  --bg: #0f1115;
  --bg-soft: #171a21;
  --card: #1e222b;
  --text: #e8eaf0;
  --muted: #9aa0ad;
  --accent: #4f8cff;
  --accent-hover: #6b9eff;
  --border: #2a2f3a;
  --radius: 10px;
  --maxw: 1200px;
  --media-bg: #000;
  --shadow: rgba(0, 0, 0, 0.5);
}

/* Light theme — toggled by adding .light to <html> (see theme.js).
   Same accent family, tuned for a white background. */
html.light {
  --bg: #f5f6f8;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --text: #1c1f26;
  --muted: #5b626e;
  --accent: #2f6fe0;
  --accent-hover: #1f5fd0;
  --border: #dfe2e8;
  --media-bg: #000;
  --shadow: rgba(0, 0, 0, 0.15);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Header */
.site-header {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.main-nav a {
  margin-left: 18px;
  color: var(--muted);
}
.main-nav a:hover { color: var(--text); }

/* Language switcher (apex=EN / de.=DE) — compact pill in the header row */
.lang-switch {
  margin-left: 18px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
}
.lang-switch:hover { color: var(--accent); border-color: var(--accent); }

/* Header search (server-side, /search?q=...) */
.logo { margin-right: auto; } /* pushes nav + search to the right */
.site-search {
  position: relative; /* anchors the autocomplete dropdown */
  margin-left: 18px;
  display: flex;
  gap: 6px;
}
.site-search input[type="search"] {
  padding: 6px 10px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  min-width: 180px;
}
.site-search input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.site-search button {
  padding: 6px 12px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.site-search button:hover { filter: brightness(1.1); }

/* Theme toggle (light/dark) — sits in the header row */
.theme-toggle {
  margin-left: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Show the "sun" icon in light mode (we toggle the glyph via JS, but also
   keep a CSS hook in case the icon is an SVG). */
html.light .theme-toggle::before { content: ""; }

/* Empty search / listing state */
.empty-state {
  color: var(--muted);
  padding: 12px 0;
}
.empty-state a { color: var(--accent); }

/* Persistent category nav */
.cat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 0 20px 10px;
}
.cat-link {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.cat-link:hover { color: var(--text); background: var(--card); }
.cat-link.is-active {
  color: var(--text);
  background: var(--accent);
  font-weight: 600;
}
.cat-link.is-active:hover { background: var(--accent-hover); }

/* Main */
.site-main {
  max-width: var(--maxw);
  margin: 0 auto;
  /* Extra bottom padding so the sticky footer never covers the last row. */
  padding: 24px 20px 100px;
}

/* Hero */
.hero { margin-bottom: 28px; }
.hero h1 { margin: 0 0 6px; font-size: 1.8rem; }
.hero p { margin: 0; color: var(--muted); }

/* Categories */
.categories-block { margin-bottom: 32px; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
.cat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.9rem;
}
.cat-chip:hover { border-color: var(--accent); }
.cat-chip span { color: var(--muted); font-size: 0.8rem; }
.cat-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.cat-chip.is-active span { color: rgba(255, 255, 255, 0.8); }
.cat-chip.is-active:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* In-page category filter (category listing pages) */
.cat-filter { margin: 0 0 24px; }
.cat-filter h2 { font-size: 1.05rem; margin: 0 0 10px; color: var(--muted); }

/* Game grid — fixed column counts so pages fill complete rows on desktop.
   Listing pages: 42 = 7x6 (desktop); in-feed halves 21 = 7x3; home blocks 14 = 7x2.
   Tablet (4) / phone (2) may end with a short last row — normal for grids.
   margin-bottom gives a consistent gap between consecutive grid blocks (the
   in-feed ad splits a page into several .game-grid divs); the in-feed ad's
   own 16px margin pairs with this to keep even spacing between rows. */
.game-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 1000px) {
  .game-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); }
}
.game-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
}
.game-card:hover { border-color: var(--accent); transform: translateY(-2px); transition: transform 0.1s; }
.game-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--media-bg);
  display: block;
}
.game-title {
  padding: 8px 10px;
  font-size: 0.85rem;
  text-align: center;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Game page */
.games-block + .games-block { margin-top: 36px; }
.games-block h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.view-all { font-size: 0.85rem; font-weight: 400; color: var(--accent); text-decoration: none; white-space: nowrap; }
.view-all:hover { text-decoration: underline; }
.game-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
}
@media (max-width: 800px) {
  .game-layout { grid-template-columns: 1fr; }
}
.game-player { min-width: 0; }
.game-player h1 { font-size: 1.5rem; margin: 0 0 12px; }
/* Responsive player: scale to container width while keeping the game's native
   aspect ratio (set inline per game via aspect-ratio: W / H). Without this the
   <object> keeps its fixed height attribute and squashes on narrow screens. */
.game-player object, .game-player .no-player {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: var(--media-bg);
}
.no-player {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.game-instructions, .game-description { margin-top: 24px; }
.rich-text { white-space: normal; color: var(--text); }

/* Related games ("More like this") below the player */
.related-games { margin-top: 32px; }
.related-games h2 { font-size: 1.25rem; margin: 0 0 12px; }

/* Sort controls (listings) */
.sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}
.sort-label { font-size: 0.85rem; color: var(--muted); }
.sort-link {
  font-size: 0.85rem;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--muted);
  text-decoration: none;
}
.sort-link:hover { color: var(--text); border-color: var(--accent); }
.sort-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Sidebar */
.meta-block { margin-bottom: 20px; }
.meta-block h3 { font-size: 0.95rem; margin: 0 0 8px; color: var(--muted); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
}
a.tag:hover { border-color: var(--accent); color: var(--text); }

/* Listing */
.listing-page h1 { font-size: 1.5rem; margin: 0 0 4px; }
.result-count { color: var(--muted); margin: 0 0 20px; }
/* Title (left) + sort controls (right) on one line */
.listing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.listing-head h1 { font-size: 1.5rem; margin: 0; }
.listing-head .sort-controls { margin: 0; }

/* Pager */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 28px;
}
.pager-info { color: var(--muted); font-size: 0.9rem; }

/* Infinite-scroll sentinel: a 1px in-flow marker above the pager/footer.
   Observed by search-suggest.js; staying in the document flow means it keeps
   firing mid-scroll and is never covered by the sticky footer. */
.infinite-sentinel { height: 1px; }

/* Search autocomplete dropdown (search-suggest.js) */
.suggest-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 30px var(--shadow);
  max-height: 280px;
  overflow: auto;
  z-index: 60;
}
.suggest-item {
  padding: 8px 12px;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggest-item.is-active,
.suggest-item:hover { background: var(--bg-soft); }

/* 404 */
.not-found { text-align: center; padding: 60px 0; }
.not-found h1 { font-size: 2rem; }

/* Footer — static, at the end of the page content (not sticky). The sticky
   header already keeps the main nav one tap away, so a sticky footer was
   redundant and covered the last row of content. */
.site-footer {
  background: var(--bg-soft);
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* Admin */
.admin-form {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-form label { font-size: 0.9rem; color: var(--muted); }
.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="number"],
.admin-form select,
.admin-form textarea {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.95rem;
  font-family: inherit;
}
.admin-form textarea { min-height: 100px; resize: vertical; }
.admin-form button {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 0.95rem;
  cursor: pointer;
}
.admin-form button:hover { background: var(--accent-hover); }
.admin-form button.danger { background: #c0392b; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--muted); font-weight: 600; }
.admin-msg { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 0.9rem; }
.admin-msg.ok { background: #14351f; color: #7fd49a; }
.admin-msg.err { background: #3a1414; color: #e89090; }

/* Admin filter bar */
.admin-filter {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.admin-filter input[type="text"] {
  flex: 1;
  min-width: 180px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.95rem;
  font-family: inherit;
}
.admin-filter select {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.9rem;
  font-family: inherit;
}
.admin-filter button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
}
.admin-filter button:hover { background: var(--accent-hover); }
.admin-filter .filter-clear {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: underline;
}

/* Tag browse */
.tag-page h1 { font-size: 1.5rem; margin: 0 0 4px; }
.back-link { margin: 0 0 12px; }
.back-link a { font-size: 0.9rem; }
.tag-filter { margin: 16px 0; }
.tag-filter input[type="search"] {
  width: 100%;
  max-width: 360px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.95rem;
  font-family: inherit;
}
.tag-filter input[type="search"]::placeholder { color: var(--muted); }
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text);
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent-hover); }
.tag-chip .tag-count {
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 1px 7px;
}
.tag-empty { color: var(--muted); font-size: 0.9rem; }

/* AdSense — responsive units. The label keeps the ad visually distinct
   from site content (AdSense policy). Column layout: label above the unit. */
.ad-slot {
  margin: 16px 0;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.ad-label {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ad-slot .adsbygoogle { width: 100%; }
/* Highlighted variant — prominent in-content spots (e.g. "More like this"). */
.ad-slot--highlighted {
  border: 1px solid var(--accent);
  background: var(--card);
}
.ad-slot--highlighted .ad-label { color: var(--accent); }

/* Static / compliance pages */
.static-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  line-height: 1.65;
}
.static-page h1 { font-size: 1.8rem; margin-bottom: 16px; }
.static-page h2 { font-size: 1.15rem; margin-top: 28px; margin-bottom: 8px; }
.static-page p { margin: 10px 0; }
.static-page ul { margin: 10px 0; padding-left: 22px; }
.static-page li { margin: 4px 0; }
.static-page address { font-style: normal; }
.static-page .legal-missing,
.static-page em { color: var(--muted); }
.static-page .btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 8px 14px;
  margin-right: 8px;
}
.static-page .btn:hover { background: var(--accent-hover); color: #fff; }

/* Contact page — professional form + contact details card. */
.contact-page { max-width: 640px; }
.contact-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin: 16px 0;
  padding: 16px 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.contact-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.contact-detail__label {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.contact-detail__value {
  font-size: 0.95rem;
  color: var(--text);
}
.contact-detail__value a { color: var(--accent); }
.contact-detail__value a:hover { color: var(--accent-hover); }
.contact-missing { color: var(--muted); }

.contact-form {
  margin: 16px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.contact-field { display: flex; flex-direction: column; gap: 6px; }
.contact-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.contact-field input,
.contact-field textarea {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.contact-field textarea { resize: vertical; min-height: 120px; }
.contact-field input:focus,
.contact-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.contact-submit {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.contact-submit:hover { background: var(--accent-hover); }
.contact-legal { margin-top: 20px; }

/* Footer links */
.site-footer .footer-links {
  margin: 8px 0 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
}
.site-footer .footer-links a { color: var(--muted); }
.site-footer .footer-links a:hover { color: var(--accent-hover); }

/* Cookie consent banner */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 640px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 8px 30px var(--shadow);
  z-index: 1000;
  font-size: 0.9rem;
}
.cookie-banner p { margin: 0 0 12px; }
.cookie-banner .cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.cookie-banner .cookie-actions button {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.9rem;
}
.cookie-banner .cookie-actions button:hover { border-color: var(--accent); }
.cookie-banner .cookie-actions .cookie-accept {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.cookie-banner .cookie-actions .cookie-accept:hover { background: var(--accent-hover); }
