/* Design tokens. Enterprise branding (manifest/tour "branding") overrides these per tour; see
   viewer/src/branding.js. Light values here, dark values below. */
:root {
  color-scheme: light;
  --bg: #edede9;
  --ink: #1f2328;
  --chip: rgba(255, 255, 255, 0.92);
  --chip-ink: #1f2328;
  --accent: #b5652d;
  --accent-ink: #ffffff;
  --pill: rgba(24, 26, 29, 0.78);
  --pill-ink: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  --blur: blur(10px);
  --radius: 999px;
  --radius-panel: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-weight: 500;
  --font-scale: 1;
}
/* Dark: the visitor's system setting, unless the embedding page forces a theme (data-theme) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1b1c1e;
    --ink: #ececec;
    --chip: rgba(36, 38, 42, 0.9);
    --chip-ink: #ececec;
    --accent: #d08a52;
    --accent-ink: #ffffff;
    --pill: rgba(36, 38, 42, 0.9);
    --pill-ink: #f2f2f2;
    --border: rgba(255, 255, 255, 0.09);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1c1e;
  --ink: #ececec;
  --chip: rgba(36, 38, 42, 0.9);
  --chip-ink: #ececec;
  --accent: #d08a52;
  --accent-ink: #ffffff;
  --pill: rgba(36, 38, 42, 0.9);
  --pill-ink: #f2f2f2;
  --border: rgba(255, 255, 255, 0.09);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; transition: background-color 0.3s; }
#tour { position: fixed; inset: 0; font-family: var(--font); font-weight: var(--font-weight); font-size: calc(14px * var(--font-scale)); line-height: 1.3; color: var(--ink); user-select: none; -webkit-user-select: none; }
.tour-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
#tour.looking .tour-canvas { cursor: none; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); opacity: 0; transition: opacity 0.2s; }
#tour.looking .crosshair { opacity: 1; }
.tour-ui { position: absolute; inset: 0; pointer-events: none; }
.tour-ui button { pointer-events: auto; font: inherit; color: inherit; cursor: pointer; }

/* Shared surface for everything floating over the scene */
.surface, .chip, .btn, .title {
  background: var(--chip);
  color: var(--chip-ink);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.9s ease, filter 0.9s ease; }
.poster.gone { opacity: 0; filter: blur(6px); }
.fade { position: absolute; inset: 0; background: var(--bg); opacity: 0; transition: opacity 0.25s ease; }
.fade.on { opacity: 1; }

.progress { position: absolute; top: 0; left: 0; right: 0; height: 3px; opacity: 0; transition: opacity 0.5s; }
.progress.on { opacity: 1; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }

.title { position: absolute; top: 12px; left: 12px; max-width: calc(100% - 140px); display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: var(--radius); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title:empty { display: none; }
.title img { height: 20px; width: auto; display: block; }

.hint, .notice { position: absolute; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: var(--radius); background: var(--pill); color: var(--pill-ink); font-size: 0.93em; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; transition: opacity 0.8s; }
.hint { top: 46%; }
.hint.gone { opacity: 0; }
.notice { top: 56px; white-space: normal; text-align: center; border-radius: var(--radius-panel); }

.rooms { position: absolute; left: 16px; right: 16px; bottom: 16px; display: flex; gap: 8px; overflow-x: auto; justify-content: center; padding: 2px 160px 2px 2px; scrollbar-width: none; }
.rooms::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: var(--radius); transition: background-color 0.3s, color 0.3s; }
.chip.current { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.lighting { position: absolute; top: 12px; right: 12px; max-width: 60%; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.lighting[hidden] { display: none; }
.lighting-head { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: var(--radius); background: var(--pill); color: var(--pill-ink); font-size: 0.93em; }
.lighting-head svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.chip.small { padding: 6px 11px; font-size: 0.93em; }
.chip.loading { animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.5; } }
.lighting-note { flex-basis: 100%; text-align: right; font-size: 0.86em; }
.lighting-note:not(:empty) { flex-basis: auto; padding: 4px 9px; border-radius: var(--radius-panel); background: var(--pill); color: var(--pill-ink); }

.buttons { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; min-width: 38px; padding: 0 12px; border-radius: var(--radius); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn.full { padding: 0; justify-content: center; }
.btn.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.tap { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); animation: tap 0.7s ease-out forwards; }
.tap.fail { border-color: #e5484d; }
@keyframes tap { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }

.joy { position: fixed; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); border: 1.5px solid rgba(255, 255, 255, 0.6); pointer-events: none; display: none; z-index: 5; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }

.debug { position: absolute; top: 52px; left: 12px; white-space: pre; padding: 4px 8px; border-radius: 6px; background: var(--pill); color: var(--pill-ink); font: 12px/1.3 ui-monospace, Menlo, monospace; }
.fatal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 14px 18px; border-radius: var(--radius-panel); background: var(--pill); color: var(--pill-ink); text-align: center; max-width: calc(100% - 32px); }

@media (max-width: 600px) {
  .rooms { justify-content: flex-start; bottom: 62px; padding-right: 2px; }
  .lighting { top: 52px; left: 12px; max-width: none; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .lighting-note { flex-basis: auto; flex: none; text-align: left; }
  .btn span { display: none; }
  .btn.mode, .btn.tour { padding: 0; width: 38px; justify-content: center; }
}
