:root {
  color-scheme: dark;
  --bg: #121310;
  --text: #f4f2e9;
  --muted: #bdbbb0;
  --yellow: #ffdb41;
  --line: #393a33;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; }
button { cursor: pointer; font: inherit; }
[hidden] { display: none !important; }
p, h1, h2, figure { margin: 0; }

.welcome {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: max(1.75rem, env(safe-area-inset-top)) 1.25rem max(1.75rem, env(safe-area-inset-bottom));
}

.intro { display: grid; gap: 1.75rem; width: min(100%, 32rem); }
.poster {
  background-color: #191a16;
  border: 1px solid var(--line);
  display: grid;
  min-height: 11rem;
  max-height: 51svh;
  overflow: hidden;
  padding: .75rem;
  place-items: center;
}
.poster img {
  width: 100%;
  height: auto;
  max-height: min(46vh, 29rem);
  object-fit: contain;
  display: block;
}
.intro-copy { display: grid; align-content: center; gap: .9rem; }
h1 {
  font-size: clamp(1.65rem, 6vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -.055em;
  display: grid;
  gap: .3rem;
}
h1 strong {
  color: var(--yellow);
  font-size: clamp(4.5rem, 18vw, 8rem);
  font-family: "Arial Black", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: -.095em;
  line-height: .85;
}
h1 strong span { padding-left: .018em; }
#intro-hint { font-size: 1rem; line-height: 1.6; color: var(--muted); }
.intro-actions { margin-top: .55rem; display: grid; gap: .35rem; }
.primary, .secondary, .glass {
  border-radius: 5px;
  min-height: 3.05rem;
  padding: .7rem 1rem;
  font-size: 1rem;
  font-weight: 680;
  border: 1px solid transparent;
}
.primary { background: var(--yellow); color: #15150e; }
.primary:active { background: #e9c42b; }
.secondary { background: transparent; color: var(--text); }
.secondary:active { background: #23241d; }
.glass { background: #161713ec; color: var(--text); border-color: #535249; }
.compact { padding-inline: .85rem; }
button:focus-visible { outline: 2px solid #fff4af; outline-offset: 3px; }
.message {
  border-left: 2px solid var(--yellow);
  color: var(--text);
  padding-left: .75rem;
  font-size: .9375rem;
  line-height: 1.6;
}

.ar-view {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #11120f;
}
.camera-stage { position: absolute; inset: 0; overflow: hidden; }
#camera-feed, #ar-overlay { display: block; width: 100%; height: 100%; position: absolute; inset: 0; }
#camera-feed { object-fit: cover; }
#ar-overlay { pointer-events: none; }
.camera-top, .camera-bottom {
  display: flex;
  position: absolute;
  left: max(1rem, env(safe-area-inset-left));
  right: max(1rem, env(safe-area-inset-right));
  width: auto;
}
.camera-top { top: max(1rem, env(safe-area-inset-top)); justify-content: flex-end; }
.camera-bottom {
  flex-direction: column;
  gap: .65rem;
  align-items: center;
  text-align: center;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
}
.camera-feedback {
  background: #121310e6;
  border: 1px solid #545347;
  border-radius: 5px;
  padding: .7rem 1rem;
  line-height: 1.45;
}
#tracking-status { font-size: 1rem; font-weight: 750; color: var(--yellow); }
#tracking-hint { font-size: .9rem; color: var(--text); }
#tracking-hint:empty { display: none; }
.camera-actions { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; }
.camera-actions:has(button[hidden] + button[hidden]) { display: none; }

.reticle {
  position: absolute;
  left: 50%;
  top: 47%;
  transform: translate(-50%, -50%);
  width: min(66vw, 40vh, 20rem);
  aspect-ratio: 600 / 848;
  pointer-events: none;
  display: none;
}
[data-mode="scanning"] .reticle { display: block; }
.reticle i { position: absolute; width: 1.8rem; height: 1.8rem; border: solid var(--yellow); border-width: 0; filter: drop-shadow(0 1px 2px #18180e); }
.reticle i:nth-child(1) { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.reticle i:nth-child(2) { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.reticle i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.reticle i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

.texture-video {
  position: fixed;
  width: 1px;
  height: 1px;
  bottom: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
}

dialog {
  width: min(42rem, calc(100% - 2rem));
  background: #191a16;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1rem;
  max-height: 94vh;
}
dialog[open] { position: fixed; inset: 0; margin: auto; }
dialog::backdrop { background: #080905e8; }
.video-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.video-header h2 { font-size: 1.2rem; }
#fallback-video { display: block; width: 100%; max-height: 70vh; background: #000; }
#video-message { margin-top: .7rem; }

@media (min-width: 740px) {
  .intro { width: min(100%, 62rem); display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(2rem, 6vw, 5rem); }
  .poster { height: min(70vh, 37rem); max-height: none; padding: 1.1rem; }
  .poster img { max-height: min(65vh, 34rem); }
  .intro-actions { width: min(100%, 21rem); }
}

@media (max-height: 550px) and (orientation: landscape) {
  .camera-top { justify-content: flex-start; }
  .camera-bottom { right: max(1rem, env(safe-area-inset-right)); align-items: flex-end; text-align: right; }
  .reticle { width: min(52vw, 46vh, 20rem); }
}
