/* =====================================================================
   私人美术馆 3.0 - 全局共享样式库 (gallery.css)
   支持：立轴馆、手卷馆，包含安卓画屏电竞级触控优化
===================================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; background: #1a1514; overflow: hidden; font-family: "STSong", "SimSun", serif; color: #E6D2B4; transition: background 1s ease; cursor: default; }

/* 空闲隐藏控制台 */
body.idle { cursor: none; } 
body.idle #control-bar { opacity: 0; pointer-events: none; } 
body.local-zoom-mode:not(.idle) #bottom-wrapper { cursor: crosshair !important; }

/* ---------------------------------------------------------------------
   展馆布局容器 (立轴 & 手卷)
--------------------------------------------------------------------- */
#main-viewer { position: absolute; top: 0.2%; bottom: 0.2%; left: 0; right: 0; opacity: 0; transition: all 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); }
#main-viewer.effect-fade { transform: none; } #main-viewer.effect-fade.loaded { opacity: 1; transform: none; }
#main-viewer.effect-slide { transform: translateY(80px); } #main-viewer.effect-slide.loaded { opacity: 1; transform: translateY(0); }
#main-viewer.effect-zoom { transform: scale(0.9); } #main-viewer.effect-zoom.loaded { opacity: 1; transform: scale(1); }
#main-viewer.effect-none { transition: none !important; transform: none; } #main-viewer.effect-none.loaded { opacity: 1; transition: none !important; }

#top-wrapper { position: absolute; top: 0; left: 0; width: 100%; height: 32%; overflow: hidden; border-bottom: 1px solid #333; }
.gap { position: absolute; top: 32%; left: 0; width: 100%; height: 30px; background: transparent; }
#bottom-wrapper { position: absolute; top: 32%; margin-top: 30px; left: 0; width: 100%; bottom: 0; overflow: hidden; }
.osd-viewer { width: 100%; height: 100%; } 
#top-viewer canvas, #bottom-viewer canvas { transform: scale(1.002); transform-origin: center center; }
#red-box { position: absolute; border: 2px solid rgba(255, 0, 0, 0.8); pointer-events: none; z-index: 10; }

#breath-shadow { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; animation: breath 6s infinite alternate ease-in-out; }
@keyframes breath { 0% { box-shadow: inset 0 0 15px rgba(0,0,0,0.4); } 100% { box-shadow: inset 0 0 45px rgba(0,0,0,0.7); } }

/* ---------------------------------------------------------------------
   控制台与电竞级按键优化
--------------------------------------------------------------------- */
#header-zone { display: none !important; } 
#control-bar { position: absolute; z-index: 9999; text-align: center; transition: opacity 0.5s ease; }
body.lz-mode #control-bar { bottom: 20px; left: 0; width: 100%; padding: 10px; }
body.sj-mode #control-bar { top: 0; left: 0; width: 100%; padding: 15px; background: rgba(15, 10, 5, 0.85); }
body.show-details #control-bar { background: transparent; }

.btn, select { 
    display: inline-block; margin: 4px; padding: 8px 14px; 
    background: rgba(26, 21, 20, 0.8); color: #FFF5E6; 
    border: 1px solid rgba(212, 160, 23, 0.4); border-radius: 6px; 
    cursor: pointer; font-size: 14px; transition: all 0.15s ease; 
    vertical-align: middle; backdrop-filter: blur(4px);
    user-select: none; -webkit-user-select: none;
    touch-action: manipulation; 
    -webkit-tap-highlight-color: transparent; 
}
select option { background: #1a1514; color: #E6D2B4; }

.btn:hover, .btn:active, select:hover, select:active { background: #d4a017 !important; color: #000 !important; border-color: #d4a017 !important; }
.btn:active { transform: scale(0.92) !important; }
.btn.active-cycle { background: rgba(76, 175, 80, 0.6) !important; border-color: #4CAF50 !important; color: #fff !important; }
.btn.active-cycle:hover, .btn.active-cycle:active { background: #4CAF50 !important; color: #000 !important; }

#zoom-debug { display: inline-block; margin: 4px; padding: 8px 12px; font-family: monospace; font-weight: bold; font-size: 15px; border-radius: 6px; vertical-align: middle; transition: all 0.3s ease; pointer-events: none; border: 1px solid; min-width: 85px; text-align: center; }
#zoom-debug.state-drift { background: rgba(26, 21, 20, 0.8); color: #888; border-color: rgba(136, 136, 136, 0.3); backdrop-filter: blur(4px); }
#zoom-debug.state-aligned { background: rgba(76, 175, 80, 0.15); color: #8bc34a; border-color: rgba(139, 195, 74, 0.8); box-shadow: 0 0 10px rgba(139, 195, 74, 0.3); backdrop-filter: blur(4px); }

#sel-native-zoom { font-weight: bold; color: #8bc34a; border-color: rgba(139, 195, 74, 0.5); background: rgba(15, 30, 15, 0.6); } 
#sel-native-zoom:hover { border-color: #8bc34a; }
#calc-factor-btn { border-color: #03a9f4; color: #03a9f4; padding: 8px 10px; font-weight: bold; } 
#calc-factor-btn:hover, #calc-factor-btn:active { background: #03a9f4 !important; color: #000 !important; border-color: #03a9f4 !important; }

/* ---------------------------------------------------------------------
   多级分类下拉菜单面板
--------------------------------------------------------------------- */
.custom-select-container { position: relative; display: inline-block; vertical-align: middle; margin: 4px; text-align: left; }
.custom-select-header { padding: 8px 14px; background: rgba(26, 21, 20, 0.8); color: #FFF5E6; border: 1px solid rgba(212, 160, 23, 0.4); border-radius: 6px; cursor: pointer; font-size: 14px; min-width: 220px; backdrop-filter: blur(4px); display: flex; justify-content: space-between; align-items: center; transition: all 0.2s ease; }
.custom-select-header:hover { border-color: #d4a017; }
.custom-select-list { position: absolute; left: 0; background: rgba(26, 21, 20, 0.95); border: 1px solid rgba(212, 160, 23, 0.4); border-radius: 6px; max-height: 450px; overflow-y: auto; display: none; min-width: 100%; width: max-content; z-index: 10000; box-shadow: 0 -5px 20px rgba(0,0,0,0.7); }
body.lz-mode .custom-select-list { bottom: 100%; margin-bottom: 5px; } 
body.sj-mode .custom-select-list { top: 100%; margin-top: 5px; } 
.custom-select-list.open { display: block; }
.batch-controls { display: flex; flex-direction: column; background: rgba(30, 25, 20, 1); border-bottom: 1px solid #d4a017; position: sticky; top: 0; z-index: 10; }
.batch-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-bottom: 1px dashed rgba(212, 160, 23, 0.15); } .batch-row:last-child { border-bottom: none; } 
.batch-label { color: #bbb; font-size: 13px; }
.batch-btns span { cursor: pointer; font-size: 12px; color: #d4a017; font-weight: bold; padding: 4px 8px; border-radius: 4px; margin-left: 5px; background: rgba(212, 160, 23, 0.1); transition: all 0.2s; } 
.batch-btns span:hover { background: #d4a017; color: #000; }
.custom-select-item { padding: 10px 14px; cursor: pointer; color: #E6D2B4; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(212, 160, 23, 0.15); font-size: 14px; transition: background 0.2s ease; } 
.custom-select-item:hover { background: rgba(212, 160, 23, 0.2); color: #FFF; }
.custom-select-item input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; accent-color: #d4a017; flex-shrink: 0; } 
.custom-select-item span.art-name { flex-grow: 1; white-space: nowrap; }

.custom-select-list::-webkit-scrollbar, #details-panel::-webkit-scrollbar { width: 6px; } 
.custom-select-list::-webkit-scrollbar-thumb, #details-panel::-webkit-scrollbar-thumb { background: #d4a017; border-radius: 3px; }

/* ---------------------------------------------------------------------
   作品志面板 (释文)
--------------------------------------------------------------------- */
#details-panel { position: absolute; background: rgba(26, 21, 20, 0.95); transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); z-index: 205; overflow-y: auto; line-height: 2.2; font-size: 18px; text-align: justify; }
body.lz-mode #details-panel { right: -450px; top: 0; width: 400px; height: 100%; border-left: 1px solid rgba(212, 160, 23, 0.3); box-shadow: -10px 0 40px rgba(0,0,0,0.8); padding: 40px 30px 100px 30px; }
body.lz-mode.show-details #details-panel { right: 0; }
body.sj-mode #details-panel { bottom: -100%; left: 5%; width: 90%; height: 40%; border: 1px solid rgba(212, 160, 23, 0.3); border-bottom: none; border-radius: 20px 20px 0 0; padding: 30px; }
body.sj-mode.show-details #details-panel { bottom: 0; }

/* =====================================================================
   手卷馆最终收口补丁
===================================================================== */
body.sj-mode #top-viewer canvas,
body.sj-mode #bottom-viewer canvas {
    transform: none !important;
    transform-origin: center center;
}

body.sj-mode .btn,
body.sj-mode select,
body.sj-mode .custom-select-header,
body.sj-mode #zoom-debug,
body.sj-mode #zoom-debug.state-drift,
body.sj-mode #zoom-debug.state-aligned {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

body.sj-mode #top-wrapper,
body.sj-mode #bottom-wrapper,
body.sj-mode .osd-viewer {
    contain: layout paint;
}

body.sj-mode #control-bar,
body.sj-mode .custom-select-list,
body.sj-mode #details-panel,
body.sj-mode #red-box {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

body.sj-mode #red-box {
    transform: translateZ(0);
}

/* 🔥 修复3：撤销纯黑背景，改为半透明，使得导览图不再被粗暴截断 */
body.sj-mode #control-bar {
    background: rgba(15, 10, 5, 0.5) !important;
}

body.sj-mode .btn,
body.sj-mode select,
body.sj-mode .custom-select-header,
body.sj-mode #zoom-debug.state-drift {
    background: #1a1514 !important;
}

body.sj-mode .btn,
body.sj-mode select,
body.sj-mode .custom-select-header,
body.sj-mode #control-bar,
body.sj-mode #details-panel,
body.sj-mode #zoom-debug {
    transition: none !important;
}

body.sj-mode #top-wrapper {
    border-bottom: none !important;
}

body.sj-mode .custom-select-list,
body.sj-mode #details-panel {
    box-shadow: none !important;
}

body.sj-mode .btn,
body.sj-mode select,
body.sj-mode .custom-select-header {
    color: #FFF5E6 !important;
}

body.sj-mode .btn:hover,
body.sj-mode .btn:active,
body.sj-mode select:hover,
body.sj-mode select:active,
body.sj-mode .custom-select-header:hover,
body.sj-mode .custom-select-header:active {
    background: #d4a017 !important;
    color: #000 !important;
    border-color: #d4a017 !important;
}

body.lz-mode .brightness-readout {
    min-width: 100px;
    text-align: center;
    cursor: default;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

/* =====================================================================
   私人美术馆 3.0 - 极简主控栏与设置菜单样式 (针对 43 寸竖屏自适应换行)
===================================================================== */
.minimal-ui-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 15px 20px !important;
    gap: 15px 30px !important;
}

.ui-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

/* ⚙️ 设置面板样式 */
.settings-dropdown-container {
    position: relative;
    margin-left: 10px;
}

.settings-btn {
    border-color: rgba(255,255,255,0.2) !important;
    color: #bbb !important;
    background: transparent !important;
}
.settings-btn:hover { border-color: #d4a017 !important; color: #fff !important; }

.settings-dropdown-panel {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 10px;
    background: rgba(15, 10, 5, 0.95);
    border: 1px solid rgba(212, 160, 23, 0.4);
    border-radius: 8px;
    padding: 15px;
    width: 320px;
    display: none;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.9);
    z-index: 10001;
}

.settings-dropdown-panel.open {
    display: flex;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.settings-label {
    color: #aaa;
    font-size: 14px;
}

.settings-row select {
    margin: 0;
    padding: 6px 10px;
}

.brightness-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mini-btn {
    padding: 4px 8px !important;
    margin: 0 !important;
    font-size: 12px !important;
}