:root {
  --bg: #111418;
  --surface: #1b2027;
  --border: #2c333d;
  --text: #e8e6e1;
  --muted: #9aa3ad;
  --accent: #f2b45a;
  --danger: #e06c5f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.6rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 0.5rem; }
.hint, .lead { color: var(--muted); }
.lead { font-size: 1.1rem; }

.nav {
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.nav a { color: var(--text); text-decoration: none; padding: 4px 0; }
.nav a[aria-current="page"] { color: var(--accent); }
.nav .brand { font-weight: 700; margin-right: 8px; }

.messages { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.msg { background: var(--surface); border-left: 3px solid var(--accent); padding: 8px 12px; }
.msg.error { border-color: var(--danger); }

label { display: block; color: var(--muted); }
label.inline { display: inline-flex; gap: 6px; align-items: center; }
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
}
label > input:not([type="checkbox"]), label > select, label > textarea { display: block; width: 100%; margin-top: 4px; }
button { background: var(--accent); color: #1b1408; border: 0; font-weight: 600; cursor: pointer; }
button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--danger); color: #fff; }
button:disabled { opacity: 0.6; cursor: default; }
.stack { display: grid; gap: 14px; max-width: 560px; }
.row { display: flex; gap: 12px; align-items: end; }
.row.wrap { flex-wrap: wrap; }

.setup { max-width: 860px; margin: 8vh auto 0; }
.setup h1 { font-size: 2.4rem; margin-bottom: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 24px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: grid; gap: 12px; align-content: start; }
.card h2 { margin: 0; }
.card p { margin: 0; color: var(--muted); }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tile img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.tile .meta { padding: 10px; display: grid; gap: 8px; }
.tile .prompt { font-size: 0.9rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tile .actions button, .tile .actions a { padding: 4px 10px; font-size: 0.9rem; }
.toggle { background: var(--bg); color: var(--text); border: 1px solid var(--border); font-weight: 400; }
.toggle[aria-pressed="true"] { background: var(--accent); color: #1b1408; border-color: var(--accent); }
.tile .actions a { border: 1px solid var(--border); border-radius: 6px; text-decoration: none; }

.list { list-style: none; padding: 0; display: grid; gap: 8px; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; flex-wrap: wrap; }
.list .muted { color: var(--muted); font-size: 0.9rem; }
.join-code { font-size: 3rem; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; margin: 12px 0; }

#result img { max-width: 100%; border-radius: 8px; background: #000; }

/* Slideshow: full window, black margins, no overlays (spec 5.2); nav appears on mouse move. */
body.slideshow { overflow: hidden; background: #000; }
body.slideshow main { max-width: none; padding: 0; }
body.slideshow .nav { position: fixed; top: 0; left: 0; right: 0; z-index: 2; opacity: 0; transition: opacity 0.4s; pointer-events: none; }
body.slideshow.show-nav .nav { opacity: 0.92; pointer-events: auto; }
body.slideshow.hide-cursor { cursor: none; }
.stage { position: fixed; inset: 0; background: #000; }
.stage .layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 2s ease-in-out; }
.stage .layer.visible { opacity: 1; }
.stage .empty { position: absolute; inset: auto 0 45% 0; text-align: center; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .stage .layer { transition: none; }
}
