:root {
  --night: #1d1730;      /* venue after dark */
  --booth: #2a2244;      /* raised surfaces */
  --rail: #3b3160;       /* borders, tracks */
  --bone: #f4ecdd;       /* text */
  --haze: #b3a9cf;       /* secondary text */
  --live: #ffb53d;       /* someone is being heard */
  --hush: #ff7a70;       /* muted, destructive */
  --font: "Bricolage Grotesque", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --r-s: 10px; --r-m: 18px; --r-l: 28px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .row, .stack, .field set display, which would otherwise beat the attribute */
html, body { height: 100%; }
body {
  margin: 0; background: var(--night); color: var(--bone);
  font: 400 1rem/1.45 var(--font);
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
#app { min-height: 100dvh; max-width: 30rem; margin: 0 auto; padding: max(1.25rem, env(safe-area-inset-top)) 1.125rem max(1.25rem, env(safe-area-inset-bottom)); }
.view { display: flex; flex-direction: column; gap: 1.25rem; min-height: calc(100dvh - 2.5rem); }
.view[hidden] { display: none; }
.view.center { align-items: center; justify-content: center; text-align: center; }

h1, h2, h3, p { margin: 0; }
.wordmark { font-size: 3.4rem; font-weight: 800; letter-spacing: -0.045em; line-height: 0.95; font-variation-settings: "opsz" 96; margin-top: 1.5rem; display: flex; align-items: center; gap: 0.6rem; }
/* Live captions on a big screen */
body.show { background: var(--night); color: var(--bone); margin: 0; min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr; }
.show-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.5rem; }
.show-head h1 { margin: 0; font-size: clamp(1.4rem, 3vw, 2.4rem); }
.show-lang { display: flex; gap: 0.5rem; align-items: center; color: var(--haze); }
.show-status { text-align: center; color: var(--haze); font-size: 1.4rem; }
.show-lines { list-style: none; margin: 0; padding: 0 1.5rem 7rem; overflow-y: auto; display: grid; gap: 1.2rem; align-content: end; }
.show-lines b { display: block; color: var(--live); font-size: clamp(1rem, 1.6vw, 1.4rem); }
.show-lines p { margin: 0; font-size: clamp(1.8rem, 4.2vw, 3.6rem); font-weight: 700; line-height: 1.15; }
.show-lines p.tr { color: var(--bone); }
.show-lines p.orig { font-size: clamp(1rem, 1.8vw, 1.5rem); font-weight: 400; color: var(--haze); }
.show-lines li.partial p { color: var(--haze); font-weight: 600; }
.show-join { position: fixed; right: 1rem; bottom: 1rem; background: #fff; color: #111; border-radius: 12px; padding: 0.5rem; text-align: center; font-size: 0.8rem; width: 7.5rem; }
.show-join svg { width: 100%; height: auto; display: block; }
/* A printable sign */
body.sign { background: #fff; color: #111; }
.sign-page { max-width: 38rem; margin: 0 auto; padding: 2rem 1.5rem; text-align: center; }
.sign-brand { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-weight: 800; font-size: 1.4rem; }
.sign-page h1 { font-size: 2.6rem; margin: 0.5rem 0 1rem; }
.sign-qr svg { width: min(22rem, 80vw); height: auto; }
.sign-langs { list-style: none; padding: 0; margin: 1rem 0; font-size: 1.2rem; line-height: 1.6; }
.sign-langs li:first-child { font-weight: 800; font-size: 1.5rem; }
.sign-note, .sign-url { color: #555; }
@media print { #sign-print { display: none; } }
a.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; line-height: 1.2; }
/* Legal pages and links */
.legal { text-align: center; font-size: 0.875rem; color: var(--haze); margin-top: 2rem; }
.legal a, .doc a { color: var(--live); }
body.doc { background: var(--night); color: var(--bone); }
.doc-page { max-width: 44rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; line-height: 1.55; }
.doc-page h1 { font-size: 2.2rem; margin: 0.5rem 0 0.25rem; }
.doc-page h2 { font-size: 1.25rem; margin: 2rem 0 0.5rem; }
.doc-page li { margin: 0.35rem 0; }
.wordmark img { width: 0.95em; height: 0.95em; flex: none; }
.lede { color: var(--haze); font-size: 1.0625rem; max-width: 26ch; text-wrap: balance; }
.view.center .lede { max-width: 30ch; }
h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
h3 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.015em; }
.sub, small { color: var(--haze); font-size: 0.875rem; }
small { display: block; }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: 0.625rem; }
.row > * { flex: 1; }

.field { display: flex; flex-direction: column; gap: 0.4rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-weight: 600; font-size: 0.9375rem; padding: 0; }
.field > legend { margin-bottom: 0.4rem; }
input:not([type]), input[type="text"], select {
  font: inherit; color: var(--bone); background: var(--booth); border: 1.5px solid var(--rail);
  border-radius: var(--r-s); padding: 0.8rem 0.9rem; width: 100%;
}
input::placeholder { color: color-mix(in srgb, var(--haze) 60%, transparent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--haze) 50%), linear-gradient(135deg, var(--haze) 50%, transparent 50%); background-position: right 1.1rem center, right 0.8rem center; background-size: 0.3rem 0.3rem; background-repeat: no-repeat; padding-right: 2.2rem; }
[dir="rtl"] select { background-position: left 0.8rem center, left 1.1rem center; padding-right: 0.9rem; padding-left: 2.2rem; }
input[type="range"] { width: 100%; accent-color: var(--live); height: 2rem; }

button, a.button {
  font: 600 1rem/1 var(--font); color: var(--bone); background: var(--booth); border: 1.5px solid var(--rail);
  border-radius: var(--r-s); padding: 0.85rem 1rem; cursor: pointer; touch-action: manipulation;
}
button:active { transform: translateY(1px); }
button.primary { background: var(--live); border-color: var(--live); color: #2a1c00; font-weight: 700; padding: 1rem; }
button.danger { color: var(--hush); border-color: color-mix(in srgb, var(--hush) 55%, var(--rail)); }
button.quiet { background: none; border-color: transparent; color: var(--haze); font-weight: 500; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--bone); outline-offset: 2px; }

.stepper { display: grid; grid-template-columns: 3.25rem 1fr 3.25rem; align-items: center; background: var(--booth); border: 1.5px solid var(--rail); border-radius: var(--r-s); }
.stepper button { border: 0; background: none; font-size: 1.5rem; padding: 0.7rem 0; }
.stepper output { text-align: center; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.choices { display: grid; gap: 0.5rem; }
.choices label { display: grid; grid-template-columns: 1fr; gap: 0.1rem; padding: 0.75rem 0.9rem; border: 1.5px solid var(--rail); border-radius: var(--r-s); cursor: pointer; position: relative; }
.choices input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choices label:has(input:checked) { border-color: var(--live); background: color-mix(in srgb, var(--live) 12%, var(--night)); }
.choices label:has(input:focus-visible) { outline: 3px solid var(--bone); outline-offset: 2px; }
.choices b { font-weight: 600; }

.switch { display: grid; grid-template-columns: auto 1fr; gap: 0.8rem; align-items: start; cursor: pointer; }
.switch input { appearance: none; width: 2.9rem; height: 1.7rem; border-radius: 1rem; background: var(--rail); position: relative; margin: 0.1rem 0 0; cursor: pointer; flex: none; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--bone); transition: transform 0.15s; }
.switch input:checked { background: var(--live); }
.switch input:checked::after { transform: translateX(1.2rem); background: #2a1c00; }
.switch b { display: block; font-weight: 600; }
.switch[hidden] { display: none; }

.joinrow { display: grid; grid-template-columns: 1fr auto auto; gap: 0.625rem; align-items: end; margin-top: auto; padding-top: 1.5rem; border-top: 1.5px solid var(--rail); }

.notice { background: var(--booth); border-left: 4px solid var(--live); border-radius: var(--r-s); padding: 0.8rem 0.9rem; }
.notice.bad { border-left-color: var(--hush); }

/* Sound check */
.check-ring { width: 7rem; height: 7rem; border-radius: 50%; border: 5px solid var(--rail); border-top-color: var(--live); animation: turn 1.1s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }

/* Room */
.room { gap: 1rem; }
.room-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.room-head > div:first-child { flex: 1 1 9rem; min-width: 0; }
.head-actions { display: flex; gap: 0.5rem; flex: none; }
.head-actions button { padding: 0.65rem 0.8rem; font-size: 0.9375rem; }
#room-title { overflow-wrap: anywhere; }

.voices { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(5.75rem, 1fr)); gap: 1.25rem 0.5rem; }
.voice { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; text-align: center; }
.voice button { all: unset; cursor: pointer; display: grid; place-items: center; width: 4.75rem; height: 4.75rem; border-radius: 50%; background: var(--booth); font: 700 1.6rem/1 var(--font); color: var(--bone); box-shadow: 0 0 0 3px var(--rail); transition: box-shadow 0.12s, background 0.12s; }
.voice button:focus-visible { outline: 3px solid var(--bone); outline-offset: 6px; }
.voice.speaking button { background: var(--live); color: #2a1c00; box-shadow: 0 0 0 3px var(--night), 0 0 0 7px var(--live), 0 0 0 14px color-mix(in srgb, var(--live) 28%, transparent); }
.voice.muted button { color: var(--haze); box-shadow: 0 0 0 3px var(--rail); background: repeating-linear-gradient(135deg, var(--booth) 0 7px, var(--night) 7px 14px); }
.voice .who { font-weight: 600; font-size: 0.9375rem; line-height: 1.15; max-width: 100%; overflow-wrap: anywhere; }
.voice .tag { color: var(--haze); font-size: 0.78rem; min-height: 1em; }
.voice.muted .tag { color: var(--hush); }
.voice.empty button { background: none; box-shadow: none; border: 2px dashed var(--rail); width: 4.5rem; height: 4.5rem; color: var(--haze); cursor: default; font-size: 1.2rem; }

/* Translated captions */
.captions { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; align-content: start; max-height: 40vh; min-height: 6rem; overflow-y: auto; }
.captions[hidden] { display: none; }
.cap-tools { display: flex; justify-content: space-between; gap: 0.5rem; }
.cap-tools[hidden] { display: none; }
.cap-tools button { padding: 0.35rem 0.6rem; font-size: 0.875rem; }
/* Large captions: the transcript fills the screen, people are hidden. */
.room.big .voices { display: none; }
.room.big .captions { max-height: 62vh; }
.room.big .captions li { font-size: 1.75rem; line-height: 1.25; }
.captions li, .ip-log li { cursor: pointer; }
.big-view { inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border: 0; padding: 1rem; background: var(--night); color: var(--bone); display: none; }
.big-view[open] { display: grid; grid-template-rows: 1fr auto; gap: 1rem; }
.big-text { overflow-y: auto; display: grid; align-content: center; gap: 1.5rem; }
.big-text.flipped { transform: rotate(180deg); }
.big-text p { margin: 0; font-size: clamp(2rem, 9vw, 3.5rem); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.big-text small { display: block; color: var(--haze); font-size: 1rem; }
.summary-text { white-space: pre-wrap; max-height: 60vh; overflow-y: auto; margin: 0; }
.phrase-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; max-height: 60vh; overflow-y: auto; }
.phrase-list button { width: 100%; text-align: start; }
.captions li { background: var(--booth); border-radius: var(--r-s); padding: 0.55rem 0.8rem; font-size: 1.0625rem; line-height: 1.35; overflow-wrap: anywhere; }
.captions li.mention { box-shadow: inset 4px 0 0 var(--live); }
.captions li.partial span { color: var(--haze); font-style: italic; }
.captions b { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--live); }
.captions li.pending span { color: var(--haze); }
.captions small { margin-top: 0.15rem; }
.captions .tr { display: block; margin-top: 0.3rem; padding-top: 0.3rem; border-top: 1px solid var(--rail); color: var(--live); font-weight: 600; }
.caption-note { margin-top: -0.4rem; color: var(--live); font-size: 0.8125rem; }
#btn-translate[aria-pressed="true"] { border-color: var(--live); color: var(--live); }

/* Language packs to download */
.packs { display: grid; gap: 0.6rem; background: var(--booth); border-radius: var(--r-m); padding: 0.9rem; }
.packs-title { font-weight: 700; }
.packs-list { display: grid; gap: 0.35rem; }
.pack { display: grid; grid-template-columns: auto 1fr auto; gap: 0.6rem; align-items: center; cursor: pointer; padding: 0.35rem 0; }
.pack input { width: 1.25rem; height: 1.25rem; accent-color: var(--live); margin: 0; }
.pack small { color: var(--haze); font-variant-numeric: tabular-nums; }
.pack .why { display: block; font-size: 0.85rem; line-height: 1.35; margin-top: 0.15rem; font-variant-numeric: normal; }
.packs-check { color: var(--haze); font-size: 0.85rem; }
.vc-sentence { font-size: 1.25rem; font-weight: 600; line-height: 1.4; background: var(--booth); border-radius: var(--r-m); padding: 0.9rem; }
#btn-hand[aria-pressed="true"] { color: var(--live); border-color: var(--live); }

/* Interpreter */
.interp-entry { text-align: left; padding: 1rem; font-weight: 600; }
.interp-entry::after { content: " →"; color: var(--live); }
.ip-langs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.5rem; align-items: end; }
.ip-langs .swap { padding: 0.8rem 0.7rem; font-size: 1.2rem; }
.ip-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; overflow-y: auto; flex: 1; align-content: start; }
.ip-log li { max-width: 88%; background: var(--booth); border-radius: var(--r-m); padding: 0.7rem 0.9rem; display: grid; gap: 0.25rem; overflow-wrap: anywhere; }
.ip-log li.side-a { justify-self: start; border-bottom-left-radius: var(--r-s); }
.ip-log li.side-b { justify-self: end; border-bottom-right-radius: var(--r-s); background: color-mix(in srgb, var(--live) 16%, var(--booth)); }
.ip-log .said { font-size: 1.2rem; font-weight: 600; line-height: 1.3; }
.ip-log .orig { color: var(--haze); font-size: 0.875rem; }
.ip-manual { width: 100%; }
.ip-type { width: 100%; display: grid; grid-template-columns: minmax(0, 7rem) 1fr auto; gap: 0.4rem; }
.ip-type select, .ip-type input { min-width: 0; }
.ip-type button { padding: 0 1rem; }
.ip-manual button { padding: 1.4rem 0.6rem; font-size: 1rem; }

.knocks { display: grid; gap: 0.5rem; }
.knock { background: var(--booth); border-radius: var(--r-s); padding: 0.75rem 0.9rem; display: grid; gap: 0.6rem; border-left: 4px solid var(--live); }
.knock .row button { padding: 0.65rem; }

.chip { margin-top: auto; text-align: left; font-weight: 500; font-size: 0.875rem; line-height: 1.3; color: var(--haze); background: none; border: 1.5px solid var(--rail); border-radius: var(--r-m); padding: 0.6rem 0.85rem; }
.advice { margin: 0; padding: 0 0 0 1.1rem; color: var(--haze); font-size: 0.875rem; display: grid; gap: 0.35rem; }
.advice[hidden] { display: none; }

.talkbar { position: sticky; bottom: 0; display: grid; justify-items: center; gap: 0.5rem; padding: 0.75rem 0 0; background: linear-gradient(to top, var(--night) 75%, transparent); }
.talk-hint { color: var(--haze); font-size: 0.9375rem; min-height: 1.4em; text-align: center; }
.talk {
  width: min(100%, 17rem); height: 5.5rem; border-radius: var(--r-l); border: 0;
  background: var(--booth); box-shadow: inset 0 0 0 2px var(--rail), 0 6px 0 #120d20;
  font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.talk.ptt { height: 9.5rem; width: 9.5rem; border-radius: 50%; font-size: 1.15rem; }
.talk.live { background: var(--live); color: #2a1c00; box-shadow: 0 2px 0 #7a4d00; transform: translateY(4px); }
.talk.off { color: var(--hush); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--hush) 55%, var(--rail)), 0 6px 0 #120d20; }
.talk:active { transform: translateY(4px); }

/* Sheets */
.sheet { border: 0; padding: 1.5rem 1.125rem max(1rem, env(safe-area-inset-bottom)); margin: auto auto 0; width: 100%; max-width: 30rem; max-height: 92dvh; overflow: auto; background: var(--night); color: var(--bone); border-radius: var(--r-l) var(--r-l) 0 0; box-shadow: 0 -2px 0 var(--rail); }
.sheet[open] { display: flex; flex-direction: column; gap: 1rem; }
.sheet::backdrop { background: rgb(8 5 16 / 0.7); }
.scan-frame { width: min(100%, 20rem); aspect-ratio: 1; margin: 0 auto; border-radius: var(--r-m); overflow: hidden; background: var(--booth); box-shadow: 0 0 0 3px var(--live); }
.scan-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.qr { background: var(--bone); border-radius: var(--r-m); padding: 1rem; width: min(100%, 17rem); margin: 0 auto; aspect-ratio: 1; }
.qr svg { display: block; width: 100%; height: 100%; }
.link { text-align: center; font-weight: 600; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }

.toast { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--bone); color: var(--night); font-weight: 600; padding: 0.75rem 1rem; border-radius: var(--r-m); max-width: calc(100vw - 2rem); z-index: 20; text-align: center; }
.toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .check-ring { animation: none; border-color: var(--live); }
  * { transition: none !important; }
}
.joinrow .field > span { white-space: nowrap; }

/* Table cards (sign.html?cards=1): six a page, cut along the dashed lines. */
.sign-cards { padding: 1rem; }
.sign-cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; max-width: 190mm; margin: 0 auto; background: #fff; color: #111; }
.sign-card { border: 1px dashed #999; padding: 6mm; display: grid; justify-items: center; gap: 2mm; text-align: center; min-height: 85mm; }
.sign-card h2 { margin: 0; font-size: 15pt; }
.sign-card p { margin: 0; font-size: 8pt; }
.sign-card-qr { width: 34mm; height: 34mm; }
.sign-card-qr svg { width: 100%; height: 100%; }
.sign-card-nfc { width: 22mm; height: 22mm; border: 1.5px solid #111; border-radius: 50%; display: grid; place-items: center; font-size: 7pt; font-weight: 700; }
.sign-card-url { color: #555; }
.sign-cards-tools { display: flex; gap: 0.75rem; justify-content: center; margin-top: 1rem; }
@media print { .sign-cards-tools, #sign-cards-link { display: none; } .sign-cards { padding: 0; } }
