  *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

  :root {
    --film-active: 200px;
    --film-rest: 52px;
    --toolbar-h: 52px;
    --strip-h: 96px;
  }

  html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: #06090f;
    cursor: none;
  }

  /* ── Custom cursor ── */
  #cursor {
    position: fixed; z-index: 9999; pointer-events: none;
    width: 10px; height: 10px; border-radius: 50%;
    background: rgba(255,255,255,0.9);
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, background 0.2s;
    mix-blend-mode: difference;
  }
  #cursor.hover {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.6);
  }

  /* ── PSV container fills viewport ── */
  #photosphere {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
  }

  /* Push PSV canvas below UI layers */
  #photosphere .psv-container { z-index: 0; }

  /* ── Vignette ── */
  #vignette {
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background: radial-gradient(ellipse at 50% 40%, transparent 25%, rgba(0,0,0,0.65) 100%);
  }

  /* ── Scene title ── */
  #scene-info {
    position: fixed;
    bottom: calc(var(--strip-h) + var(--toolbar-h) + 24px);
    left: 0; right: 0;
    text-align: center;
    pointer-events: none;
    z-index: 11;
    transition: opacity 0.5s ease, transform 0.5s ease;
  }
  #scene-info.fade {
    opacity: 0;
    transform: translateY(8px);
  }
  #scene-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.5rem, 4vw, 2.6rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.92);
    text-shadow: 0 2px 48px rgba(0,0,0,0.9);
    line-height: 1.15;
  }
  #scene-sub {
    margin-top: 6px;
    font-family: 'Raleway', sans-serif;
    font-weight: 200;
    font-size: 0.7rem;
    letter-spacing: 0.38em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
  }

  /* ── Counter ── */
  #counter {
    position: fixed;
    top: 22px; right: 24px; z-index: 20;
    font-family: 'Cinzel', serif;
    font-size: 10px; letter-spacing: 0.22em;
    color: rgba(255,255,255,0.22);
    pointer-events: none;
  }
  #counter em { color: rgba(255,255,255,0.55); font-style: normal; }

  /* ── Back link top-left ── */
  #back-link {
    position: fixed; top: 22px; left: 24px; z-index: 20;
    font-family: 'Cinzel', serif;
    font-size: 12px; letter-spacing: 0.24em;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    pointer-events: all;
    transition: color 0.2s;
    display: flex; align-items: center; gap: 8px;
  }
  #back-link::before {
    content: '←';
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    transition: color 0.2s, transform 0.2s;
  }
  #back-link:hover { color: rgba(255,255,255,0.8); }
  #back-link:hover::before { color: rgba(255,255,255,0.8); transform: translateX(-3px); }

  /* ── Nav arrows ── */
  .nav-arrow {
    position: fixed; top: 50%;
    transform: translateY(-50%);
    z-index: 20; pointer-events: all;
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.3);
    border: 0.5px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.5);
    font-size: 16px; text-decoration: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
  }
  .nav-arrow:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.45);
    color: #fff;
  }
  #nav-prev { left: 16px; }
  #nav-next { right: 16px; }

  /* ── UI bottom layer ── */
  #ui {
    position: fixed; inset: 0; z-index: 10;
    display: flex; flex-direction: column;
    justify-content: flex-end;
    pointer-events: none;
  }

  /* ── Toolbar ── */
  #toolbar {
    pointer-events: all;
    height: var(--toolbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 0.5px solid rgba(255,255,255,0.07);
    z-index: 15;
  }

  #toolbar-left {
    font-family: 'Cinzel', serif;
    font-size: 13px; letter-spacing: 0.22em;
    color: rgba(255,255,255,0.72);
  }

  #toolbar-right { display: flex; gap: 6px; }

  .tb-btn {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 0.5px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.55);
    font-size: 13px; cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    text-decoration: none;
    font-variant-emoji: text;
  }
  #btn-home { font-size: 17px; }
  .tb-btn:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.4);
    color: #fff;
  }
  .tb-btn.active {
    background: rgba(168,216,255,0.14);
    border-color: rgba(168,216,255,0.5);
    color: #a8d8ff;
  }

  /* ── Film strip ── */
  #strip {
    pointer-events: all;
    height: var(--strip-h);
    display: flex;
    overflow: hidden;
    position: relative;
    background: rgba(0,0,0,0.25);
    touch-action: pan-x;
  }

  #sprockets-top, #sprockets-bot {
    position: absolute; left: 0; right: 0;
    display: flex; pointer-events: none; z-index: 5;
  }
  #sprockets-top { top: 4px; }
  #sprockets-bot { bottom: 4px; }

  .sp-slot { flex: 1; display: flex; justify-content: center; }
  .sp-hole {
    width: 9px; height: 6px; border-radius: 1px;
    border: 0.5px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.5);
  }

  .frame {
    flex: 0 0 var(--film-rest);
    height: 100%;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: flex-basis 0.55s cubic-bezier(0.4,0,0.2,1);
    border-right: 1px solid rgba(0,0,0,0.4);
  }
  .frame.active { flex-basis: var(--film-active); }

  .frame-img {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    transition: transform 0.4s ease;
  }
  .frame:hover .frame-img { transform: scale(1.04); }

  .frame-shade {
    position: absolute; inset: 0;
    background: rgb(0 0 0 / 23%);
    transition: background 0.3s;
  }
  .frame.active .frame-shade { background: rgba(0,0,0,0.1); }
  .frame:hover .frame-shade  { background: rgba(0,0,0,0.25); }

  .frame-active-bar {
    position: absolute; top: 0; left: 0; right: 0;
    height: 2px;
    background: rgba(255,255,255,0.75);
    opacity: 0; transition: opacity 0.3s;
  }
  .frame.active .frame-active-bar { opacity: 1; }

  .frame-num {
    position: absolute; top: 16px; left: 7px;
    font-family: 'Raleway', sans-serif;
    font-size: 9px; letter-spacing: 0.08em;
    color: rgba(255,255,255,0.2);
    pointer-events: none;
  }
  .frame.active .frame-num { color: rgba(255,255,255,0.45); }

  .frame-label {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 20px 8px 14px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    font-family: 'Raleway', sans-serif;
    font-size: 9px; font-weight: 300;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.0);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: color 0.3s;
    pointer-events: none;
  }
  .frame.active .frame-label { color: rgba(255,255,255,0.75); }
  .frame:hover  .frame-label { color: rgba(255,255,255,0.5); }

  /* Hide PSV's own UI chrome — we replace it entirely */
  .psv-navbar,
  .psv-panel,
  .psv-notification,
  .psv-overlay { display: none !important; }

  /* ── Panorama list panel ── */
  #pano-list-panel {
    position: fixed;
    bottom: calc(var(--strip-h) + var(--toolbar-h) + 10px);
    right: 24px;
    min-width: 220px;
    max-width: 320px;
    max-height: 58vh;
    overflow-y: auto;
    background: rgba(6,9,15,0.48);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 0.5px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 6px 0;
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.4,0,0.2,1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
  }
  #pano-list-panel::-webkit-scrollbar { width: 3px; }
  #pano-list-panel::-webkit-scrollbar-track { background: transparent; }
  #pano-list-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }
  #pano-list-panel.open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
  }

  #pano-list { list-style: none; }

  .pano-list-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 14px;
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.07em;
    color: rgba(255,255,255,0.75);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pano-list-item:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.88);
  }
  .pano-list-item.active {
    color: #a8d8ff;
    background: rgba(168,216,255,0.06);
  }
  .pano-list-item .item-num {
    font-family: 'Cinzel', serif;
    font-size: 8px;
    letter-spacing: 0.14em;
    color: rgba(255,255,255,0.38);
    min-width: 18px;
    flex-shrink: 0;
  }
  .pano-list-item.active .item-num { color: rgba(168,216,255,0.5); }

  .pano-list-item .item-dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: #a8d8ff;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0;
  }
  .pano-list-item.active .item-dot { opacity: 1; }

  /* ── Mobile tweaks ── */
  @media (max-width: 600px) {
    :root {
      --film-active: 130px;
      --film-rest: 34px;
      --strip-h: 80px;
      --toolbar-h: 48px;
    }
    #scene-title { font-size: 1.3rem; letter-spacing: 0.08em; }
    .nav-arrow { width: 30px; height: 30px; font-size: 13px; }
    #back-link, #counter { font-size: 8px; }
  }
  body.is-fullscreen #strip { display: none; }
  body.is-fullscreen { --strip-h: 0px; }

  /* ── Minimap ── */
  #mp-pin-layer { position: absolute; inset: 0; pointer-events: none; }
  .mp-pin-hit {
    position: absolute; width: 28px; height: 28px;
    transform: translate(-50%,-50%);
    cursor: pointer; pointer-events: all; border-radius: 50%;
  }
  .mp-pin-hit::after {
    content: ''; position: absolute;
    width: 10px; height: 10px; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    border-radius: 50%;
    background: var(--pin-color, #a8d8ff);
    border: 1.5px solid rgba(255,255,255,0.85);
    box-shadow: 0 1px 6px rgba(0,0,0,0.6);
    transition: transform 0.15s;
  }
  .mp-pin-hit:hover::after { transform: translate(-50%,-50%) scale(1.4); }

  #map-orb {
    position: fixed;
    bottom: calc(var(--strip-h) + var(--toolbar-h) + 16px); left: 20px;
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(0,0,0,0.55); border: 0.5px solid rgba(255,255,255,0.22);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.65); font-size: 17px;
    cursor: pointer; z-index: 50; box-shadow: 0 2px 20px rgba(0,0,0,0.55);
    transition: opacity .4s ease, transform .4s cubic-bezier(.4,0,.2,1), background .2s, border-color .2s, color .2s;
  }
  #map-orb:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.45); color: #fff; }
  #map-orb.orb-hidden { opacity: 0; transform: scale(0.5); pointer-events: none; }

  #map-panel {
    position: fixed;
    bottom: calc(var(--strip-h) + var(--toolbar-h) + 16px); left: 20px;
    width: 260px; border-radius: 10px; overflow: hidden;
    background: rgba(6,10,20,0.9); border: 0.5px solid rgba(255,255,255,0.14);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    z-index: 49; box-shadow: 0 8px 48px rgba(0,0,0,0.7);
    transform-origin: bottom left;
    transition: opacity .45s ease, transform .45s cubic-bezier(.4,0,.2,1);
  }
  #map-panel.panel-hidden  { opacity: 0; transform: scale(0.04) translate(-8px,12px); pointer-events: none; }
  #map-panel.panel-visible { opacity: 1; transform: scale(1) translate(0,0); }
  @keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-28px) scale(0.96); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
  }
  #map-panel.panel-enter { animation: slideInLeft .55s cubic-bezier(.4,0,.2,1) forwards; }

  .mp-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 12px 8px; border-bottom: 0.5px solid rgba(255,255,255,0.08);
  }
  .mp-title { font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: 0.2em; color: rgba(255,255,255,0.85); text-transform: uppercase; }
  .mp-close {
    width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.06); border: 0.5px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.38); font-size: 10px; flex-shrink: 0;
    transition: background .2s, color .2s;
  }
  .mp-close:hover { background: rgba(255,255,255,0.16); color: #fff; }

  #mp-img-wrap { position: relative; width: 100%; height: 164px; overflow: hidden; background: #0a1828; }
  #mp-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .4s ease; }
  #mp-img-wrap img.loading { opacity: 0; }

  #mp-active-pulse {
    position: absolute; pointer-events: none;
    width: 16px; height: 16px; border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.9);
    transform: translate(-50%,-50%);
    animation: minimap-pulse 1.8s ease-out infinite; display: none;
  }
  @keyframes minimap-pulse {
    0%   { transform: translate(-50%,-50%) scale(1);   opacity: .9; }
    100% { transform: translate(-50%,-50%) scale(2.4); opacity: 0;  }
  }

  .mp-footer {
    padding: 6px 12px 8px; font-family: 'Raleway', sans-serif; font-size: 9px;
    letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255,255,255,0.6);
    border-top: 0.5px solid rgba(255,255,255,0.07);
    display: flex; align-items: center; justify-content: space-between;
  }
  .mp-count { color: rgba(255,255,255,0.75); }
