:root{
    --bg:#111;
    color-scheme:dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* 禁用图片默认拖动行为 */
img{
    user-select:none;
    -webkit-user-drag:none;
}

body {
    height: 100vh;
    background-color: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    user-select: none;       /* 标准 */

    -webkit-user-select: none; /* Safari / Chrome */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE 10+ */
    touch-action: none;

    /* (可选) 禁止该元素内的图片被拖拽 - 仅限 Webkit */
    -webkit-user-drag: none;
}

#zoomBox {
    position: fixed;
    z-index: 10000;
    height: 100vh;
    width: 100vw;
    background-color: var(--bg);
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.displayNone {
    display: none !important;
}

#zoomBar {
    position: fixed;
    bottom: 60px;
    z-index: 100020;
}

/* --- 导航栏 --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    color: #fff;
    z-index: 1;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    flex-shrink: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.06));
    backdrop-filter: blur(6px);
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    flex: 1;
}

.nav-right {
    justify-content: flex-end;
    gap: 4px; /* 按钮间距 */
    position: relative; /* 关键：作为下拉菜单的定位基准 */
}

.book-title {
    flex: 2;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 图标按钮通用样式 */
.icon-btn {
    background: none;
    border: none;
    color: #ddd;
    font-size: 20px; /* 图标稍微调小一点，更精致 */
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: rgba(255,255,255,0.1);
}

/* --- 下拉菜单样式 (新增) --- */
.dropdown-menu {
    position: absolute;
    top: 48px; /* 在按钮下方 */
    right: 5px; /* 右对齐 */
    background-color: #333;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    width: 160px;
    display: flex;
    flex-direction: column;
    padding: 8px 0;

    /* 动画初始状态 */
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    pointer-events: none; /* 隐藏时不可点击 */
    transition: opacity 0.2s ease, transform 0.2s ease;

    /* 确保在最上层 */
    z-index: 200;
}

/* 显示状态 */
.dropdown-menu.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* 菜单项样式 */
.menu-item {
    background: none;
    border: none;
    color: #fff;
    padding: 12px 20px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 12px; /* 图标和文字的间距 */
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background-color: rgba(255,255,255,0.05);
}

/* 菜单里的图标 */
.menu-icon {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

/* 收藏激活状态 */
.menu-item.active .menu-icon {
    color: #ff4757;
}

/* --- 主内容区域 --- */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.slider-container {
    height: 100vh;
    aspect-ratio: 1 / 1.414;
    width: auto;
    max-width: 100%;
    max-height: 1200px;
    overflow: hidden;
    background-color: #000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    user-select: none;
    touch-action: none;
    position: relative;
}

.slider-track {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    cursor: grab;
    transform: translateY(0px);
}

.slider-track:active {
    cursor: grabbing;
}

.slider-track.transitioning {
    transition: transform 0.3s ease-out;
}

.slider-track.bouncing {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.slide {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#pageBox {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.page {
}

.pageZoom {
}

#toolBar {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 14px;
    letter-spacing: 1px;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.06));
    backdrop-filter: blur(6px);
}

.btn-tool {
    background-color: transparent; /* 透明背景 */
    color: #333;                  /* 文字颜色 */
    border: none;       /* 边框 */
    padding: 2px;           /* 内边距 */
    border-radius: 6px;           /* 圆角 */
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;    /* 动画 */
    outline: none;
}

/* 悬停效果 */
.btn-tool:hover {
    background-color: rgba(0,0,0,0.1); /* 半透明背景 */
    border-color: #555;
    color: #000;
}

/* 按下效果 */
.btn-tool:active {
    background-color: rgba(0,0,0,0.2);
}

.zoom-btn-close {
    /* 1. 定位：右上角固定 */
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;

    /* 2. 布局：利用Flex让X号处于合适的位置 */
    display: flex;
    justify-content: flex-end; /* 靠右 */
    align-items: flex-start;   /* 靠上 */

    /* 3. 形状：利用边框半径切出左下角扇形 */
    width: auto;
    height: auto;
    min-width: 50px;  /* 最小尺寸保证点击热区 */
    min-height: 50px;
    background-color: rgb(141, 169, 213); /* 默认半透明黑 */
    border-radius: 0 0 0 100%; /* 关键：左下角圆弧 */

    /* 4. 适配：刘海屏/安全区域 (Safe Area) */
    /* 只有在有刘海的手机上，padding才会自动变大，否则保持默认12px */
    padding-top: max(12px, env(safe-area-inset-top) + 6px);
    padding-right: max(12px, env(safe-area-inset-right) + 6px);
    padding-left: 15px; /* 维持扇形比例 */
    padding-bottom: 15px;

    /* 5. 交互与体验优化 */
    color: white;
    border: none;
    outline: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* 去除移动端点击时的灰色背景块 */
    touch-action: manipulation; /* 优化点击延迟 */
    user-select: none; /* 禁止选中文本 */

    transition: background-color 0.2s ease;
}

/* 内部图标样式 */
.zoom-btn-close span {
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
    /* 微调位置，确保视觉居中 */
    transform: translate(2px, -2px);
    pointer-events: none; /* 点击穿透，确保点在按钮上 */
}

/* 6. 触摸反馈状态 (替代Hover) */
.zoom-btn-close:active {
    background-color: rgba(200, 0, 0, 0.9); /* 按下变红 */
    transition: none; /* 按下时立即响应，不要过渡动画 */
}