/* ============================================
   全景图浏览前台样式 - 瑞银明亮蓝白主题
   配色参考：https://www.rydz.cc/flipbook/
   主色 #2563eb（天蓝） / #0ea5e9（亮蓝）
   ============================================ */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { width:100%; height:100%; overflow:hidden; background:#f8fafc; font-family:'Segoe UI','PingFang SC','Microsoft YaHei',system-ui,sans-serif; color:#0f172a; user-select:none; }
body.home-page { overflow-y:auto; min-height:100vh; display:flex; flex-direction:column; }
:root {
    --primary:#2563eb;       /* 瑞银品牌主蓝 */
    --primary-dark:#1d4ed8;
    --accent:#0ea5e9;        /* 点亮天蓝 */
    --bg:#ffffff;
    --bg2:#f8fafc;
    --bg-soft:#eff6ff;
    --text:#0f172a;
    --text-dim:#64748b;
    --text-mute:#94a3b8;
    --glass:rgba(37,99,235,0.06);
    --border:rgba(148,163,184,0.2);
    --border-strong:rgba(148,163,184,0.35);
    --danger:#ef4444;
    --success:#10b981;
}
#viewer-container { position:fixed; inset:0; }
#viewer-container canvas { display:block !important; }

/* 加载层 */
.loading-overlay { position:fixed; inset:0; background:linear-gradient(135deg,#ffffff,#eff6ff); display:flex; align-items:center; justify-content:center; z-index:9999; transition:opacity .5s; }
.loading-overlay.hide { opacity:0; pointer-events:none; }
.loading-box { text-align:center; }
.loading-spinner { width:56px; height:56px; margin:0 auto 20px; border:3px solid #dbeafe; border-top-color:#2563eb; border-radius:50%; animation:spin 1s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.loading-text { color:#2563eb; font-size:15px; margin-bottom:12px; letter-spacing:1px; font-weight:500; }
.loading-percent { font-size:32px; font-weight:800; color:#2563eb; margin-bottom:14px; font-variant-numeric:tabular-nums; }
.loading-bar { width:280px; height:8px; background:#e2e8f0; border-radius:4px; overflow:hidden; box-shadow:inset 0 1px 3px rgba(0,0,0,0.08); }
.loading-fill { height:100%; width:0%; background:linear-gradient(90deg,#2563eb,#0ea5e9); border-radius:4px; transition:width .3s ease; box-shadow:0 0 8px rgba(37,99,235,0.4); }

/* 顶部栏（播放页） */
.top-bar { position:fixed; top:0; left:0; right:0; height:64px; background:rgba(255,255,255,0.92); backdrop-filter:blur(12px); display:flex; align-items:center; justify-content:space-between; padding:0 20px; z-index:100; border-bottom:1px solid var(--border); transition:opacity .3s; }
.top-bar.hide { opacity:0; pointer-events:none; }
.top-left { display:flex; align-items:center; gap:12px; }
.top-divider { color:var(--text-mute); }
.site-logo { display:flex; align-items:center; gap:10px; text-decoration:none; }
.top-logo-img { height:52px; width:auto; max-width:160px; object-fit:contain; border-radius:6px; background:#fff; padding:3px 8px; }
.site-name { font-size:16px; font-weight:600; color:var(--text); letter-spacing:1px; }
.top-center { flex:1; text-align:center; }
.scene-title { font-size:17px; font-weight:600; color:var(--text); }
.top-right { display:flex; align-items:center; gap:6px; }

/* 播放页图标按钮（使用内联 SVG） */
.icon-btn { width:40px; height:40px; border:none; background:rgba(255,255,255,0.85); color:var(--text); border-radius:10px; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; transition:all .2s; border:1px solid var(--border); }
.icon-btn:hover { background:var(--primary); color:#fff; border-color:var(--primary); box-shadow:0 4px 14px rgba(37,99,235,0.35); }
.icon-btn.active { background:var(--primary); color:#fff; border-color:var(--primary); box-shadow:0 4px 14px rgba(37,99,235,0.35); }
.icon-btn svg { width:20px; height:20px; }
.icon-btn:active { transform:scale(0.94); }

/* 返回按钮 */
.back-btn { color:var(--text); text-decoration:none; font-size:14px; padding:6px 12px; border-radius:8px; background:rgba(148,163,184,0.15); transition:background .2s; display:inline-flex; align-items:center; gap:4px; }
.back-btn:hover { background:var(--primary); color:#fff; }

/* 底部缩略图导航（播放页） */
.thumb-bar { position:fixed; bottom:0; left:0; right:0; padding:16px; background:rgba(255,255,255,0.92); backdrop-filter:blur(12px); z-index:100; transition:opacity .3s, transform .3s; border-top:1px solid var(--border); }
.thumb-bar.hide { opacity:0; pointer-events:none; transform:translateY(20px); }
.thumb-track { display:flex; gap:12px; overflow-x:auto; padding:4px; scrollbar-width:thin; scrollbar-color:var(--primary) transparent; }
.thumb-track::-webkit-scrollbar { height:6px; }
.thumb-track::-webkit-scrollbar-thumb { background:var(--primary); border-radius:3px; }
.thumb-track::-webkit-scrollbar-track { background:transparent; }
.thumb-card { flex:0 0 auto; width:96px; height:64px; border-radius:8px; overflow:hidden; cursor:pointer; border:2px solid transparent; position:relative; transition:all .2s; background:#f1f5f9; }
.thumb-card:hover { transform:translateY(-4px); border-color:var(--primary); box-shadow:0 6px 18px rgba(37,99,235,0.25); }
.thumb-card.active { border-color:var(--primary); box-shadow:0 0 0 2px rgba(37,99,235,0.3); }
.thumb-card img { width:100%; height:100%; object-fit:cover; }
.thumb-card .thumb-name { position:absolute; bottom:0; left:0; right:0; padding:4px 6px; font-size:10px; color:#fff; background:linear-gradient(0deg,rgba(0,0,0,0.75),transparent); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* 场景简介弹窗 */
.desc-modal { position:fixed; inset:0; background:rgba(15,23,42,0.5); z-index:300; display:flex; align-items:center; justify-content:center; opacity:0; pointer-events:none; transition:opacity .3s; }
.desc-modal.show { opacity:1; pointer-events:auto; }
.desc-card { background:#fff; border:1px solid var(--border); border-radius:16px; max-width:480px; width:90%; max-height:70vh; overflow:hidden; box-shadow:0 24px 60px rgba(15,23,42,0.25); }
.desc-head { display:flex; align-items:center; justify-content:space-between; padding:20px 24px; border-bottom:1px solid var(--border); background:var(--bg2); }
.desc-head h3 { color:var(--primary); font-size:18px; font-weight:600; }
.desc-close { width:32px; height:32px; border:none; background:transparent; color:var(--text-dim); font-size:24px; cursor:pointer; border-radius:8px; display:flex; align-items:center; justify-content:center; transition:all .2s; }
.desc-close:hover { color:var(--text); background:rgba(148,163,184,0.15); }
.desc-body { padding:24px; color:var(--text); line-height:1.8; font-size:14px; overflow-y:auto; max-height:calc(70vh - 72px); }

/* 空状态 / 错误状态 */
.empty-state { position:fixed; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; background:var(--bg2); z-index:200; text-align:center; }
.empty-icon { font-size:80px; opacity:0.4; margin-bottom:24px; }
.empty-state h2 { color:var(--primary); font-size:22px; margin-bottom:12px; font-weight:600; }
.empty-state p { color:var(--text-dim); font-size:14px; }
.retry-btn { margin-top:24px; padding:12px 32px; background:linear-gradient(135deg,var(--primary),var(--primary-dark)); color:#fff; border:none; border-radius:10px; font-size:14px; cursor:pointer; transition:all .2s; font-weight:500; }
.retry-btn:hover { box-shadow:0 8px 24px rgba(37,99,235,0.35); transform:translateY(-1px); }

/* 移动端适配 */
@media (max-width:768px) {
    .top-bar { height:56px; padding:0 12px; }
    .site-name { display:none; }
    .scene-title { font-size:15px; }
    .icon-btn { width:36px; height:36px; }
    .icon-btn svg { width:18px; height:18px; }
    .thumb-card { width:72px; height:52px; }
    .desc-card { width:92%; }
    .top-right { gap:4px; }
}

/* 横竖屏适配 */
@media (orientation:landscape) and (max-height:500px) {
    .top-bar { height:48px; }
    .thumb-bar { padding:8px; }
    .thumb-card { height:44px; width:66px; }
}

/* 全屏模式 */
body:fullscreen .top-bar, body:fullscreen .thumb-bar { opacity:0.3; }
body:fullscreen .top-bar:hover, body:fullscreen .thumb-bar:hover { opacity:1; }

/* ========== 首页（作品集列表） ========== */
body.home-page { background:var(--bg2); }
.home-header { padding:20px 32px; display:flex; align-items:center; justify-content:space-between; gap:24px; border-bottom:1px solid var(--border); background:rgba(255,255,255,0.9); backdrop-filter:blur(12px); position:sticky; top:0; z-index:50; }
.home-logo { display:flex; align-items:center; gap:14px; font-size:20px; font-weight:700; color:var(--text); }
.home-logo .logo-img { height:64px; max-height:64px; width:auto; max-width:260px; object-fit:contain; border-radius:8px; background:#fff; padding:5px 10px; box-shadow:0 2px 8px rgba(0,0,0,0.1); }
.home-nav { display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.home-nav a { color:var(--text-dim); text-decoration:none; font-size:15px; padding:9px 16px; border-radius:8px; transition:all .2s; border:1px solid transparent; font-weight:500; }
.home-nav a:hover { color:var(--primary); background:var(--bg-soft); border-color:rgba(37,99,235,0.2); }
.home-hero { text-align:center; padding:48px 20px 32px; }
.home-hero h1 { font-size:40px; background:linear-gradient(135deg,#2563eb,#0ea5e9); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; margin-bottom:10px; font-weight:700; }
.home-hero p { color:var(--text-dim); font-size:16px; }
.collection-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:24px; padding:24px 32px 48px; max-width:1400px; margin:0 auto; }
.collection-card { background:#fff; border:1px solid var(--border); border-radius:16px; overflow:hidden; text-decoration:none; color:inherit; transition:all .3s; display:block; }
.collection-card:hover { transform:translateY(-6px); box-shadow:0 20px 50px rgba(15,23,42,0.12); border-color:rgba(37,99,235,0.3); }
.coll-cover { position:relative; width:100%; height:200px; background:#e2e8f0; overflow:hidden; }
.coll-cover img { width:100%; height:100%; object-fit:cover; transition:transform .5s; }
.collection-card:hover .coll-cover img { transform:scale(1.06); }
.coll-cover-placeholder { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:64px; opacity:0.3; }
.coll-overlay { position:absolute; inset:0; background:linear-gradient(to top,rgba(15,23,42,0.6) 0%,transparent 60%); display:flex; align-items:center; justify-content:center; opacity:0; transition:opacity .3s; }
.collection-card:hover .coll-overlay { opacity:1; }
.play-icon { width:64px; height:64px; background:linear-gradient(135deg,#2563eb,#1d4ed8); border-radius:50%; display:flex; align-items:center; justify-content:center; box-shadow:0 8px 28px rgba(37,99,235,0.5); transition:transform .2s; color:#fff; }
.collection-card:hover .play-icon { transform:scale(1.08); }
.coll-info { padding:20px; }
.coll-info h3 { font-size:20px; margin-bottom:6px; color:var(--text); font-weight:600; }
.coll-info p { font-size:13px; color:var(--text-dim); margin-bottom:12px; line-height:1.5; }
.coll-meta { display:flex; justify-content:space-between; align-items:center; font-size:13px; color:var(--text-dim); }
.enter-btn { color:var(--primary); font-weight:600; }
.home-empty { grid-column:1/-1; text-align:center; padding:80px 20px; }
.home-empty .empty-icon { font-size:64px; opacity:0.3; margin-bottom:16px; }
.home-empty h2 { color:var(--text); margin-bottom:8px; font-weight:600; }
.home-empty p { color:var(--text-dim); }
.home-footer { text-align:center; padding:24px 32px; color:var(--text-dim); font-size:13px; border-top:1px solid var(--border); background:#fff; margin-top:auto; }
.home-footer .footer-links { margin-bottom:10px; display:flex; justify-content:center; flex-wrap:wrap; gap:6px; align-items:center; }
.home-footer .footer-links a { color:var(--text-dim); text-decoration:none; padding:4px 8px; border-radius:6px; transition:color .2s; font-size:13px; }
.home-footer .footer-links a:hover { color:var(--primary); }
.home-footer .footer-links a.admin-link { color:#cbd5e1; border:none; font-size:12px; opacity:0.5; transition:opacity .2s; }
.home-footer .footer-links a.admin-link:hover { opacity:0.9; color:#94a3b8; background:transparent; }
.home-footer .footer-links .sep { color:var(--border-strong); }
@media (max-width:768px) {
    .home-header { padding:14px 16px; flex-wrap:wrap; gap:12px; }
    .home-logo .logo-img { height:48px; }
    .home-nav { gap:2px; }
    .home-nav a { padding:6px 10px; font-size:14px; }
    .home-hero h1 { font-size:32px; }
    .collection-grid { grid-template-columns:1fr; padding:16px; }
    .coll-cover { height:180px; }
}

/* ========== 播放页（view.php） ========== */
body.viewer-page { overflow:hidden; }
.viewer-page .top-bar { transition:opacity .3s; }
.viewer-page .thumb-bar { transition:opacity .3s; }

/* ========== 首页分享按钮 ========== */
.nav-share-btn { display:inline-flex; align-items:center; gap:6px; color:#fff; background:linear-gradient(135deg,#2563eb,#1d4ed8); border:1px solid rgba(37,99,235,0.5); border-radius:8px; padding:8px 16px; font-size:13px; cursor:pointer; transition:all .2s; font-family:inherit; font-weight:500; }
.nav-share-btn:hover { transform:translateY(-1px); box-shadow:0 4px 16px rgba(37,99,235,0.4); }
.nav-share-btn svg { width:14px; height:14px; }

/* ========== 分享弹窗 ========== */
.share-modal { position:fixed; inset:0; z-index:9999; display:flex; align-items:center; justify-content:center; opacity:0; visibility:hidden; transition:opacity .25s, visibility .25s; }
.share-modal.show { opacity:1; visibility:visible; }
.share-mask { position:absolute; inset:0; background:rgba(15,23,42,0.55); backdrop-filter:blur(4px); }
.share-card { position:relative; z-index:1; width:440px; max-width:92vw; max-height:90vh; overflow-y:auto; background:#fff; border-radius:16px; padding:32px 28px 28px; color:var(--text); box-shadow:0 24px 60px rgba(15,23,42,0.25); transform:scale(0.92); transition:transform .25s cubic-bezier(.2,.8,.2,1); }
.share-modal.show .share-card { transform:scale(1); }
.share-close { position:absolute; top:12px; right:14px; width:32px; height:32px; border:none; background:rgba(0,0,0,0.05); border-radius:50%; cursor:pointer; font-size:20px; color:#888; display:flex; align-items:center; justify-content:center; transition:all .2s; }
.share-close:hover { background:rgba(0,0,0,0.1); color:#333; }
.share-card-title { font-size:18px; font-weight:700; text-align:center; margin-bottom:4px; color:var(--text); }
.share-card-sub { font-size:13px; color:var(--text-dim); text-align:center; margin-bottom:20px; }

.share-qr-wrap { text-align:center; margin-bottom:20px; }
.share-qr-img { width:160px; height:160px; border-radius:8px; background:#f5f7fa; padding:8px; border:1px solid var(--border); }
.share-qr-hint { font-size:12px; color:var(--text-mute); margin-top:6px; }

.share-ways { margin-bottom:16px; }
.share-way-item { margin-bottom:16px; }
.share-way-item > label { display:block; font-size:13px; font-weight:600; color:var(--text); margin-bottom:8px; }
.share-input-row { display:flex; gap:8px; align-items:stretch; }
.share-input { flex:1; padding:10px 12px; background:var(--bg2); border:1px solid var(--border); border-radius:8px; color:var(--text); font-size:13px; font-family:'Consolas','Monaco','Courier New',monospace; min-width:0; }
.share-input:focus { outline:none; border-color:var(--primary); background:#fff; }
.share-textarea { flex:1; padding:10px 12px; background:var(--bg2); border:1px solid var(--border); border-radius:8px; color:var(--text); font-size:12px; font-family:'Consolas','Monaco','Courier New',monospace; resize:none; line-height:1.5; white-space:pre; overflow-x:auto; min-width:0; }
.share-textarea:focus { outline:none; border-color:var(--primary); background:#fff; }
.btn-copy { white-space:nowrap; padding:10px 18px; background:linear-gradient(135deg,#2563eb,#1d4ed8); color:#fff; border:none; border-radius:8px; font-size:13px; cursor:pointer; transition:all .2s; font-family:inherit; font-weight:500; }
.btn-copy:hover { transform:translateY(-1px); box-shadow:0 4px 12px rgba(37,99,235,0.35); }
.share-hint { font-size:12px; color:var(--text-mute); margin-top:8px; line-height:1.5; }

.share-wechat-tip { display:flex; gap:10px; align-items:flex-start; padding:12px 14px; background:var(--bg-soft); border-radius:8px; border-left:3px solid var(--primary); }
.share-tip-icon { font-size:18px; flex-shrink:0; margin-top:1px; }
.share-tip-text { font-size:12px; color:#1e40af; line-height:1.6; }
.share-tip-text strong { color:#1e3a8a; }

@media (max-width:480px) {
    .share-card { padding:24px 18px 20px; border-radius:14px; }
    .share-qr-img { width:130px; height:130px; }
    .share-input-row { flex-direction:column; }
    .btn-copy { width:100%; justify-content:center; }
}
