/* games.vovaauer.com — shared styles for the index and every game page.
   Same palette as the main site; no fonts, no images, no frameworks. */

:root {
  --bg: #0b0b0e;
  --fg: #e8e8ea;
  --muted: #9a9aa2;
  --line: rgba(255, 255, 255, 0.10);
  --card: rgba(255, 255, 255, 0.03);
  --card-hover: rgba(255, 255, 255, 0.06);
  --accent: #c9c9d4;
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ── index ───────────────────────────────────────────────────────── */
.index {
  max-width: 52rem;
  margin: 0 auto;
  padding: clamp(2rem, 8vh, 5rem) 16px 3rem;
}
.index h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
.index .sub { color: var(--muted); margin: 0 0 2rem; }
.index .sub a { color: var(--fg); }
.games {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: .75rem;
}
.games a {
  display: block;
  height: 100%;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.games a:hover { background: var(--card-hover); border-color: rgba(255, 255, 255, .2); }
.games a:active { transform: scale(.99); }
.games svg { display: block; width: 2.4rem; height: 2.4rem; margin-bottom: .6rem; }
.games h2 { font-size: 1.05rem; margin: 0 0 .2rem; }
.games p { margin: 0; color: var(--muted); font-size: .88rem; }
.games .tag {
  display: inline-block; margin-top: .6rem;
  font: 500 .7rem/1 var(--mono); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: .25rem .5rem;
}
.index footer { margin-top: 2.5rem; color: var(--muted); font-size: .85rem; }

/* ── game page ───────────────────────────────────────────────────── */
body.game { overflow: hidden; }
#stage { position: fixed; inset: 0; }
.hud {
  position: fixed; top: 10px; left: 10px; right: 10px;
  display: flex; align-items: center; gap: .6rem;
  pointer-events: none;           /* the game gets the mouse everywhere else */
  font-size: .85rem;
  z-index: 2;
}
.hud > * { pointer-events: auto; }
.hud a, .hud button {
  appearance: none;
  font: inherit; color: var(--fg); text-decoration: none;
  background: rgba(11, 11, 14, .6);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .3rem .75rem;
  cursor: pointer;
}
.hud a:hover, .hud button:hover { border-color: rgba(255, 255, 255, .25); }
.hud .hint {
  color: var(--muted);
  pointer-events: none;
  background: rgba(11, 11, 14, .45);
  border-radius: 999px;
  padding: .3rem .75rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.hud .spacer { flex: 1; pointer-events: none; }
.hud.faded { opacity: .25; transition: opacity .4s ease; }
.hud.faded:hover { opacity: 1; }

#panel {
  position: fixed; top: 52px; right: 10px;
  width: min(20rem, calc(100vw - 20px));
  max-height: calc(100vh - 64px); overflow: auto;
  padding: .8rem .9rem .9rem;
  background: rgba(11, 11, 14, .82);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  z-index: 3;
}
#panel[hidden] { display: none; }
#panel .bs-h {
  display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
  margin: 0 0 .6rem; font-weight: 600;
}
#panel .bs-meta { font: 500 .7rem/1.2 var(--mono); color: var(--muted); text-align: right; }

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr));
  gap: .25rem;
  margin: 0; padding: 0; list-style: none;
}
.level-grid button {
  appearance: none; background: transparent;
  border: 1px solid var(--line); border-radius: 6px;
  color: var(--fg); font: 500 .72rem/1 var(--mono);
  padding: .35rem 0; width: 100%;
  position: relative; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.level-grid button:hover:not([disabled]) { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .18); }
.level-grid button[aria-current="true"] { background: rgba(201, 201, 212, .12); border-color: var(--accent); }
.level-grid button[disabled] { cursor: not-allowed; opacity: .45; color: var(--muted); }
.level-grid button .lock { position: absolute; right: .28rem; top: 50%; transform: translateY(-50%); opacity: .75; }

.msg {
  position: fixed; inset: 0; display: grid; place-items: center;
  color: var(--muted); font: 14px var(--mono); padding: 16px; text-align: center;
}

/* ── multiplayer lobby (game.js, pages with data-multiplayer) ────── */
.lobby {
  position: fixed; inset: 0; z-index: 4;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(11, 11, 14, .5);
}
.lobby[hidden] { display: none; }
.lb-card {
  width: min(22rem, 100%);
  max-height: calc(100vh - 32px); overflow: auto;
  display: flex; flex-direction: column; gap: .6rem;
  padding: 1.2rem 1.1rem 1.1rem;
  background: rgba(11, 11, 14, .88);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.lb-card h1 { font-size: 1.35rem; margin: 0 0 .2rem; letter-spacing: -.01em; }
.lb-card h2 { font-size: 1.25rem; margin: 0; letter-spacing: -.01em; }
.lb-card p { margin: 0; }
.lb-card .lb-label {
  margin-top: .35rem; text-align: left;
  font: 500 .7rem/1 var(--mono); color: var(--muted); letter-spacing: .04em;
}
.lb-row { display: flex; gap: .4rem; }
.lb-row > * { flex: 1; min-width: 0; }
.lb-card button {
  appearance: none;
  font: inherit; color: var(--fg);
  min-height: 44px;                 /* thumb-sized */
  padding: .6rem .8rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.lb-card button:hover { background: var(--card-hover); border-color: rgba(255, 255, 255, .2); }
.lb-card button:active { transform: scale(.99); }
.lb-card button:focus-visible, .lb-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lb-card button.primary { background: rgba(201, 201, 212, .12); border-color: var(--accent); }
.lb-card button.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.lb-card button.quiet:hover { color: var(--fg); }
.lb-card button small { display: block; color: var(--muted); font-size: .8rem; }
.lb-note { color: #e3a27f; font-size: .9rem; }
.lb-code { font: 600 2rem/1.1 var(--mono); letter-spacing: .18em; padding-left: .18em; }
.lb-link {
  width: 100%;
  font: .76rem var(--mono); color: var(--fg);
  padding: .55rem .6rem;
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line); border-radius: 10px;
}
.lb-score { font: 600 2.2rem/1.1 var(--mono); }
.lb-wait { color: var(--muted); }
.lb-wait::before {
  content: ""; display: inline-block; vertical-align: middle;
  width: .5rem; height: .5rem; margin: 0 .5rem .15rem 0;
  border-radius: 50%; background: var(--accent);
  animation: lb-pulse 1.2s ease-in-out infinite;
}
@keyframes lb-pulse { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .lb-wait::before { animation: none; } }

.hud .net-stat {
  pointer-events: none;
  font: 500 .72rem/1 var(--mono); color: var(--muted);
  background: rgba(11, 11, 14, .45);
  border-radius: 999px;
  padding: .45rem .7rem;
  white-space: nowrap;
}
.hud .net-stat[hidden] { display: none; }
