:root {
  --bg: #f6f2eb;
  --ink: #2a2118;
  --muted: #74685b;
  --wood: #8a5a33;
  --wood-dark: #5c3a1f;
  --card: #fffdf9;
  --line: #e4dccf;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
a { color: var(--wood-dark); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 20px 48px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.logo { font-family: Georgia, "Times New Roman", serif; font-size: 1.5rem; font-weight: 700; letter-spacing: .02em; text-decoration: none; color: var(--ink); }
.logo span { display: inline-block; border: 3px solid var(--wood); padding: 0 8px; margin-right: 1px; box-shadow: inset 0 0 0 2px #efe6d6; }

.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 36px; align-items: center; }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; gap: 20px; } }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.1; margin: 0 0 16px; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 24px; }

.steps { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps b { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--wood); color: #fff; display: grid; place-items: center; font-size: .9rem; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px; border-radius: 999px; font: inherit; font-weight: 600;
  background: var(--wood); color: #fff; box-shadow: 0 4px 14px rgba(92, 58, 31, .25);
  transition: transform .1s, background .2s;
}
.btn:hover { background: var(--wood-dark); }
.btn:active { transform: scale(.97); }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.secondary:hover { background: #f1eadf; }
.btn svg { width: 20px; height: 20px; }
.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.stage {
  position: relative; background: radial-gradient(ellipse at 50% 40%, #fff 0%, #ece4d7 100%);
  border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden;
  aspect-ratio: 1 / 1; width: 100%;
}
.stage model-viewer { width: 100%; height: 100%; --poster-color: transparent; }

.note { color: var(--muted); font-size: .92rem; margin-top: 18px; }
.error { background: #fbe6e1; color: #8a2a17; border: 1px solid #efc3b8; padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; }

.busy { position: fixed; inset: 0; background: rgba(246, 242, 235, .92); display: none; place-items: center; z-index: 10; text-align: center; }
.busy.on { display: grid; }
.spinner { width: 48px; height: 48px; margin: 0 auto 14px; border: 5px solid var(--line); border-top-color: var(--wood); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* view page */
.viewer { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 800px) { .viewer { grid-template-columns: 1fr; gap: 20px; } }
.viewer .stage { aspect-ratio: 4 / 5; }
@media (max-width: 800px) { .viewer .stage { aspect-ratio: auto; height: 68vh; } }
.ar-btn { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); white-space: nowrap; }
.ar-btn:active { transform: translateX(-50%) scale(.97); }
.panel h2 { font-family: Georgia, serif; font-size: 1.6rem; margin: 0 0 10px; }
.panel .actions { margin: 20px 0; }
.qr { display: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 12px; gap: 16px; align-items: center; }
.qr.on { display: flex; }
.qr #qrcode img, .qr #qrcode canvas { display: block; width: 128px; height: 128px; }
.link { font-family: ui-monospace, Consolas, monospace; background: var(--card); border: 1px solid var(--line); padding: 8px 12px; border-radius: 8px; word-break: break-all; }
footer { color: var(--muted); font-size: .85rem; text-align: center; margin-top: 40px; }
.hero > *, .viewer > * { min-width: 0; }
@media (max-width: 480px) {
  header.top .btn { padding: 10px 14px; font-size: .9rem; }
  .qr.on { flex-direction: column; text-align: center; }
}
.stage model-viewer { transition: opacity .3s; }
.stage model-viewer.pending { opacity: 0; }
[hidden] { display: none !important; }

/* camera test page */
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin-top: 20px; }
.shot { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; justify-items: start; }
.shot img { width: 100%; border-radius: 8px; background: #ddd; }
.shot figcaption { color: var(--muted); font-size: .9rem; word-break: break-word; }
