:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #08111f;
  color: #e2e8f0;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #08111f; }
body { overflow: hidden; }
button, a { font: inherit; }
.viewer-shell { min-height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.viewer-header { z-index: 3; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 14px 10px; border-bottom: 1px solid rgba(148,163,184,.16); background: rgba(8,17,31,.92); backdrop-filter: blur(14px); }
.viewer-header p { margin: 0; color: #7dd3fc; font-size: .68rem; letter-spacing: .14em; }
.viewer-header h1 { margin: 2px 0 0; font-size: clamp(1rem,4vw,1.35rem); }
.back-link { min-height: 42px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid rgba(125,211,252,.3); border-radius: 12px; color: #e0f2fe; text-decoration: none; background: rgba(14,116,144,.18); }
.build { color: #94a3b8; font-size: .7rem; }
.viewer-stage { position: relative; min-height: 0; overflow: hidden; touch-action: none; background: radial-gradient(circle at 50% 15%,rgba(56,189,248,.16),transparent 38%),linear-gradient(#0b1728,#07101d 70%); }
[data-world-canvas] { width: 100%; height: 100%; display: block; touch-action: none; }
.world-view-detail-layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; z-index: 1; }
.viewer-hud { position: absolute; z-index: 2; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.viewer-hud span { padding: 7px 10px; border: 1px solid rgba(148,163,184,.18); border-radius: 999px; background: rgba(8,17,31,.72); color: #cbd5e1; font-size: .72rem; backdrop-filter: blur(8px); }
.viewer-controls { position: absolute; z-index: 2; right: 10px; bottom: 12px; display: grid; grid-template-columns: repeat(2,minmax(44px,auto)); gap: 7px; max-width: 220px; }
.viewer-controls button { min-width: 44px; min-height: 42px; padding: 0 9px; border: 1px solid rgba(125,211,252,.3); border-radius: 11px; background: rgba(15,23,42,.88); color: #e0f2fe; box-shadow: 0 8px 22px rgba(0,0,0,.28); font-size: .76rem; }
.viewer-controls button[aria-pressed="false"] { color: #94a3b8; border-color: rgba(148,163,184,.2); background: rgba(15,23,42,.68); }
.viewer-detail { position: absolute; z-index: 2; left: 10px; bottom: 12px; max-width: min(58vw,320px); display: grid; gap: 3px; padding: 10px 12px; border: 1px solid rgba(250,204,21,.26); border-radius: 13px; background: rgba(15,23,42,.86); box-shadow: 0 8px 24px rgba(0,0,0,.28); pointer-events: none; }
.viewer-detail strong { color: #fde68a; font-size: .84rem; }
.viewer-detail span { color: #cbd5e1; font-size: .74rem; line-height: 1.45; }
.empty-state { position: absolute; z-index: 3; inset: 0; display: grid; place-content: center; gap: 7px; text-align: center; background: rgba(8,17,31,.84); }
.empty-state[hidden] { display: none; }
.empty-state span { color: #94a3b8; }
.viewer-legend { display: flex; gap: 12px; overflow-x: auto; padding: 9px 14px max(10px,env(safe-area-inset-bottom)); border-top: 1px solid rgba(148,163,184,.14); background: #0b1524; color: #94a3b8; font-size: .72rem; white-space: nowrap; }
@media (max-width:560px) {
  .viewer-header { grid-template-columns: auto minmax(0,1fr); padding-left: 10px; padding-right: 10px; }
  .back-link { min-height: 40px; padding: 0 10px; }
  .build { display: none; }
  .viewer-hud { align-items: flex-start; }
  .viewer-hud span:last-child { display: none; }
  .viewer-controls {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-width: none;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .viewer-controls::-webkit-scrollbar { display: none; }
  .viewer-controls button {
    flex: 0 0 auto;
    min-width: 64px;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 10px;
    font-size: .7rem;
    white-space: nowrap;
  }
  .viewer-detail {
    left: 8px;
    right: auto;
    top: 54px;
    bottom: auto;
    max-width: min(72vw, 280px);
    padding: 8px 10px;
    border-radius: 11px;
    background: rgba(15,23,42,.78);
  }
  .viewer-detail strong { font-size: .78rem; }
  .viewer-detail span { font-size: .68rem; line-height: 1.35; }
}