html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.video360-body {
    overflow: hidden;
}

#player-wrap {
    position: fixed;
    inset: 0;
    background: #000;
    overflow: hidden;
}

#vp {
    width: 100%;
    height: 100%;
}

.video-js {
    width: 100% !important;
    height: 100% !important;
}

/* The <video> element stays technically visible — iOS Safari auto-pauses
   video with `visibility: hidden` or `display: none` after ~2 seconds to
   save battery. #sphere-canvas (z-index: 1) sits on top and fully occludes
   it, so the raw flat video is never seen. */

#sphere-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    touch-action: none;    /* disable browser pan/zoom — we handle pinch ourselves */
    cursor: grab;
}
#sphere-canvas:active {
    cursor: grabbing;
}

/* video.js chrome sits above the canvas */
.video-js .vjs-control-bar,
.video-js .vjs-big-play-button,
.video-js .vjs-loading-spinner,
.video-js .vjs-error-display,
.video-js .vjs-modal-dialog,
.video-js .vjs-text-track-display {
    z-index: 2;
}

/* Show the control bar even before first play. Default video.js theme hides
   it until .vjs-has-started is set; we unconditionally make it visible. */
.video-js .vjs-control-bar {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* First-view onboarding hint ("Drag to look around"). Fades out on first
   interaction with the sphere (or after a timeout — see video360.html).
   `pointer-events: none` → clicks pass through to the 3D canvas.
   Responsive: scales with viewport on phones via clamp(). */
.video360-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: clamp(16px, 3vmin, 26px) clamp(22px, 4vmin, 34px);
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    font-size: clamp(13px, 2.2vmin, 18px);
    font-weight: 500;
    letter-spacing: 0.01em;
    text-align: center;
    pointer-events: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: opacity 0.45s ease;
    animation: video360-hint-pulse 1.6s ease-in-out 0.6s 2;
}
.video360-hint[hidden] {
    display: none !important;
}
.video360-hint.hiding {
    opacity: 0;
}
.video360-hint-icon {
    width: clamp(44px, 7vmin, 72px);
    height: clamp(44px, 7vmin, 72px);
    color: #fff;
}
.video360-hint-text {
    white-space: nowrap;
}
.video360-hint-text-sub {
    font-size: 0.85em;
    opacity: 0.85;
    margin-top: -4px;   /* tighten the gap after the primary line */
}

/* Subtle pulse so it's harder to miss without being annoying. */
@keyframes video360-hint-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50%      { transform: translate(-50%, -50%) scale(1.04); }
}

/* Quality (and any other) popup menus must sit above the custom logo
   (which is position:fixed with z-index 1 and outside the player container). */
.video-js .vjs-menu {
    z-index: 30;
}

.video-js .vjs-big-play-button {
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    line-height: 80px;
    font-size: 40px;
    top: 50%;
    left: 50%;
    margin-top: -40px;
    margin-left: -40px;
}

/* Lift logo above the video.js control bar by control-bar-height + 8px.
   .vjs-control-bar is 3em tall, but video.js sets font-size:10px on .video-js root,
   so actual bar height is 30px. The logo itself inherits 16px, which is why we can't use 3em here. */
.video360-logo > div {
    bottom: calc(30px + 8px) !important;
}

/* video.js quality menu button — render current quality label (Auto/1080p/...)
   as text inside the icon placeholder. Text is set dynamically via JS.
   Video.js control bar height is 3em; matching font-size × line-height keeps
   the glyph box = control height, which auto-centers the label. */
.video-js .vjs-quality-menu-button .vjs-icon-placeholder {
    font-family: inherit;
    font-size: 1.1em;
    font-weight: 700;
    line-height: 2.73;         /* 1.1em × 2.73 ≈ 3em, matches .vjs-control height */
    letter-spacing: -0.02em;
    text-align: center;
    display: block;
    width: 100%;
    height: 100%;
}

/* === Track minimap overrides ===
   PiP shell sizing comes from `appmap.css` (calc(100vh - 40px) — standard
   20 px margin top + bottom). Only video-specific things stay here:
   - Bottom edge gets a touch more clearance to sit above video.js's
     30 px control bar (~10 px gap).
   - Expand-button (auto-built by AppMap when the PiP is collapsed) sits
     at the bottom-left so the user reads "map" alongside the player
     controls instead of up at the corner. */
.video360-body .appmap-mode-floating {
    /* 20 px top margin + 20 px gap above the 30 px video.js controlbar = 70 */
    height: calc(100vh - 70px);
    max-height: calc(100vh - 70px);
}
/* Map-toggle button — bottom-left, above the 30 px video.js controlbar.
   Always visible (toggles the floating shell), styled transparent with a
   white SVG icon to match marzipano's #buttonContainer toggle. */
.video360-body .appmap-pip-expand {
    top: auto;
    left: 10px;
    bottom: 40px;
    width: 50px;
    height: 50px;
    background: transparent;
    border: none;
    box-shadow: none;
    color: #fff;
    border-radius: 4px;
}
.video360-body .appmap-pip-expand:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}
.video360-body .appmap-pip-expand svg {
    width: 34px;
    height: 34px;
}
/* Pulse uses the flat keyframes — no box-shadow baseline to anchor the
   shadow-based pulse against, same reason as #buttonContainer in marzipano. */
.video360-body .appmap-pip-expand.appmap-toggle-pulse {
    animation-name: appmap-toggle-pulse-flat;
}
.video360-body .appmap-mode-floating .video360-pip-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 12px;
    background: rgba(17, 24, 39, 0.88);
    color: #fff;
    border-radius: 0 0 8px 8px;
    font: 12px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.45;
    z-index: 5;
}
.video360-pip-info .row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.video360-pip-info .lbl {
    opacity: 0.65;
}
.video360-pip-info .warn {
    margin-top: 6px;
    padding: 6px 8px;
    background: rgba(234, 179, 8, 0.15);
    border-left: 3px solid #eab308;
    color: #fde68a;
    font-size: 11px;
    line-height: 1.3;
    border-radius: 3px;
}

/* On mobile the PiP is fullscreen — hide the rounded corners that don't
   apply to the info overlay either. */
@media (max-width: 900px), (max-height: 500px) {
    .video360-body .appmap-mode-floating .video360-pip-info {
        border-radius: 0;
    }
}

/* === List page === */
.video360-list-body {
    overflow: auto;
    color: #e5e7eb;
}

.video360-list {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.video360-list-header h1 {
    margin: 0 0 4px;
    font-size: 22px;
    color: #fff;
}

.video360-list-header p {
    margin: 0 0 24px;
    color: #9ca3af;
    font-size: 13px;
}

.video360-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.video360-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #111827;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.video360-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.video360-thumb {
    position: relative;
    aspect-ratio: 2 / 1;
    background: #000;
}

.video360-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video360-duration,
.video360-res,
.video360-trackbadge {
    position: absolute;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
}

.video360-duration {
    bottom: 6px;
    right: 6px;
}

.video360-res {
    top: 6px;
    right: 6px;
}

.video360-trackbadge {
    top: 6px;
    left: 6px;
    background: rgba(37, 99, 235, 0.85);
    font-weight: 600;
}

.video360-title {
    padding: 10px 12px;
    font-size: 14px;
    color: #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
