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

body {
    overflow: hidden;
    background: #000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
canvas { display: block; }

/* ── Blocker / start / pause ─────────────────────────────────── */
#blocker {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; cursor: pointer;
}
#enter-msg, #pause-msg { text-align: center; color: #fff; }
#enter-msg h1, #pause-msg h1 {
    font-size: 2.8rem; font-weight: 300;
    letter-spacing: 0.15em; margin-bottom: 1rem;
}
#enter-msg p, #pause-msg p {
    font-size: 1.2rem; color: #ccc; margin-bottom: 0.6rem;
}
#enter-msg .hint, #pause-msg .hint {
    font-size: 0.9rem; color: #888; line-height: 1.8; margin-top: 1.5rem;
}

/* ── Crosshair ───────────────────────────────────────────────── */
#crosshair {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    color: rgba(255,255,255,0.5);
    font-size: 24px; pointer-events: none;
    z-index: 10; display: none; font-family: monospace;
}

/* ── Artwork viewer ──────────────────────────────────────────── */
#art-viewer {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 300;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}

/* Close button — fixed to top-right of the overlay */
#viewer-close {
    position: fixed; top: 18px; right: 18px;
    background: rgba(30,30,30,0.85); border: 1px solid #555;
    color: #fff; font-size: 1.3rem;
    width: 40px; height: 40px; border-radius: 50%;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    z-index: 310;
}
#viewer-close:hover { background: rgba(255,255,255,0.18); }

/* Two-column row: left = artwork, right = sidebar */
/* The inner wrapper is only used to anchor the sidebar; the image is positioned freely */
#art-viewer-inner {
    position: relative;
    display: flex; flex-direction: row;
    align-items: center; justify-content: center;
    width: 100%; height: 100%;
    pointer-events: none; /* let clicks fall through to overlay to close */
    cursor: default;
}

/* ── Left column — just holds the img-wrap ── */
#viewer-left {
    display: flex; flex-direction: column; align-items: center;
    flex: 1 1 auto; min-width: 0;
    pointer-events: none;
}

/* The img-wrap fills the whole viewport so the image can be panned anywhere */
#viewer-img-wrap {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    overflow: visible;
    pointer-events: all;
    cursor: zoom-in;
}

#viewer-img {
    display: block;
    /* Natural size fits 80vw × 80vh by default; zoom/pan is applied via JS transform */
    max-width: 80vw;
    max-height: 80vh;
    object-fit: contain;
    border: 6px solid #2a2019;
    box-shadow: 0 8px 40px rgba(0,0,0,0.7);
    transform-origin: center center;
    user-select: none; -webkit-user-drag: none;
    /* No transition during drag; JS applies transform directly */
}

#viewer-zoom-hint {
    position: fixed; bottom: 18px; left: 50%;
    transform: translateX(-50%);
    font-size: 0.72rem; color: rgba(255,255,255,0.3);
    pointer-events: none; letter-spacing: 0.06em;
    white-space: nowrap;
}

/* Placard — fixed at bottom-centre of screen */
#viewer-placard {
    position: fixed; bottom: 36px; left: 50%;
    transform: translateX(-50%);
    background: #f5f0e8; color: #2a2019;
    padding: 10px 28px;
    border-radius: 2px; text-align: center;
    min-width: 260px; max-width: 500px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.5);
    pointer-events: none;
    z-index: 320;
}
#viewer-title  { font-size: 1.05rem; font-weight: 600; font-style: italic; margin-bottom: 3px; }
#viewer-artist { font-size: 0.85rem; color: #555; margin-bottom: 4px; }
#viewer-desc   { font-size: 0.8rem; color: #666; line-height: 1.4; }
.viewer-slot-label { font-size: 0.72rem; color: #999; margin-top: 5px; }

/* ── Right sidebar — fixed so it stays put while image pans ── */
#viewer-right {
    position: fixed; top: 50%; right: 24px;
    transform: translateY(-50%);
    width: 260px;
    display: flex; flex-direction: column; gap: 0;
    pointer-events: all;
    z-index: 320;
    max-height: 90vh; overflow-y: auto;
}

#viewer-upload-toggle {
    width: 100%;
    background: rgba(255,255,255,0.08); border: 1px solid #555;
    color: #ccc; font-size: 0.82rem;
    padding: 9px 14px; border-radius: 7px;
    cursor: pointer; text-align: left;
    display: none; /* shown by JS */
}
#viewer-upload-toggle:hover { background: rgba(255,255,255,0.15); color: #fff; }

#viewer-upload {
    margin-top: 0; padding: 16px;
    background: #181818; border-radius: 10px;
    border: 1px solid #2e2e2e;
    display: none; /* shown by JS */
}
#viewer-upload h3 {
    font-size: 0.9rem; font-weight: 500;
    color: #bbb; margin-bottom: 14px;
}
#viewer-upload label {
    display: block; margin-bottom: 10px;
    font-size: 0.8rem; color: #888;
}
#viewer-upload input[type="text"] {
    display: block; width: 100%; margin-top: 3px;
    padding: 7px 9px; background: #242424;
    border: 1px solid #3a3a3a; border-radius: 5px;
    color: #eee; font-size: 0.85rem; outline: none;
}
#viewer-upload input[type="text"]:focus { border-color: #777; }
#viewer-upload input[type="file"] {
    display: block; margin-top: 3px; color: #aaa; font-size: 0.8rem;
}
#viewer-save {
    display: block; width: 100%; margin-top: 14px;
    padding: 9px; background: #e0c97f; color: #1a1a1a;
    border: none; border-radius: 6px; cursor: pointer;
    font-size: 0.9rem; font-weight: 600;
}
#viewer-save:hover { background: #d4b85a; }
#viewer-save:disabled { opacity: 0.5; cursor: wait; }

/* ── Scene bar ──────────────────────────────────────────────────── */
#scene-bar {
    position: fixed; top: 12px; left: 12px;
    z-index: 50; display: none;
    background: rgba(0,0,0,0.65); padding: 8px 14px;
    border-radius: 8px; border: 1px solid #444;
    color: #ccc; font-size: 0.85rem;
    align-items: center; gap: 10px;
}
#scene-bar label { display: flex; align-items: center; gap: 6px; }
#scene-select {
    background: #2a2a2a; color: #eee; border: 1px solid #555;
    border-radius: 4px; padding: 4px 8px; font-size: 0.85rem; outline: none;
}
#scene-bar button {
    background: #3a3a3a; color: #ccc; border: 1px solid #555;
    border-radius: 4px; padding: 4px 10px; cursor: pointer;
    font-size: 0.8rem;
}
#scene-bar button:hover { background: #555; color: #fff; }
#scene-delete { color: #e88; }
#scene-delete:hover { background: #633; color: #faa; }
