/* Room list + creator desk. Uses theme.css's tokens throughout — no new
 * colors or fonts, so these pages read as the same product as the wall and
 * the station. */

body { margin: 0; }

/* Must outrank the explicit `display` values below: a bare [hidden] only
 * carries the UA's `display: none`, which any class-level display wins. */
[hidden] { display: none !important; }

.shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-height: 100vh;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.wordmark span { color: var(--accent); }

.intro h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 6vw, 50px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 10px 0 14px;
}
.intro h1 span { color: var(--focus); }
.lede { color: var(--ink-dim); max-width: 54ch; margin: 0; line-height: 1.6; }

main { display: flex; flex-direction: column; gap: 24px; flex: 1; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.panel h2 { font-family: var(--font-display); font-size: 20px; margin: 2px 0 0; }

.section-heading { display: flex; gap: 14px; align-items: flex-start; }
.section-number { font-family: var(--font-mono); font-size: 11px; color: var(--accent); padding-top: 4px; }
.section-help { color: var(--ink-dim); font-size: 14px; line-height: 1.6; margin: 0; }
.section-help[data-error="true"] { color: var(--accent); }
.section-help a, footer a { color: var(--focus); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field input, .field textarea, select, .preset-row input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  padding: 11px 13px;
  min-height: 46px;
  width: 100%;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus-visible, .field textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.quiet-button {
  min-height: 46px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.quiet-button:hover:not(:disabled) { border-color: var(--focus); }
.primary-button { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

.create-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.create-row .field { flex: 1 1 260px; }

#modeOptions { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#modeOptions legend { padding: 0 0 8px; }
.mode { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; line-height: 1.5; font-size: 14px; color: var(--ink-dim); }
.mode input { margin-top: 3px; accent-color: var(--accent); }
.mode strong { display: block; color: var(--ink); font-weight: 600; }
.mode em { display: block; margin-top: 4px; font-style: normal; color: var(--focus); }
#modeOptions:disabled .mode { opacity: 0.5; cursor: default; }

#promptForm { display: flex; flex-direction: column; gap: 16px; }
.preset-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.preset-row select, .preset-row input { flex: 1 1 220px; width: auto; }

.room-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.room {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.room-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.room-head h3 { font-family: var(--font-display); font-size: 17px; margin: 0; }
.room-body, .invite { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.room-body > div, .invite > div { flex: 1 1 260px; display: flex; flex-direction: column; gap: 12px; }
.room-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }
.room-qr {
  width: 132px;
  height: 132px;
  border-radius: 10px;
  background: #fff;
  padding: 7px;
  flex: 0 0 auto;
}
.join-url { font-family: var(--font-mono); font-size: 12px; color: var(--focus); margin: 0; word-break: break-all; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: 13px;
}

@media (max-width: 560px) {
  .room-body, .invite { flex-direction: column; align-items: flex-start; }
}

/* Sits just outside the starting-point radios: it picks which contract the
   generator writes against, not where the piece starts from. */
.interactive-option { padding-top: 14px; margin-top: 2px; border-top: 1px solid var(--line); }
.interactive-option input:disabled + span { opacity: 0.5; }

/* Destructive action. Reads as quiet until you reach for it, so it never
   competes with "Open creator desk" — the thing people actually want. */
.danger-button { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.danger-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.danger-button:disabled { opacity: 0.6; }

/* ── Demo scene collection ───────────────────────────────────────────────
   Every preview is live, so each card frames a little CRT: square pixels
   (the pieces render at 320-wide and scale up unsmoothed, like mode 13h),
   faint scanlines over the top, and a black bezel. Theme tokens only, so it
   still reads as the same product as the rest of the desk. */
.gallery-grid {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.gallery-card {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 150ms, box-shadow 150ms;
}
.gallery-card:hover { border-color: var(--ink-dim); }
.gallery-card.is-live { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 6px 24px var(--accent-soft); }
.gallery-screen { position: relative; background: #000; border-bottom: 1px solid var(--line); }
.gallery-screen canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.gallery-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px);
}
.gallery-live, .gallery-broken {
  position: absolute;
  z-index: 1;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.gallery-live { background: var(--accent); color: var(--ground); }
.gallery-broken { background: var(--surface); color: var(--ink-dim); }
.gallery-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 16px; flex: 1; }
.gallery-body h4 { font-family: var(--font-display); font-size: 16px; margin: 0; color: var(--ink); }
.gallery-blurb { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.5; }
.gallery-lineage { margin: 0; color: var(--ink-dim); font-family: var(--font-mono); font-size: 11px; line-height: 1.55; }
/* An archive piece's picture, over the title card its sketch draws. */
.gallery-screen .gallery-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* A long section: its count, its order, and the button for the next page. */
.gallery-paging { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 12px; }
.gallery-paging-count { margin: 0; color: var(--ink-dim); font-family: var(--font-mono); font-size: 11px; }
.gallery-paging-sort { color: var(--ink-dim); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.gallery-paging-sort select { font: inherit; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.gallery-paging-sort select option { color: #111; }
.gallery-more { display: block; margin: 16px auto 0; }
/* An archive piece's credit: who made it, where it lives, on what terms. */
.gallery-credit { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-left: 2px solid var(--line); }
.gallery-credit p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink); }
.gallery-credit .gallery-credit-licence { color: var(--ink-dim); font-size: 12px; }
.gallery-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.gallery-tags { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.gallery-tags li {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink);
}
.gallery-tags .tag-action { border-color: var(--accent); }
.gallery-tags .tag-people { border-color: var(--focus); }
.gallery-controls { margin: 0; color: var(--ink-dim); font-size: 12px; line-height: 1.5; }
.gallery-pick { margin-top: auto; align-self: flex-start; }
.gallery-card.is-live .gallery-pick { border-color: var(--accent); }
#galleryStatus[data-error="true"] { color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .gallery-card { transition: none; }
}

/* Sections: demo scene, party games, living canvases. */
.gallery-sections { display: flex; flex-direction: column; gap: 28px; }
.gallery-section-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.gallery-section-intro { margin: 4px 0 12px; color: var(--ink-dim); font-size: 14px; }
/* The prompt that made a generated piece. Tucked away so cards stay scannable. */
.gallery-prompt { font-size: 12px; color: var(--ink-dim); }
.gallery-prompt summary { cursor: pointer; color: var(--focus); }
.gallery-prompt summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.gallery-prompt p { margin: 6px 0 0; font-family: var(--font-mono); line-height: 1.55; }

/* ── finding something in the library ─────────────────────────────────────
   Search and tags sit above the sections rather than beside them: a host
   scans the collection first and narrows second, and a sidebar would take
   the width the cards need to show a piece running. */
.library-find {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.library-search { display: flex; flex-direction: column; gap: 6px; }
.library-search input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.library-search input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.library-tags { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.library-group { display: flex; flex-direction: column; gap: 6px; }
.library-group-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.library-group-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.library-tag {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 120ms, background 120ms, color 120ms;
}
.library-tag:hover { border-color: var(--ink-dim); }
.library-tag.is-on { border-color: var(--accent); background: var(--accent); color: var(--ground); }
.library-tag:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
#libraryCount { margin: 0 0 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.library-clear { padding: 4px 10px; font-size: 12px; }

/* What a card carries in the library: its tags, and -- for anything the desk
   may not run -- a drawn poster instead of a live preview. */
.library-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.library-chips li {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
}
.gallery-card.is-listed .gallery-screen::after { background: none; }
.gallery-card.is-listed .gallery-screen canvas { image-rendering: auto; }
@media (prefers-reduced-motion: reduce) {
  .library-tag { transition: none; }
}

/* What phones see: the live piece's panel in a phone-sized frame. The frame
   takes the skin's ground so the panel sits on its own background. */
.phone-preview { flex: 0 1 340px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.phone-frame { height: 560px; overflow: hidden auto; overscroll-behavior: contain; padding: 0 16px 20px; border: 1px solid var(--line);
  border-radius: 26px; background: var(--p-ground); color: var(--p-ink); font-family: var(--p-font); }
.phone-frame .control-sharing:empty { display: none; }
.phone-frame .panel-head:first-child { margin-top: 18px; }
.phone-preview figcaption { margin: 0; font-size: 12px; }

/* The host's own controls, drawn by the phones' renderer on the skin's ground
   so they read as the same instrument, just a wider one. */
.host-controls { display: grid; gap: 14px; }
.host-frame { padding: 2px 18px 18px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--p-ground); color: var(--p-ink); font-family: var(--p-font); }
.host-frame .control-sharing:empty { display: none; }

/* Your images: what pieces on the wall find in room.images. A checkerboard
 * under each image, so a transparent one shows as transparent. */
.images-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.images-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.image-card {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.image-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  border-bottom: 1px solid var(--line);
  background-color: #2a2e2b;
  background-image:
    linear-gradient(45deg, #3a3f3b 25%, transparent 25%, transparent 75%, #3a3f3b 75%),
    linear-gradient(45deg, #3a3f3b 25%, transparent 25%, transparent 75%, #3a3f3b 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
/* Out of the flow, so a tall image fits inside the 4:3 frame instead of
 * stretching it. */
.image-frame img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.image-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.image-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; }
.image-meta { margin: 0; color: var(--ink-dim); font-family: var(--font-mono); font-size: 11px; }
.image-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.image-actions .quiet-button { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.image-actions .image-remove { margin-left: auto; }
.image-actions .image-remove.is-armed { border-color: var(--accent); color: var(--accent); }
