/*
 * Merzo Software play theme — the merzosoftware.com look (lobby-app/src/style.css) at
 * the §10 type scale: 18px body, never below 16px, 32/24px headings, 48px
 * targets, 4.5:1 text. Served at /theme.css by play/api. Three text-size
 * presets scale everything from html[data-text-size].
 */
:root {
  color-scheme: dark;
  --bg: #04070a;
  --bg-panel: #070b0d;
  --bg-input: #0d1418;
  --line: #24333a;
  --text: #f1f6f7;
  --text-muted: #b9c6c9;
  --accent: #25dce3;
  --accent-ink: #041013;
  --danger: #ff9a9a;
  --ok: #63e6a7;
  /* Category accents, docs/NEW_PRODUCT.md §4. */
  --accent-crash: #29d7ff;
  --accent-table: #f2c45b;
  --accent-table-alt: #d8b45a;
  --accent-slots: #cf5cff;
  --accent-instant: #63e6a7;
  --text-scale: 1;
  --font: "Oxanium", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
}
html[data-text-size="large"] { --text-scale: 1.15; }
html[data-text-size="xlarge"] { --text-scale: 1.3; }

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html {
  font-family: var(--font);
  font-size: calc(18px * var(--text-scale));
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-weight: 400;
  overflow-wrap: anywhere;
  /* Drop the 300 ms tap delay and double-tap zoom; pinch and scroll stay. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

h1, h2, h3 { font-weight: 700; line-height: 1.25; color: var(--text); }
h1 { font-size: calc(32px * var(--text-scale)); margin-bottom: 16px; }
h2 { font-size: calc(24px * var(--text-scale)); margin: 32px 0 12px; }
h3 { font-size: calc(20px * var(--text-scale)); margin: 24px 0 8px; }
p, li { margin-bottom: 16px; }
ul, ol { padding-left: 1.3em; }
strong { font-weight: 700; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Inline links present a 48px-tall tap box; the line grows to hold it, so no
   box overflows its paragraph. */
p a, li a, .check a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 4px;
  vertical-align: middle;
}

/* ----- header / footer ----- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
}
/* The public lobby's brand block (lobby-app/src/style.css .brand): the MERZO
   wordmark with the letter-spaced SOFTWARE line beneath it — owner mandate
   2026-09-03, "Merzo Software like the current lobby, not just MERZO". */
.brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 0 0 195px;
  width: 195px;
  min-height: 48px;
  text-decoration: none;
}
.brand-logo { width: 100%; height: auto; display: block; }
.brand-sub {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  color: var(--accent);
}
.site-nav { display: flex; gap: 12px; margin-left: auto; }
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  padding: 0 16px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}
.lede { font-size: calc(20px * var(--text-scale)); color: var(--text); margin-bottom: 24px; }
.aside { color: var(--text-muted); font-weight: 500; margin-top: 24px; }
.callout {
  border-left: 4px solid var(--accent);
  background: var(--bg-panel);
  padding: 14px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-weight: 600;
}
.steps li { margin-bottom: 12px; }

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-panel);
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-start;
}
.demo-note {
  margin: 0;
  font-weight: 600;
  border-left: 4px solid var(--accent-table);
  padding-left: 12px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 12px; }
.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-weight: 600;
}
.footer-copy { margin: 0; font-size: calc(16px * var(--text-scale)); font-weight: 500; color: var(--text-muted); }

/* ----- forms ----- */
.form { display: flex; flex-direction: column; gap: 20px; margin: 24px 0; }
.field { display: flex; flex-direction: column; gap: 8px; }
label { font-weight: 600; }
.optional { font-weight: 500; color: var(--text-muted); }
.hint { margin: 0; font-size: calc(16px * var(--text-scale)); font-weight: 500; color: var(--text-muted); }
input[type="text"], input[type="email"], input[type="password"], select, textarea {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  font: inherit;
  color: var(--text);
  background: var(--bg-input);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--accent);
  outline-offset: 2px;
}
/* The reset page wraps its two acknowledgement rows in [data-acks] so app.js
   can hide them together; `contents` keeps them direct flex children of the
   form, so they keep the form's 20px gap like signup and invite. */
[data-acks] { display: contents; }
.check {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 4px 0;
  cursor: pointer;
  font-weight: 500;
}
.check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  accent-color: var(--accent);
  cursor: pointer;
}
.turnstile { min-height: 65px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  min-width: 48px;
  padding: 0 24px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: 0.7; cursor: wait; }
.form .btn { width: 100%; }

.form-msg {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--bg-panel);
  font-weight: 600;
}
.form-msg.is-error { border-color: var(--danger); color: var(--danger); }
.form-msg.is-ok { border-color: var(--ok); color: var(--ok); }
.form-msg a { color: inherit; }
.result { margin-top: 24px; }

/* ----- lobby ----- */
.lobby-status { color: var(--text-muted); font-weight: 500; }
.cards { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr; gap: 16px; margin: 0 0 24px; }
.card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0;
}
.card-title { margin: 0 0 8px; font-size: calc(24px * var(--text-scale)); }
.card-note { margin: 0; color: var(--text-muted); font-weight: 500; }

/* ----- admin: pending approvals ----- */
.admin-count { margin-top: 0; }
.card-meta { margin: 0 0 4px; font-weight: 500; }
.card-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.card-confirm { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.card-confirm-text { margin: 0; font-weight: 600; }
.card .form-msg { margin-top: 16px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  font-size: calc(16px * var(--text-scale));
  font-weight: 600;
  color: var(--text-muted);
  vertical-align: middle;
}
.badge-ok { border-color: var(--ok); color: var(--ok); }
.btn-danger { border-color: var(--danger); color: var(--danger); }

/* ----- tables (comfortable density) ----- */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); }
th { font-weight: 700; }

.prose .doc-version { color: var(--text-muted); font-weight: 500; margin-top: 40px; }

@media (min-width: 700px) {
  .form .btn { width: auto; align-self: flex-start; }
  .site-footer { padding-left: 32px; padding-right: 32px; }
  .site-header { padding-left: 32px; padding-right: 32px; }
}

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

/* ----- lobby game cards ----- */
.game-card { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start; }
.game-tile {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--line);
}
.game-tile[hidden] { display: none; }
.game-card-body { min-width: 0; }
.game-card .card-title { overflow-wrap: anywhere; }
.game-balance { color: var(--text); font-variant-numeric: tabular-nums; }
.game-card-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.game-card-actions .btn { flex: 1 1 140px; }
.reset-confirm { margin-top: 16px; padding: 16px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.reset-confirm p { margin: 0 0 12px; font-weight: 600; }
.reset-confirm .btn { margin-right: 12px; margin-bottom: 8px; }
.game-card .form-msg { margin-top: 12px; }
@media (max-width: 360px) {
  .game-card { grid-template-columns: 1fr; }
}

/* ----- /play/:gameId launcher: the game fills the viewport, one way out ----- */
.player-body { margin: 0; background: #04070a; overflow: hidden; }
.player { position: fixed; inset: 0; background: #04070a; }
.player-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #04070a; }
.player-home {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 10px));
  left: max(10px, env(safe-area-inset-left, 10px));
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  text-decoration: none;
}
.player-home-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(37, 220, 227, 0.42);
  background: rgba(7, 11, 13, 0.82);
  color: var(--accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px rgba(37, 220, 227, 0.22);
}
.player-home:hover .player-home-tile { border-color: var(--accent); color: #fff; }
.player-home-chevron { font-size: 26px; line-height: 1; font-weight: 800; margin-top: -2px; }
.player-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 72px 24px 24px;
  text-align: center;
}
.player-status[hidden] { display: none; }
.player-status-text { margin: 0; max-width: 32rem; font-size: calc(20px * var(--text-scale)); font-weight: 600; }
.player-status-link { margin: 16px 0 0; }
.player-status-link[hidden] { display: none; }
