:root {
  --bg: #0f1216;
  --panel: rgba(21, 25, 31, .72);
  --panel-strong: rgba(21, 25, 31, .9);
  --border: rgba(255,255,255,.12);
  --text: #f7f8fa;
  --muted: #b5bdc8;
  --accent: #61a8ff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
button, input { font: inherit; }
button { color: inherit; }

#app { position: fixed; inset: 0; overflow: hidden; background: #0b0d10; }
#viewer { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#viewer:active { cursor: grabbing; }

.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

.topbar {
  position: absolute;
  top: calc(12px + var(--safe-top));
  left: 12px;
  right: 12px;
  min-height: 58px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 12px;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 18px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); }
.brand strong { display: block; font-size: 15px; letter-spacing: .1px; }
.brand span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw; }

.icon-btn { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border); background: rgba(255,255,255,.07); display: grid; place-items: center; cursor: pointer; font-weight: 700; }
.icon-btn:active { transform: scale(.97); }

.room-chip { position: absolute; top: calc(82px + var(--safe-top)); left: 50%; transform: translateX(-50%); padding: 8px 13px; border-radius: 999px; z-index: 15; font-size: 13px; font-weight: 650; pointer-events: none; }

.room-panel { position: absolute; left: 12px; top: calc(82px + var(--safe-top)); width: min(260px, calc(100vw - 24px)); border-radius: 18px; padding: 12px; z-index: 19; transition: opacity .18s ease, transform .18s ease; }
.room-panel.hidden { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.panel-title { font-size: 12px; color: var(--muted); margin: 0 0 9px 3px; text-transform: uppercase; letter-spacing: .08em; }
.room-list { display: grid; gap: 7px; }
.room-item { width: 100%; border: 1px solid var(--border); background: rgba(255,255,255,.055); border-radius: 13px; padding: 11px 12px; text-align: left; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.room-item span { color: var(--muted); font-size: 11px; }
.room-item.active { background: rgba(97,168,255,.18); border-color: rgba(97,168,255,.45); }

.toolbar { position: absolute; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom)); border-radius: 20px; padding: 6px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; z-index: 20; }
.tool-btn { min-height: 55px; border: 0; background: transparent; border-radius: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; color: var(--muted); font-size: 10px; }
.tool-btn .tool-icon { color: var(--text); font-size: 20px; line-height: 1; }
.tool-btn.active, .tool-btn:active { background: rgba(255,255,255,.08); color: var(--text); }

.hotspot-layer { position: absolute; inset: 0; pointer-events: none; z-index: 12; }
.hotspot { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; border: 0; background: transparent; padding: 0; cursor: pointer; }
.hotspot-dot { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(16,20,25,.72); border: 2px solid rgba(255,255,255,.8); box-shadow: 0 8px 24px rgba(0,0,0,.25); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: pulse 2s infinite; }
.hotspot-dot::before { content: "→"; font-size: 25px; font-weight: 600; }
.hotspot-label { margin-top: 6px; padding: 6px 9px; border-radius: 999px; background: rgba(16,20,25,.78); color: #fff; font-size: 11px; white-space: nowrap; border: 1px solid rgba(255,255,255,.15); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.22), 0 8px 24px rgba(0,0,0,.25); } 50% { box-shadow: 0 0 0 9px rgba(255,255,255,0), 0 8px 24px rgba(0,0,0,.25); } }

.toast { position: absolute; left: 50%; bottom: calc(84px + var(--safe-bottom)); transform: translate(-50%, 12px); background: var(--panel-strong); border: 1px solid var(--border); padding: 10px 14px; border-radius: 999px; max-width: calc(100vw - 28px); font-size: 12px; z-index: 40; opacity: 0; pointer-events: none; transition: .2s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.info-dialog { width: min(520px, calc(100vw - 24px)); max-height: min(70vh, 620px); border: 1px solid var(--border); color: var(--text); background: rgba(20,24,29,.96); border-radius: 22px; padding: 0; box-shadow: 0 24px 80px rgba(0,0,0,.45); }
.info-dialog::backdrop { background: rgba(0,0,0,.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-bottom: 1px solid var(--border); }
.dialog-head strong { display: block; }
.dialog-head span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.dialog-body { padding: 14px 16px 18px; font-size: 14px; line-height: 1.5; color: #e8ebef; }
.dialog-body ul { padding-left: 20px; }
.dialog-body li { margin: 7px 0; }
.small { color: var(--muted); font-size: 12px; }

@media (min-width: 800px) {
  .topbar { left: 18px; right: 18px; top: calc(18px + var(--safe-top)); }
  .room-panel { left: 18px; top: calc(90px + var(--safe-top)); width: 280px; }
  .room-chip { top: calc(90px + var(--safe-top)); }
  .toolbar { left: 50%; right: auto; width: 430px; transform: translateX(-50%); bottom: calc(18px + var(--safe-bottom)); }
}
