/* Afters. Butter, plum, lilac, cream.
   One typeface, Bricolage Grotesque, set heavy for headings and regular for
   everything else. The loud bits are the wordmark, the sticker and the tilted
   button; the photo grid stays quiet so the pictures do the talking. */

@font-face {
  font-family: 'Bricolage';
  src: url('/fonts/bricolage.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --butter: #ffd84d;
  --butter-deep: #f3c52e;
  --plum: #4b2a5e;
  --plum-deep: #25122f;
  --lilac: #cdbde8;
  --cream: #fff3c4;
  --danger: #b3261e;

  --bg: var(--butter);
  --ink: var(--plum);
  --muted: #6a4a7c;
  --surface: var(--cream);
  --sheet: #fff8dc;
  --line: rgba(75, 42, 94, 0.24);
  --btn-bg: var(--plum);
  --btn-fg: var(--butter);
  --ok: #1f6f43;

  --font: 'Bricolage', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-s: 10px;
  --r-m: 14px;
  --r-l: 22px;
  --pad: clamp(14px, 4vw, 32px);
  --dock: 76px;
  color-scheme: light;
}

/* Colour schemes (picked under Colours, saved in this browser; js/theme.js sets them before the page
   draws). Each light scheme swaps the four brand colours; everything else follows. */
html[data-theme='lilac'] {
  --butter: #d9c9f2; --butter-deep: #c5b0ea; --plum: #3b1f4f; --plum-deep: #1f0f2a; --lilac: #ffd84d; --cream: #f5effc;
  --muted: #5e4473; --sheet: #faf6ff; --line: rgba(59, 31, 79, 0.24);
}
html[data-theme='mint'] {
  --butter: #a8ecc8; --butter-deep: #8fe0b6; --plum: #0b3a2e; --plum-deep: #1f7a5c; --lilac: #ffc9a6; --cream: #ffffff;
}
/* Mint uses the dark layout (light text), on deep mint instead of plum. */
html[data-theme='mint'].dark body { --surface: #2b8a6a; --sheet: #23735a; --muted: #d4f3e3; --line: rgba(255, 255, 255, 0.28); }
html[data-theme='mint'].dark .doc-top, html[data-theme='mint'].dark .doc-nav { background: #186a4f; }
html[data-theme='sunset'] {
  --butter: #ffb199; --butter-deep: #ff9c80; --plum: #3d1330; --plum-deep: #220a1b; --lilac: #ffe27a; --cream: #fff0e8;
  --muted: #7a3f5e; --sheet: #fff7f2; --line: rgba(61, 19, 48, 0.24);
}

/* After dark: chosen, or Auto when the device is in dark mode. Every page, not just rooms. */
html.dark body {
  --bg: var(--plum-deep);
  --ink: var(--cream);
  --muted: #cdb9da;
  --surface: #3a2049;
  --sheet: #2f1840;
  --line: rgba(255, 243, 196, 0.22);
  --btn-bg: var(--butter);
  --btn-fg: var(--plum);
  --ok: #7fdca4;
  --danger: #ff8a80;
  color-scheme: dark;
}
/* Pieces that are light cards on butter become dark cards at night. */
html.dark .recent a, html.dark .roundbtn { background: var(--surface); color: var(--ink); }
html.dark .roundbtn.quiet { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
html.dark .start input { background: var(--surface); color: var(--ink); border-color: rgba(255, 243, 196, 0.45); }
html.dark .start input::placeholder { color: var(--muted); }
html.dark .home-foot { border-top-color: var(--line); }
html.dark .didyou { box-shadow: 5px 6px 0 #000; }
html.dark .form-error { background: var(--surface); }
html.dark body.is-doc { background: var(--bg); color: var(--ink); }
html.dark .doc-top, html.dark .doc-nav { background: #1a0c22; }
html.dark .doc-nav { border-bottom-color: var(--line); }
html.dark .doc-nav a { background: var(--surface); }
html.dark .doc-nav a[aria-current='page'] { background: var(--butter); color: var(--plum); }
html.dark .doc .card, html.dark .doc .steps li, html.dark .doc .result { background: var(--surface); }
html.dark .doc .steps li::before { background: var(--butter); color: var(--plum); }
html.dark .doc form input, html.dark .doc form select, html.dark .doc form textarea { background: var(--surface); color: var(--ink); border-color: rgba(255, 243, 196, 0.45); }
html.dark .dock, html.dark .selbar, html.dark .tray { box-shadow: 0 0 0 1.5px rgba(255, 243, 196, 0.25), 0 10px 34px rgba(0, 0, 0, 0.5); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 16px/1.45 var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- shared pieces ---------- */

svg.wm { display: block; height: 34px; width: auto; overflow: visible; }
.wm-dot { fill: var(--lilac); }
.wordmark { display: inline-block; color: var(--ink); text-decoration: none; }
.wordmark img { display: block; height: 34px; width: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 2px solid var(--btn-bg); border-radius: 16px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 700; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn.soft { background: var(--surface); color: var(--ink); border-color: var(--surface); }
.btn.lilac { background: var(--lilac); color: var(--plum); border-color: var(--lilac); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: 13px; }
.btn svg { flex: none; }

.linkbtn { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; color: inherit; font-weight: 600; }
.muted { color: var(--muted); }
.sticker { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--lilac); color: var(--plum); font-weight: 700; font-size: 15px; transform: rotate(-4deg); }

.iconbtn { flex: none; width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--surface); color: var(--ink); display: grid; place-content: center; }
.iconbtn[aria-pressed='true'], .iconbtn[aria-expanded='true'] { background: var(--btn-bg); color: var(--btn-fg); }

/* a real switch */
.switch { position: relative; flex: none; width: 52px; height: 32px; border-radius: 999px; border: 2px solid var(--ink); background: transparent; padding: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); transition: transform 0.15s ease; }
.switch[aria-checked='true'] { background: var(--lilac); border-color: var(--plum); }
.switch[aria-checked='true']::after { transform: translateX(20px); background: var(--plum); }
@media (prefers-reduced-motion: reduce) { .switch::after { transition: none; } }

/* ---------- home ---------- */

.home { max-width: 1040px; margin: 0 auto; padding: var(--pad); min-height: 100dvh; display: flex; flex-direction: column; }
.home-top { display: flex; justify-content: space-between; align-items: center; }
.home-top svg.wm { height: 38px; }
.home-top a.plain { font-weight: 700; text-underline-offset: 4px; }
.home-main { padding: clamp(28px, 6vh, 64px) 0 28px; position: relative; }
/* The aside in the empty top right on wide screens. Hidden on phones, where space is for the buttons. */
.didyou { display: none; }
@media (min-width: 980px) {
  .didyou { display: block; position: absolute; right: 0; top: clamp(28px, 6vh, 64px); width: 270px; padding: 18px 20px 20px; background: var(--lilac); color: var(--plum); border: 2px solid var(--plum); border-radius: 22px 22px 22px 6px; transform: rotate(2deg); font-size: 15px; line-height: 1.4; box-shadow: 5px 6px 0 var(--plum); }
  .didyou strong { display: block; font: 800 19px/1.1 var(--font); margin-bottom: 6px; }
  .didyou p + p { margin-top: 8px; }
  .didyou-end { font-weight: 700; }
}
.home h1 {
  font: 800 clamp(44px, 7vw, 76px)/0.94 var(--font);
  letter-spacing: -0.04em;
  max-width: 11ch;
  text-wrap: balance;
}
@media (min-width: 700px) { .home h1 { max-width: 18ch; font-size: clamp(52px, 6vw, 68px); } }
.home .sticker { margin: 14px 0 0 4px; font-size: clamp(15px, 2vw, 18px); }
.lede { margin-top: 16px; font-size: clamp(18px, 2.4vw, 22px); line-height: 1.4; max-width: 34em; }
.start { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; max-width: 640px; align-items: center; }
.start input {
  flex: 1 1 240px; min-height: 58px; padding: 0 20px;
  border: 2px solid var(--plum); border-radius: 18px; background: var(--cream); color: var(--plum); font-size: 17px;
}
.start input::placeholder { color: #7b5e8c; }
.start .btn { min-height: 58px; padding: 0 28px; font-size: 18px; font-weight: 800; border-radius: 18px; transform: rotate(-1.5deg); }
.start .btn:hover, .start .btn:focus-visible { transform: rotate(0deg); }
.start .btn:active { transform: rotate(0deg) translateY(1px); }
.keep { margin-top: 14px; display: flex; align-items: center; gap: 12px; max-width: 640px; }
.keep .choice, .keep .opts { max-width: 340px; }
.keep > span { font-weight: 700; font-size: 15px; white-space: nowrap; }
.keep .opts { flex: 1; }
.keep .opt { min-height: 40px; }
.keep { flex-wrap: wrap; }
.sheet h3 { margin: 22px 0 8px; font-size: 15px; }
.joinrow { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 640px; }
.joinrow .btn { min-height: 52px; border-radius: 16px; background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 700; }
.scan-video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 18px; background: #000; margin-bottom: 10px; }
.joinrow .drop-hint { display: none; font-size: 15px; }
/* Computers with a mouse: no camera scanning, a compact Paste a link, and the drop hint on the same line. */
@media (hover: hover) and (pointer: fine) and (min-width: 700px) {
  .joinrow { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
  .joinrow .scanbtn { display: none; }
  .joinrow .btn { min-height: 40px; padding: 0 14px; font-size: 14.5px; border-radius: 13px; flex: none; }
  .joinrow .drop-hint { display: inline; }
}
.install { margin-top: 12px; font-size: 15px; }
.install:has(button[hidden]) { display: none; }
/* Laptops: the whole home page fits on one screen. */
@media (min-width: 700px) and (max-height: 920px) {
  .home { padding-top: 18px; padding-bottom: 18px; }
  .home-main { padding: 22px 0 18px; }
  .home h1 { font-size: clamp(46px, 7.4vh, 62px); }
  .home .sticker { margin-top: 10px; }
  .lede { margin-top: 12px; font-size: 19px; }
  .start { margin-top: 18px; }
  .start input, .start .btn { min-height: 52px; }
  .keep { margin-top: 10px; }
  .facts { gap: 14px 24px; }
  .facts strong { font-size: 17px; }
  .facts span { font-size: 14px; line-height: 1.4; }
  .home-foot { margin-top: 16px; padding-top: 12px; }
  .facts { padding-top: 20px; }
  .didyou { top: 22px; }
}
/* Smaller laptops (about 760 px tall or less): tighter again so nothing scrolls. */
@media (min-width: 700px) and (max-height: 760px) {
  .home { padding-top: 12px; padding-bottom: 10px; }
  .home-main { padding: 12px 0 8px; }
  .home h1 { font-size: clamp(40px, 7vh, 54px); }
  .home .sticker { margin-top: 6px; }
  .lede { margin-top: 8px; font-size: 17px; }
  .start { margin-top: 12px; }
  .start input, .start .btn { min-height: 48px; }
  .keep { margin-top: 8px; }
  .keep .opt { min-height: 36px; }
  .joinrow { margin-top: 8px; }
  .facts { padding-top: 12px; gap: 10px 22px; }
  .home-foot { margin-top: 10px; }
  .facts strong { font-size: 16px; }
  .facts span { font-size: 13.5px; }
  .home-foot { padding-top: 8px; font-size: 14px; }
  .didyou { top: 12px; }
}
@media (min-width: 700px) and (max-height: 660px) {
  .home { padding-bottom: 4px; }
  .home h1 { font-size: 40px; }
  .home-main { padding-top: 6px; }
  .lede { font-size: 16px; }
  .facts { padding-top: 8px; }
  .facts span { margin-top: 2px; font-size: 13px; line-height: 1.35; }
}
.form-error { margin-top: 14px; padding: 12px 16px; background: var(--cream); border-left: 5px solid var(--danger); border-radius: var(--r-s); max-width: 640px; }

.pending { margin-top: 28px; padding: 18px; background: var(--plum); color: var(--cream); border-radius: var(--r-l); max-width: 640px; }
.pending h2 { font: 800 22px/1.1 var(--font); }
.pending .choices { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.pending .btn { border-color: var(--cream); background: transparent; color: var(--cream); }
.pending .btn.go { background: var(--butter); border-color: var(--butter); color: var(--plum); }

.recent { margin-top: 44px; max-width: 640px; }
.recent h2 { font: 800 20px/1.2 var(--font); letter-spacing: -0.01em; }
.recent ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.recent li { display: flex; gap: 8px; align-items: stretch; }
.recent a { flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; text-decoration: none; font-weight: 700; background: var(--cream); border-radius: var(--r-m); }
.recent a span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roundbtn { flex: none; width: 50px; display: grid; place-content: center; border: 0; border-radius: var(--r-m); background: var(--cream); color: var(--plum); cursor: pointer; }
.roundbtn.quiet { background: transparent; box-shadow: inset 0 0 0 2px var(--cream); }
.roundbtn:hover { background: var(--lilac); }
.roundbtn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.recent a span:last-child { font-weight: 400; white-space: nowrap; color: var(--muted); }
.recent .linkbtn { margin-top: 12px; font-size: 15px; }

/* The facts sit at the foot of the screen, so the spare height becomes a gap above them. */
.facts { margin: auto 0 0; padding: 12px 0 0; list-style: none; display: grid; gap: 20px 24px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.facts strong { display: block; font: 800 19px/1.15 var(--font); letter-spacing: -0.01em; }
.facts span { display: block; margin-top: 4px; font-size: 15px; }
.home-foot { margin-top: 24px; padding-top: 16px; border-top: 2px solid var(--plum); display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 15px; font-weight: 600; }

/* ---------- room ---------- */

.room { min-height: 100dvh; padding-bottom: calc(var(--dock) + 96px + env(safe-area-inset-bottom)); }
.room-top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 10px var(--pad); padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--bg); color: var(--ink);
}
.room-top .home-link { flex: none; display: grid; place-content: center; height: 44px; padding-right: 4px; color: inherit; }
.room-top .home-link svg.wm { height: 21px; width: auto; }
/* Phones: logo and Share on top, the room name and Rename get the full width below. */
@media (max-width: 620px) {
  .room-top { flex-wrap: wrap; row-gap: 4px; }
  body .room-top .home-link { margin-right: auto; }
  body .room-top > .title { order: 3; flex: 1 0 100%; }
  body .room-top > .title h1 { font-size: 24px; }
}
.room-top .title { flex: 1; min-width: 0; }
.room-top h1 { font: 800 20px/1.15 var(--font); letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-top h1 button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.room-top h1 button span { overflow: hidden; text-overflow: ellipsis; }
.room-top h1 button svg { flex: none; }
.rename-pill { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px 5px 9px; border-radius: 999px; background: var(--surface); color: var(--ink); font: 700 14px/1 var(--font); letter-spacing: 0; }
.room-top h1 button:hover .rename-pill { background: var(--lilac); color: var(--plum); }
.room-top h1 button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.room-top .meta { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-top .btn { min-height: 42px; padding: 0 16px; border-radius: 14px; }

/* Sort and Room settings: the two main controls, side by side under the title. */
.controls { display: flex; gap: 8px; padding: 10px var(--pad) 0; align-items: center; }
.ctl { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 0 10px 0 12px; border-radius: 14px; border: 2px solid var(--ink); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; gap: 7px; font: 700 15px/1.1 var(--font); cursor: pointer; justify-content: center; }
.ctl > span { flex: 0 1 auto; }
.ctl > span { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctl svg { flex: none; }
.ctl:hover { background: var(--lilac); color: var(--plum); }
.ctl:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.controls .iconbtn { height: 46px; width: 46px; }
/* Wider screens: the menus stay button-sized instead of stretching; search sits at the far right. */
.controls .ctl { max-width: 230px; }
.controls .iconbtn { margin-left: auto; }
/* Select: the smallest of the three, sized to its word. */
.ctl.selectctl { flex: none; padding: 0 12px; }
.ctl.selectctl > span { flex: none; }
.ctl.selectctl[aria-pressed='true'] { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
/* Phones: buttons sized to their words, and "Sort" without the current order, so all four fit on one line. */
@media (max-width: 440px) {
  .controls { gap: 6px; }
  .ctl { flex: 1 1 auto; padding: 0 7px; gap: 4px; font-size: 14px; }
  .ctl svg { width: 16px; height: 16px; }
  .ctl > span { flex: none; overflow: visible; }
  .ctl .sortval { display: none; }
  .ctl.selectctl { flex: none; padding: 0 8px; }
}
/* The narrowest phones: Select as its icon. */
@media (max-width: 359px) {
  .ctl.selectctl .sellabel { display: none; }
}
@media (max-width: 420px) { .controls { gap: 6px; } .ctl { font-size: 14px; gap: 5px; padding: 0 8px; } .controls .iconbtn { width: 42px; } }
.settings-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.settings-list .pill { gap: 6px; }
.sheet .settings-list .pill { background: var(--butter); color: var(--plum); }

.tools { display: flex; align-items: center; gap: 8px; padding: 10px var(--pad) 10px; }
.chips { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip small { font-size: 13px; font-weight: 400; opacity: 0.75; }
.chip[aria-pressed='true'] { background: var(--btn-bg); color: var(--btn-fg); }
.chip.cam { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.chip.cam[aria-pressed='true'] { background: var(--lilac); color: var(--plum); box-shadow: none; }
.searchrow { padding: 0 var(--pad) 10px; }
.searchrow input { width: 100%; min-height: 46px; padding: 0 16px; border: 2px solid var(--ink); border-radius: 14px; background: var(--surface); color: var(--ink); }
.searchrow input::placeholder { color: var(--muted); }
.nomatch { padding: 28px var(--pad); color: var(--muted); }

.tip { margin: 0 var(--pad) 12px; padding: 12px 14px; background: var(--surface); border-radius: var(--r-m); font-size: 14.5px; display: flex; gap: 12px; align-items: flex-start; }
.tip p { flex: 1; }

/* The grid. Four sizes, pinch or use the view sheet. */
.grid { --min: 112px; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(var(--min), 1fr)); padding: 0 calc(var(--pad) - 6px); touch-action: pan-y; }
.grid.z0 { --min: 68px; gap: 4px; }
.grid.z1 { --min: 88px; }
.grid.z2 { --min: 112px; }
.grid.z3 { --min: 170px; }
@media (min-width: 700px) {
  .grid { padding: 0 var(--pad); gap: 8px; }
  .grid.z0 { --min: 100px; gap: 6px; }
  .grid.z1 { --min: 150px; }
  .grid.z2 { --min: 210px; }
  .grid.z3 { --min: 320px; }
}
.day { grid-column: 1 / -1; margin: 14px 2px 2px; font: 800 17px/1.2 var(--font); display: flex; gap: 10px; align-items: baseline; }
.day:first-child { margin-top: 2px; }
.day small { font-weight: 400; font-size: 14px; color: var(--muted); }

.tile { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: var(--r-m); background: var(--surface); overflow: hidden; display: block; width: 100%; color: var(--ink); text-align: left; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.grid.z0 .tile { border-radius: 10px; }
.marquee { position: fixed; z-index: 50; pointer-events: none; border: 2px solid var(--butter); background: rgba(255, 216, 77, 0.18); border-radius: 6px; }
.dragging, .dragging * { user-select: none; -webkit-user-select: none; cursor: crosshair; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.12s ease, border-radius 0.12s ease; pointer-events: none; }
.grid.fit .tile img { object-fit: contain; }
.tile .ph { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 8px; font-size: 12px; color: var(--muted); word-break: break-all; }
.tile .ph b { display: block; font: 800 20px/1 var(--font); color: var(--ink); margin-bottom: 4px; }
.tile .badge { position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(37, 18, 47, 0.78); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; gap: 4px; align-items: center; }
.tile .badge.live { background: var(--lilac); color: var(--plum); letter-spacing: 0.02em; }
.tile .tick { position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgba(37, 18, 47, 0.3); display: none; place-content: center; color: var(--plum); }
.tile .tick svg { display: none; }
.selecting .tile .tick { display: grid; }
.tile.on .tick { background: var(--lilac); border-color: var(--lilac); }
.tile.on .tick svg { display: block; }
.tile.on img { transform: scale(0.88); border-radius: 10px; }
.tile .cap { display: none; }
@media (prefers-reduced-motion: reduce) { .tile img { transition: none; } }

/* list view: a row per file with its facts */
.grid.list { grid-template-columns: 1fr; gap: 6px; max-width: 760px; }
.grid.list .tile { aspect-ratio: auto; display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 6px 44px 6px 6px; min-height: 76px; }
.grid.list .tile img, .grid.list .tile .ph { position: static; width: 64px; height: 64px; border-radius: 10px; }
.grid.list .tile .ph { font-size: 0; padding: 0; background: var(--bg); }
.grid.list .tile .ph b { font-size: 13px; margin: 0; }
.grid.list .tile .badge { left: 10px; bottom: 10px; font-size: 10px; padding: 1px 6px; }
.grid.list .tile .cap { display: block; min-width: 0; }
.grid.list .tile .cap b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid.list .tile .cap span { display: block; font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid.list .tile .tick { top: 50%; right: 10px; transform: translateY(-50%); border-color: var(--ink); background: transparent; }
.grid.list .tile.on img { transform: none; }

.empty { padding: clamp(28px, 9vh, 88px) var(--pad); max-width: 600px; }
.empty h2 { font: 800 clamp(32px, 8vw, 50px)/0.98 var(--font); letter-spacing: -0.03em; }
.empty p { margin-top: 12px; color: var(--muted); font-size: 17px; }
.empty .actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }

.room-foot { padding: 30px var(--pad) 0; font-size: 14.5px; color: var(--muted); display: grid; gap: 14px; }
.foot-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.foot-pills .pill, .settings-list .pill { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--surface); color: var(--ink); font: 700 14.5px/1 var(--font); text-decoration: none; cursor: pointer; }
.foot-pills .pill:hover, .settings-list .pill:hover { background: var(--lilac); color: var(--plum); }
.foot-pills .pill.danger, .settings-list .pill.danger { background: transparent; box-shadow: inset 0 0 0 2px var(--danger); color: var(--danger); }
.foot-pills .pill:focus-visible, .settings-list .pill:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.message { max-width: 560px; padding: clamp(40px, 14vh, 140px) var(--pad); }
.message h1 { font: 800 clamp(34px, 8vw, 56px)/1 var(--font); letter-spacing: -0.03em; }
.message p { margin: 14px 0 24px; color: var(--muted); }

/* ---------- dock, selection bar, upload tray: all in thumb reach ---------- */

.dock, .selbar {
  position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 8;
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 6px;
  padding: 8px; border-radius: var(--r-l);
  background: var(--plum); color: var(--cream);
  box-shadow: 0 10px 34px rgba(37, 18, 47, 0.35);
}
.dock .btn, .selbar .btn { min-height: 46px; padding: 0 14px; border-radius: 15px; border-color: transparent; background: transparent; color: var(--cream); font-size: 15.5px; }
.dock .btn.go, .selbar .btn.go { flex: 1 1 auto; background: var(--butter); color: var(--plum); border-color: var(--butter); font-weight: 800; }
/* Files: pale yellow like Photos, a step smaller. */
.dock .btn.files { background: var(--cream); border-color: var(--cream); color: var(--plum); font-weight: 800; font-size: 14.5px; padding: 0 12px; }
.dock .gap { flex: 1 1 0; min-width: 0; }
.selecting .dock { display: none; }
@media (max-width: 430px) {
  .dock, .selbar { gap: 4px; }
  .dock .btn, .selbar .btn { padding: 0 9px; font-size: 15px; gap: 6px; }
}
.selbar strong { flex: 1 1 auto; min-width: 0; padding-left: 8px; font-size: 15px; line-height: 1.2; }
.selbar .btn[disabled] { opacity: 0.4; }
.selbar .btn.del { color: #ffb4ab; }

.tray {
  position: fixed; left: 8px; right: 8px; bottom: calc(var(--dock) + env(safe-area-inset-bottom)); z-index: 7;
  max-width: 560px; margin: 0 auto;
  background: var(--plum); color: var(--cream); border-radius: var(--r-l);
  box-shadow: 0 10px 34px rgba(37, 18, 47, 0.35);
  overflow: hidden;
}
.tray-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px 10px; }
.tray-head .t { flex: 1; min-width: 0; }
.tray-head strong { display: block; }
.tray-head small { display: block; color: #dccbe6; font-size: 13.5px; }
.tray-head button { background: none; border: 0; color: var(--cream); text-decoration: underline; text-underline-offset: 3px; padding: 8px 0; font-weight: 600; }
.bar { height: 6px; background: rgba(255, 243, 196, 0.2); }
.bar i { display: block; height: 100%; width: 0; background: var(--butter); transition: width 0.2s linear; }
.tray-list { max-height: 34vh; overflow: auto; margin: 0; padding: 4px 16px 10px; list-style: none; font-size: 14px; }
.tray-list li { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid rgba(255, 243, 196, 0.14); }
.tray-list .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-list .s { color: #dccbe6; white-space: nowrap; }
.tray-list .s.err { color: #ffb4ab; white-space: normal; text-align: right; }
.tray-list .s.ok { color: #a9e8c4; }
.tray-list button { background: none; border: 0; color: var(--butter); padding: 0; text-decoration: underline; }

.sponsor { display: block; margin: 10px 12px 12px; padding: 10px 14px; border-radius: var(--r-m); background: rgba(255, 243, 196, 0.12); color: inherit; text-decoration: none; font-size: 14px; }
.sponsor small { display: block; font-size: 11.5px; opacity: 0.75; margin-bottom: 2px; }
.sponsor strong { font-weight: 700; }
dialog .sponsor { background: var(--surface); margin: 16px 0 0; }

/* ---------- dialogs ---------- */

dialog {
  border: 0; padding: 0; color: var(--ink); background: var(--sheet);
  width: min(100vw, 480px); max-width: 100vw; max-height: 92dvh;
  border-radius: 26px 26px 0 0; margin: auto auto 0;
}
@media (min-width: 600px) { dialog { border-radius: 26px; margin: auto; } }
dialog::backdrop { background: rgba(37, 18, 47, 0.62); }
.sheet { padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.sheet-head h2 { flex: 1; font: 800 27px/1.05 var(--font); letter-spacing: -0.025em; }
.x { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink); display: grid; place-content: center; }
.sheet p + p { margin-top: 10px; }
.sheet .actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.sheet .actions .btn { flex: 1 1 auto; }
.sheet label, .sheet legend { display: block; font-weight: 700; margin: 16px 0 6px; padding: 0; }
.sheet fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.sheet fieldset + fieldset { margin-top: 16px; }
.sheet legend { margin: 0 0 8px; }
.sheet:focus { outline: none; }
.sheet select, .sheet textarea, .sheet input[type='text'], .sheet input[type='search'] { width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--r-s); background: var(--bg); color: var(--ink); }
body:not(.is-home) .sheet select, body:not(.is-home) .sheet textarea, body:not(.is-home) .sheet input[type='text'] { background: var(--surface); }
.sheet .bar { background: var(--line); border-radius: 3px; overflow: hidden; margin: 14px 0 8px; }
.sheet .bar i { background: var(--ink); }
.sheet .note { margin-top: 16px; font-size: 14.5px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.row .t { flex: 1; min-width: 0; }
.row .t strong { display: block; }
.row .t span { display: block; font-size: 14.5px; color: var(--muted); }

/* option lists in the view sheet */
.opts { display: grid; gap: 6px; }
.opts.seg { grid-auto-flow: column; grid-auto-columns: 1fr; }
/* colour scheme picker */
.schemes { display: grid; gap: 6px; }
.scheme { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 14px; border: 2px solid transparent; border-radius: 14px; background: var(--surface); color: var(--ink); text-align: left; }
.scheme .t { flex: 1; min-width: 0; }
.scheme strong { display: block; font-weight: 800; }
.scheme small { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.3; }
.scheme > svg { flex: none; visibility: hidden; }
.scheme[aria-checked='true'] { border-color: var(--ink); }
.scheme[aria-checked='true'] > svg { visibility: visible; }
.swatch { flex: none; display: flex; }
.swatch i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.18); }
.swatch i + i { margin-left: -7px; }
.opt { min-height: 46px; padding: 0 14px; border-radius: 13px; border: 0; background: var(--surface); color: var(--ink); font-weight: 600; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.opts.seg .opt { justify-content: center; text-align: center; padding: 0 6px; }
.opt[aria-checked='true'] { background: var(--btn-bg); color: var(--btn-fg); }
.opt svg { display: none; }
.opt[aria-checked='true'] svg { display: block; }
.opts.seg .opt svg { display: none; }

/* the ticket: the one loud object */
.ticket { background: var(--butter); color: var(--plum); border-radius: 20px; overflow: hidden; }
.ticket-qr { padding: 20px 20px 16px; display: grid; place-items: center; }
.ticket-qr svg { width: min(100%, 300px); height: auto; background: #fff; border-radius: 14px; padding: 14px; display: block; }
.ticket-qr img.qr-img { width: min(100%, 300px); height: auto; border-radius: 14px; display: block; image-rendering: pixelated; -webkit-touch-callout: default; }
.qr-tools { margin-top: 10px; }
.print-card { display: none; }
@media print {
  @page { margin: 12mm; }
  body > *:not(.print-card) { display: none !important; }
  .print-card { display: block !important; }
  .print-card img { display: block; width: 100%; max-width: 150mm; height: auto; margin: 0 auto; }
}
.ticket-cut { position: relative; height: 0; border-top: 3px dashed var(--plum); margin: 0 16px; opacity: 0.5; }
.ticket-cut::before, .ticket-cut::after { content: ''; position: absolute; top: -13px; width: 24px; height: 24px; border-radius: 50%; background: var(--sheet); }
.ticket-cut::before { left: -28px; }
.ticket-cut::after { right: -28px; }
.ticket-text { padding: 14px 20px 18px; }
.ticket-text strong { display: block; font: 800 26px/1.05 var(--font); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.ticket-text span { display: block; margin-top: 4px; font-size: 15px; }
.linkrow { display: flex; gap: 8px; margin-top: 14px; }
.linkrow input { flex: 1; min-width: 0; padding: 0 14px; min-height: 48px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 14px; }
.sheet .actions.share { margin-top: 10px; }

/* lightbox */
dialog.viewer { width: 100vw; height: 100dvh; max-height: 100dvh; max-width: 100vw; border-radius: 0; margin: 0; background: #1a0c22; color: #fff; }
.viewer-wrap { height: 100%; display: flex; flex-direction: column; }
.viewer-wrap:focus { outline: none; }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
.viewer-bar .t { flex: 1; min-width: 0; }
.viewer-bar .t strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-bar .t small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; color: #cdb9da; overflow: hidden; font-size: 13.5px; line-height: 1.3; }
.viewer-bar .x { background: rgba(255, 255, 255, 0.14); color: #fff; }
.stage { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.stage .frame { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; touch-action: manipulation; }
.stage .frame.haslive img { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.stage .frame img, .stage .frame video { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.stage .frame video.livev { position: absolute; inset: 0; margin: auto; }
.stage .frame.zoomed { overflow: auto; display: block; cursor: zoom-out; }
.stage .frame.zoomed img { max-width: none; max-height: none; width: 260%; }
.stage .frame.wide { overflow-x: auto; overflow-y: hidden; display: block; }
.stage .frame.wide img { max-width: none; height: 100%; width: auto; }
.stage .note { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 13px; color: #cdb9da; padding: 0 16px; pointer-events: none; text-shadow: 0 1px 3px #000; }
.stage .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; background: rgba(255, 255, 255, 0.12); color: #fff; display: grid; place-content: center; z-index: 2; }
.stage .nav.prev { left: 0; border-radius: 0 12px 12px 0; }
.stage .nav.next { right: 0; border-radius: 12px 0 0 12px; }
.livebtn { position: absolute; left: 12px; top: 10px; z-index: 3; min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--lilac); color: var(--plum); font-weight: 800; font-size: 13px; letter-spacing: 0.03em; display: inline-flex; align-items: center; gap: 6px; }
.livebtn[aria-pressed='true'] { background: var(--butter); }
.viewer-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
.viewer-actions .btn { flex: 1 1 auto; border-color: var(--butter); background: var(--butter); color: var(--plum); }
.viewer-actions .btn.quiet { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.55); flex: 0 0 auto; padding: 0 14px; }
.viewer-actions .btn { min-width: 0; }

/* misc */
.dropzone { position: fixed; inset: 0; z-index: 50; background: rgba(205, 189, 232, 0.95); color: var(--plum); display: grid; place-content: center; text-align: center; pointer-events: none; }
.dropzone strong { font: 800 clamp(40px, 9vw, 96px)/0.95 var(--font); letter-spacing: -0.04em; }
.toast { position: fixed; left: 50%; bottom: calc(var(--dock) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--plum); color: var(--cream); padding: 12px 18px; border-radius: 999px; font-weight: 700; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(37, 18, 47, 0.4); text-align: center; }
body.is-home .toast, body.is-doc .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }

/* ---------- information pages ---------- */

body.is-doc { background: var(--sheet); color: var(--plum); }
.doc-top { background: var(--butter); }
.doc-top .in { max-width: 760px; margin: 0 auto; padding: 14px var(--pad); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.doc-nav { background: var(--butter); border-bottom: 2px solid var(--plum); }
.doc-nav .in { max-width: 760px; margin: 0 auto; padding: 0 var(--pad) 12px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.doc-nav .in::-webkit-scrollbar { display: none; }
.doc-nav a { flex: none; padding: 9px 14px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 15px; background: var(--cream); }
.doc-nav a[aria-current='page'] { background: var(--plum); color: var(--butter); }
.doc { max-width: 760px; margin: 0 auto; padding: clamp(28px, 6vw, 56px) var(--pad) 40px; }
.doc h1 { font: 800 clamp(38px, 8vw, 60px)/0.96 var(--font); letter-spacing: -0.035em; text-wrap: balance; }
.doc .lead { margin-top: 16px; font-size: clamp(18px, 2.4vw, 21px); line-height: 1.45; max-width: 36em; }
.doc h2 { font: 800 25px/1.15 var(--font); letter-spacing: -0.015em; margin: 44px 0 10px; }
.doc h3 { font: 700 18px/1.25 var(--font); margin: 22px 0 4px; }
.doc p, .doc li, .doc dd, .doc dt { font-size: 17px; line-height: 1.55; }
.doc p { max-width: 38em; }
.doc p + p { margin-top: 12px; }
.doc ul, .doc ol { padding-left: 22px; margin: 8px 0; max-width: 38em; }
.doc li + li { margin-top: 6px; }
.doc a { font-weight: 600; text-underline-offset: 3px; }
.doc .card { margin-top: 18px; padding: 18px 20px; background: var(--cream); border-radius: var(--r-l); }
.doc .card h3 { margin-top: 0; }
.doc .card + .card { margin-top: 12px; }
.doc .steps { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; counter-reset: s; max-width: none; }
.doc .steps li { counter-increment: s; position: relative; padding: 16px 18px 16px 62px; background: var(--cream); border-radius: var(--r-l); margin: 0; }
.doc .steps li::before { content: counter(s); position: absolute; left: 16px; top: 14px; width: 32px; height: 32px; border-radius: 50%; background: var(--plum); color: var(--butter); display: grid; place-content: center; font-weight: 800; }
.doc .steps strong { display: block; font-size: 18px; }
.doc dl { margin: 18px 0 0; display: grid; gap: 2px 20px; grid-template-columns: minmax(120px, 0.6fr) 2fr; }
.doc dt { font-weight: 700; padding: 10px 0; border-top: 1.5px solid var(--line); }
.doc dd { margin: 0; padding: 10px 0; border-top: 1.5px solid var(--line); }
@media (max-width: 560px) { .doc dl { grid-template-columns: 1fr; } .doc dd { border-top: 0; padding-top: 0; } }
.doc form { margin-top: 22px; display: grid; gap: 4px; max-width: 560px; }
.doc form label { font-weight: 700; margin-top: 14px; }
.doc form .hint { font-size: 14.5px; color: var(--muted); }
.doc form input, .doc form select, .doc form textarea { width: 100%; padding: 13px 14px; border: 2px solid var(--plum); border-radius: 14px; background: #fff; color: var(--plum); }
.doc form .btn { margin-top: 20px; justify-self: start; }
.doc .result { margin-top: 16px; padding: 14px 16px; border-radius: var(--r-m); background: var(--cream); font-weight: 600; }
.doc .result.bad { border-left: 5px solid var(--danger); }
.doc-foot { max-width: 760px; margin: 0 auto; padding: 18px var(--pad) 40px; border-top: 2px solid var(--line); font-size: 15px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 20px; }
