:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #f1e9de;
  background: #151313;
}

.robot-line:has(.dialogue-layout) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.dialogue-layout, .dialogue-visible {
  grid-area: 1 / 1;
  min-width: 0;
}
.dialogue-layout { opacity: 0; user-select: none; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
html.transition-active, html.transition-active body {
  overflow: hidden;
  overscroll-behavior: none;
}

main {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  text-align: center;
  padding: 2rem 1.25rem;
  background: radial-gradient(ellipse at 50% 56%, #3a2926, #151313 65%);
}

.entrance-content {
  align-self: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 1rem;
}

#entrance p { max-width: min(100%, 26rem); margin: 0; line-height: 1.65; }
#camera-notice, .camera-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  justify-items: center;
  gap: 1.25rem;
}
#entrance .camera-note {
  max-width: min(100%, 20rem);
  font-size: .875rem;
  color: #cabbae;
}
.direct-note {
  display: block;
  margin-top: .6rem;
  font-size: .875rem;
  color: #cabbae;
}
.camera-footer {
  display: none;
  justify-items: center;
  padding-top: 1.5rem;
  padding-bottom: env(safe-area-inset-bottom);
}
#entrance:has(#camera-notice:not([hidden]) #camera-consent:not([hidden])) .camera-footer {
  display: grid;
}
.opening-robot {
  position: relative;
  width: clamp(4.75rem, 19vw, 7rem);
  filter: brightness(1.8);
  transform-origin: 54% 85%;
  animation: robot-two-frames 1.2s step-end infinite;
}
.opening-robot img { display: block; width: 100%; height: auto; }
.opening-robot img:first-child { clip-path: inset(0 0 48%); }
.opening-robot .opening-robot-step {
  position: absolute;
  inset: 0;
  clip-path: inset(51% 0 0);
  transform-origin: 54% 52%;
  animation: robot-two-steps 1.2s step-end infinite;
}
@keyframes robot-two-frames {
  0%, 100% { transform: none; }
  50% { transform: translate(4px, -5px) rotate(5deg); }
}
@keyframes robot-two-steps {
  0%, 100% { transform: none; }
  50% { transform: rotate(-13deg) translateX(-1px); }
}
.robot-line {
  min-width: 0;
  overflow-wrap: anywhere;
  padding: .65rem 1rem;
  border: 1px solid #d7ae8d4d;
  border-radius: .55rem;
  background: #211a18ed;
}
#entrance .robot-line {
  position: relative;
  width: min(100%, 26rem);
  padding: .9rem 1.05rem;
  border-color: #ad8268;
  border-radius: .9rem;
  background: #2c211c;
}
#entrance .robot-line::before {
  content: "";
  position: absolute;
  top: -.38rem;
  left: calc(50% - .34rem);
  width: .68rem;
  height: .68rem;
  transform: rotate(45deg);
  border-top: 1px solid #ad8268;
  border-left: 1px solid #ad8268;
  background: #2c211c;
}
.entrance-content > .robot-line:not([hidden]) ~ .robot-line::before,
.entrance-content:has(> .robot-line:not([hidden])) #camera-intro::before {
  content: none;
}

.entrance-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 5rem;
  border: 1px solid #f9e2c9;
  border-radius: .55rem;
  padding: .55rem 1.25rem;
  color: #2c211c;
  background: #edc9a9;
  box-shadow: 0 3px 0 #96694e;
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
}
.entrance-action:focus-visible {
  outline: 2px solid #edc9a9;
  outline-offset: 3px;
}
@media (hover: hover) {
  .entrance-action:not(:disabled):hover { background: #f8dcc2; }
}
.entrance-action:not(:disabled):active {
  background: #dfb292;
  box-shadow: 0 1px 0 #96694e;
  transform: translateY(2px);
}
.entrance-action:disabled {
  opacity: .55;
  box-shadow: none;
  cursor: default;
}

#ar { position: fixed; inset: 0; overflow: hidden; background: #171313; }
#camera {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}
#door-transition {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100%;
  height: 100%;
}
#transition-logo {
  position: fixed;
  z-index: 11;
  pointer-events: none;
}
#transition-logo .opening-robot { width: 100%; }
.transition-active #entrance .opening-robot { visibility: hidden; }
.ar-hints {
  position: absolute;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(26rem, calc(100% - 2rem));
  display: flex;
  align-items: flex-end;
  gap: .4rem;
  text-align: center;
  pointer-events: none;
}
.ar-hints:not(:has(.robot-line:not([hidden]))) { visibility: hidden; }
.ar-hints img {
  flex: none;
  filter: brightness(1.8) drop-shadow(0 1px 4px #151313);
}
.ar-hints p {
  position: relative;
  flex: 1;
  margin: 0 0 .25rem .4rem;
  border-color: #ad8268;
  border-radius: .9rem;
  background: #2c211c;
}
.ar-hints p::before {
  content: "";
  position: absolute;
  bottom: .65rem;
  left: -.35rem;
  width: .6rem;
  height: .6rem;
  transform: rotate(45deg);
  border-bottom: 1px solid #ad8268;
  border-left: 1px solid #ad8268;
  background: inherit;
}
