:root {
  color-scheme: dark;
  --ivory: #f2e9da;
  --gold: #c9a86a;
  --ink: #21140f;
}

* {
  box-sizing: border-box;
}

html,
body,
#showroom {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #17100c;
}

body {
  color: var(--ivory);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP",
    system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body.is-embedded .standalone-only {
  display: none;
}

#showroom {
  position: relative;
  isolation: isolate;
}

#scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#scene:focus-visible {
  outline: 1px solid rgb(201 168 106 / 75%);
  outline-offset: -4px;
}

.vignette,
.grain {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}

.vignette {
  background:
    linear-gradient(180deg, rgb(12 7 5 / 44%) 0%, transparent 20%, transparent 72%, rgb(12 7 5 / 50%) 100%),
    radial-gradient(ellipse at center, transparent 50%, rgb(9 5 3 / 44%) 100%);
}

.grain {
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.brand {
  position: absolute;
  z-index: 4;
  top: max(22px, env(safe-area-inset-top));
  left: max(24px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
  text-shadow: 0 2px 18px rgb(0 0 0 / 55%);
}

.brand-mark {
  font-family: "Didot", "Bodoni 72", "Times New Roman", serif;
  font-size: clamp(23px, 2.2vw, 32px);
  letter-spacing: 0.045em;
  line-height: 1;
}

.brand-sub {
  color: rgb(242 233 218 / 63%);
  font-family: "Avenir Next", "Helvetica Neue", sans-serif;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.25em;
}

#reticle {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 240ms ease;
}

#reticle::before,
#reticle::after,
#reticle i::before,
#reticle i::after {
  position: absolute;
  width: 5px;
  height: 1px;
  background: rgb(242 233 218 / 72%);
  content: "";
}

#reticle::before {
  top: 0;
  left: 0;
}

#reticle::after {
  top: 0;
  right: 0;
}

#reticle i::before {
  bottom: 0;
  left: 0;
}

#reticle i::after {
  right: 0;
  bottom: 0;
}

body[data-ready="true"] #reticle {
  opacity: 0.72;
}

#active-caption {
  position: absolute;
  z-index: 4;
  bottom: max(62px, calc(env(safe-area-inset-bottom) + 48px));
  left: max(24px, env(safe-area-inset-left));
  display: grid;
  gap: 4px;
  max-width: min(360px, calc(100vw - 48px));
  padding-left: 14px;
  border-left: 1px solid rgb(201 168 106 / 65%);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 250ms ease, transform 250ms ease;
  text-shadow: 0 2px 18px rgb(0 0 0 / 70%);
}

#active-caption.is-visible {
  opacity: 1;
  transform: none;
}

.caption-kicker {
  color: var(--gold);
  font-family: "Avenir Next", "Helvetica Neue", sans-serif;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

#active-caption strong {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-size: clamp(16px, 1.55vw, 21px);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.45;
}

.control-hint {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 16px));
  left: 0;
  color: rgb(242 233 218 / 58%);
  font-family: "Avenir Next", "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-align: center;
  text-shadow: 0 2px 12px rgb(0 0 0 / 70%);
  pointer-events: none;
  transition: opacity 500ms ease;
}

body[data-interacted="true"] .control-hint {
  opacity: 0.16;
}

.touch-copy {
  display: none;
}

#loading {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 46%, rgb(73 47 32 / 52%), transparent 48%),
    #17100c;
  transition: opacity 800ms ease, visibility 800ms;
}

#loading.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-brand {
  font-family: "Didot", "Bodoni 72", "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 48px);
  letter-spacing: 0.06em;
  line-height: 1;
}

.loading-rule {
  width: 92px;
  height: 1px;
  margin: 22px 0 16px;
  overflow: hidden;
  background: rgb(201 168 106 / 22%);
}

.loading-rule span {
  display: block;
  width: 44%;
  height: 100%;
  background: var(--gold);
  animation: load-sweep 1.6s cubic-bezier(0.7, 0, 0.3, 1) infinite;
}

#loading p {
  margin: 0;
  color: var(--gold);
  font-family: "Avenir Next", sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3em;
}

#loading small {
  margin-top: 11px;
  color: rgb(242 233 218 / 50%);
  font-size: 10px;
  letter-spacing: 0.08em;
}

@keyframes load-sweep {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(250%);
  }
}

#error {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 32px;
  background: #17100c;
  text-align: center;
}

#error[hidden] {
  display: none;
}

#error > span {
  color: var(--gold);
  font-family: "Avenir Next", sans-serif;
  font-size: 9px;
  letter-spacing: 0.3em;
}

#error h1 {
  max-width: 560px;
  margin: 18px 0 12px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(22px, 4vw, 36px);
  font-weight: 500;
}

#error p {
  max-width: 560px;
  margin: 0;
  color: rgb(242 233 218 / 64%);
  font-size: 12px;
  line-height: 1.9;
}

#error button {
  min-height: 44px;
  margin-top: 24px;
  padding: 0 22px;
  border: 1px solid rgb(201 168 106 / 65%);
  background: transparent;
  color: var(--ivory);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.noscript {
  position: fixed;
  z-index: 99;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  background: #17100c;
  color: var(--ivory);
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (pointer: coarse), (max-width: 760px) {
  #scene {
    cursor: default;
  }

  .desktop-copy {
    display: none;
  }

  .touch-copy {
    display: inline;
  }

  #active-caption {
    bottom: max(56px, calc(env(safe-area-inset-bottom) + 44px));
    left: 18px;
  }

  .control-hint {
    right: 18px;
    bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
    left: 18px;
    font-size: 8px;
    letter-spacing: 0.08em;
  }
}

@media (max-width: 440px) {
  .brand {
    top: max(17px, env(safe-area-inset-top));
    left: 18px;
  }

  #active-caption {
    max-width: calc(100vw - 36px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
