/* Tokens */
:root {
  --ink: #1b1340;       /* page background */
  --panel: #2a1f5e;     /* raised surfaces */
  --line: #3d3180;
  --paper: #f6f1ff;     /* text */
  --muted: #a99fd6;
  --sun: #ffc93c;       /* primary accent */
  --pop: #ff4f8b;       /* card shadow / danger */
  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 10px;
  --gutter: clamp(.75rem, 3vw, 1rem);
  --tap: 44px;          /* minimum touch target */
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* hidden always wins over display styles */
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  margin: 0; background: var(--ink); color: var(--paper); font: 16px/1.55 var(--body);
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--sun); }
img { max-width: 100%; display: block; }
h1, h2 { font-family: var(--display); font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.45rem, 3.5vw + .6rem, 2.3rem); margin: 1.25rem 0 .9rem; }
h2 { font-size: clamp(1.15rem, 1.5vw + .8rem, 1.35rem); margin: 1.75rem 0 .75rem; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.wrap { width: min(1280px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--sun); color: var(--ink); padding: .5rem 1rem; z-index: 10; }
.muted { color: var(--muted); }
body > main { flex: 1 0 auto; }   /* pushes the footer to the bottom on short pages */
html.lock, html.lock body { overflow: hidden; }

/* Header: logo and search share one row at every width */
.site-head { background: var(--panel); border-bottom: 1px solid var(--line); }
.head-row { display: flex; align-items: center; gap: .75rem; padding-block: .6rem; }
.logo {
  font: 800 clamp(1.15rem, 2.5vw + .6rem, 1.6rem)/1.1 var(--display); color: var(--sun); text-decoration: none;
  flex: 0 1 auto; margin-right: auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand {
  display: flex; flex-direction: column; justify-content: center; flex: 0 1 auto; margin-right: auto;
  min-width: 0; text-decoration: none;
}
.brand .logo { display: block; margin: 0; }
.tagline {
  display: block; margin-top: .2rem; color: var(--muted); font-size: .85rem; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search { flex: 1 1 8.5rem; max-width: 320px; min-width: 0; }
.search input { width: 100%; min-height: var(--tap); }

/* Header buttons (phones only) */
.icon-btn {
  display: inline-grid; place-items: center; flex: none; width: var(--tap); height: var(--tap);
  padding: 0; border-radius: 10px; background: transparent; color: var(--paper);
}
.music-btn { color: var(--sun); margin-left: .25rem; }
.music-btn:focus-visible { outline-offset: -2px; }
.menu-btn, .search-btn, .drawer-head, .drawer-search, .drawer-only, .menu-scrim { display: none; }

/* Desktop and tablet: a category bar under the header */
.cats { border-top: 1px solid var(--line); }
.cats-row {
  position: relative; display: flex; gap: .25rem; overflow-x: auto; padding-block: .45rem;
  scrollbar-width: none; overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
  padding-right: 2.5rem;
}
.cats-row::-webkit-scrollbar { display: none; }
.cats a {
  flex: none; display: inline-flex; align-items: center; gap: .5rem;
  min-height: 38px; padding: 0 .85rem; border-radius: 999px;
  color: var(--paper); text-decoration: none; font-size: .92rem;
}
.cats a[aria-current] { background: var(--sun); color: var(--ink); font-weight: 600; }
.cats .n, .cats .drawer-only { display: none; }

/* "All games" drop-down (desktop/tablet, needs JavaScript; without it "All games" is a plain link) */
.cats { position: relative; }
.allgames-btn { display: none; }
.js .allgames-link { display: none; }
.js .allgames-btn {
  /* pinned to the left of the scrolling bar; the soft shadow fades categories as they slide under it */
  position: sticky; left: 0; z-index: 2; background: transparent; box-shadow: 14px 0 12px -6px var(--panel);
  display: inline-flex; align-items: center; gap: .3rem; flex: none;
  min-height: 38px; padding: 0 .7rem 0 .85rem; border-radius: 999px;
  color: var(--paper); font-weight: 600; font-size: .92rem;
}
.js .allgames-btn::before { content: ""; position: absolute; inset: 0 -2px; z-index: -1; background: var(--panel); }  /* solid backing, also behind the rounded corners */
.js .allgames-btn::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 999px; background: transparent; }  /* the pill colour */
.js .allgames-btn.is-current::after, .js .allgames-btn[aria-expanded="true"]::after { background: var(--sun); }
.allgames-btn svg { transition: transform .15s; }
.allgames-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.allgames-btn.is-current, .allgames-btn[aria-expanded="true"] { color: var(--ink); }
.allcats-panel {
  position: absolute; z-index: 60; top: 100%; left: 0; right: 0;
  background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 0 var(--pop), 0 18px 40px rgb(5 2 20 / .45);
  max-height: min(70vh, 640px); overflow-y: auto; overscroll-behavior: contain;
}
.allcats-panel[hidden] { display: none; }
.allcats-panel .wrap { padding-block: 1rem 1.25rem; }
.allcats-top { display: flex; gap: .5rem; flex-wrap: wrap; padding-bottom: .8rem; margin-bottom: .8rem; border-bottom: 1px solid var(--line); }
.allcats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .15rem 1rem; }
.allcats-panel a {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: 40px; padding: 0 .75rem; border-radius: 8px;
  color: var(--paper); text-decoration: none; font-size: .95rem;
}
.allcats-top a { font-weight: 600; background: var(--ink); }
.allcats-panel .n { display: inline; color: var(--muted); font-size: .85rem; }
.allcats-panel a[aria-current] { background: var(--sun); color: var(--ink); font-weight: 600; }
.allcats-panel a[aria-current] .n { color: var(--ink); opacity: .7; }

/* Phones: hamburger + slide-in menu (only when JavaScript runs; without it the bar above still works) */
@media (max-width: 760px) {
  .js .menu-btn, .js .search-btn { display: inline-grid; }
  .js .head-search { display: none; }
  .js .head-row { gap: .25rem; padding-block: .35rem; }
  .js .menu-btn { margin-left: -.5rem; }
  .music-btn { margin-left: 0; margin-right: -.5rem; }
  .js .search-btn:last-child { margin-right: -.5rem; }
  .js .brand { margin-right: auto; }
  .tagline { font-size: .75rem; margin-top: .1rem; }

  .js .menu-scrim {
    display: block; position: fixed; inset: 0; z-index: 899; background: rgb(10 6 30 / .6);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .js .cats {
    position: fixed; z-index: 900; top: 0; left: 0; bottom: 0; width: min(340px, 86vw);
    display: flex; flex-direction: column; border: 0; background: var(--panel);
    box-shadow: 6px 0 0 var(--pop);
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) env(safe-area-inset-left);
    transform: translateX(calc(-100% - 8px)); visibility: hidden;
    transition: transform .25s ease, visibility 0s linear .25s;
  }
  .menu-open .menu-scrim { opacity: 1; pointer-events: auto; }
  .menu-open .cats { transform: none; visibility: visible; transition: transform .25s ease; }
  .js.menu-open, .js.menu-open body { overflow: hidden; }

  .js .drawer-head {
    display: flex; align-items: center; justify-content: space-between; flex: none;
    padding: .35rem .5rem .35rem 1rem; border-bottom: 1px solid var(--line);
  }
  .drawer-title { font: 800 1.3rem var(--display); color: var(--sun); }
  .js .drawer-search { display: block; flex: none; padding: .75rem 1rem; }
  .js .drawer-search input { width: 100%; min-height: var(--tap); }

  .js .cats-row {
    flex: 1; display: block; width: auto; margin: 0; overflow-y: auto; overflow-x: hidden;
    -webkit-mask-image: none; mask-image: none; padding: 0 .5rem 1.5rem; overscroll-behavior: contain;
  }
  .js .cats a {
    display: flex; justify-content: space-between; min-height: var(--tap);
    padding: 0 .75rem; border-radius: 8px; font-size: 1rem;
  }
  .js .cats a:active { background: var(--line); }
  .js .cats a[aria-current] { background: var(--sun); color: var(--ink); }
  .js .cats .n { display: inline; color: var(--muted); font-size: .85rem; font-weight: 400; }
  .js .cats a[aria-current] .n { color: var(--ink); opacity: .7; }
  .js .drawer-only { display: flex; }
  .js .allgames-btn, .allcats-panel { display: none !important; }
  .js .drawer-label {
    display: block; margin: 1rem .75rem .35rem; padding-top: .9rem; border-top: 1px solid var(--line);
    color: var(--muted); font-size: .85rem; font-weight: 600;
  }
}

/* Ads: clear separation from content and game controls */
.ad { width: min(1280px, 100% - 2 * var(--gutter)); margin: 1rem auto; min-height: 100px; text-align: center; overflow: hidden; }
.ad-inner { max-width: 100%; margin-inline: auto; }

/* Listing */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: .25rem 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.list-head h1 { margin-bottom: 0; }
.count { font: 500 1rem var(--body); color: var(--muted); vertical-align: middle; }
.sort { display: flex; gap: .25rem; }
.sort a { color: var(--muted); text-decoration: none; padding: 0 .75rem; min-height: 38px; display: inline-flex; align-items: center; border-radius: 6px; }
.sort a[aria-current] { color: var(--paper); background: var(--panel); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.25rem 1rem; }
.grid-feat { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* Cards: the one loud element — cartridge-style offset shadow */
.card { color: var(--paper); text-decoration: none; display: block; min-width: 0; }
.card img, .card .noimg {
  aspect-ratio: 4 / 3; width: 100%; height: auto; object-fit: cover; border-radius: var(--r);
  background: var(--panel); box-shadow: 4px 4px 0 var(--pop);
  transition: transform .12s, box-shadow .12s;
}
.card .noimg { display: grid; place-items: center; font-size: 2rem; color: var(--muted); }
.card:active img { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--pop); }
.card-title {
  margin-top: .55rem; font-size: .92rem; font-weight: 600; line-height: 1.3;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.empty { color: var(--muted); padding: 2rem 0; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.row-head h2 { margin-bottom: .8rem; }
.h1-size { font-size: clamp(1.45rem, 3.5vw + .6rem, 2.3rem); }   /* same size as the "New games" heading */
.row-head { align-items: center; }
.row-head a { display: inline-flex; align-items: center; min-height: var(--tap); text-decoration: none; font-weight: 600; font-size: .95rem; }
.row-head a::after { content: " →"; white-space: pre; }
.card-plays { display: block; margin-top: .15rem; color: var(--muted); font-size: .8rem; }
.card-plays .star-txt { color: #ffc83d; }
.rated { margin-top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; margin: 2rem 0; }
.pager a {
  justify-self: start; display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 1.1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; text-decoration: none;
}
.pager a:last-child { justify-self: end; }
.pager-pos { color: var(--muted); font-size: .9rem; text-align: center; }

/* Game page */
.game-head { display: flex; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; margin: 1.25rem 0 1rem; }
.game-head h1 { margin: 0; }
.tag {
  background: var(--panel); border: 1px solid var(--line); padding: 0 .8rem; min-height: 32px;
  display: inline-flex; align-items: center; border-radius: 999px; text-decoration: none; font-size: .9rem;
}
.stage { --ar: 1.3333; width: min(100%, calc(72vh * var(--ar))); margin-inline: auto; }
.player {
  aspect-ratio: var(--ar); width: 100%; position: relative; overflow: hidden;
  background: #000; border-radius: 12px; box-shadow: 6px 6px 0 var(--pop);
}
.player iframe { width: 100%; height: 100%; border: 0; display: block; }
.play { all: unset; cursor: pointer; position: absolute; inset: 0; display: grid; place-items: center; }
.play img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(2px) brightness(.55); transform: scale(1.04); }
.play-label {
  position: relative; font: 800 clamp(1.25rem, 3vw + .6rem, 1.6rem)/1 var(--display); background: var(--sun); color: var(--ink);
  padding: .9em 2.2em; border-radius: 999px; box-shadow: 4px 4px 0 var(--pop);
}
.play:active .play-label { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--pop); }
.play:focus-visible { outline: 3px solid var(--sun); outline-offset: -3px; }
.player-bar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .6rem .75rem; margin-top: .9rem; }

/* Star rating under the game */
.rating { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .75rem; margin-right: auto; }
.stars { display: flex; }
.stars button {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0; margin: 0;
  background: none; border-radius: 6px; cursor: pointer; color: inherit;
}
.s-wrap { position: relative; display: block; width: 28px; height: 28px; }   /* the star itself; partial fills are a % of this */
.stars svg { display: block; width: 28px; height: 28px; }
.s-empty svg { fill: #463a86; }
.s-fill { position: absolute; top: 0; left: 0; height: 100%; overflow: hidden; pointer-events: none; }
.s-fill svg { fill: #ffc83d; filter: drop-shadow(0 1px 0 rgb(0 0 0 / .25)); }
.stars button[aria-pressed="true"] .s-empty svg { stroke: #ffc83d; stroke-width: 1.2; }
.rating-score { font-weight: 600; font-variant-numeric: tabular-nums; }
.rating-msg { color: var(--muted); font-size: .9rem; }
.rating-msg:empty { display: none; }
.rating-score { white-space: nowrap; }
.rating-msg.err { color: #ff9cbc; }
.rating.busy .stars { opacity: .6; pointer-events: none; }
/* Preview: highlight the star under the pointer (or keyboard focus) and every star before it */
@media (hover: hover) {
  .fav-btn:hover svg { transform: scale(1.12); }
  .fav-remove:hover { background: rgb(15 10 40 / .9); }
  .stars:hover .s-fill { width: 0 !important; }
  .stars button:hover .s-fill, .stars button:has(~ button:hover) .s-fill { width: 100% !important; }
}
.stars:has(button:focus-visible) .s-fill { width: 0 !important; }
.stars button:focus-visible .s-fill, .stars button:has(~ button:focus-visible) .s-fill { width: 100% !important; }
.stage.immersive .rating, .stage.immersive .fav-btn { display: none; }

/* Favourite heart (left of the star rating); the two stay side by side */
.fav-rate { display: flex; align-items: flex-start; gap: .35rem; margin-right: auto; min-width: 0; }
.fav-rate .fav-btn { margin-block: -7px; }   /* centre the 52px heart on the 38px star row, even when the score wraps below */
.fav-rate .rating { margin-right: 0; min-width: 0; }
.stage.immersive .fav-rate { display: none; }
.fav-btn {
  flex: none; display: inline-grid; place-items: center; width: 52px; height: 52px; padding: 0;
  border-radius: 50%; background: transparent; color: #ff2d4a; cursor: pointer;
}
.fav-btn[hidden] { display: none; }
.fav-btn svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .15s; }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.fav-btn.pop svg { animation: fav-pop .35s ease; }
@keyframes fav-pop { 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
.fav-btn:focus-visible { outline-offset: 0; }

/* "My favourites" on the home page — only when the browser can store favourites */
.favs { display: none; margin-top: 1rem; }
.fav-ok .favs { display: block; }
.fav-count:empty { display: none; }
.fav-empty {
  display: flex; align-items: center; gap: 1rem; max-width: 640px; padding: 1rem 1.2rem;
  background: var(--panel); border: 1px dashed var(--line); border-radius: 12px; color: #dcd5f5;
}
.fav-empty[hidden] { display: none; }
.fav-empty p { margin: 0; }
.fav-empty svg { flex: none; fill: none; stroke: #ff2d4a; stroke-width: 2; }
.fav-item { position: relative; min-width: 0; }
.fav-remove {
  position: absolute; top: .4rem; right: .55rem; display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0; border-radius: 50%;
  background: rgb(15 10 40 / .7); color: #ff2d4a;
}
.fav-remove svg { fill: currentColor; }
.fav-more { margin-top: 1rem; font-weight: 600; }
.player-bar .exit, .player-bar .bar-title { display: none; }
.about { max-width: 70ch; }
.about p { color: #dcd5f5; }

/* Play mode: the game fills the screen, with a slim bar to get back out.
   Used on phones when Play is tapped, and for "Full screen" everywhere
   (it also covers iPhone, which has no real full-screen API for pages). */
.stage.immersive {
  position: fixed; inset: 0; z-index: 1000; width: auto; margin: 0; background: #000;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.stage.immersive .player {
  flex: 1; min-height: 0; aspect-ratio: auto; border-radius: 0; box-shadow: none;
  width: min(100%, calc((100dvh - 44px) * var(--ar) * 1.6)); margin-inline: auto;
}
.stage.immersive .player-bar {
  order: -1; margin: 0; height: 44px; padding: 0 .5rem; justify-content: flex-start; background: var(--ink); flex: none;
}
.stage.immersive .exit { display: inline-flex; }
.stage.immersive .bar-title { display: block; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.stage.immersive #fs { display: none; }
.player-bar .exit { align-items: center; gap: .35rem; min-height: 36px; padding: 0 .8rem; background: var(--panel); color: var(--paper); }

/* Footer */
.site-foot { margin-top: 3rem; border-top: 1px solid var(--line); background: var(--panel); padding-bottom: env(safe-area-inset-bottom); }
.foot-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem 1.5rem; flex-wrap: wrap; padding-block: 1rem; color: var(--muted); font-size: .9rem; }
.foot-row p { margin: 0; }
.foot-links { display: flex; gap: .25rem 1.25rem; flex-wrap: wrap; }
.foot-links a { display: inline-flex; align-items: center; min-height: var(--tap); }

/* Pointer-only niceties: hover effects never stick on touch screens */
@media (hover: hover) {
  .allcats-panel a:hover { background: var(--line); }
  .allcats-panel a[aria-current]:hover { background: var(--sun); }
  .js .allgames-btn:not([aria-expanded="true"]):not(.is-current):hover::after { background: var(--line); }
  .music-btn:hover { background: var(--line); }
  .cats a:hover { background: var(--line); }
  .cats a[aria-current]:hover { background: var(--sun); }
  .card:hover img, .card:focus-visible img { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--sun); }
  .play:hover .play-label { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--pop); }
  .pager a:hover { border-color: var(--sun); }
}

/* Phones */
@media (max-width: 359px) {
  .rating .stars button { width: 27px; }
  .rating .s-wrap, .rating .stars svg { width: 24px; height: 24px; }
  .rating .rating-score { font-size: .85rem; }
  .rating { gap: .25rem .4rem; }
  .logo { font-size: 1.02rem; }
  .js .icon-btn { width: 40px; }
  .head-row { gap: .5rem; }
  .search { flex-basis: 7rem; }
}
@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem .75rem; }
  .card img, .card .noimg { box-shadow: 3px 3px 0 var(--pop); }
  .card-title { font-size: .88rem; }
  /* Featured becomes a swipeable row that peeks the next card */
  .grid-feat {
    display: flex; overflow-x: auto; gap: .9rem; scroll-snap-type: x mandatory;
    margin-inline: calc(-1 * var(--gutter)); padding: 0 var(--gutter) .4rem; scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .grid-feat::-webkit-scrollbar { display: none; }
  .grid-feat .card { flex: 0 0 72%; scroll-snap-align: start; }
  /* Most played: same two-column grid as the rest of the site, top 6 only ("See all" has the rest) */
  .grid-row > :nth-child(n+7) { display: none; }
  .grid-row.fav-grid > :nth-child(n+7) { display: block; }   /* favourites always show up to the admin limit */
  .card-plays { font-size: .78rem; }
  .player { box-shadow: 4px 4px 0 var(--pop); border-radius: 10px; }
  .stars button { width: 30px; height: 38px; }
  .s-wrap, .stars svg { width: 26px; height: 26px; }
  .rating { gap: .25rem .5rem; }
  .rating-score { font-size: .92rem; }
  /* the game keeps its shape, but the strip under it (stars, score, full screen) uses the full width */
  .stage:not(.immersive) { width: 100%; }
  .stage:not(.immersive) .player { width: min(100%, calc(62vh * var(--ar))); margin-inline: auto; }
  .ad { margin: .75rem auto; }
  .pager-pos { font-size: .82rem; }
  .foot-row { flex-direction: column; align-items: flex-start; }
}

/* Home page intro text */
.home-intro { max-width: 75ch; margin: 1.5rem 0 .5rem; color: #e4ddf8; }
.home-intro p, .home-intro ul { margin: 0 0 .8rem; }
.home-intro ul { padding-left: 1.25rem; }
.home-intro h2 { margin: 0 0 .6rem; }
.home-intro h3 { font: 700 1.05rem var(--body); margin: 1rem 0 .4rem; }
.home-intro strong { color: var(--paper); }
.home-intro + section h2 { margin-top: 1.25rem; }

/* Videos page */
.vid-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.25rem; align-items: start; }
.vid-layout.vid-single { grid-template-columns: minmax(0, 1fr); max-width: 1000px; }
.vid-frame { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; box-shadow: 6px 6px 0 var(--pop); }
.vid-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vid-now h2 { margin: 1rem 0 .2rem; font-size: 1.2rem; }
.vid-now p { margin: 0; }
.vid-list { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; max-height: min(78vh, 720px); }
.vid-list-head { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.vid-list ol { list-style: none; margin: 0; padding: .35rem; overflow-y: auto; overscroll-behavior: contain; }
.vid-item {
  all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 1.4rem 120px 1fr; gap: .6rem;
  align-items: center; width: 100%; padding: .45rem; border-radius: 8px;
}
.vid-item:focus-visible { outline: 3px solid var(--sun); outline-offset: -3px; }
.vid-item[aria-current] { background: var(--line); }
.vid-item[aria-current] .vid-num { color: var(--sun); }
.vid-num { color: var(--muted); font-size: .8rem; text-align: center; font-variant-numeric: tabular-nums; }
.vid-item img { width: 120px; aspect-ratio: 16 / 9; height: auto; object-fit: cover; border-radius: 6px; background: var(--ink); }
.vid-meta { min-width: 0; display: grid; gap: .1rem; }
.vid-title { font-size: .9rem; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vid-meta .muted { font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vid-admin-thumbs { display: flex; gap: .4rem; flex-wrap: wrap; }
.vid-admin-thumbs img { border-radius: 6px; width: 120px; height: 68px; object-fit: cover; }
@media (hover: hover) { .vid-item:not([aria-current]):hover { background: rgb(61 49 128 / .5); } }
@media (max-width: 900px) {
  .vid-layout { grid-template-columns: minmax(0, 1fr); }
  .vid-list { max-height: none; }
  .vid-list ol { overflow: visible; }
}
@media (max-width: 600px) {
  .vid-frame { border-radius: 10px; box-shadow: 4px 4px 0 var(--pop); }
  .vid-item { grid-template-columns: 1.2rem 104px 1fr; }
  .vid-item img { width: 104px; }
}

/* Info pages, news and contact */
.doc { max-width: 72ch; }
.doc-body { color: #e4ddf8; }
.doc-body h2 { margin-top: 2rem; }
.doc-body h3 { font: 700 1.05rem var(--body); margin: 1.5rem 0 .5rem; }
.doc-body p, .doc-body ul { margin: 0 0 1rem; }
.doc-body ul { padding-left: 1.25rem; }
.doc-body li { margin-bottom: .35rem; }
.doc-body strong { color: var(--paper); }
.doc-meta { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
.doc > .doc-meta:last-child { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.doc-back { margin: 1.25rem 0 0; }
.doc-back + h1 { margin-top: .5rem; }
.post-hero { width: 100%; border-radius: 12px; margin: 0 0 1.5rem; box-shadow: 6px 6px 0 var(--pop); }

.post-list { display: grid; gap: 1.75rem; max-width: 900px; }
.post-item { display: grid; gap: 1.25rem; padding-bottom: 1.75rem; border-bottom: 1px solid var(--line); }
.post-item.has-img { grid-template-columns: minmax(0, 260px) 1fr; }
.post-item img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r); box-shadow: 4px 4px 0 var(--pop); }
.post-item h2 { margin: 0 0 .3rem; }
.post-item h2 a { color: var(--paper); text-decoration: none; }
.post-item h2 a:hover { color: var(--sun); }
.post-item p { margin: 0 0 .4rem; color: #dcd5f5; }
.post-item .doc-meta { margin-bottom: .5rem; }

.contact-form { margin-top: 1.5rem; }
.contact-form label { display: block; margin-bottom: 1.1rem; font-weight: 600; }
.contact-form input, .contact-form textarea { display: block; width: 100%; margin-top: .35rem; min-height: var(--tap); font-weight: 400; }
.contact-form textarea { resize: vertical; }
.contact-form [aria-invalid="true"] { border-color: var(--pop); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.opt { color: var(--muted); font-weight: 400; }
.field-err { display: block; color: #ff9cbc; font-weight: 400; font-size: .9rem; margin-top: .3rem; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.captcha { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin: 0 0 1.25rem; }
.captcha legend { font: 600 1rem var(--body); color: var(--paper); padding: 0 .4rem; }
.captcha-row { display: flex; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.captcha-row img { border-radius: 8px; border: 1px solid var(--line); }
.captcha-input { max-width: 12rem; text-transform: uppercase; letter-spacing: .15em; }
.captcha label { margin-bottom: 0; }
.form-note { color: var(--muted); font-size: .9rem; margin-top: 1rem; }
.notice { border-radius: 10px; padding: .9rem 1.1rem; margin: 1rem 0; background: var(--panel); border-left: 4px solid var(--sun); }
.notice p { margin: .25rem 0; }
.notice-err { border-color: var(--pop); }
.contact-form button[type=submit] { min-height: var(--tap); padding-inline: 1.6rem; }

@media (max-width: 600px) {
  .post-item.has-img { grid-template-columns: 1fr; gap: .9rem; }
  .field-row { grid-template-columns: 1fr; }
  .foot-links { gap: 0 1.1rem; }
}

/* Forms (shared) */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; max-width: 100%;
}
button, .btn {
  background: var(--sun); color: var(--ink); border: 0; border-radius: 8px; padding: .55rem 1.1rem;
  font-weight: 700; cursor: pointer; text-decoration: none; display: inline-block;
}
button:disabled { opacity: .45; cursor: default; }
button.link { background: none; color: var(--sun); padding: 0; font-weight: 400; text-decoration: underline; }
button.danger, .danger { color: var(--pop); }

/* Admin */
.admin .head-row { flex-wrap: wrap; }
.admin .logo { flex: none; }
.admin-tabs { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.admin-tabs a { color: var(--paper); text-decoration: none; padding: .3rem .7rem; border-radius: 6px; }
.admin-tabs a[aria-current] { background: var(--sun); color: var(--ink); }
.admin-tabs form { margin-left: .5rem; }
.admin-main { padding-bottom: 3rem; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem 1.4rem; margin: 1rem 0; }
.box.narrow { max-width: 440px; }
.box label { display: block; margin-bottom: .9rem; }
.box label > input:not([type=checkbox]), .box label > select, .box label > textarea { display: block; width: 100%; margin-top: .3rem; }
.box textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }
.check { display: flex !important; gap: .5rem; align-items: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
legend { font: 800 1.2rem var(--display); color: var(--sun); margin-bottom: .6rem; }
.inline-form { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; }
.inline-form label { margin: 0; flex: 1 1 240px; }
.flash { padding: .8rem 1rem; border-radius: 8px; margin-top: 1rem; border-left: 4px solid var(--sun); background: var(--panel); }
.flash-err { border-color: var(--pop); }
.stats { font-size: 1.1rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.prose { max-width: 70ch; }
.filters, .bulk { display: flex; gap: .5rem; flex-wrap: wrap; margin: .8rem 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; }
tr.off td { opacity: .5; }
.games-table img { border-radius: 4px; width: 64px; height: 48px; object-fit: cover; }
.toggle { padding: .2rem .6rem; font-size: .85rem; background: var(--line); color: var(--paper); }
.toggle[aria-pressed="true"] { background: var(--sun); color: var(--ink); }
.cat-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.cat-row input[name=name] { flex: 1 1 180px; }
.cat-row input[name=slug] { flex: 1 1 160px; color: var(--muted); }
.cat-row select { flex: 0 1 260px; font-size: .88rem; }
.star-txt { color: #ffc83d; }
tr.unread td { font-weight: 700; }
tr.unread td .muted { font-weight: 400; }
.msg-body { margin-top: 1rem; white-space: normal; overflow-wrap: anywhere; }
.msg-actions { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.fmt-help { margin: -.4rem 0 1rem; color: var(--muted); font-size: .9rem; }
.fmt-help summary { cursor: pointer; color: var(--sun); }
form.inline { display: inline; }
.small { font-size: .88rem; margin-top: -.4rem; }
textarea.code { font-size: .82rem; }
.ad-switches td:not(:first-child), .ad-switches th:not(:first-child) { width: 7.5rem; }
.size-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; }
.size-row select { width: 100%; margin-top: .3rem; }
.size-custom { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; }
.size-custom input { width: 6rem; }
.size-custom[hidden] { display: none; }
.copy-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.copy-row input { flex: 1 1 320px; min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.btn-ghost { background: transparent; color: var(--sun); border: 1px solid var(--sun); }
.box h3 { font: 700 1.05rem var(--body); margin: 1.4rem 0 .4rem; }
.box p { margin: .4rem 0; }
.nowrap { white-space: nowrap; }
.inline-check { display: inline-flex !important; margin: 0; padding: 0 .3rem; white-space: nowrap; }
.vote-box { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 2rem; padding: .9rem 1rem; margin: 0 0 1rem; background: var(--ink); border-radius: 10px; }
.vote-score { font-size: 1.15rem; white-space: nowrap; }
.vote-score strong { font-size: 1.6rem; }
.vote-bars { display: grid; gap: .2rem; flex: 1 1 260px; max-width: 420px; }
.vote-bar { display: grid; grid-template-columns: 2.6rem 1fr 3rem; align-items: center; gap: .6rem; font-size: .88rem; }
.vote-bar .bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.vote-bar .bar span { display: block; height: 100%; background: #ffc83d; border-radius: 99px; }
.vote-bar > .muted { text-align: right; }
.switch { display: inline-flex !important; align-items: center; gap: .45rem; margin: 0 !important; cursor: pointer; }
.switch input { width: 1.15rem; height: 1.15rem; accent-color: var(--sun); }
.switch input:not(:checked) + span { color: var(--pop); }
details.box > summary { cursor: pointer; font-weight: 700; }
.sticky-save { position: sticky; bottom: 0; padding: .8rem 0; background: linear-gradient(transparent, var(--ink) 35%); margin-top: 1rem; }
code { background: var(--ink); padding: .1rem .35rem; border-radius: 4px; }


@media (max-width: 600px) {
  .row2 { grid-template-columns: 1fr; }
  .size-row { grid-template-columns: 1fr; }
  .admin-tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .admin .head-row { flex-wrap: wrap; }
  .box { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
