@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  font-family: 'DM Sans', Arial, sans-serif;
  color: #182d43;
  background: #91d9dc;
  font-synthesis: none;
  --blue: #205fc9;
  --panel: #fffefa;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 3px solid #f5b940; outline-offset: 4px; }
#room { position: relative; width: 100%; height: 100svh; min-height: 500px; overflow: hidden; }
#canvas-wrap { position: absolute; inset: 0; }
canvas { display: block; }
.css3d-layer { position: absolute; inset: 0; pointer-events: none; }
body.focused .css3d-layer { pointer-events: auto; }
.tv-mount { width: 480px; height: 360px; background: #152c42; pointer-events: auto; overflow: hidden; border-radius: 22px; }
.tv-mount iframe { display: block; border: 0; width: 100%; height: 100%; }

.masthead { position: absolute; z-index: 10; top: 30px; left: 34px; right: 34px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.brand { display: flex; gap: 9px; align-items: center; font-family: 'Space Grotesk', Arial, sans-serif; font-size: 23px; letter-spacing: -1px; font-weight: 700; text-decoration: none; color: #172d46; pointer-events: auto; }
.brand-icon { font-size: 29px; line-height: 1; }
.room-label { font-size: 9px; letter-spacing: 2px; font-weight: 700; }

.room-panel { position: absolute; z-index: 14; right: 28px; bottom: 24px; width: 292px; padding: 19px 18px 10px; background: var(--panel); border: 1px solid #fff; border-radius: 22px; box-shadow: 0 5px 0 #23394c12, 0 14px 32px #23394c16; }
.welcome h1 { font-family: 'DM Sans', Arial, sans-serif; font-size: 31px; line-height: 1.04; letter-spacing: -1.35px; margin: 0 0 10px; font-weight: 700; }
.welcome h1 span { display: block; }
.welcome p { font-size: 11px; line-height: 1.5; margin: 0; color: #4a5968; }
.dock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 15px; padding-top: 10px; border-top: 1px solid #dfe5e8; }
.dock button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; height: 56px; min-width: 44px; border: 0; border-radius: 13px; background: transparent; color: #405269; transition: background .18s, color .18s; }
.dock svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dock button span { font-size: 10px; font-weight: 600; }
.dock button:hover { background: #edf1f3; }
.dock button.is-active { background: #e0eaff; color: #205fc9; }
.dock button.is-loading, .hotspot.is-loading { animation: media-loading 1s ease-in-out infinite; }
.dock button.is-loading svg, .hotspot.is-loading .status-dot { animation: media-loading-icon .8s linear infinite; }

.hotspot { position: absolute; left: 0; top: 0; min-height: 44px; display: flex; gap: 8px; align-items: center; border: 1px solid #ffffffdf; border-radius: 28px; padding: 10px 15px; background: #175bdce8; box-shadow: 0 0 0 3px #ffffff28, 0 5px 16px #1447a530; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; will-change: transform; transition: background .2s; }
.hotspot:hover { background: #154bae; }
.hotspot.is-active { background: #16418b; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 7px #b8d9ff; }
.hotspot.is-active .status-dot { background: #a4f3ce; }
.hotspot-arrow { font-size: 13px; margin-left: 2px; opacity: .75; }
#media-error { position: fixed; left: 28px; bottom: 28px; z-index: 16; max-width: min(430px, calc(100vw - 370px)); background: #fff5dd; border: 1px solid #e4c891; border-radius: 14px; color: #304358; font-size: 13px; line-height: 1.5; padding: 13px 17px; box-shadow: 0 4px 20px #0001; overflow-wrap: anywhere; }
#media-error:empty, #media-error[hidden] { display: none; }
#media-error a { color: #1752ab; }

#loading { position: absolute; inset: 0; z-index: 20; background: #a0dfe0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; }
#loading[hidden] { display: none; }
.loading-mark { font-size: 65px; animation: turn 4s linear infinite; }
#loading p { font-size: 13px; letter-spacing: 1px; }
#fallback { position: absolute; inset: 100px 20px 210px; text-align: center; }
#fallback[hidden] { display: none; }
#fallback p { max-width: 430px; margin: 0 auto 20px; line-height: 1.5; }
#fallback img { height: 65%; object-fit: contain; }
body.no-webgl #hotspots, body.no-webgl .welcome { display: none; }
body.no-webgl .room-panel { padding: 8px; }
body.no-webgl .dock { margin: 0; padding: 0; border: 0; }
.fallback-tv { position: absolute; width: min(80vw, 640px); aspect-ratio: 4/3; left: 50%; top: 18%; transform: translateX(-50%); z-index: 4; }
.fallback-tv:empty { display: none; }
.fallback-tv iframe { width: 100%; height: 100%; border: 0; border-radius: 16px; }
.stereo-audio-host { position: fixed; left: -10000px; top: 0; width: 320px; height: 180px; overflow: hidden; opacity: 0; pointer-events: none; }
.stereo-audio-iframe { display: block; width: 100%; height: 100%; border: 0; }
@keyframes turn { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  #room { --panel-height: calc(164px + env(safe-area-inset-bottom, 0px)); min-height: 480px; }
  #canvas-wrap, #hotspots { position: absolute; inset: 0 0 var(--panel-height); }
  .masthead { top: max(23px, env(safe-area-inset-top)); left: 23px; right: 23px; }
  .brand { font-size: 21px; }
  .brand-icon { font-size: 26px; }
  .room-label { display: none; }
  .room-panel { right: 0; left: 0; bottom: 0; width: 100%; height: var(--panel-height); padding: 20px 22px max(10px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; box-shadow: 0 -4px 20px #28394b0a; }
  .welcome h1 { font-size: 28px; line-height: 1.1; letter-spacing: -1.2px; margin: 0 0 7px; }
  .welcome h1 span { display: inline; }
  .welcome p { font-size: 11px; }
  .dock { margin-top: 12px; padding-top: 8px; }
  .dock button { height: 51px; }
  .hotspot { min-height: 44px; padding: 8px 12px; font-size: 11px; gap: 6px; }
  .hotspot-arrow { display: none; }
  #spot-lights { display: none; }
  body.focused #canvas-wrap { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  body.no-webgl .room-panel { left: 15px; right: 15px; bottom: max(12px, env(safe-area-inset-bottom)); width: auto; height: auto; border-radius: 18px; }
  #media-error { left: 16px; right: 16px; bottom: calc(var(--panel-height) + 12px); width: auto; max-width: none; }
  body.focused #media-error { bottom: 90px; }
  #fallback { inset: 90px 22px 110px; }
}
@media (max-height: 500px) and (min-width: 701px) {
  #room { min-height: 320px; }
  .masthead { top: 17px; left: 22px; right: 22px; }
  .welcome { display: none; }
  .room-panel { width: 260px; padding: 8px; right: 20px; bottom: 16px; }
  .dock { border: 0; margin: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@keyframes media-loading { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes media-loading-icon { to { transform: rotate(360deg); } }
