/* Game Night: the game-select screen. Everything is sized in rem, and 1rem is a hundredth of the
   screen's width (or the matching share of its height), so a 1080p and a 4K television show the
   same picture at the same apparent size. */
:root {
  --bg: #0b131f; --panel: #142238; --panel2: #1b2d49; --line: rgba(255, 255, 255, 0.14);
  --ink: #f2f5f9; --dim: #a9b6c8; --gold: #ffd166; --accent: #ffd166;
  font-size: max(11px, min(1vw, 1.78vh));
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink); overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none;
}
#shell {
  position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; padding: 3.2rem 5rem 2.6rem;
  background:
    radial-gradient(60rem 34rem at 18% -6%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(70rem 40rem at 92% 112%, rgba(60, 120, 200, 0.2), transparent 70%),
    linear-gradient(180deg, #0d1828, var(--bg));
}
#shell[inert] { visibility: hidden; }

header { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 1.3rem; }
.brand svg { width: 4.4rem; height: 4.4rem; }
h1 { margin: 0; font-size: 3.5rem; font-weight: 800; letter-spacing: -0.02em; }

.pads { display: flex; align-items: center; gap: 0.9rem; font-size: 1.45rem; font-weight: 600; color: var(--dim); padding: 0.8rem 1.5rem; border-radius: 99rem; background: rgba(255, 255, 255, 0.06); border: 0.12rem solid var(--line); }
.pads svg { width: 2.5rem; height: 2.5rem; fill: currentColor; }
.pads.ready { color: var(--ink); }
.pads.ready svg { fill: #7ddc7a; }
.pads.waiting svg { animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: none; opacity: 0.65; } 50% { transform: translateY(-0.2rem); opacity: 1; } }

/* ---- tiles */
#tiles { display: flex; align-items: center; justify-content: safe center; gap: 2.6rem; padding: 2rem 5rem; margin: 0 -5rem; overflow-x: auto; scrollbar-width: none; }   /* reaches the screen's edges so a tile's glow is never cut off */
#tiles::-webkit-scrollbar { display: none; }
.tile {
  --accent: var(--gold);
  flex: 0 0 auto; width: min(27rem, calc((100vw - 16rem) / var(--n, 3))); padding: 0; border: 0; text-align: left; color: inherit; font: inherit; cursor: pointer;
  background: var(--panel); border-radius: 1.8rem; overflow: hidden; position: relative;
  outline: 0.3rem solid transparent; outline-offset: 0.35rem;
  box-shadow: 0 1rem 2.4rem rgba(0, 0, 0, 0.35);
  transform: scale(0.94); opacity: 0.78;
  transition: transform 0.18s ease-out, opacity 0.18s, outline-color 0.18s, box-shadow 0.18s;
}
.tile.on { transform: scale(1.04); opacity: 1; outline-color: var(--accent); box-shadow: 0 1.6rem 4rem rgba(0, 0, 0, 0.5), 0 0 5rem color-mix(in srgb, var(--accent) 30%, transparent); }
.tile:focus { outline-color: transparent; }
.tile.on:focus, .tile:focus-visible { outline-color: var(--accent); }
.tile .art { display: block; aspect-ratio: 16 / 9; background: #0a1220; position: relative; overflow: hidden; }
.tile .art img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s ease-out; }
.tile.on .art img { transform: scale(1.05); }
.tile .art::after { content: ""; position: absolute; inset: 55% 0 0 0; background: linear-gradient(180deg, transparent, rgba(11, 19, 31, 0.75)); }
.tile .play { position: absolute; right: 1rem; bottom: 1rem; z-index: 1; display: flex; align-items: center; gap: 0.55rem; padding: 0.45rem 1.1rem 0.45rem 0.55rem; border-radius: 99rem; background: var(--accent); color: #101a28; font-weight: 800; font-size: 1.35rem; opacity: 0; transform: translateY(0.5rem); transition: opacity 0.18s, transform 0.18s; }
.tile.on .play { opacity: 1; transform: none; }
.tile .body { display: block; padding: 1.4rem 1.7rem 1.6rem; }
.tile .title { display: block; font-size: 2.3rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.tile .tagline { display: block; margin-top: 0.5rem; font-size: 1.22rem; line-height: 1.4; color: var(--dim); min-height: 3.4em; }
.tile .meta { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; gap: 0.6rem 0.8rem; margin-top: 1.1rem; min-height: 5rem; font-size: 1.12rem; font-weight: 700; }   /* room for two rows, so every tile is the same height */
.chip { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.95rem; border-radius: 99rem; background: rgba(255, 255, 255, 0.08); white-space: nowrap; }
.chip[hidden] { display: none; }
.chip svg { width: 1.5rem; height: 1.5rem; fill: currentColor; }
.chip.progress { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.tile.busy .title::after { content: " ..."; color: var(--dim); }

/* ---- button pictures and the hint row */
.hints, #hints { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.8rem 2.6rem; font-size: 1.45rem; font-weight: 600; color: var(--dim); }
.hint { display: inline-flex; align-items: center; gap: 0.65rem; background: none; border: 0; padding: 0.3rem 0.5rem; border-radius: 0.8rem; color: inherit; font: inherit; cursor: pointer; }
.hint:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.g { width: 2.3rem; height: 2.3rem; flex: none; }
.g text { font: 800 17px system-ui, -apple-system, "Segoe UI", sans-serif; fill: #0d1522; text-anchor: middle; }
.play .g { width: 2rem; height: 2rem; }
kbd { display: inline-grid; place-items: center; min-width: 2.3rem; height: 2.3rem; padding: 0 0.6rem; border-radius: 0.55rem; background: #233650; border: 0.12rem solid rgba(255, 255, 255, 0.25); border-bottom-width: 0.3rem; color: var(--ink); font: 700 1.15rem system-ui, -apple-system, "Segoe UI", sans-serif; }
.play kbd { background: rgba(16, 26, 40, 0.16); border-color: rgba(16, 26, 40, 0.4); color: #101a28; min-width: 2rem; height: 2rem; }

/* ---- saved games */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6, 11, 19, 0.72); backdrop-filter: blur(0.5rem); }
.overlay[hidden] { display: none; }
.sheet { width: min(64rem, 92vw); padding: 2.6rem 3rem 2.2rem; border-radius: 2rem; background: var(--panel); border: 0.12rem solid var(--line); box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.6); }
h2 { margin: 0; font-size: 2.6rem; font-weight: 800; }
.sub { margin: 0.6rem 0 1.6rem; font-size: 1.25rem; line-height: 1.45; color: var(--dim); }
.row { display: flex; align-items: center; gap: 1.5rem; width: 100%; min-height: 5.6rem; padding: 0.9rem 1.5rem; margin-top: 0.7rem; border-radius: 1.2rem; border: 0.2rem solid transparent; background: rgba(255, 255, 255, 0.05); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.row.on { border-color: var(--gold); background: var(--panel2); }
.row .name { font-size: 1.7rem; font-weight: 800; }
.row .what { font-size: 1.2rem; color: var(--dim); margin-top: 0.15rem; }
.row .grow { flex: 1; min-width: 0; }
.row .do { font-size: 1.3rem; font-weight: 800; padding: 0.55rem 1.3rem; border-radius: 99rem; border: 0.15rem solid var(--line); color: var(--dim); white-space: nowrap; }
.row.on .do { color: var(--ink); border-color: rgba(255, 255, 255, 0.4); }
.row.none .do { visibility: hidden; }
.row.close { justify-content: center; font-size: 1.5rem; font-weight: 800; min-height: 4.4rem; }
.row.ask { border-color: #ff7b6b; background: #2a2030; cursor: default; }
.row.ask .name { font-size: 1.45rem; }
.pick { font: inherit; font-size: 1.3rem; font-weight: 800; padding: 0.6rem 1.4rem; border-radius: 99rem; border: 0.2rem solid var(--line); background: none; color: var(--dim); cursor: pointer; white-space: nowrap; }
.pick.on { color: #101a28; background: var(--gold); border-color: var(--gold); }
.pick.erase.on { background: #ff7b6b; border-color: #ff7b6b; }
#savehints { margin-top: 1.8rem; }

#toast { position: absolute; left: 50%; bottom: 7.5rem; transform: translateX(-50%); max-width: 80vw; padding: 1rem 1.8rem; border-radius: 1.2rem; background: #f2f5f9; color: #101a28; font-size: 1.4rem; font-weight: 700; text-align: center; box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5); }
#toast[hidden] { display: none; }

/* ---- the game itself, filling the window */
#game { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.plain { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; font-size: 20px; background: var(--bg); }
.plain a { color: var(--gold); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-aspect-ratio: 1/1) {              /* a phone held upright: stack the tiles */
  #shell { padding: 5rem 4rem; overflow-y: auto; display: block; }
  :root { font-size: max(11px, 2.4vw); }
  #tiles { flex-direction: column; overflow: visible; padding: 4rem 0; margin: 0; }
  .tile { width: 100%; }
  header { flex-wrap: wrap; gap: 2rem; }
}
