/* ---------- 基础重置 ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    background: #000;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
}

body {
    /* 适配 iPhone 顶部灵动岛 / 刘海 / 底部 Home Indicator */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ---------- 查看器容器 ---------- */
.viewer {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ---------- 图片 ---------- */
.slide {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
    transform-origin: center center;
    transition: opacity 0.35s ease;
    will-change: transform, opacity;
}

.slide.is-active {
    opacity: 1;
}

.slide.is-loading {
    opacity: 0;
}

/* ---------- 顶部提示与计数 ---------- */
.hint {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.hint.is-hidden {
    opacity: 0;
}

.counter {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    letter-spacing: 0.04em;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ---------- 进入沉浸式（点击图片切换） ---------- */
body.is-immersive .hint {
    opacity: 0;
}

/* ---------- 错误 / 占位 ---------- */
.error {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    text-align: center;
    padding: 24px;
    line-height: 1.6;
}

.error strong {
    color: rgba(255, 255, 255, 0.85);
}

/* ---------- 防止 iOS Safari 长按弹出菜单 ---------- */
img {
    -webkit-touch-callout: none;
}
