:root {
  color-scheme: light;
  --ink: #181714;
  --muted: rgba(24, 23, 20, 0.58);
  --paper: rgba(240, 234, 224, 0.88);
  --line: rgba(24, 23, 20, 0.2);
  --accent: #ff5b35;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #b6aa99; color: var(--ink); }
body { min-height: 100dvh; }
button, a { font: inherit; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
#scene.dragging { cursor: grabbing; }

.masthead {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 30px;
  pointer-events: none;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.045em;
  font-weight: 760;
  font-size: clamp(18px, 2vw, 28px);
  pointer-events: auto;
}
.brand-mark { font-weight: 900; }
.brand-dot { color: var(--accent); }

.live-state {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(238, 231, 220, 0.56);
  backdrop-filter: blur(14px);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.14em;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #8c857b; }
.live-state.online .live-dot { background: #37a568; box-shadow: 0 0 0 5px rgba(55, 165, 104, 0.14); }

.hero-copy {
  position: fixed;
  z-index: 5;
  top: 14vh;
  left: clamp(24px, 5vw, 84px);
  width: min(650px, 50vw);
  pointer-events: none;
  text-shadow: 0 1px 18px rgba(221, 213, 202, 0.55);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.eyebrow {
  margin: 0 0 10px;
  font: 760 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.hero-copy h1 {
  margin: 0;
  max-width: 12em;
  font-size: clamp(28px, 3.6vw, 58px);
  line-height: 0.98;
  letter-spacing: -0.065em;
  font-weight: 760;
}
.deck { margin: 18px 0 0; max-width: 43em; color: var(--muted); font-size: 12px; line-height: 1.5; }

.new-card, .detail-card {
  position: fixed;
  z-index: 11;
  right: clamp(18px, 4vw, 60px);
  width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--line);
  background: var(--paper);
  backdrop-filter: blur(20px) saturate(0.8);
  box-shadow: 0 20px 70px rgba(40, 34, 26, 0.12);
}
.new-card { transition: opacity 0.35s ease, transform 0.35s ease; }
.details-open .hero-copy { opacity: 0.08; transform: translateY(-8px); }
.details-open .new-card { opacity: 0; pointer-events: none; transform: translateY(14px); }
.new-card {
  bottom: 74px;
  padding: 18px 20px;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.new-card.pop { animation: card-pop 0.65s cubic-bezier(.2,.8,.2,1); }
.new-card h2, .detail-card h2 { margin: 0; font-size: 21px; line-height: 1.05; letter-spacing: -0.035em; }
.new-card > p:last-child { margin: 9px 0 0; color: var(--muted); font-size: 12px; }

.detail-card {
  top: 88px;
  padding: 22px;
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.detail-card.open { opacity: 1; transform: translateX(0); pointer-events: auto; }
.detail-card > .eyebrow { padding-right: 72px; }
.detail-tools { position: absolute; top: 8px; right: 9px; display: flex; align-items: center; gap: 2px; }
.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: rgba(24, 23, 20, 0.7);
  background: transparent;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}
.icon-button:hover, .icon-button:focus-visible { color: var(--ink); background: rgba(24, 23, 20, 0.07); outline: none; }
.detail-tools .close { font-size: 23px; line-height: 1; }
.ar-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.ar-icon:not(:disabled) { color: #b73b20; }
.ar-icon:disabled { opacity: 0.25; cursor: default; }
.ar-icon[hidden] { display: none; }
.detail-zh { margin: 5px 0 18px; color: var(--muted); }
.detail-card dl { margin: 0; display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; font-size: 11px; }
.detail-card dt { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.detail-card dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.detail-actions a { padding: 9px 11px; border: 1px solid var(--line); color: var(--ink); background: transparent; text-decoration: none; font-size: 10px; font-weight: 750; letter-spacing: 0.08em; cursor: pointer; }
.detail-actions a[hidden] { display: none; }

.inspect-hint {
  position: fixed;
  z-index: 8;
  left: 42%;
  bottom: 82px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 999px;
  color: rgba(24, 23, 20, 0.62);
  background: rgba(240, 234, 224, 0.5);
  backdrop-filter: blur(10px);
  font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.inspect-hint span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.details-open .inspect-hint { opacity: 1; transform: translate(-50%, 0); }
.ar-model { position: fixed; left: -10px; top: -10px; width: 1px; height: 1px; opacity: 0.001; pointer-events: none; }

.footer {
  position: fixed;
  z-index: 9;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 17px 28px;
  border-top: 1px solid var(--line);
  background: rgba(220, 211, 198, 0.55);
  backdrop-filter: blur(12px);
  font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.13em;
}
.footer > :last-child { text-align: right; }

.loading {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: #b6aa99;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loading.hidden { opacity: 0; visibility: hidden; }
.loading span { width: 22px; height: 22px; border: 2px solid rgba(24,23,20,.2); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.8s linear infinite; }
.loading p { margin: 0; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes card-pop { 0% { opacity: 0; transform: translateY(18px); } 100% { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .masthead { padding: 18px; }
  .hero-copy { top: 12vh; left: 18px; width: calc(100vw - 36px); }
  .hero-copy h1 { max-width: 10em; font-size: clamp(31px, 11vw, 52px); }
  .deck { max-width: 26em; }
  .new-card { right: 14px; bottom: 66px; width: min(320px, calc(100vw - 28px)); }
  .detail-card { top: auto; bottom: 66px; right: 14px; max-height: 54vh; overflow: auto; }
  .details-open .hero-copy { opacity: 0; }
  .inspect-hint { left: 50%; top: 48%; bottom: auto; white-space: nowrap; }
  .footer { grid-template-columns: 1fr 1fr; padding: 15px 16px; }
  .footer > :nth-child(2) { display: none; }
}

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