:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b0d0a;
  color: #f7f5ed;
  --muted: #b8beb1;
  --line: #394034;
  --panel: #171b15;
  --accent: #dcebaa;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
p, h1, h2, figure { margin: 0; }
h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 2.7vw, 2rem);
  font-weight: 400;
  line-height: 1.17;
  text-wrap: balance;
}
h2 { font-size: .95rem; }
a { color: var(--accent); }
button, input, select {
  font: inherit;
  min-height: 44px;
  padding: .55rem .85rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: #1b2118;
  color: inherit;
}
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .42; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.brand {
  color: var(--accent);
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .19em;
  font-weight: 700;
  margin-bottom: .35rem;
}
.audience {
  height: 100vh;
  height: 100dvh;
  min-height: 280px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.audience-header, .audience-footer {
  padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
}
.audience-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding-top: max(.7rem, env(safe-area-inset-top));
  padding-bottom: .7rem;
}
#fullscreen { flex: none; }
.audience-main { min-height: 0; background: #000; }
.stage {
  position: relative;
  height: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
  touch-action: pan-y pinch-zoom;
}
.stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}
.stage > p { padding: 1rem; text-align: center; }
figcaption {
  position: absolute;
  inset: auto .6rem .55rem;
  width: fit-content;
  max-width: calc(100% - 1.2rem);
  max-height: 40%;
  overflow: auto;
  margin-inline: auto;
  padding: .4rem .7rem;
  border-radius: .35rem;
  background: rgb(0 0 0 / 83%);
  color: white;
  text-align: center;
  font-size: clamp(.83rem, 2vw, 1rem);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.audience-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .55rem 1rem;
  padding-top: .65rem;
  padding-bottom: max(.65rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.view-status { font-size: .82rem; color: var(--muted); }
#connection:not(:empty) { margin-top: .2rem; color: #f9d9a0; }
.slide-nav { display: flex; align-items: center; gap: .65rem; }
#position { text-align: center; min-width: 3rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
#mode-toggle { justify-self: end; border-color: #65764e; }
.no-script { position: fixed; inset: 42% 0 auto; padding: 1rem; background: #1b2118; text-align: center; }
.control-main { width: min(76rem, 100%); margin-inline: auto; padding: clamp(1rem, 3vw, 2.5rem); }
.control-header { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: 1.25rem; }
.control-status { color: var(--accent); margin-bottom: .7rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: .65rem; padding: 1rem; }
.login { display: grid; gap: .65rem; max-width: 26rem; }
.login button { justify-self: start; }
.primary { color: #14200e; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.notice { background: #352b19; border: 1px solid #69512d; border-radius: .5rem; padding: .8rem; margin-bottom: 1rem; }
.control-actions, .control-step, .control-jump { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.control-actions { justify-content: space-between; }
.control-jump select { min-width: 0; max-width: min(18rem, 65vw); }
.control-step strong { font-variant-numeric: tabular-nums; }
.end { border-color: #805c47; color: #ffdccc; }
.control-grid { display: grid; grid-template-columns: 3fr 2fr; gap: .8rem; margin: .8rem 0 1rem; }
.control-grid section { min-width: 0; display: grid; align-content: start; gap: .65rem; }
.preview { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: .25rem; }
.speaker-notes { white-space: pre-wrap; line-height: 1.55; }
@media (max-width: 720px) {
  .audience-footer { grid-template-columns: 1fr auto; }
  .view-status { grid-column: 1 / -1; }
  .wide { display: none; }
  .control-grid { grid-template-columns: 1fr; }
}
@media (max-width: 350px) {
  .audience-footer { column-gap: .35rem; }
  .audience-footer button { padding-inline: .5rem; }
  .slide-nav { gap: .2rem; }
}
