/* 屏幕阅读器专用样式 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 亮色模式变量 */
:root {
    --bg-gradient: linear-gradient(-45deg, #00C4FF, #9D1BB2, #00C4FF, #764ba2, #667eea);
    --search-bg: rgba(255, 255, 255, 0.9);
    --search-border: #e0e0e0;
    --search-focus-border: #4a90d9;
    --search-text: #333;
    --search-shadow: rgba(74, 144, 217, 0.3);
    --text-primary: #333;
    --text-secondary: #666;
    --footer-bg: rgba(0, 196, 255, 0.1);
    --footer-text: rgba(255, 255, 255, 0.9);
    --footer-link: rgba(255, 255, 255, 0.95);
    --footer-link-hover: #fff;
    --footer-separator: rgba(255, 255, 255, 0.3);
    --theme-toggle-bg: rgba(255, 255, 255, 0.2);
    --theme-toggle-border: rgba(255, 255, 255, 0.3);
    --theme-toggle-hover-bg: rgba(255, 255, 255, 0.3);
}

/* 暗色模式变量 */
:root.dark {
    --bg-gradient: linear-gradient(-45deg, #1a1a2e, #16213e, #0f3460, #1a1a2e, #16213e);
    --search-bg: rgba(30, 30, 46, 0.9);
    --search-border: #444466;
    --search-focus-border: #4facfe;
    --search-text: #e0e0e0;
    --search-shadow: rgba(79, 172, 254, 0.3);
    --text-primary: #e0e0e0;
    --text-secondary: #b8b8d0;
    --footer-bg: rgba(26, 26, 46, 0.6);
    --footer-text: rgba(224, 224, 224, 0.9);
    --footer-link: rgba(79, 172, 254, 0.95);
    --footer-link-hover: #00f2fe;
    --footer-separator: rgba(255, 255, 255, 0.15);
    --theme-toggle-bg: rgba(255, 255, 255, 0.1);
    --theme-toggle-border: rgba(255, 255, 255, 0.2);
    --theme-toggle-hover-bg: rgba(255, 255, 255, 0.15);
}

/* 搜索框样式 */
.search-container {
    text-align: center;
    margin: 20px auto;
    max-width: 500px;
    padding: 0 20px;
}

.search-box {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid var(--search-border);
    border-radius: 25px;
    outline: none;
    transition: all 0.3s ease;
    background: var(--search-bg);
    color: var(--search-text);
}

.search-box:focus {
    border-color: var(--search-focus-border);
    box-shadow: 0 0 10px var(--search-shadow);
}

.search-count {
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999 !important; /* 高于页脚的 z-index: 9999 */
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
}

.boot-screen {
    font-family: 'Courier New', monospace;
    color: #00ff88;
    text-align: left;
    max-width: 600px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.2);
}

.boot-line {
    margin: 5px 0;
    font-size: 14px;
    opacity: 0;
    transform: translateX(-10px);
    animation: bootLineIn 0.3s ease forwards;
}

.boot-line .prompt {
    color: #00ffff;
}

.boot-line .command {
    color: #ffffff;
}

.boot-line .result {
    color: #ffcc00;
}

.boot-line .success {
    color: #00ff88;
}

@keyframes bootLineIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cursor-blink {
    display: inline-block;
    width: 10px;
    height: 18px;
    background: #00ff88;
    animation: blink 0.8s infinite;
    vertical-align: middle;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 动态渐变背景 */
body {
    background: var(--bg-gradient);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    position: relative;
    overflow-x: hidden;
    transition: background 0.3s ease;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 背景装饰层 */
.bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* 浮动光点效果 */
.floating-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation: floatOrb 20s ease-in-out infinite;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: #00ffff;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 250px;
    height: 250px;
    background: #ff00ff;
    top: 60%;
    right: 10%;
    animation-delay: -5s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: #00ff88;
    bottom: 20%;
    left: 30%;
    animation-delay: -10s;
}

.orb-4 {
    width: 180px;
    height: 180px;
    background: #ffff00;
    top: 30%;
    right: 30%;
    animation-delay: -15s;
}

@keyframes floatOrb {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -30px) scale(1.1);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    75% {
        transform: translate(10px, 10px) scale(1.05);
    }
}

/* 扫描线效果 */
.scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(0, 0, 0, 0.02) 50%
    );
    background-size: 100% 4px;
    animation: scanMove 10s linear infinite;
}

@keyframes scanMove {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 链接项隐藏/显示动画 */
.link-item {
    transition: all 0.3s ease;
}

.link-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* 卡片弹跳入场动画 */
.bounce-in {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    opacity: 0;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-50px);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 禁用链接样式 */
.disabled-link {
    opacity: 0.5;
    pointer-events: none;
}

.disabled-link img {
    filter: grayscale(100%);
}

@media (max-width: 768px) {
    .container {
        width: 95%;
        margin: 10px auto;
        padding: 15px;
    }

    .header h1 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }

    .header p {
        font-size: 0.9em;
        margin-top: 0;
    }

    .content {
        padding: 10px;
        margin: 0 auto;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
        margin: 5px 0;
    }

    .search-box {
        padding: 10px 16px;
        font-size: 14px;
    }

    .menu-btn {
        padding: 8px 12px;
        font-size: 16px;
    }
    
    .menu-dropdown {
        min-width: 140px;
        padding: 8px;
    }
    
    .menu-item {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* 修复容器高度导致页脚被遮挡的问题 */
html, body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
}

#wrap {
    height: auto !important;
    min-height: 100vh !important;
    position: relative !important;
}

/* 确保内容区域不会遮挡页脚 */
#main {
    padding-bottom: 60px !important; /* 为页脚预留空间 */
}

/* 加载动画样式 */
#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, #00C4FF, #9D1BB2, #764ba2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999 !important;
    transition: opacity 0.5s ease;
}

.loader {
    display: flex;
    gap: 8px;
}

.loader-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loader-circle:nth-child(1) { animation-delay: -0.32s; }
.loader-circle:nth-child(2) { animation-delay: -0.16s; }
.loader-circle:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loader-text {
    margin-top: 20px;
    color: white;
    font-size: 14px;
    opacity: 0.8;
}

/* 页面加载完成后隐藏加载动画 */
#loader-wrapper.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 页脚样式 - 固定在视口底部 */
#footer, body #footer, html body #footer {
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    padding: 8px 0 !important;
    min-height: auto !important;
    line-height: 1.3 !important;
    border: none !important;
    clear: both !important;
    width: 100% !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 9999 !important;
    text-align: center !important;
    color: #ffffff !important;
}

#footer a {
    color: var(--footer-link);
    transition: color 0.3s ease;
    font-size: 12px !important;
}

#footer a:hover {
    color: var(--footer-link-hover);
}

.footer-contents {
    color: var(--footer-text);
    font-size: 8px !important;
    padding: 0 10px;
}

.copyright {
    color: var(--footer-text);
    font-size: 11px !important;
}

.footer-link-separator {
    color: var(--footer-separator);
    width: 1px;
    height: 10px;
    margin: 0 4px !important;
    display: inline-block;
}

.footer-contents .links {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
}

.footer-contents .links .line {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    line-height: 1.3;
}

/* 菜单按钮 */
.menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    vertical-align: middle;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* 下拉菜单 */
.menu-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 160px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.menu-dropdown.show {
    display: flex;
}

/* 菜单项 */
.menu-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.3s ease;
}

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

/* 主题切换菜单项 */
.theme-item {
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
}

/* 菜单位置容器 - 保持原来内外网按钮的位置 */
#kg-btn {
    position: absolute;
    top: 50px;
    right: 4%;
}

/* Logo 区域暗色模式 */
#logo {
    transition: opacity 0.3s ease;
}

/* 链接卡片暗色模式 */
.app li {
    transition: all 0.3s ease;
}

:root.dark .app li a {
    color: var(--text-primary);
}

/* 覆盖 style.css 中的样式以支持暗色模式 */
:root.dark a {
    color: #e0e0e0;
}

:root.dark .text-js {
    color: #e0e0e0;
}

/* 内外网切换按钮暗色模式 */
:root.dark .tgl-btn {
    background: rgba(30, 30, 46, 0.9);
    border-color: #444466;
}

:root.dark .tgl-btn:before {
    background: #4facfe;
}

/* 加载动画暗色模式 */
:root.dark .loading-overlay {
    background: linear-gradient(135deg, #0a0a15 0%, #0d0d1a 50%, #0a0a15 100%);
}

:root.dark .boot-screen {
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 30px rgba(79, 172, 254, 0.2);
}

/* 浮动光点暗色模式 */
:root.dark .floating-orb {
    opacity: 0.3;
}

:root.dark .orb-1 {
    background: #4facfe;
}

:root.dark .orb-2 {
    background: #00f2fe;
}

:root.dark .orb-3 {
    background: #764ba2;
}

:root.dark .orb-4 {
    background: #667eea;
}

@media (max-width: 480px) {
    .container {
        width: 100%;
        margin: 5px auto;
        padding: 10px;
    }

    .header h1 {
        font-size: 1.2em;
        margin-bottom: 8px;
    }

    .header p {
        font-size: 0.8em;
        margin-top: 0;
    }

    .content {
        padding: 5px;
        margin: 0 auto;
    }

    .btn {
        padding: 6px 10px;
        font-size: 10px;
        margin: 5px 0;
    }

    .theme-toggle-fixed {
        top: 10px;
        right: 10px;
        padding: 6px 10px;
        font-size: 14px;
    }

    .footer-contents {
        font-size: 6px !important;
    }

    .footer-contents .links .line {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        justify-content: center;
    }

    .footer-link-separator {
        margin: 0 2px !important;
    }
}

/* 链接状态指示器 */
.status-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 10;
}

/* 分组样式 */
.link-group {
    margin-bottom: 20px;
}

.group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: bold;
    color: white;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.group-header .group-icon {
    font-size: 1.2em;
}

.group-header .group-name {
    flex: 1;
    font-size: 1em;
}

.group-header .group-count {
    font-size: 0.85em;
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
}

/* 暗色模式分组样式 */
:root.dark .group-header {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border-color: rgba(79, 172, 254, 0.3);
}

.status-indicator.online {
    background: #28a745;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.6);
}

.status-indicator.offline {
    background: #dc3545;
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.6);
}

.status-indicator.local {
    background: #17a2b8;
    box-shadow: 0 0 8px rgba(23, 162, 184, 0.6);
}

.status-indicator.disabled {
    background: #6c757d;
    box-shadow: none;
    opacity: 0.6;
}

.status-indicator.unknown {
    background: #ffc107;
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.6);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

.status-indicator.checking {
    animation: pulse 1.5s infinite;
    background: #ffc107;
}
