/* ===== Underground Games ===================================================
   Dark-committed design. Deep charcoal gradient ground, floating gray-gradient
   dock nav, dense game grid with a googly-eyes hover gag.
   ========================================================================= */

:root {
  --bg-0:      #05060a;
  --bg-1:      #0c0e16;
  --bg-2:      #14161f;
  --panel:     #171923;
  --panel-2:   #1e212d;
  --line:      #2a2e3d;
  --text:      #eef0f6;
  --text-dim:  #9aa0b4;
  --text-mute: #6b7185;
  --accent:    #7c5cff;
  --accent-2:  #21d0b2;
  --danger:    #ff5470;
  --radius:    16px;
  --shadow:    0 18px 40px -12px rgba(0,0,0,.65);
  --dock-h:    58px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 78% -8%, rgba(124,92,255,.16), transparent 60%),
    radial-gradient(900px 600px at 8% 12%, rgba(33,208,178,.10), transparent 55%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 46%, #000 100%);
  background-attachment: fixed;
  padding-bottom: calc(var(--dock-h) + 46px);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 10px;
  transition: top .2s;
}
.skip:focus { top: 12px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: linear-gradient(180deg, rgba(8,9,14,.92), rgba(8,9,14,.55) 70%, transparent);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; flex-shrink: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  font-weight: 800; font-size: 18px;
  color: #fff;
  background: linear-gradient(145deg, #2b2f3e, #0e0f16);
  border: 1px solid #3a3f52;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 6px 16px -6px #000;
}
.brand-name {
  font-weight: 800; letter-spacing: .14em; font-size: 13px; line-height: 1;
  display: flex; flex-direction: column; gap: 3px; color: var(--text);
}
.brand-name span { color: var(--text-mute); letter-spacing: .34em; font-size: 10px; }

.search {
  position: relative; flex: 1; max-width: 620px; margin: 0 auto;
}
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; fill: var(--text-mute); }
.search input {
  width: 100%; height: 42px; padding: 0 16px 0 42px;
  border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); color: var(--text); font-size: 14px;
}
.search input::placeholder { color: var(--text-mute); }
.search input:focus { outline: none; border-color: var(--accent); background: rgba(124,92,255,.08); }

.topbar-meta { flex-shrink: 0; }
#count-pill {
  font-size: 12px; color: var(--text-dim);
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.03);
}

/* ---------- layout ---------- */
main { padding: 8px clamp(16px, 4vw, 40px) 0; max-width: 1600px; margin: 0 auto; }

.section-title {
  font-size: clamp(20px, 3vw, 27px); font-weight: 800; letter-spacing: -.01em;
  margin: 18px 2px 16px;
}

/* ---------- category chips ---------- */
.chips {
  display: flex; gap: 9px; flex-wrap: wrap;
  margin: 4px 0 6px;
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height .35s ease, opacity .25s ease, margin .25s ease;
}
.chips.open { max-height: 320px; opacity: 1; margin: 10px 0 4px; }
.chip {
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text-dim); font-size: 12.5px; font-weight: 600;
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  text-transform: capitalize; transition: .15s;
}
.chip:hover { color: var(--text); border-color: #3c4256; }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- game grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  position: relative;
}
/* gray sheen over the grid, like the reference */
.grid::before {
  content: ""; position: absolute; inset: -10px -10px 40%;
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 70%);
  border-radius: 28px; pointer-events: none; z-index: 0;
}

.card {
  position: relative; z-index: 1;
  display: block; border: 0; padding: 0; margin: 0;
  text-align: left; cursor: pointer; color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  will-change: transform;
}
.card:hover, .card:focus-visible {
  transform: translateY(-5px);
  border-color: #45496a;
  box-shadow: var(--shadow);
  outline: none;
}

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--panel-2), #101219);
  overflow: hidden;
}
.card-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease, filter .35s ease;
}
.card:hover .card-thumb img { transform: scale(1.07); filter: saturate(1.1); }

/* play badge */
.card-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at center, rgba(5,6,10,.35), rgba(5,6,10,.7));
  opacity: 0; transition: opacity .2s ease;
}
.card:hover .card-play, .card:focus-visible .card-play { opacity: 1; }
.card-play span {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 8px 24px -6px var(--accent);
  transform: scale(.8); transition: transform .2s ease;
}
.card:hover .card-play span { transform: scale(1); }
.card-play svg { width: 22px; height: 22px; fill: #fff; margin-left: 3px; }

/* googly eyes overlay (drawn by eyes.js) */
.eyes {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 58px; height: 30px; opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  transform: translateY(-6px);
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.45));
}
.card:hover .eyes { opacity: 1; transform: translateY(0); }
.eyes .sclera { fill: #fff; }
.eyes .pupil  { fill: #0a0a0a; transition: transform .05s linear; }

.card-body { padding: 10px 12px 12px; }
.card-title {
  font-size: 13.5px; font-weight: 700; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.card-cat { font-size: 11px; color: var(--text-mute); text-transform: capitalize; margin-top: 3px; }

.more {
  display: block; margin: 26px auto 10px; padding: 12px 26px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-weight: 700; cursor: pointer;
  transition: .15s;
}
.more:hover { border-color: var(--accent); color: #fff; background: rgba(124,92,255,.12); }

.empty { text-align: center; color: var(--text-dim); padding: 60px 0; }

.pagefoot {
  max-width: 1100px; margin: 40px auto 0; padding: 24px clamp(16px,4vw,40px);
  color: var(--text-mute); font-size: 12px; text-align: center; line-height: 1.7;
}
.pagefoot a { color: var(--text-dim); }

/* ---------- floating dock nav (photo 2 shape, gray gradient, photo 3 placement) ---------- */
.dock {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 3px;
  max-width: calc(100vw - 20px);
  padding: 7px 7px 7px 8px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #f4f5f7 0%, #d9dbe0 42%, #b9bcc6 100%);
  border: 1px solid rgba(255,255,255,.6);
  box-shadow:
    0 2px 0 rgba(255,255,255,.5) inset,
    0 -10px 20px -8px rgba(0,0,0,.35) inset,
    0 22px 50px -12px rgba(0,0,0,.7);
}
.dock-logo {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(160deg, #23262f, #0c0d12);
  border: 1px solid #3a3d49;
  box-shadow: 0 2px 6px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.12);
}
.dock-logo svg { width: 19px; height: 19px; fill: #f4f5f7; }
.dock-link, .dock-cta {
  font: inherit; font-weight: 700; font-size: 13.5px;
  border: 0; cursor: pointer; white-space: nowrap;
  padding: 10px 15px; border-radius: 999px;
  background: transparent; color: #2b2d36;
  transition: .15s;
}
.dock-link:hover { color: #000; background: rgba(255,255,255,.5); }
.dock-link.is-active { color: #fff; background: linear-gradient(160deg, #2b2d36, #16171d); box-shadow: 0 3px 8px rgba(0,0,0,.3); }
.dock-cta {
  color: #14161f;
  background: linear-gradient(180deg, #ffffff, #e7e8ec);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 2px 5px rgba(0,0,0,.18);
  margin-left: 2px;
}
.dock-cta:hover { background: #fff; }

@media (max-width: 560px) {
  .brand-name { display: none; }
  .topbar-meta { display: none; }
  .dock-link[data-view="random"] { display: none; }
  .dock { bottom: 14px; gap: 2px; }
  .dock-link, .dock-cta { padding: 9px 11px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
.no-motion *, .no-motion *::before, .no-motion *::after {
  transition: none !important; animation: none !important;
}
.no-motion .card:hover { transform: none; }
.no-motion .card:hover .card-thumb img { transform: none; }
.no-motion .eyes { display: none; }

/* ---------- home rows / rails ---------- */
.row { margin: 26px 0 6px; }
.row-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 0 2px 12px;
}
.row-head h2 { font-size: clamp(17px, 2.4vw, 22px); font-weight: 800; margin: 0; letter-spacing: -.01em; }
.row-all {
  flex-shrink: 0; border: 0; background: none; cursor: pointer;
  color: var(--text-dim); font: inherit; font-weight: 700; font-size: 13px;
}
.row-all:hover { color: var(--accent); }
.rail {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 14px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity;
  padding: 4px 2px 14px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.rail::-webkit-scrollbar { height: 8px; }
.rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.rail .card { scroll-snap-align: start; }
@media (min-width: 700px)  { .rail { grid-auto-columns: 220px; } }
@media (min-width: 1200px) { .rail { grid-auto-columns: 240px; } }

/* ---------- about / prose ---------- */
.prose {
  max-width: 760px; margin: 0 auto; padding: 24px clamp(16px,4vw,40px) 40px;
}
.prose h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 800; letter-spacing: -.02em; margin: 12px 0 14px; }
.prose h2 { font-size: 19px; font-weight: 800; margin: 30px 0 10px; }
.prose p, .prose li { color: var(--text-dim); line-height: 1.75; }
.prose .lead { font-size: 17px; color: var(--text); }
.prose a { color: var(--accent); text-decoration: none; }
.prose a:hover { text-decoration: underline; }
.prose ul { padding-left: 20px; }
.prose li { margin: 6px 0; }
.prose .muted { color: var(--text-mute); font-size: 13px; margin-top: 36px; }
.backlink { color: var(--text-dim); text-decoration: none; font-size: 13px; font-weight: 600; }
.backlink:hover { color: var(--text); }

/* ---------- settings modal ---------- */
.ug-modal[hidden] { display: none; }
.ug-modal {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 20px;
  background: rgba(3,4,7,.66); backdrop-filter: blur(4px);
}
.ug-modal-card {
  width: min(460px, 100%); max-height: 88vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--panel), var(--bg-1));
  border: 1px solid var(--line); border-radius: 20px;
  padding: 22px; box-shadow: var(--shadow);
}
.ug-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ug-modal-head h2 { margin: 0; font-size: 19px; font-weight: 800; }
.ug-x { border: 0; background: none; color: var(--text-dim); font-size: 24px; line-height: 1; cursor: pointer; }
.ug-x:hover { color: var(--text); }
.ug-field { margin: 16px 0; }
.ug-field > label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.ug-hint { color: var(--text-mute); font-size: 12px; margin: 6px 0 0; line-height: 1.5; }
.ug-row { display: flex; gap: 8px; }
.ug-field input[type="text"], .ug-field input:not([type]), .ug-field input[type="url"],
#ug-panic-key, #ug-panic-url, #ug-cloak {
  width: 100%; height: 38px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); color: var(--text); font: inherit; font-size: 13px;
}
#ug-panic-key { width: 56px; text-align: center; flex-shrink: 0; }
.ug-field select { appearance: none; cursor: pointer; }
.ug-swatches { display: flex; gap: 8px; }
.ug-sw {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; box-shadow: 0 0 0 1px rgba(255,255,255,.1);
}
.ug-sw.on { border-color: #fff; }
.ug-btn {
  border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--text);
  font: inherit; font-weight: 700; font-size: 13px; padding: 9px 15px;
  border-radius: 10px; cursor: pointer;
}
.ug-btn:hover { border-color: var(--accent); }
.ug-check { display: flex; align-items: center; gap: 9px; font-weight: 600 !important; cursor: pointer; }
.ug-check input { width: 16px; height: 16px; }

/* dock icon buttons */
.dock a.dock-link { text-decoration: none; display: inline-flex; align-items: center; }
.dock-ico { padding: 9px 10px; }
.dock-ico svg { width: 17px; height: 17px; fill: currentColor; display: block; }
.dock-cta.dock-ico { color: #14161f; }
@media (max-width: 680px) {
  .dock { gap: 1px; padding: 6px; bottom: 14px; overflow-x: auto; scrollbar-width: none; }
  .dock::-webkit-scrollbar { display: none; }
  .dock-link, .dock-cta { padding: 8px 10px; font-size: 12.5px; }
  .dock-link[data-view="new"] { display: none; }
}

/* ---------- ads (a-ads.com) ---------- */
:root { --sticky-ad-h: 0px; }

.ad {
  margin: 24px auto;
  max-width: 728px;
  padding: 0 clamp(16px, 4vw, 40px);
  text-align: center;
}
.row + .ad { margin-top: 6px; }
.ad-top { margin: 14px auto 4px; }
.ad-in-grid { grid-column: 1 / -1; margin: 6px auto; }
.ad-label {
  display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 6px;
}
.ad-inner {
  width: 100%; height: 92px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.ad-inner iframe { width: 100%; height: 100%; }
.ad-slot:empty { display: none; }

/* sticky footer ad — sits below the floating dock */
.ad-sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 54;
  display: flex; justify-content: center;
  padding: 8px 12px;
  background: rgba(8,9,14,.94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.ad-sticky-host { width: 100%; max-width: 728px; }
.ad-sticky-host .ad { margin: 0; padding: 0; }
.ad-sticky-host .ad-inner { height: 72px; border: 0; background: transparent; border-radius: 0; }
.ad-sticky-x {
  position: absolute; top: 3px; right: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.45); color: #fff;
  font-size: 17px; line-height: 1; cursor: pointer; z-index: 1;
}
.ad-sticky-x:hover { background: rgba(0,0,0,.7); }

/* when the sticky ad is present, lift the dock and pad the page */
.dock { bottom: calc(22px + var(--sticky-ad-h)); }
body { padding-bottom: calc(var(--dock-h) + 46px + var(--sticky-ad-h)); }
@media (max-width: 680px) {
  .dock { bottom: calc(14px + var(--sticky-ad-h)); }
}
