/* Colours and type in one place. Ask your AI helper to change these to your museum's. */
:root {
  --wall: #243b4a;
  --paper: #f5f6f3;
  --surface: #ffffff;
  --ink: #1b1e20;
  --muted: #58636b;
  --brass: #9c7424;
  --line: #d5d9da;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --wall: #243b4a;
    --paper: #12181c;
    --surface: #1e2930;
    --ink: #e8ecee;
    --muted: #a3aeb5;
    --brass: #d2a44a;
    --line: #34424b;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* Hidden parts stay hidden, whatever their layout. */

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.55 var(--sans);
}

h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}
h1 { font-size: clamp(1.75rem, 5vw, 2.4rem); }
h2 { font-size: 1.35rem; }

a { color: inherit; text-decoration-color: var(--brass); text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

/* The wall and its object label: the one bold element on the page. */
.wall {
  background: var(--wall);
  padding: clamp(3rem, 12vw, 6rem) 1.25rem clamp(2rem, 6vw, 3rem);
}
.label {
  max-width: 24rem;
  margin-left: max(0px, calc((100% - 35.5rem) / 2));
  background: var(--surface);
  border-top: 6px solid var(--brass);
  padding: 1.25rem 1.5rem 1.5rem;
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.25);
}
.label p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; }
.label .label-meta { font-style: italic; color: var(--ink); margin: 0 0 0.75rem; }

.page {
  max-width: 38rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}
main.page > section { padding: 2rem 0; border-bottom: 1px solid var(--line); }
main.page > section:last-child { border-bottom: 0; }
.footer { padding-top: 1rem; padding-bottom: 3rem; color: var(--muted); font-size: 0.95rem; }
.quiet { color: var(--muted); font-size: 0.95rem; }
#feedback-status { margin: 0; min-height: 1.5em; }

/* Forms */
form { display: grid; gap: 0.75rem; }
fieldset { border: 0; margin: 0; padding: 0; }
legend { padding: 0; margin-bottom: 0.5rem; }
textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
}
button {
  justify-self: start;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--wall);
  border: 0;
  border-radius: 4px;
  padding: 0.7rem 1.25rem;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) { button { background: var(--brass); color: #16110a; } }
button:disabled { opacity: 0.6; cursor: default; }

.rating-options { display: flex; gap: 0.5rem; }
.rating-options label { position: relative; }
.rating-options input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.rating-options span {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-weight: 600;
}
.rating-options input:checked + span { background: var(--wall); color: #fff; border-color: var(--wall); }
@media (prefers-color-scheme: dark) { .rating-options input:checked + span { background: var(--brass); color: #16110a; border-color: var(--brass); } }
.rating-options input:focus-visible + span { outline: 3px solid var(--brass); outline-offset: 2px; }

/* Live poll */
.poll-options { display: grid; gap: 0.5rem; }
.poll-option {
  position: relative;
  justify-self: stretch;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  justify-content: space-between;
}
@media (prefers-color-scheme: dark) { .poll-option { background: var(--surface); color: var(--ink); } }
.poll-option .bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: color-mix(in srgb, var(--brass) 22%, transparent);
  transition: width 0.4s ease;
}
.poll-option span { position: relative; }
@media (prefers-reduced-motion: reduce) { .poll-option .bar { transition: none; } }

.plain-links { padding-left: 1.2rem; }
.plain-links li + li { margin-top: 0.4rem; }

/* Staff page */
.feedback-list { list-style: none; padding: 0; }
.feedback-list li { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.feedback-list time { color: var(--muted); font-size: 0.9rem; margin-left: 0.5rem; }
.feedback-list p { margin: 0.25rem 0 0; }

/* Artwork search */
.page.wide { max-width: 64rem; padding-top: 2rem; padding-bottom: 2rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.search { display: flex; gap: 0.5rem; }
.search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
}
#search-status { min-height: 1.5em; }
.results {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1.25rem;
}

/* Top bar with the room controls */
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: max(0.6rem, env(safe-area-inset-top)) 1rem 0.6rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; text-decoration: none; }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.topbar-actions > button { padding: 0.5rem 0.9rem; }
.nav-link { font-size: 0.95rem; white-space: nowrap; }
.room-pill { display: inline-flex; align-items: center; gap: 0.45rem; white-space: nowrap; }
.pill-invite { opacity: 0.85; font-weight: 400; }
.live-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #4cc26b; box-shadow: 0 0 0 0 rgb(76 194 107 / 0.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgb(76 194 107 / 0); } 100% { box-shadow: 0 0 0 0 rgb(76 194 107 / 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
@media (max-width: 30rem) { .pill-invite { display: none; } }

.panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0.75rem;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--brass);
  border-radius: 4px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.25);
}
.panel input, .inline-form input {
  font: inherit;
  font-size: 0.95rem;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
}
.panel .qr { justify-self: center; width: 220px; height: 220px; background: #fff; border-radius: 4px; }
.panel-note { margin: 0; font-size: 0.95rem; color: var(--muted); text-align: center; }
.room-code { font-family: ui-monospace, monospace; font-size: 1.1rem; letter-spacing: 0.12em; color: var(--ink); }
.inline-form { display: flex; gap: 0.5rem; }
.inline-form input { flex: 1; min-width: 0; }
.danger { justify-self: stretch; background: none; color: #b3261e; border: 1px solid currentColor; }
@media (prefers-color-scheme: dark) { .danger { background: none; color: #f2b8b5; } }
.link-button { background: none; color: var(--muted); padding: 0; font-weight: 400; text-decoration: underline; }
@media (prefers-color-scheme: dark) { .link-button { background: none; color: var(--muted); } }

.fling-hint { margin: 0.75rem 0 0; padding: 0.6rem 0.8rem; border-left: 4px solid var(--brass); background: var(--surface); font-size: 0.95rem; }
.toast {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 30;
  max-width: calc(100vw - 2rem);
  margin: 0;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  background: #1b1e20;
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.3);
  transform: translate(-50%, 150%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); }
.card img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--line); user-select: none; -webkit-user-select: none; }
.hosting .card img { cursor: grab; }
.card h2 { font-size: 1.05rem; margin: 0.75rem 0.9rem 0.25rem; }
.card p { margin: 0 0.9rem 0.25rem; font-size: 0.95rem; }
.card-actions { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0.9rem 0.9rem; font-size: 0.9rem; }
.fling-button { display: none; padding: 0.45rem 1.1rem; }
.hosting .fling-button { display: inline-block; }
.fling-button:active { transform: translateY(-2px) scale(0.97); }
.ghost { position: fixed; z-index: 20; object-fit: contain; pointer-events: none; box-shadow: 0 20px 40px rgb(0 0 0 / 0.35); }

/* Full-screen card for flicking on phones */
.stage-open { overflow: hidden; }
.stage { position: fixed; inset: 0; z-index: 10; background: rgb(10 14 17 / 0.94); display: grid; grid-template-rows: auto 1fr auto; place-items: center; padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom)); }
.stage[hidden] { display: none; }
.stage-close { justify-self: end; background: none; color: #fff; font-size: 2rem; line-height: 1; padding: 0.25rem 0.75rem; }
.stage-card { margin: 0; width: min(88vw, 30rem); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; will-change: transform; }
.stage-card img { display: block; width: 100%; max-height: 62vh; object-fit: contain; pointer-events: none; filter: drop-shadow(0 18px 30px rgb(0 0 0 / 0.5)); }
.stage-card figcaption { color: #e8ecee; text-align: center; margin-top: 0.75rem; font-size: 0.95rem; }
.stage-hint { justify-self: center; background: none; color: #d2a44a; font-weight: 600; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .stage-hint { animation: none; } }

/* Guest screen */
.guest { background: #12181c; color: #e8ecee; min-height: 100vh; min-height: 100dvh; }
.guest a { color: #e8ecee; }
.guest-main { max-width: 40rem; margin: 0 auto; padding: max(1rem, env(safe-area-inset-top)) 1rem 2rem; }
.join-form { display: grid; gap: 0.75rem; padding-top: 3rem; }
.join-form input { text-transform: uppercase; letter-spacing: 0.15em; font-family: ui-monospace, monospace; font-size: 1.3rem; background: #1e2930; color: inherit; }
.guest button { background: #d2a44a; color: #16110a; }
.guest-bar { display: flex; justify-content: space-between; color: #a3aeb5; font-size: 0.9rem; margin: 0 0 1rem; }
.guest-bar strong { color: #e8ecee; font-family: ui-monospace, monospace; letter-spacing: 0.1em; }
.landing { position: relative; min-height: 70vh; min-height: 70dvh; display: grid; place-items: center; }
.landing > * { grid-area: 1 / 1; }
.waiting { color: #a3aeb5; text-align: center; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; } }
.landed { margin: 0; width: 100%; text-align: center; }
.landed img { display: block; margin: 0 auto; max-width: 100%; max-height: 62vh; max-height: 62dvh; object-fit: contain; filter: drop-shadow(0 16px 30px rgb(0 0 0 / 0.6)); }
.landed figcaption { display: grid; gap: 0.2rem; margin-top: 1rem; }
.landed strong { font-family: var(--serif); font-size: 1.3rem; }
.landed span { color: #a3aeb5; }
.landed a { font-size: 0.9rem; margin-top: 0.25rem; }
.leaving { pointer-events: none; }
.history-heading { font-size: 1rem; color: #a3aeb5; margin-top: 2rem; }
.history { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); gap: 0.5rem; }
.history img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; }

/* Guest pages: top bar, room title, ended notice, My rooms */
.guest .topbar { background: #1a2227; border-color: #2a353c; }
.guest .brand { color: #e8ecee; }
.guest h1 { font-size: 1.6rem; }
.guest-bar { align-items: baseline; gap: 1rem; }
.guest-title { font-size: 1.25rem !important; margin: 0; color: #e8ecee; }
.guest .link-button { color: #a3aeb5; }
.quiet-dark { color: #a3aeb5; }
.ended { text-align: center; padding: 1rem; margin-top: 1rem; border: 1px solid #34424b; border-radius: 4px; background: #1a2227; }
.ended p { margin: 0 0 0.5rem; }
.button-link { display: inline-block; padding: 0.6rem 1rem; border-radius: 4px; background: #d2a44a; color: #16110a !important; font-weight: 600; text-decoration: none; }
.room-list { list-style: none; padding: 0; display: grid; gap: 0.75rem; }
.room-list a { display: grid; grid-template-columns: 5.5rem 1fr; grid-template-rows: auto auto; column-gap: 0.9rem; align-items: center; padding: 0.6rem; border-radius: 4px; background: #1a2227; text-decoration: none; }
.room-list .thumbs { grid-row: span 2; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 5.5rem; height: 5.5rem; background: #2a353c; border-radius: 3px; overflow: hidden; }
.room-list .thumbs img { width: 100%; height: 100%; object-fit: cover; }
.room-list .thumbs img:only-child { grid-column: span 2; grid-row: span 2; }
.room-list strong { font-family: var(--serif); font-size: 1.15rem; align-self: end; }
.room-list span { color: #a3aeb5; font-size: 0.9rem; align-self: start; }
.saved-artworks { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 1rem; }
.saved-artworks li { display: grid; gap: 0.2rem; align-content: start; }
.saved-artworks img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #1a2227; border-radius: 4px; margin-bottom: 0.3rem; }
.saved-artworks span { color: #a3aeb5; font-size: 0.9rem; }
.saved-artworks a { font-size: 0.9rem; }
