/* ============================================================
   hellcatpool 全局优化样式 v3.0
   - 统一底部导航（所有页面一致尺寸）
   - 节日主题切换过渡动画
   - 流畅度优化：过渡动画、平滑滚动、GPU加速
   - 响应式适配：PC/手机/平板
   - 性能优化：图片懒加载、减少重绘、内容可见性
   ============================================================ */

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}
/* 全局隐藏所有滚动条（所有元素） */
* {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
*::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}
*::-webkit-scrollbar-track {
    display: none !important;
}
*::-webkit-scrollbar-thumb {
    display: none !important;
}

/* 全局过渡优化 */
* {
    -webkit-tap-highlight-color: transparent;
}

/* 图片优化 */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 按钮和可点击元素优化 */
a, button, .btn, [role="button"] {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 选中文本颜色 */
::selection {
    background: rgba(100, 255, 218, 0.3);
    color: #fff;
}

/* 加载动画 */
@keyframes hc-fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes hc-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.hc-fade-in {
    animation: hc-fade-in 0.6s ease-out forwards;
}

.hc-pulse {
    animation: hc-pulse 2s ease-in-out infinite;
}

/* 卡片悬浮效果（通用） */
.hc-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.hc-card:hover {
    transform: translateY(-4px);
}

/* ============================================================
   统一底部导航（所有页面共用，确保大小一致）
   ============================================================ */
.bottom-nav {
    width: 100%;
    background-color: #1f1f1f;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 100;
}
.bottom-nav-items {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    max-width: 800px;
    margin: 0 auto;
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #e0e0e0;
    text-decoration: none;
    padding: 6px 2px;
    min-height: 44px;
    transition: color 0.25s ease, transform 0.15s ease;
    touch-action: manipulation;
}
.bottom-nav-item.active {
    color: #2575fc;
    font-weight: bold;
}
@media (hover: hover) {
    .bottom-nav-item:hover { color: #2575fc; }
}
.bottom-nav-item:active {
    opacity: 0.7;
    transform: scale(0.95);
}
.bottom-nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
    line-height: 1;
}
.bottom-nav-text {
    font-size: 12px;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
}

/* ============================================================
   节日主题切换过渡动画
   ============================================================ */
body {
    transition: background-color 0.6s ease, color 0.6s ease;
}
.container, .stats-section, .query-card, .uploaded-image-item,
.calculator-container, .game-map-container, .usage-container,
.content-wrapper, .hero {
    transition: background-color 0.6s ease, border-color 0.6s ease;
}
h1, h2, h3, .stats-value, .stats-item, a, .bottom-nav-item {
    transition: color 0.6s ease;
}
.stats-item {
    transition: border-left-color 0.6s ease, background 0.6s ease;
}

/* 节日主题小标签（页面右上角） */
.festival-badge {
    position: fixed;
    top: 12px;
    left: 16px;
    z-index: 99;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(37, 117, 252, 0.15);
    color: #2575fc;
    border: 1px solid rgba(37, 117, 252, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    animation: festivalBadgeIn 0.8s ease 0.5s forwards, badgeFadeOut 0.8s ease 4.5s forwards;
    pointer-events: none;
}
@keyframes festivalBadgeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes badgeFadeOut {
    to {
        opacity: 0;
        transform: translateY(-8px);
        pointer-events: none;
    }
}
@media (max-width: 600px) {
    .festival-badge { font-size: 10px; padding: 3px 8px; top: 8px; left: 10px; }
}

/* ============================================================
   页面加载与切换流畅度优化
   ============================================================ */
/* GPU加速层 */
.bottom-nav, .festival-badge, .modal, .uploaded-image-item {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

/* 页面进入动画 */
.hc-page-enter {
    animation: hcPageEnter 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes hcPageEnter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 图片加载完成淡入 */
img.hc-img-loaded {
    animation: hcImgFadeIn 0.4s ease forwards;
}
@keyframes hcImgFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 减少首屏阻塞：非关键内容延迟渲染 */
.hc-defer-render {
    content-visibility: auto;
    contain-intrinsic-size: 1px 400px;
}

/* 按钮点击反馈优化 */
button, .btn, a.bottom-nav-item {
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}

/* 滚动性能优化 */
.hc-scroll-container {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ============================================================
   响应式适配
   ============================================================ */

/* 大屏优化（>1200px） */
@media (min-width: 1200px) {
    .hc-container {
        max-width: 1200px;
        margin: 0 auto;
    }
}

/* 平板（768px - 1024px） */
@media (max-width: 1024px) {
    .hc-hide-tablet {
        display: none !important;
    }
}

/* 手机（<768px） */
@media (max-width: 768px) {
    /* 全局字体优化 */
    html {
        font-size: 14px;
    }

    .hc-hide-mobile {
        display: none !important;
    }

    .hc-full-width-mobile {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* 按钮在手机上更宽 */
    .hc-btn-mobile {
        width: 100%;
        justify-content: center;
    }

    /* 表格横向滚动 */
    .hc-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 图片在手机上更清晰 */
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* 小屏手机（<480px） */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }

    .hc-hide-small {
        display: none !important;
    }
}

/* ============================================================
   无障碍优化
   ============================================================ */

/* 键盘焦点样式 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #64ffda;
    outline-offset: 2px;
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   性能优化
   ============================================================ */

/* 内容可见性优化 */
.hc-content-auto {
    content-visibility: auto;
    contain-intrinsic-size: 1px 500px;
}

/* 图片懒加载占位 */
img[loading="lazy"] {
    background: linear-gradient(90deg, #1a1a2e 25%, #16213e 50%, #1a1a2e 75%);
    background-size: 200% 100%;
    animation: hc-shimmer 1.5s infinite;
}

@keyframes hc-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
