html, body.viewer {
  margin: 0;
  height: 100%;
  background: var(--viewer-bg-color, #0b120e);
  overflow: hidden;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

.viewer-app {
  --viewer-bg-color: #0b120e;
  --viewer-bg-image: none;
  position: relative;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  color: #f6efe3;
}

/* display: rules below must not win over the hidden attribute */
[hidden] { display: none !important; }

#camera, .camera-feed, .camera-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #15241c;
  z-index: 0;
}

/* Keep the video in the layout (not display:none) so iOS Safari can attach the stream. */
#camera:not(.is-live) {
  opacity: 0;
  pointer-events: none;
}
#camera.is-live {
  opacity: 1;
}

.camera-fallback {
  background-color: var(--viewer-bg-color, #15241c);
  background-image:
    linear-gradient(180deg, rgba(16,28,22,.28), rgba(10,16,12,.62)),
    var(--viewer-bg-image, none);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.viewer-app[data-bg-type="color"] .camera-fallback,
body.viewer[data-bg-type="color"] .camera-fallback {
  background-image: none;
}

.gate, .perm-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
  background: linear-gradient(180deg, rgba(10,16,12,.35), rgba(10,16,12,.88));
  z-index: 10;
}
.gate-card {
  width: min(440px, 100%);
  background: rgba(16, 22, 18, .92);
  border: 2px solid #e8c36a;
  border-radius: 18px;
  padding: 22px 20px 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.gate h1, .perm-error h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(26px, 6vw, 36px);
  margin: 0 0 8px;
  line-height: 1.15;
}
.gate p, .perm-error p { margin: 0 0 18px; color: #efe4d0; }
.gate-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.gate .cta, .perm-error .cta {
  border: 0;
  cursor: pointer;
  font: 800 16px "Source Sans 3", sans-serif;
}
.viewer-app.is-gated .hud,
.viewer-app.is-gated .empty-board,
.viewer-app.is-gated .concierge-fab,
.viewer-app.is-gated .selfie-btn,
.viewer-app.is-gated .selfie-hint { visibility: hidden; }
.gate-copy-desk { display: none; }
.desktop-preview-note { display: none; }

/* Wide layouts preview the board (no camera gate). Phones, including landscape under 1024px, keep the Safari camera path. */
@media (min-width: 1024px), (min-width: 801px) and (hover: hover) and (pointer: fine) {
  .gate-copy-phone { display: none; }
  .gate-copy-desk { display: block; }
  #start-ar,
  #retry-camera { display: none !important; }
  .desktop-preview-note {
    display: block;
    position: absolute;
    top: calc(12px + env(safe-area-inset-top));
    left: 12px;
    right: 68px;
    z-index: 6;
    margin: 0;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(16, 22, 18, .72);
    color: #e8c36a;
    font-size: 13px;
    font-weight: 700;
    width: fit-content;
    max-width: calc(100% - 80px);
  }
  .gate,
  html.is-desktop-preview .gate { display: none !important; }
  .camera-fallback[hidden],
  .camera-fallback,
  html.is-desktop-preview .camera-fallback[hidden],
  html.is-desktop-preview .camera-fallback {
    display: block !important;
  }
  .viewer-app.is-gated .hud,
  .viewer-app.is-gated .empty-board,
  .viewer-app.is-gated .concierge-fab,
  html.is-desktop-preview .viewer-app.is-gated .hud,
  html.is-desktop-preview .viewer-app.is-gated .empty-board,
  html.is-desktop-preview .viewer-app.is-gated .concierge-fab { visibility: visible; }
  .selfie-btn,
  .selfie-hint,
  html.is-desktop-preview .selfie-btn,
  html.is-desktop-preview .selfie-hint { display: none !important; }
}

.demo-banner {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 8;
  background: #e8c36a;
  color: #101c16;
  text-align: center;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 8px 10px;
}

.stage {
  position: absolute;
  inset: 0;
  perspective: 900px;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 3;
}

.billboard {
  width: min(86vw, 78vh, 560px);
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: rotateY(-7deg) rotateX(5deg) translateZ(28px);
  transform-style: preserve-3d;
  background: transparent;
  pointer-events: none;
  transition: transform .35s ease, width .35s ease;
}
.billboard-face {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 10px solid #1b140c;
  border-radius: 10px;
  box-shadow:
    0 28px 70px rgba(0,0,0,.55),
    inset 0 0 0 3px #e8c36a;
  background: #111;
  overflow: hidden;
  pointer-events: auto;
}
.billboard.featured {
  width: min(92vw, 86vh, 620px);
  transform: rotateY(-4deg) rotateX(3deg) translateZ(48px) scale(1.03);
}
.billboard.featured .billboard-face {
  box-shadow:
    0 36px 80px rgba(0,0,0,.6),
    inset 0 0 0 4px #f3d98a;
}
.billboard.is-tappable .billboard-face { cursor: pointer; }
.board-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  gap: 8px;
}
.share-icon,
.shot-icon {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(16, 22, 18, .72);
  color: #f6efe3;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.share-icon:focus-visible,
.shot-icon:focus-visible { outline: 2px solid #e8c36a; }
.shot-preview {
  display: block;
  width: 100%;
  max-height: 46vh;
  object-fit: contain;
  border-radius: 12px;
  margin: 12px 0 14px;
  background: #0b120e;
}
.cta.is-disabled { opacity: .45; pointer-events: auto; }

.selfie-btn {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 12px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  margin: 0;
  padding: 0 12px 0 10px;
  border: 1.5px solid rgba(246, 239, 227, .7);
  border-radius: 999px;
  background: rgba(10, 16, 12, .42);
  color: #f6efe3;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font: 800 13px/1 "Source Sans 3", sans-serif;
}
.selfie-btn:focus-visible {
  outline: 2px solid #e8c36a;
  outline-offset: 2px;
}
.viewer-app.is-selfie .selfie-btn {
  background: rgba(232, 195, 106, .24);
  border-color: #e8c36a;
  color: #f6efe3;
}
.viewer-app:has(.demo-banner) .selfie-btn {
  top: calc(44px + env(safe-area-inset-top));
}
.selfie-hint {
  position: absolute;
  top: calc(62px + env(safe-area-inset-top));
  left: 12px;
  z-index: 12;
  max-width: min(280px, calc(100% - 80px));
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(16, 22, 18, .88);
  color: #e8c36a;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
}
.viewer-app:has(.demo-banner) .selfie-hint {
  top: calc(94px + env(safe-area-inset-top));
}
.viewer-app.is-selfie #camera.is-live {
  transform: scaleX(-1);
}
.viewer-app.is-selfie .stage {
  place-items: start end;
  padding-top: max(76px, 12vh);
  padding-right: 2px;
}
.viewer-app.is-selfie .billboard,
.viewer-app.is-selfie .billboard.featured {
  width: min(56vw, 40vh, 320px);
  justify-self: end;
  transform-origin: right top;
  transform:
    rotateY(calc(-3deg + var(--selfie-yaw, 0deg)))
    rotateX(calc(5deg + var(--selfie-pitch, 0deg)))
    translate3d(var(--selfie-x, 0px), var(--selfie-y, 0px), -48px);
  transition: width .35s ease;
}
@media (prefers-reduced-motion: reduce) {
  .viewer-app.is-selfie .billboard,
  .viewer-app.is-selfie .billboard.featured {
    transform-origin: right top;
    transform: rotateY(-3deg) rotateX(5deg) translateZ(-48px);
  }
}

/* Screen HUD, top-right — stays off the billboard so Share can live on the frame. */
.hamburger {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  left: auto;
  z-index: 12;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1.5px solid rgba(246, 239, 227, .7);
  border-radius: 12px;
  background: rgba(10, 16, 12, .42);
  color: #f6efe3;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.hamburger .hamburger-icon {
  display: block;
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .65));
}
.hamburger:focus-visible {
  outline: 2px solid #e8c36a;
  outline-offset: 2px;
}
.hamburger.is-open {
  background: rgba(232, 195, 106, .22);
  border-color: #e8c36a;
  color: #f6efe3;
}
.viewer-app:has(.demo-banner) .hamburger {
  top: calc(44px + env(safe-area-inset-top));
}
.viewer-menu {
  position: absolute;
  top: calc(62px + env(safe-area-inset-top));
  right: 12px;
  left: auto;
  z-index: 12;
  min-width: min(280px, calc(100% - 24px));
  background: rgba(16, 22, 18, .96);
  border: 2px solid #e8c36a;
  border-radius: 16px;
  padding: 8px;
  display: flex;
  flex-direction: column;
}
.viewer-app:has(.demo-banner) .viewer-menu {
  top: calc(94px + env(safe-area-inset-top));
}
.viewer-menu a, .viewer-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #f6efe3;
  text-decoration: none;
  font: 700 16px "Source Sans 3", sans-serif;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.viewer-menu a:hover, .viewer-menu button:hover { background: rgba(246,239,227,.1); }

.concierge-fab {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 72px;
  margin: 0;
  padding: 6px 4px 4px;
  border: 0;
  background: transparent;
  color: #f6efe3;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.concierge-fab:not(.is-placed) { visibility: hidden; }
.concierge-fab-face,
.concierge-dude,
.concierge-label { pointer-events: none; }
.concierge-fab-face {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #f6efe3;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
  display: grid;
  place-items: center;
}
.concierge-dude {
  width: 40px;
  height: 40px;
  display: block;
  animation: concierge-bob 2.6s ease-in-out infinite;
}
.concierge-lid {
  transform-box: fill-box;
  transform-origin: center top;
  transform: scaleY(0);
  animation: concierge-blink 5.2s ease-in-out infinite;
}
.concierge-lid-r { animation-delay: .04s; }
.concierge-tie-spark {
  transform-box: fill-box;
  transform-origin: center;
  animation: concierge-twinkle 2.8s ease-in-out infinite;
}
.concierge-label {
  font: 800 9px/1 "Source Sans 3", sans-serif;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .85);
}
.concierge-fab:focus-visible {
  outline: 2px solid #e8c36a;
  outline-offset: 3px;
  border-radius: 12px;
}
.concierge-fab.is-open .concierge-fab-face {
  box-shadow: 0 0 0 3px #e8c36a, 0 6px 16px rgba(0, 0, 0, .5);
}
@keyframes concierge-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes concierge-blink {
  0%, 86%, 94%, 100% { transform: scaleY(0); }
  90% { transform: scaleY(1); }
}
@keyframes concierge-twinkle {
  0%, 68%, 100% { opacity: .2; transform: scale(.75); }
  80% { opacity: 1; transform: scale(1.2); }
}
@media (prefers-reduced-motion: reduce) {
  .concierge-dude,
  .concierge-lid,
  .concierge-tie-spark { animation: none; }
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(110px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 12;
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(16, 22, 18, .88);
  color: #e8c36a;
  font-size: 14px;
  white-space: nowrap;
}
.billboard-media {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.billboard-media img, .billboard-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.billboard.headline-only .billboard-face {
  background:
    linear-gradient(180deg, #2d4a38, #101c16);
}
.billboard.headline-only .billboard-media img {
  display: none;
}
.billboard-media video { position: absolute; inset: 0; }
.billboard-copy {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 18px 78px 16px 16px;
  background: linear-gradient(180deg, transparent, rgba(10,12,8,.88) 42%);
  pointer-events: none;
}
.billboard-copy .cta { pointer-events: auto; }
.billboard-copy .who {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #e8c36a;
  font-weight: 700;
}
.billboard-copy h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(22px, 5.4vw, 34px);
  line-height: 1.1;
  margin: 4px 0 12px;
  text-shadow: 0 2px 10px rgba(0,0,0,.7);
}
.cta {
  display: inline-flex;
  background: #c23b2e;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 999px;
}

.hud {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(8,10,8,.78));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.progress {
  height: 4px;
  background: rgba(255,255,255,.2);
  border-radius: 99px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: #e8c36a;
}
.controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.controls button, .ask-btn {
  border: 0;
  border-radius: 999px;
  background: rgba(246,239,227,.12);
  color: #f6efe3;
  padding: 10px 16px;
  font: 700 14px "Source Sans 3", sans-serif;
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.controls button[disabled] { opacity: .4; }
.meta-line {
  text-align: center;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #efe4d0;
}

.share-sheet, .shot-sheet {
  position: absolute;
  inset: 0;
  z-index: 11;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(8, 10, 8, .55);
}
.share-card {
  width: min(440px, 100%);
  background: rgba(16, 22, 18, .96);
  border: 2px solid #e8c36a;
  border-radius: 18px;
  padding: 18px 16px 16px;
}
.share-card strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
}
.share-status {
  margin: 10px 0 14px;
  color: #efe4d0;
  font-size: 14px;
  word-break: break-word;
}
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.share-actions button, .share-actions .cta {
  border: 0;
  cursor: pointer;
  font: 800 14px "Source Sans 3", sans-serif;
}
.share-actions button {
  background: rgba(246,239,227,.14);
  color: #f6efe3;
  padding: 10px 14px;
  border-radius: 999px;
}

.chat-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 13;
  max-height: 72dvh;
  background: #14110d;
  border-top: 3px solid #e8c36a;
  transform: translateY(110%);
  transition: transform .28s ease;
  display: flex;
  flex-direction: column;
}
.chat-panel.open { transform: translateY(0); }
.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
}
.chat-head strong { font-family: "Fraunces", Georgia, serif; }
.chat-head button {
  border: 0;
  background: rgba(246,239,227,.14);
  color: #f6efe3;
  border-radius: 999px;
  padding: 8px 12px;
  font: 700 13px "Source Sans 3", sans-serif;
  cursor: pointer;
}
.chat-log {
  flex: 1;
  overflow: auto;
  padding: 8px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
}
.bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 15px;
}
.bubble.user { align-self: flex-end; background: #2d4a38; }
.bubble.bot { align-self: flex-start; background: #2a2218; }
.bubble.warn { align-self: stretch; background: #3a2a12; color: #f3d98a; }
.chat-form { display: flex; gap: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
.chat-form input {
  flex: 1;
  border: 1px solid #3a3228;
  background: #1b1713;
  color: #f6efe3;
  border-radius: 999px;
  padding: 11px 14px;
  font-size: 16px;
}
.chat-form button {
  border: 0;
  background: #c23b2e;
  color: #fff;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 800;
}

.empty-board {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  z-index: 4;
}
.empty-board .cardish {
  background: rgba(16, 20, 16, .78);
  border: 2px solid #e8c36a;
  padding: 24px;
  border-radius: 16px;
  max-width: 22em;
}
