:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

html {
  background: #11110f;
}

body {
  background: transparent;
}

/* MindAR inserts the camera feed directly under <body> with a negative z-index.
   Keeping it at layer 0 prevents mobile browsers from hiding it behind <html>. */
body > video {
  z-index: 0 !important;
  object-fit: cover !important;
}

button,
a {
  font: inherit;
}

.ar-header {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 0;
  display: flex;
  width: 100%;
  min-height: calc(62px + env(safe-area-inset-top));
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(to bottom, rgba(8, 8, 7, 0.72), transparent);
  color: #fffdf7;
  pointer-events: none;
}

.exit-button,
.ambient-toggle,
.status-pill {
  pointer-events: auto;
}

.exit-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(18, 18, 16, 0.55);
  color: #fffdf7;
  font-size: 1.7rem;
  font-weight: 300;
  line-height: 1;
  text-decoration: none;
  backdrop-filter: blur(12px);
}

.ar-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ar-brand-mark {
  width: 15px;
  height: 13px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.ambient-toggle {
  min-height: 38px;
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(18, 18, 16, 0.58);
  color: #fffdf7;
  cursor: pointer;
  padding: 0 13px;
  font-size: 0.75rem;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.ambient-toggle[aria-pressed="false"] {
  color: rgba(255, 255, 255, 0.62);
}

.status-pill {
  position: fixed;
  z-index: 41;
  top: calc(66px + env(safe-area-inset-top));
  left: 50%;
  min-width: 0;
  width: max-content;
  max-width: calc(100% - 28px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(18, 18, 16, 0.58);
  padding: 9px 12px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  white-space: nowrap;
  backdrop-filter: blur(12px);
  transition: border-color 220ms ease, background 220ms ease;
}

.status-pill.is-found {
  border-color: rgba(205, 181, 126, 0.58);
  background: rgba(72, 56, 28, 0.68);
  color: #fff6df;
}

.system-overlay,
.scan-overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
}

.system-overlay {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: #f3efe4;
  color: #171713;
  text-align: center;
}

.camera-gate {
  z-index: 35;
  padding: max(88px, calc(70px + env(safe-area-inset-top))) 26px max(32px, calc(22px + env(safe-area-inset-bottom)));
}

.loading-overlay,
.error-overlay {
  display: none;
}

.loading-overlay {
  z-index: 36;
}

.gate-mark {
  width: 54px;
  height: 48px;
  margin-bottom: 4px;
  background: #171713;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.gate-copy {
  display: grid;
  max-width: 360px;
  gap: 12px;
}

.gate-kicker {
  color: #777064 !important;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.gate-copy h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.65rem, 12vw, 4.5rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.95;
}

.camera-gate > button,
.error-actions button,
.error-actions a {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: #171713;
  color: #fffdf7;
  padding: 0 24px;
  font-weight: 700;
  text-decoration: none;
}

.camera-gate > button {
  min-width: min(100%, 270px);
  margin-top: 6px;
}

.camera-gate > button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.privacy-copy {
  color: #81796c !important;
  font-size: 0.76rem;
}

.system-overlay p {
  max-width: 290px;
  margin: 0;
  color: #6d675d;
  line-height: 1.5;
}

.loader-mark {
  width: 42px;
  height: 36px;
  background: #171713;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  animation: loader-breathe 1.4s ease-in-out infinite;
}

.error-overlay {
  z-index: 60;
  padding: 26px;
}

.error-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(23, 23, 19, 0.22);
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
}

.error-overlay strong {
  max-width: 340px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 400;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.error-actions a {
  border: 1px solid rgba(23, 23, 19, 0.22);
  background: transparent;
  color: #171713;
}

.error-actions .secondary-action {
  border: 1px solid rgba(23, 23, 19, 0.22);
  background: transparent;
  color: #171713;
}

.error-overlay small {
  max-width: 330px;
  color: #81796c;
  font-size: 0.72rem;
  line-height: 1.45;
}

.scan-overlay {
  display: none;
  place-items: center;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.1) 72%, rgba(0, 0, 0, 0.3));
  color: white;
  pointer-events: none;
}

.target-frame {
  position: relative;
  width: min(66vw, 330px);
  aspect-ratio: 1086 / 1536;
}

.target-frame span {
  position: absolute;
  width: 38px;
  height: 38px;
  border-color: rgba(255, 255, 255, 0.86);
  border-style: solid;
}

.target-frame span:nth-child(1) {
  top: 0;
  left: 0;
  border-width: 2px 0 0 2px;
  border-radius: 9px 0 0;
}

.target-frame span:nth-child(2) {
  top: 0;
  right: 0;
  border-width: 2px 2px 0 0;
  border-radius: 0 9px 0 0;
}

.target-frame span:nth-child(3) {
  right: 0;
  bottom: 0;
  border-width: 0 2px 2px 0;
  border-radius: 0 0 9px;
}

.target-frame span:nth-child(4) {
  bottom: 0;
  left: 0;
  border-width: 0 0 2px 2px;
  border-radius: 0 0 0 9px;
}

.scan-instruction {
  position: absolute;
  bottom: calc(34px + env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  width: min(92%, 420px);
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  background: rgba(16, 16, 14, 0.62);
  padding: 15px 18px;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.scan-instruction strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 400;
}

.scan-instruction span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.79rem;
}

.action-panel {
  position: fixed;
  z-index: 50;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 12px;
  display: grid;
  max-width: 780px;
  margin: 0 auto;
  gap: 11px;
  border: 1px solid rgba(181, 144, 79, 0.58);
  border-radius: 22px;
  background: rgba(246, 240, 226, 0.96);
  padding: 14px;
  color: #1b1916;
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(100% + 30px));
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(20px);
  transition: opacity 260ms ease, transform 480ms cubic-bezier(0.22, 1, 0.36, 1);
}

.action-panel.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.action-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px;
}

.action-heading span {
  color: #80663b;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.action-heading strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 400;
}

.action-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  gap: 8px;
  scrollbar-width: none;
}

.action-button {
  display: grid;
  min-height: 66px;
  align-content: center;
  gap: 4px;
  border: 1px solid rgba(34, 30, 25, 0.15);
  border-radius: 14px;
  background: rgba(30, 27, 23, 0.065);
  color: #1b1916;
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
  text-decoration: none;
}

.action-button span {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.15;
}

.action-button small {
  color: rgba(45, 38, 30, 0.62);
  font-size: 0.72rem;
}

.action-button:active {
  background: rgba(117, 87, 42, 0.15);
  transform: scale(0.98);
}

.action-button.is-coming-soon {
  border-color: rgba(157, 116, 53, 0.32);
}

.action-button.is-coming-soon small {
  color: #8a6733;
}

.action-toast {
  position: fixed;
  z-index: 70;
  right: 20px;
  bottom: calc(112px + env(safe-area-inset-bottom));
  left: 20px;
  width: fit-content;
  max-width: min(440px, calc(100% - 40px));
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(18, 18, 16, 0.92);
  color: #fff8e8;
  padding: 12px 17px;
  font-size: 0.78rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translateY(12px);
  backdrop-filter: blur(18px);
  transition: opacity 220ms ease, transform 280ms ease;
}

.action-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

a-scene {
  position: fixed !important;
  z-index: 1;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
}

a-scene canvas,
.a-canvas {
  background: transparent !important;
}

@keyframes loader-breathe {
  0%, 100% { opacity: 0.38; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
}

@media (max-width: 620px) {
  .ar-brand span:last-child {
    display: none;
  }

  .status-pill {
    padding-inline: 10px;
    font-size: 0.75rem;
  }

  .action-panel {
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    gap: 9px;
    padding: 12px;
  }

  .action-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .action-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .action-button {
    min-height: 52px;
    padding: 8px 9px;
  }

  .action-button span {
    font-size: 0.79rem;
  }

  .action-button small {
    font-size: 0.65rem;
  }

  .action-toast {
    bottom: calc(206px + env(safe-area-inset-bottom));
  }
}

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