:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2a3544;
  --text: #e8edf4;
  --muted: #8b98a8;
  --accent: #5b9fd4;
  --accent-hover: #7ab3de;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.hero {
  margin-bottom: 2rem;
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 650;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.section-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.multi-card {
  margin-bottom: 1.75rem;
  padding: 1.1rem 1.15rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 12%, var(--surface)),
    var(--surface)
  );
}

.multi-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.multi-card-body h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.multi-card-body p {
  margin: 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.btn-lg {
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
  white-space: nowrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff;
}

.card-body {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.card-body h2 {
  margin: 0;
  font-size: 1rem;
}

.card-body p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.card-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b1118;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.banner {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* AR page */
html.ar-page,
body.ar-page {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

.ar-viewport {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  z-index: 1;
  background: #000;
}

.ar-viewport a-scene {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.ar-viewport .a-canvas,
.ar-viewport canvas.a-canvas {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.ar-viewport video {
  object-fit: contain;
}

.ar-hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.ar-topbar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(15, 20, 25, 0.92), transparent);
}

.ar-topbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ar-topbar h1 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.ar-topbar p {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.ar-hint {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  max-width: min(92vw, 420px);
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: rgba(15, 20, 25, 0.82);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  pointer-events: none;
  z-index: 20;
}

.ar-detected {
  position: fixed;
  left: 50%;
  top: 4.5rem;
  transform: translateX(-50%);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(91, 159, 212, 0.18);
  border: 1px solid rgba(91, 159, 212, 0.55);
  color: #d8ebfb;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.ar-detected.visible {
  opacity: 1;
}

.ar-loading.hidden,
.start-gate.hidden,
.ar-error.hidden {
  display: none;
}

.start-gate,
.ar-error {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 12, 18, 0.88);
  pointer-events: auto;
}

.start-gate-card {
  width: min(92vw, 360px);
  padding: 1.25rem 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}

.start-gate-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.start-gate-card p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.start-gate-note {
  font-size: 0.82rem !important;
  color: #ffb020 !important;
  margin-top: -0.5rem !important;
}

.ar-loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: var(--bg);
  z-index: 20;
  pointer-events: none;
}

.ar-loading.hidden {
  display: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
