/* vGames — art direction borrowed from ComG concept: deep navy, condensed titles, mono UI */

:root {
  --bg: #070d14;
  --bg-deep: #060d16;
  --glow: #173c5a;
  --panel: #0b1722;
  --panel-2: #183e59;
  --panel-solid: #08131e;
  --line: #385167;
  --line-soft: #25353d;
  --line-hi: #87b7d9;
  --text: #d4e0e9;
  --text-2: #a7bbca;
  --muted: #8facbf;
  --dim: #5f7a8e;
  --amber: #e5b06a;
  --amber-hi: #ffe0a0;
  --green: #6fbf8a;
  --red: #d9573f;
  --title: "Barlow Condensed", "Arial Narrow", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --gutter: max(20px, 7vw);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 80% 0%, var(--glow), var(--bg-deep) 65%) fixed, var(--bg);
  color: var(--text);
  font: 12px/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
}

a, button, input { font: inherit; color: inherit; }
code { color: var(--amber); }
.hidden { display: none !important; }

::selection { background: var(--amber); color: var(--bg); }

.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(#87b7d90a 1px, transparent 1px),
    linear-gradient(90deg, #87b7d90a 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 80%);
}

/* ------------------------------------------------------------------ top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 15px var(--gutter);
  background: linear-gradient(#07101bf0, #07101b00);
}

.brand b { font: 800 24px/1 var(--title); letter-spacing: 3px; color: var(--amber); }
.brand b span { color: var(--text); }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: 2px; }

.relay {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: #111f2be8;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 2px;
}
.relay i { width: 7px; height: 7px; background: var(--dim); }
.relay.on i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.relay.off i { background: var(--red); }

/* ------------------------------------------------------------------ hero */

main { flex: 1; padding: 0 var(--gutter); position: relative; }

.hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(220px, 340px);
  grid-template-areas: "kicker kicker kicker" "title text search";
  align-items: end;
  column-gap: 40px;
  padding: 4vh 0 32px;
}

.kicker { grid-area: kicker; color: var(--muted); font-size: 10px; letter-spacing: 3px; }

.hero h1 {
  grid-area: title;
  margin: 4px 0 0;
  font: 800 clamp(52px, 6vw, 92px)/0.86 var(--title);
  letter-spacing: 2px;
  text-shadow: 0 10px 50px #0009;
}
.hero h1 span { color: var(--amber); }

.hero p { grid-area: text; max-width: 520px; margin: 0; color: var(--text-2); line-height: 1.8; }

.search { grid-area: search; display: block; }
.search span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; letter-spacing: 2px; }
.search input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  background: #081522ee;
  outline: none;
}
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: var(--line-hi); background: #0d1d2c; }

/* ------------------------------------------------------------------ game panels */

.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 22px;
  padding-bottom: 60px;
}

.card {
  --accent: var(--amber);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 250px;
  padding: 26px 28px 22px;
  overflow: hidden;
  background: linear-gradient(110deg, var(--panel), var(--panel-2));
  border: 1px solid #38516755;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  animation: rise 0.5s both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.card:hover, .card:focus-within {
  border-color: var(--line-hi);
  transform: translateY(-3px);
  box-shadow: 0 18px 40px #0008;
}

/* corner ticks */
.card::before, .card::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 0 solid var(--accent);
  pointer-events: none;
}
.card::before { top: 8px; left: 8px; border-top-width: 2px; border-left-width: 2px; }
.card::after { bottom: 8px; left: 8px; border-bottom-width: 2px; border-left-width: 2px; opacity: 0.4; }

.card-thumb {
  position: absolute;
  inset: 0 0 0 30%;
  background-size: cover;
  background-position: center;
  opacity: 0.32;
  mask-image: linear-gradient(90deg, transparent, #000 70%);
  transition: opacity 0.3s, transform 0.6s;
  pointer-events: none;
}
.card:hover .card-thumb { opacity: 0.55; transform: scale(1.04); }

.card-link { position: absolute; inset: 0; z-index: 1; }
.card-link:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }

.card-top, .card-name, .card-meta, .card-desc, .card-bottom { position: relative; }

.card-top { display: flex; justify-content: space-between; gap: 10px; color: var(--dim); font-size: 10px; letter-spacing: 2px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge { padding: 2px 7px; border: 1px solid var(--line); background: #07101bb0; color: var(--muted); }
.badge.multi { border-color: var(--accent); color: var(--accent); }

.card-name {
  margin: 18px 0 12px;
  font: 600 42px/0.95 var(--title);
  letter-spacing: 1px;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.card-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; font-size: 11px; }
.card-meta div { display: flex; gap: 8px; }
.card-meta dt { color: var(--dim); letter-spacing: 1.5px; }
.card-meta dd { margin: 0; color: var(--text); }

.card-desc {
  margin: 14px 0 0;
  max-width: 44ch;
  color: var(--text-2);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
  padding-top: 18px;
}
.card-play { color: var(--dim); font-size: 10px; letter-spacing: 3px; transition: color 0.2s; }
.card:hover .card-play { color: var(--accent); }

.more {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: #111f2be8;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.more svg { width: 16px; height: 16px; transition: transform 0.2s; }
.more:hover, .more:focus-visible { border-color: var(--accent); color: var(--accent); background: #1a3143; outline: none; }
.more:hover svg { transform: translate(2px, 2px); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ------------------------------------------------------------------ empty */

.empty {
  max-width: 620px;
  margin-bottom: 60px;
  padding: 30px;
  background: linear-gradient(110deg, var(--panel), var(--panel-2));
}
.empty strong { font: 600 38px var(--title); letter-spacing: 1px; }
.empty p { color: var(--text-2); line-height: 1.8; }

/* ------------------------------------------------------------------ details dialog */

.details {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--text);
  overflow: hidden;
}
.details[open] { display: flex; animation: pop 0.22s ease-out; }
.details::backdrop {
  background: #03080fa6;
  backdrop-filter: blur(10px) saturate(0.8);
  -webkit-backdrop-filter: blur(10px) saturate(0.8);
  animation: fade 0.22s ease-out;
}
.details article { display: flex; flex-direction: column; width: 100%; min-height: 0; }

.details-banner {
  flex: 0 0 150px;
  background: linear-gradient(110deg, var(--panel), var(--panel-2));
  background-size: cover;
  background-position: center;
  mask-image: linear-gradient(#000 40%, transparent);
}

.close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: #111f2be8;
  cursor: pointer;
}
.close:hover { border-color: var(--line-hi); background: #1a3143; }

.details-body { padding: 0 32px 24px; margin-top: -60px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.details-body h2 { margin: 6px 0 12px; font: 600 58px/0.95 var(--title); text-transform: uppercase; letter-spacing: 1px; overflow-wrap: anywhere; }
.details-description { margin: 0 0 22px; color: var(--text-2); line-height: 1.8; white-space: pre-line; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  margin: 0 0 20px;
  border-top: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft);
}
.facts div { padding: 11px 14px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.facts dt { color: var(--dim); font-size: 10px; letter-spacing: 2px; }
.facts dd { margin: 3px 0 0; overflow-wrap: anywhere; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.chips:empty { display: none; }
.chip { padding: 3px 9px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.section-title { margin: 0 0 8px; color: var(--muted); font-size: 10px; letter-spacing: 3px; }
.controls { margin: 0 0 20px; padding: 0; list-style: none; }
.controls li { padding: 5px 0; border-bottom: 1px dashed var(--line-soft); color: var(--text-2); }
.controls li::before { content: "▸ "; color: var(--amber); }

.prompt {
  margin: 0 0 8px;
  padding: 14px 16px;
  border-left: 2px solid var(--amber);
  background: #0d1a26;
  color: var(--text-2);
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.7;
}

.details-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 32px;
  border-top: 1px solid var(--line-soft);
  background: #07101b;
}
.details-repo { color: var(--dim); overflow-wrap: anywhere; }
.details-repo a { color: var(--line-hi); }

.play {
  flex: none;
  display: inline-flex;
  gap: 10px;
  padding: 11px 22px;
  border: 1px solid var(--amber);
  background: var(--amber);
  color: var(--bg);
  font-weight: 500;
  letter-spacing: 3px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.play:hover { background: var(--amber-hi); }

@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes fade { from { opacity: 0; } }

/* ------------------------------------------------------------------ footer */

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
  border-top: 1px solid #25353d80;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 2px;
}

/* ------------------------------------------------------------------ 404 */

.lost { display: grid; align-content: center; justify-items: start; gap: 8px; min-height: 100vh; }
.lost h1 { margin: 0; font: 800 clamp(56px, 12vw, 140px)/0.9 var(--title); }
.lost p { color: var(--text-2); margin: 0 0 20px; }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1100px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(220px, 340px); grid-template-areas: "kicker kicker" "title title" "text search"; row-gap: 14px; }
}

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "kicker" "title" "text" "search"; row-gap: 16px; padding-top: 3vh; }
  .card-name { font-size: 36px; }
  .details-body { padding: 0 20px 20px; }
  .details-body h2 { font-size: 44px; }
  .details-actions { padding: 14px 20px; flex-direction: column; align-items: stretch; text-align: center; }
  .play { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
