:root {
  --bg: #fff8ef;
  --panel: rgba(255, 252, 246, 0.92);
  --line: rgba(92, 79, 54, 0.14);
  --text: #21190f;
  --muted: #6f614d;
  --accent: #db5e34;
  --accent-2: #0f8d73;
  --shadow: 0 26px 60px rgba(81, 60, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(219, 94, 52, 0.12), transparent 28%),
    radial-gradient(circle at 100% 100%, rgba(15, 141, 115, 0.1), transparent 28%),
    linear-gradient(180deg, #fff5ea 0%, var(--bg) 100%);
}

/* ===== USER MODE: FULLSCREEN AR ===== */

.ar-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  background: #000;
  font-family: "Avenir Next", "Segoe UI Variable", "Trebuchet MS", sans-serif;
}

html.ar-active,
body.ar-active {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.ar-active .ar-stage {
  touch-action: none;
}

.ar-viewport {
  position: absolute;
  inset: 0;
}

.ar-fullscreen .ar-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.ar-fullscreen .ar-stage a-scene {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
}

.ar-fullscreen .ar-stage canvas {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: block;
  background: transparent !important;
}

.ar-fullscreen .ar-stage > video {
  object-fit: cover !important;
}

.a-enter-vr,
.a-enter-vr-button,
.a-enter-ar,
.a-enter-ar-button {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.ar-fullscreen .camera-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  display: none;
  background: #000;
}

.ar-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 16px) 16px env(safe-area-inset-bottom, 16px);
}

.ar-overlay > * {
  pointer-events: auto;
}

.ar-brand {
  align-self: center;
  margin-top: 12px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  pointer-events: none;
}

.ar-start-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  z-index: 20;
  background: radial-gradient(circle at 50% 40%, rgba(99, 227, 179, 0.06), transparent 60%),
              #0d1320;
}

.ar-start-screen[hidden] {
  display: none !important;
}

.ar-start-title {
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: #fff;
  margin: 0 0 12px;
  line-height: 1.2;
}

.ar-start-message {
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 36px;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 300px;
}

.ar-start-btn {
  appearance: none;
  border: none;
  border-radius: 16px;
  padding: 18px 40px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  background: linear-gradient(135deg, #63e3b3, #28b5a2);
  color: #08221f;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-width: 220px;
  transition: transform 0.15s ease;
}

.ar-start-btn:active {
  transform: scale(0.97);
}

.ar-start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ar-hint {
  position: absolute;
  bottom: 40px;
  left: 16px;
  right: 16px;
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 14px 20px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.ar-hint[hidden] {
  display: none !important;
}

.ar-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  pointer-events: none;
}

.ar-spinner[hidden] {
  display: none !important;
}

.ar-spinner-dots {
  display: flex;
  gap: 10px;
}

.ar-spinner-dots span {
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  animation: spinner-pulse 1.2s ease-in-out infinite;
}

.ar-spinner-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.ar-spinner-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes spinner-pulse {
  0%, 60%, 100% { opacity: 0.25; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1.1); }
}

.ar-error-overlay,
.ar-blocked-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  z-index: 20;
  background: #0d1320;
}

.ar-error-overlay[hidden],
.ar-blocked-overlay[hidden] {
  display: none !important;
}

.ar-error-text,
.ar-blocked-message {
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 28px;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 320px;
}

.ar-blocked-title {
  color: #fff;
  font-size: 1.4rem;
  margin: 0 0 12px;
}

.ar-retry-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 14px 28px;
  font: inherit;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}

.ar-retry-btn:active {
  transform: scale(0.97);
}

.ar-retry-btn[hidden] {
  display: none !important;
}

/* ===== END USER MODE ===== */

.shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  padding: 22px 0 30px;
}

.eyebrow,
.panel-label {
  display: inline-flex;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent);
}

.hero h1,
.panel h2,
.panel h3 {
  margin: 10px 0 12px;
  line-height: 1.06;
}

.hero h1 {
  max-width: 12ch;
  font-size: clamp(2.3rem, 5vw, 4.5rem);
}

.hero-copy,
.panel-copy {
  max-width: 70ch;
  margin: 0;
  line-height: 1.72;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(16px);
}

.panel-primary {
  background: linear-gradient(180deg, rgba(255, 247, 237, 0.98), rgba(255, 251, 244, 0.95));
}

.panel-muted {
  margin-top: 24px;
  background: rgba(255, 251, 245, 0.95);
}

.panel-preview {
  margin-top: 24px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.state-code {
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.list {
  margin: 16px 0 0;
  padding-left: 18px;
  line-height: 1.7;
  color: var(--muted);
}

.cta-row,
.small-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.button,
.link {
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button[hidden] {
  display: none !important;
}

.button:hover,
.link:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(135deg, #db5e34, #f28a44);
  color: #fff7f2;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  border-color: var(--line);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.link {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 700;
}

.stage-frame {
  position: relative;
  margin-top: 16px;
  border-radius: 22px;
  overflow: hidden;
  min-height: 440px;
  border: 1px solid rgba(92, 79, 54, 0.12);
  background: linear-gradient(135deg, rgba(41, 31, 19, 0.92), rgba(56, 43, 29, 0.96));
}

.ar-stage,
.camera-preview,
.preview-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ar-stage {
  z-index: 1;
}

.ar-stage > a-scene {
  position: absolute !important;
  inset: 0;
}

.ar-stage :is(a-scene, canvas) {
  width: 100% !important;
  height: 100% !important;
}

.camera-preview {
  display: none;
  z-index: 2;
  object-fit: cover;
  background: #130f0b;
}

.preview-placeholder {
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: rgba(255, 245, 233, 0.84);
  line-height: 1.6;
}

.stage-status,
.stage-hint {
  position: absolute;
  z-index: 4;
  border-radius: 999px;
  background: rgba(16, 12, 8, 0.76);
  color: #fff8ef;
  padding: 10px 14px;
  line-height: 1.3;
  backdrop-filter: blur(8px);
}

.stage-status {
  top: 14px;
  right: 14px;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.stage-hint {
  left: 14px;
  right: 14px;
  bottom: 14px;
  font-size: 0.88rem;
}

@media (max-width: 860px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .panel-header {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 18px, 100%);
    padding-top: 20px;
  }

  .panel {
    border-radius: 22px;
    padding: 20px;
  }

  .button {
    width: 100%;
  }

  .stage-frame {
    min-height: 380px;
  }
}
