/* Public tour UI on top of Pannellum. Dark glass panels, yellow = "here / next". */
:root {
  --ui-bg: rgba(18, 20, 24, .74);
  --ui-bg-strong: rgba(18, 20, 24, .92);
  --ui-fg: #fff;
  --ui-dim: rgba(255, 255, 255, .7);
  --accent: #ffd60a;
  --gap: 10px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --btn: 40px;
  color-scheme: dark;
}
@media (pointer: coarse) { :root { --btn: 44px; } }

html, body { margin: 0; height: 100%; background: #000; overflow: hidden; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ui-fg); }
#pano { position: fixed; inset: 0; }
svg { width: 20px; height: 20px; flex: none; }
button, .tb { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Pannellum: our own title panel, fullscreen and gyroscope buttons replace these */
.pnlm-panorama-info, .pnlm-fullscreen-toggle-button, .pnlm-orientation-button { display: none !important; }
.pnlm-controls-container { top: calc(var(--gap) + var(--safe-t)); left: calc(var(--gap) + var(--safe-l)); }
@media (hover: none) { .pnlm-zoom-controls { display: none !important; } }
#pano.walkable .pnlm-dragfix { cursor: pointer; }

/* ---------- top bar */
.topbar {
  position: fixed; z-index: 20; top: calc(var(--gap) + var(--safe-t)); right: calc(var(--gap) + var(--safe-r));
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - 80px);
}
.tb {
  display: inline-flex; align-items: center; gap: 8px; height: var(--btn); padding: 0 14px; border: 0; border-radius: 10px;
  background: var(--ui-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
}
.tb:hover { background: var(--ui-bg-strong); }
.tb.icon { padding: 0; width: var(--btn); justify-content: center; }
.tb.on { color: #000; background: var(--accent); }
.tb .vr { font-weight: 800; letter-spacing: .04em; }
@media (max-width: 720px) {
  .tb { padding: 0; width: var(--btn); justify-content: center; }
  .tb span:not(.vr) { display: none; }
}

#loading {
  position: fixed; z-index: 30; top: 0; left: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 40% 100%; background-repeat: no-repeat;
}
@media (prefers-reduced-motion: no-preference) {
  #loading { animation: loading 1.1s linear infinite; }
}
@keyframes loading { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* ---------- place (bottom left) */
.place {
  position: fixed; z-index: 10; left: calc(var(--gap) + var(--safe-l)); bottom: calc(var(--gap) + var(--safe-b));
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 280px);
}
.place-text {
  padding: 7px 12px; border-radius: 10px; background: var(--ui-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  min-width: 0;
}
.place-zone { font-size: 12px; color: var(--ui-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-title { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round {
  display: inline-grid; place-items: center; width: var(--btn); height: var(--btn); flex: none; border: 0; border-radius: 50%;
  background: var(--ui-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.round:hover { background: var(--ui-bg-strong); }
@media (max-width: 640px) { .place { max-width: calc(100vw - 2 * var(--gap)); } }
/* gyroscope: in the top bar; on a narrow phone the bar is full, so bottom right (the mini-map is up there) */
@media (max-width: 640px) {
  #btn-gyro { position: fixed; z-index: 10; right: calc(var(--gap) + var(--safe-r)); bottom: calc(var(--gap) + var(--safe-b)); border-radius: 50%; }
  body.gyro .place, body.embed.gyro .place { max-width: calc(100vw - 2 * var(--gap) - var(--btn) - 8px); }
}

#live-bar { position: fixed; z-index: 10; left: calc(var(--gap) + var(--safe-l)); bottom: calc(68px + var(--safe-b)); display: none; gap: 8px; }
#live-bar button { padding: 10px 14px; border-radius: 8px; border: 0; background: var(--ui-bg); font-weight: 600; font-size: 15px; }
#live-bar .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: #888; }
#live-bar .on .dot { background: #ff3b30; }
@media (prefers-reduced-motion: no-preference) { #live-bar .on .dot { animation: pulse 1.6s ease-in-out infinite; } }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- "forward" (bottom centre) */
#btn-forward {
  position: fixed; z-index: 10; left: 50%; translate: -50% 0; bottom: calc(var(--gap) + var(--safe-b));
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 14px; border: 0; border-radius: 23px;
  background: var(--ui-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-weight: 650; font-size: 15px;
  max-width: min(320px, 50vw);
}
#btn-forward span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#btn-forward svg { color: var(--accent); width: 22px; height: 22px; }
#btn-forward:hover { background: var(--ui-bg-strong); }
@media (max-width: 640px) { #btn-forward { bottom: calc(70px + var(--safe-b)); max-width: 70vw; } }

/* ---------- navigation arrows in the panorama (Pannellum hotspots) */
.hs-nav, .hs-info { width: 0; height: 0; }
.hs-nav .arrow {
  position: absolute; left: -32px; top: -32px; width: 64px; height: 64px; padding: 0; border: 0; background: none;
  display: grid; place-items: center;
}
.hs-nav .arrow svg { width: 64px; height: 64px; overflow: visible; transform-origin: 50% 50%; }
.hs-nav .chev { fill: rgba(255, 255, 255, .93); stroke: rgba(0, 0, 0, .55); stroke-width: 2.5; stroke-linejoin: round;
                filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .55)); transition: fill .15s; }
.hs-nav .label, .hs-info .label {
  position: absolute; left: 0; top: 26px; translate: -50% 0; max-width: 200px; padding: 4px 9px; border: 0; border-radius: 999px;
  background: rgba(0, 0, 0, .62); font-size: 13px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: auto;
}
.hs-nav .arrow:hover .chev, .hs-nav.hover .chev, .hs-nav.next .chev { fill: var(--accent); }
.hs-nav.next .label, .hs-nav.hover .label { background: rgba(0, 0, 0, .8); color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .hs-nav .arrow { transition: scale .15s; }
  .hs-nav .arrow:hover, .hs-nav.hover .arrow { scale: 1.12; }
}
.hs-info .dot {
  position: absolute; left: -18px; top: -18px; width: 36px; height: 36px; border-radius: 50%; border: 2px solid #fff; padding: 0;
  background: rgba(10, 132, 255, .9); font: 700 18px/1 Georgia, serif; box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.hs-info .label { top: 22px; }
.hs-info .dot:hover { background: #0a84ff; }

/* ---------- mini-map (bottom right) */
#minimap {
  position: fixed; z-index: 10; right: calc(var(--gap) + var(--safe-r)); bottom: calc(var(--gap) + var(--safe-b));
  width: 230px; height: 170px; border-radius: 12px; overflow: hidden;
  background: var(--ui-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
#mini-svg { width: 100%; height: 100%; display: block; cursor: zoom-in; }
.mini-tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; }
.mini-tools button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: rgba(0, 0, 0, .45); padding: 0; }
.mini-tools button:hover { background: rgba(0, 0, 0, .75); }
.mini-tools svg { width: 16px; height: 16px; }
#mini-show { position: fixed; z-index: 10; right: calc(var(--gap) + var(--safe-r)); bottom: calc(var(--gap) + var(--safe-b)); }
@media (max-width: 640px) {
  #minimap { width: 150px; height: 112px; top: calc(var(--gap) + var(--safe-t)); left: calc(var(--gap) + var(--safe-l)); right: auto; bottom: auto; }
  #mini-show { top: calc(var(--gap) + var(--safe-t)); left: calc(var(--gap) + var(--safe-l)); right: auto; bottom: auto; }
  .mini-tools button { width: 28px; height: 28px; }
}
.m-edge { stroke: rgba(255, 255, 255, .35); fill: none; }
.m-node { fill: #9aa4b2; stroke: rgba(0, 0, 0, .6); cursor: pointer; }
.m-node:hover { fill: #fff; }
.m-node.stop { fill: #7fd1ff; }
.m-here { fill: var(--accent); stroke: #000; }
.m-cone { fill: var(--accent); fill-opacity: .32; stroke: var(--accent); stroke-opacity: .7; pointer-events: none; }
.m-label { fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .8); stroke-linejoin: round; pointer-events: none; }
.m-label.here { fill: var(--accent); font-weight: 700; }

/* ---------- dialogs */
dialog { color: var(--ui-fg); border: 0; padding: 0; background: #16181c; }
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: rgba(0, 0, 0, .5); overflow: hidden; overscroll-behavior: contain; }
dialog h1 { font-size: 18px; margin: 0; }
.close { width: var(--btn); height: var(--btn); display: grid; place-items: center; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); padding: 0; flex: none; }
.close:hover { background: rgba(255, 255, 255, .18); }

/* points drawer (right side) */
dialog.drawer[open] {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(380px, 100vw); height: 100dvh; max-height: none; max-width: none;
  display: flex; flex-direction: column; box-sizing: border-box; padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b));
}
@media (prefers-reduced-motion: no-preference) {
  dialog.drawer[open] { transition: translate .22s ease-out; }
  @starting-style { dialog.drawer[open] { translate: 100% 0; } }
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
#points-search {
  box-sizing: border-box; width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .08); color: #fff; font-size: 16px; margin-bottom: 8px;
}
#points-list { overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
#points-list h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ui-dim); margin: 14px 4px 6px; }
#points-list h2 small { font-weight: 400; text-transform: none; letter-spacing: 0; }
#points-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px; border: 0; border-radius: 10px; background: none; text-align: left; font-size: 15px; }
.pt:hover { background: rgba(255, 255, 255, .1); }
.pt[aria-current="true"] { background: rgba(255, 214, 10, .16); color: var(--accent); font-weight: 650; }
.pt img, .pt .noimg { width: 80px; height: 50px; object-fit: cover; border-radius: 6px; background: #333; flex: none; }
@media (prefers-reduced-motion: no-preference) { .pt img { animation: thumb-in .25s ease-out; } }
@keyframes thumb-in { from { opacity: 0; } }
.pt .tag { margin-left: auto; font-size: 11px; color: #7fd1ff; }
#points-empty { color: var(--ui-dim); text-align: center; }

/* full map */
#map-dlg[open] {
  width: min(1100px, 96vw); height: min(780px, 92dvh); max-width: none; max-height: none; border-radius: 14px;
  display: flex; flex-direction: column; box-sizing: border-box; padding: 12px;
}
.map-head { display: flex; align-items: center; gap: 10px; }
#map-tabs { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: thin; padding: 2px; }
#map-tabs button { flex: none; height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid rgba(255, 255, 255, .2); background: none; font-size: 14px; white-space: nowrap; }
#map-tabs button[aria-selected="true"] { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 650; }
#map-tabs .sw { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
#map-svg { flex: 1; width: 100%; height: auto; min-height: 0; margin-top: 8px; }
.map-note { margin: 6px 0 0; font-size: 12px; color: var(--ui-dim); }

/* overview (start screen) */
#overview-dlg[open] {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; box-sizing: border-box;
  display: grid; grid-template-rows: auto auto auto; align-content: center; padding: calc(14px + var(--safe-t)) 14px calc(14px + var(--safe-b));
  background: #0d0f12;
}
.ov-head { text-align: center; }
.ov-head h1 { font-size: clamp(20px, 3vw, 30px); }
.ov-head p { margin: 4px 0 10px; color: var(--ui-dim); }
.ov-stage { position: relative; min-height: 0; }
#ov-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ov-area { fill: rgba(255, 214, 10, 0); stroke: rgba(255, 255, 255, 0); stroke-width: 3; cursor: pointer; transition: fill .15s, stroke .15s; }
.ov-area:hover, .ov-area.hover { fill: rgba(255, 214, 10, .28); stroke: var(--accent); }
#ov-labels { position: absolute; inset: 0; pointer-events: none; }
.ov-label {
  position: absolute; translate: -50% -50%; pointer-events: auto; padding: 6px 12px; border: 0; border-radius: 999px;
  background: rgba(0, 0, 0, .72); font-weight: 650; font-size: 14px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.ov-label:hover, .ov-label.hover { background: var(--accent); color: #000; }
.ov-caption { position: absolute; margin: 0; font-size: 12px; color: rgba(255, 255, 255, .8); background: rgba(0, 0, 0, .5); padding: 3px 8px; border-radius: 6px; }
.ov-actions { display: flex; gap: 10px; justify-content: center; padding-top: 12px; }
.ov-actions button { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 22px; border-radius: 23px; border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .08); font-weight: 650; font-size: 16px; }
.ov-actions button.primary { background: var(--accent); color: #000; border-color: var(--accent); }

/* info card */
#info-dlg[open] { width: min(440px, 92vw); border-radius: 14px; padding: 18px; }
#info-body { white-space: pre-line; line-height: 1.45; color: rgba(255, 255, 255, .9); }
#info-link { color: #7fd1ff; }
#info-dlg form { text-align: right; margin: 0; }
#info-dlg form button { height: 40px; padding: 0 18px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .12); font-weight: 600; }

/* ---------- guided tour bar */
#excursion-bar {
  position: fixed; z-index: 21; top: calc(var(--gap) + var(--safe-t)); left: 50%; translate: -50% 0;
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 14px; max-width: calc(100vw - 2 * var(--gap));
  background: var(--ui-bg-strong); box-shadow: 0 2px 10px rgba(0, 0, 0, .4); box-sizing: border-box;
}
#excursion-bar button { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: rgba(255, 255, 255, .1); font-weight: 600; }
#excursion-bar button:hover { background: rgba(255, 255, 255, .2); }
.ex-step { color: var(--accent); font-weight: 700; white-space: nowrap; }
.ex-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 720px) { #excursion-bar { top: calc(64px + var(--safe-t)); } #ex-pause span { display: none; } }

/* ---------- first-visit hint */
#hint {
  position: fixed; z-index: 15; left: 50%; translate: -50% 0; bottom: calc(70px + var(--safe-b)); width: max-content; max-width: min(560px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-radius: 14px; box-sizing: border-box;
  background: var(--ui-bg-strong); box-shadow: 0 2px 12px rgba(0, 0, 0, .45);
}
#hint p { margin: 0; font-size: 14px; line-height: 1.4; }
#hint button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .1); padding: 0; flex: none; }
@media (max-width: 640px) { #hint { bottom: calc(126px + var(--safe-b)); } }

/* ---------- embedded in a card (?embed=1): only the panorama and "open" */
body.embed .place { max-width: calc(100vw - 2 * var(--gap)); }

#error { position: fixed; inset: 0; display: none; place-items: center; color: #fff; padding: 24px; text-align: center; }
