:root {
  color-scheme: dark;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --bg: #050505;
  --text: #f7f7f5;
  --muted: rgba(247,247,245,.68);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #000; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button { font: inherit; }
button:disabled { opacity: .48; cursor: default; }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
#app, #camera-shell, .screen { position: fixed; inset: 0; }
#camera-shell { z-index: 1; background: #000; overflow: hidden; }
#ar-scene { width: 100%; height: 100%; }
.screen { z-index: 10; }

.screen--solid {
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-top)) calc(24px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left));
  background: var(--bg);
  color: var(--text);
}
.start-panel {
  width: min(480px, 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.brand-block { margin-bottom: 30px; }
.author {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(247,247,245,.68);
}
h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(38px, 10vw, 58px);
  line-height: 1;
  letter-spacing: -.035em;
}
.book-icon {
  width: 74px;
  height: 74px;
  object-fit: cover;
  margin: 0 0 30px;
}
.intro-copy {
  max-width: 390px;
  margin: 0 auto 30px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.52;
}
.intro-copy p { margin: 0; }
.intro-copy p + p { margin-top: 10px; }
#start-button, #retry-button {
  min-height: 54px;
  padding: 0 28px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: #f5f5f2;
  color: #080808;
  font-weight: 650;
  letter-spacing: .01em;
  cursor: pointer;
}

.screen--transparent {
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: calc(18px + var(--safe-top)) calc(18px + var(--safe-right)) calc(30px + var(--safe-bottom)) calc(18px + var(--safe-left));
  background: linear-gradient(to bottom, rgba(0,0,0,.12), transparent 62%, rgba(0,0,0,.48));
}
.scanner-hint {
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: min(420px, 94vw);
  padding: 10px 15px 10px 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: rgba(4,4,4,.54);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.scanner-hint img { width: 32px; height: 32px; object-fit: cover; flex: 0 0 auto; }
#scan-message { margin: 0; font-size: 13px; line-height: 1.25; color: rgba(255,255,255,.94); }

.screen--video { z-index: 30; background: #000; }
#recipe-video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.close-button {
  position: absolute;
  z-index: 32;
  top: calc(14px + var(--safe-top));
  right: calc(14px + var(--safe-right));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(0,0,0,.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-size: 28px;
  line-height: 38px;
  cursor: pointer;
}
.fallback-play {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%,-50%);
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(0,0,0,.58);
  color: #fff;
  font-weight: 600;
}
.error-panel { width: min(430px, 100%); text-align: center; }
.error-label { margin: 0 0 16px; font-size: 11px; letter-spacing: .18em; opacity: .55; }
.error-panel h2 { margin: 0 0 16px; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 32px; }
.error-panel p { color: var(--muted); line-height: 1.5; }
#retry-button { margin-top: 10px; }

a-scene .a-enter-vr, a-scene .a-enter-ar { display: none !important; }
.screen--video.priming { display: block !important; opacity: 0; pointer-events: none; }
.screen--video.priming #recipe-video { width: 1px; height: 1px; }

@media (max-height: 650px) {
  .brand-block { margin-bottom: 20px; }
  .book-icon { width: 58px; height: 58px; margin-bottom: 20px; }
  .intro-copy { margin-bottom: 22px; font-size: 14px; }
  h1 { font-size: clamp(34px, 9vw, 48px); }
}
