/* 工具页共用：底部导航 + 全站 Loading（抽取自 styles.css，兼容 box.css 页面） */
:root {
    --bg: #ffffff;
    --fg: #000000;
    --muted: #666666;
    --border: #000000;
    --light-border: #cccccc;
    --hover-bg: #f5f5f5;
}

/* 底部导航样式 - 单行可左右滑动 */
.bottom-nav {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0;
    padding: 0;
    border-top: 1.5px solid var(--border);
    background: var(--bg);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.bottom-nav::-webkit-scrollbar {
    display: none;
}

/* 其他页面的导航样式 - 仅文字 */
.nav-text {
    display: block;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--muted);
    font-size: 12px;
    transition: all 0.2s;
    border-bottom: 1.5px solid transparent;
    margin-bottom: -1.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-text:hover {
    color: var(--fg);
}

.nav-text.active {
    color: var(--fg);
    font-weight: bold;
    border-bottom-color: var(--fg);
}

/* 组间分隔：新组首项加左侧细分隔线 */
.nav-text.nav-group-start {
    margin-left: 8px;
    padding-left: 16px;
    border-left: 1.5px solid var(--muted);
}

/* 工具页底部留白，避免被固定导航遮挡 */
body {
    padding-bottom: 60px;
}

/* 全站 Loading 动画 */
.sp-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 99998;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
}
.sp-loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.sp-loading-logo {
    width: 64px;
    height: 64px;
    border: 2px solid var(--fg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--fg);
    animation: spLogoPulse 1.2s ease-in-out infinite;
}
.sp-loading-text {
    margin-top: 14px;
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 3px;
    animation: spTextFade 1.2s ease-in-out infinite;
}
@keyframes spLogoPulse {
    0%, 100% {
        transform: scale(1);
        border-color: var(--fg);
    }
    50% {
        transform: scale(1.08);
        border-color: var(--muted);
    }
}
@keyframes spTextFade {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}
@media (max-width: 480px) {
    .sp-loading-logo {
        width: 56px;
        height: 56px;
        font-size: 1.2rem;
    }
    .sp-loading-text {
        font-size: 0.72rem;
    }
}

/* ===== 底部大类导航（两字 + 汉堡详细） ===== */
.bottom-nav > a.nav-cat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 7px 0 8px;
    text-decoration: none;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    border-bottom: 1.5px solid transparent;
    margin-bottom: -1.5px;
}
.bottom-nav > a.nav-cat.active {
    color: var(--fg);
    font-weight: bold;
    border-bottom-color: var(--fg);
}
.bottom-nav .nav-cat-icon { font-size: 16px; line-height: 1; }

/* 汉堡详细面板 */
.nav-panel {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
}
.nav-panel.open { display: block; }
.nav-panel-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.nav-panel-box {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    border-top: 1.5px solid var(--border);
    border-radius: 14px 14px 0 0;
    max-height: 72vh;
    overflow-y: auto;
    padding: 14px 12px 24px;
    animation: navSlideUp 0.25s ease;
    -webkit-overflow-scrolling: touch;
}
.nav-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 4px;
}
.nav-panel-title { font-size: 15px; font-weight: bold; color: var(--fg); }
.nav-panel-close {
    background: none;
    border: 1.5px solid var(--light-border);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
}
.nav-panel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.nav-panel-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 12px 4px;
    border: 1.5px solid var(--light-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--fg);
    font-size: 11px;
    text-align: center;
}
.nav-panel-item .npi-icon { font-size: 18px; line-height: 1; }
.nav-panel-item:hover { background: var(--hover-bg); }
.nav-panel-lock { overflow: hidden; }
@keyframes navSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
@media (max-width: 480px) {
    .bottom-nav > a.nav-cat { font-size: 10px; padding: 8px 0 9px; }
    .bottom-nav .nav-cat-icon { font-size: 15px; }
    .nav-panel-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
}
