/* Lobby de play.xb.ar. La lista es el sitio: nombre, cupo, jugar. */

:root {
  --bg: #100e0c;
  --bg-2: #1a1612;
  --ink: #f4efe6;
  --muted: #a89b8c;
  --line: #2c261f;
  --red: #ff3a2a;
  --brass: #e0b15a;
  --shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
  --serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(255, 58, 42, 0.16), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.45;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.25rem 6vw 0;
}

.mark {
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.mark span {
  color: var(--muted);
  font-weight: 400;
}

.top nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.95rem;
}

.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--ink); }

.lobby {
  flex: 1;
  max-width: calc(40rem + 12vw);
  padding: 2.2rem 6vw 4rem;
}

.kicker {
  margin: 0 0 0.6rem;
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 2.5rem;
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(3.2rem, 8vw, 6.4rem);
  letter-spacing: -0.035em;
  line-height: 0.92;
}

.games {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.6rem 8.4rem;
  column-gap: 1.25rem;
  align-items: center;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
}

.name {
  display: flex;
  align-items: center;
  min-width: 0;
  line-height: 0;
  text-decoration: none;
}

.name img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 3rem;
}

.game:hover .name img { filter: brightness(1.12); }

.cupo {
  display: flex;
  gap: 0.12rem;
  color: var(--brass);
}

.cupo svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
  fill: currentColor;
}

.acciones {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.acciones a {
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}

.go { color: var(--ink); }
.game:hover .go,
.acciones .go:hover { color: var(--red); }

.otra {
  color: var(--muted);
  font-weight: 500;
}

.otra:hover { color: var(--ink); }

.game a:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

.registro {
  margin: 1.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.page {
  flex: 1;
  width: min(1120px, calc(100% - 8vw));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.page h1 {
  font-size: clamp(2.8rem, 6vw, 4.6rem);
  margin-bottom: 0.4rem;
}

.lede {
  margin: 0 0 1.8rem;
  max-width: 40rem;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(240px, 420px) minmax(260px, 1fr);
  gap: 2rem;
  align-items: start;
}

.stage {
  position: relative;
  width: min(100%, 520px);
  aspect-ratio: 1;
  overflow: hidden;
  background: #202020;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* El runtime dibuja el juego a 100% del host. El cuadrado lo marca .stage. */
.stage-boot {
  margin: 0;
  padding: 1.2rem 1rem 0;
  max-width: 18rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.stage wasm4-app {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.layout-arcade {
  grid-template-columns: minmax(320px, 1.5fr) minmax(240px, 0.7fr);
}

.cabinet {
  position: relative;
  width: 100%;
  aspect-ratio: 304 / 224;
  background: #000;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.cabinet #game {
  width: 100%;
  height: 100%;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input[type="text"], input[type="url"] {
  width: 100%;
  background: var(--bg-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0.75rem 0.8rem;
  font: inherit;
}

button, .button {
  appearance: none;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-weight: 600;
  padding: 0.75rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

button:hover, .button:hover { background: var(--red); color: white; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.secondary:hover { border-color: var(--ink); background: transparent; color: var(--ink); }

.row { display: flex; gap: 0.5rem; }
.row > * { flex: 1; }

.note, .status {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status strong { color: var(--ink); font-weight: 600; }

.keys {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.keys th, .keys td {
  text-align: left;
  padding: 0.35rem 0.6rem 0.35rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.keys th { color: var(--muted); font-weight: 500; width: 7rem; }
.keys-play th { width: auto; }
.keys-play td { white-space: nowrap; }

.fine {
  font-size: 0.85rem;
  color: var(--muted);
}

.fine a { color: var(--brass); }
.lobby .fine { margin: 1.15rem 0 0; }

.bitacora {
  margin: 0;
  max-height: 9rem;
  overflow: auto;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted);
  white-space: pre-wrap;
  background: #1a1714;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
}

.error { color: #ffb4a8; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.pill i {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #6b6258;
  display: inline-block;
}

.pill.up i { background: #7dce6a; }
.pill.down i { background: var(--red); }

.bar {
  height: 4px;
  background: var(--line);
  margin-top: 0.4rem;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brass);
}

.screen {
  background: #000;
  min-height: 280px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 1.5rem;
}

.screen:has(canvas) {
  padding: 0;
  display: block;
}

.screen canvas {
  width: 100%;
  height: auto;
  display: block;
  border: 0;
  outline: none;
}

@media (max-width: 800px) {
  .layout, .layout-arcade { grid-template-columns: 1fr; }
  .top nav { display: none; }
  .lobby { max-width: none; }
  .game {
    column-gap: 0.7rem;
    row-gap: 0.15rem;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name acciones" "cupo acciones";
  }
  .name { grid-area: name; }
  .name img { max-height: 2.45rem; }
  .cupo { grid-area: cupo; }
  .acciones { grid-area: acciones; align-self: center; }
  .acciones { gap: 0.7rem; }
}
