/* Written for older TV browsers too (LG webOS 6 is roughly Chrome 79): no flex `gap`, no :has(),
   no container queries. Sizes scale with the screen so the page reads from the couch. */

:root {
  --bg: #16121f;
  --card: #241d33;
  --card-edge: #3a2f52;
  --text: #f5f0ff;
  --muted: #b3a8cc;
  --accent: #ffd23f;
  --accent-ink: #231a00;
  --accent-2: #ff6fb5;
  --focus: #7cf3ff;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { font-size: clamp(16px, 1.15vw + 10px, 30px); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(circle at 15% 0%, #2d1f47 0, transparent 45%),
                    radial-gradient(circle at 100% 100%, #3a1a33 0, transparent 40%);
  background-attachment: fixed;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
}

main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.5rem 16px 2rem;
}

header { margin-bottom: 1.5rem; }

h1 {
  margin: 0;
  font-size: 3rem;
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 900;
  color: var(--accent);
}
h1 span { color: var(--accent-2); margin-left: 0.15em; }

.tagline { margin: 0.5rem 0 0; color: var(--muted); max-width: 36rem; }

.games {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  grid-gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1rem;
}

.card h2 { margin: 0 0 0.4rem; font-size: 1.5rem; line-height: 1.15; }

.chips { margin: 0 0 0.6rem; padding: 0; list-style: none; }
.chips li {
  display: inline-block;
  margin: 0 0.35rem 0.35rem 0;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: lowercase; /* tags stay lowercase whatever games.json says */
}

.blurb { margin: 0 0 1rem; }

.actions { margin-top: auto; display: flex; flex-wrap: wrap; }
.actions .btn { flex: 1 1 8rem; margin: 0.25rem; }
.actions { margin-left: -0.25rem; margin-right: -0.25rem; margin-bottom: -0.25rem; }

.btn {
  display: block;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.btn.secondary { background: transparent; color: var(--accent); }

/* Visible focus for TV remotes and keyboards. Browsers without :focus-visible ignore the second rule. */
.btn:focus, .text-link:focus { outline: 4px solid var(--focus); outline-offset: 3px; }
.btn:focus:not(:focus-visible), .text-link:focus:not(:focus-visible) { outline: none; }

.note { color: var(--muted); }

footer { margin-top: 2rem; color: var(--muted); font-size: 0.85rem; }
footer p { margin: 0.25rem 0; }
.text-link { color: var(--accent); }

/* ---------- Gate status (landing page banner, admin and closed pages) ---------- */

.banner {
  margin: 0 0 1.25rem;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}
.banner[hidden] { display: none; }
.banner strong { color: var(--text); }
.banner.open strong { color: #7dff9a; }
.banner.grace strong { color: var(--accent); }

.narrow { max-width: 34rem; }
.logo-link { text-decoration: none; }
.logo-link:focus { outline: 4px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.panel {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
}
.panel h2 { margin: 0 0 0.5rem; font-size: 1.4rem; }
.panel p { margin: 0 0 0.75rem; }

.status { font-weight: 800; font-size: 1.3rem; }
.status-open { color: #7dff9a; }
.status-grace { color: var(--accent); }
.status-closed { color: var(--accent-2); }

.error { color: #ff8a8a; font-weight: 600; }
.muted { color: var(--muted); font-size: 0.9rem; }

.stack label { display: block; margin-bottom: 0.3rem; }
.stack input {
  display: block;
  width: 100%;
  margin-bottom: 0.9rem;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  border: 2px solid var(--card-edge);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.stack input:focus { outline: none; border-color: var(--focus); }
.stack .btn { width: 100%; font: inherit; font-weight: 700; cursor: pointer; }

.row { display: flex; flex-wrap: wrap; margin: 0 -0.25rem 0.5rem; }
.row form { flex: 1 1 10rem; margin: 0.25rem; }
.row .btn { width: 100%; font: inherit; font-weight: 700; cursor: pointer; }

.inline { display: inline; }
.link-button {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--accent); text-decoration: underline; cursor: pointer;
}
.link-button:focus { outline: 4px solid var(--focus); outline-offset: 3px; }

/* Admin page: one line per game in the Updates panel. */
.updates { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.updates li { padding: 0.6rem 0; border-top: 1px solid var(--card-edge); }
.updates li:first-child { border-top: 0; padding-top: 0; }
.updates span { display: block; color: var(--muted); font-size: 0.9rem; }
.updates span span { display: inline; font-size: inherit; }
.updates .warn { color: var(--accent); }
.updates .error { color: #ff8a8a; font-weight: 600; }

/* Only show the remote hint on big screens, where a TV is likely. */
.remote-hint { display: none; }
@media (min-width: 1200px) and (hover: none), (min-width: 1200px) and (pointer: coarse) {
  .remote-hint { display: block; }
}
