/* ============ 网址导航 - 全局 ============ */
:root {
    --card-bg: rgba(255, 255, 255, 0.92);
    --card-bg-dark: rgba(17, 24, 39, 0.55);
    --card-border: rgba(255, 255, 255, 0.25);
    --text-main: #0f172a;
    --text-sub: #475569;
    --primary: #6366f1;
    --radius: 14px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-main);
    min-height: 100vh;
    position: relative;
}

.page-bg {
    position: fixed; inset: 0; z-index: -2;
    transition: background 0.6s ease;
}
.page-mask {
    position: fixed; inset: 0; z-index: -1;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

/* ============ 顶栏 ============ */
/* 右上角后台管理入口 */
.admin-entry {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 30;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: 999px;
    background: rgba(15,23,42,0.45);
    border: 1px solid rgba(255,255,255,0.45);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    backdrop-filter: blur(6px);
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    cursor: pointer;
}
.admin-entry:hover { background: rgba(99,102,241,0.85); transform: scale(1.05); }

.topbar { position: absolute; top: 0; left: 0; right: 0; padding: 16px 24px; z-index: 10; }
.topbar-right { display: flex; justify-content: flex-end; gap: 8px; }

.btn-mini {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    border: 1px solid rgba(255,255,255,0.35);
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}
.btn-mini:hover { background: rgba(255,255,255,0.32); }

/* ============ 主体 ============ */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px 90px;
}

.hero { text-align: center; margin-bottom: 26px; }
.site-title {
    font-size: 42px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 3px 18px rgba(0,0,0,0.45);
    letter-spacing: 2px;
}
.site-subtitle {
    margin-top: 8px;
    color: rgba(255,255,255,0.9);
    font-size: 15px;
    text-shadow: 0 1px 8px rgba(0,0,0,0.4);
}

.clock-row { margin-top: 18px; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,0.5); }
.clock { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 3px; }
.date { margin-top: 2px; font-size: 14px; opacity: 0.9; }

/* 搜索框 */
.search-box {
    margin: 22px auto 0;
    max-width: 640px;
    display: flex;
    background: rgba(255,255,255,0.95);
    border-radius: 999px;
    padding: 6px 6px 6px 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.engine-select {
    border: none; background: transparent;
    color: var(--text-sub);
    font-size: 14px;
    padding: 0 6px;
    outline: none;
    cursor: pointer;
    max-width: 92px;
}
.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    padding: 8px 10px;
    color: var(--text-main);
    min-width: 0;
}
.search-btn {
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 10px 26px;
    border-radius: 999px;
    font-size: 14px;
    cursor: pointer;
    transition: filter 0.2s;
    white-space: nowrap;
}
.search-btn:hover { filter: brightness(1.1); }

/* ============ 常用工具 ============ */
.calc-toggle-row { margin: 26px auto 0; text-align: center; }
.calc-toggle {
    padding: 8px 22px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.14);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: all 0.2s;
}
.calc-toggle:hover { background: rgba(255,255,255,0.3); }
.tools-panel {
    max-width: 420px;
    margin: 26px auto 8px;
    background: var(--card-bg-dark);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.tools-tabs { display: flex; padding: 8px 8px 0; gap: 6px; }
.tool-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.85);
    padding: 10px 0;
    font-size: 14px;
    cursor: pointer;
    border-radius: 10px 10px 0 0;
    transition: all 0.2s;
}
.tool-tab.active { background: rgba(255,255,255,0.16); color: #fff; }
.tool-tab.tool-close { flex: 0 0 auto; padding: 10px 14px; font-size: 12px; }
.tool-body { padding: 12px; }

/* 计算器 */
.calc { background: rgba(15,23,42,0.45); border-radius: 10px; padding: 12px; }
.calc-display {
    background: rgba(0,0,0,0.35);
    color: #fff;
    font-size: 30px;
    text-align: right;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 10px;
    min-height: 54px;
    word-break: break-all;
    font-variant-numeric: tabular-nums;
}
.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.calc-grid button {
    border: none;
    background: rgba(255,255,255,0.14);
    color: #fff;
    font-size: 17px;
    padding: 12px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
    user-select: none;
}
.calc-grid button:hover { background: rgba(255,255,255,0.28); }
.calc-grid button:active { transform: scale(0.94); }
.calc-grid button.o { background: rgba(99,102,241,0.75); }
.calc-grid button.c { background: rgba(239,68,68,0.75); }
.calc-grid button.eq { background: #22c55e; grid-column: span 2; }

/* ============ 分区 Tab ============ */
.cat-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 30px auto 24px;
}
.cat-tab {
    padding: 8px 22px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.14);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: all 0.2s;
}
.cat-tab:hover { background: rgba(255,255,255,0.3); }
.cat-tab.active {
    background: #fff;
    color: var(--text-main);
    border-color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

/* ============ 网址卡片 ============ */
.section-head {
    display: flex; align-items: center; gap: 12px;
    margin: 30px 0 16px;
}
.section-head h2 {
    color: #fff;
    font-size: 20px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.45);
}
.section-head .line { flex: 1; height: 1px; background: rgba(255,255,255,0.3); }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}
.link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 12px 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-main);
    box-shadow: 0 4px 14px rgba(0,0,0,0.14);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.link-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(0,0,0,0.24);
}
.link-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    background: rgba(99,102,241,0.1);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    overflow: hidden;
    flex-shrink: 0;
}
.link-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.link-title {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.empty-tip {
    grid-column: 1 / -1;
    text-align: center;
    color: rgba(255,255,255,0.85);
    padding: 40px 0;
    font-size: 14px;
}

/* ============ 页脚 ============ */
.footer {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    background: linear-gradient(transparent, rgba(0,0,0,0.35));
    z-index: 10;
}
/* ============ 弹窗 ============ */
/* 确保 hidden 属性始终生效（避免被 display:flex 覆盖导致弹窗无法关闭） */
[hidden] { display: none !important; }
.modal-mask {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(3px);
}
.modal {
    width: 92%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: pop 0.2s ease;
}
@keyframes pop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.modal label { display: block; font-size: 13px; color: var(--text-sub); margin: 10px 0 4px; }
.modal input, .modal select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.modal input:focus, .modal select:focus { border-color: var(--primary); }
.modal-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn-plain {
    padding: 9px 20px; border: 1px solid #d1d5db;
    background: #fff; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.btn-primary {
    padding: 9px 20px; border: none;
    background: var(--primary); color: #fff; border-radius: 8px;
    cursor: pointer; font-size: 14px;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-danger {
    padding: 9px 20px; border: none;
    background: #ef4444; color: #fff; border-radius: 8px;
    cursor: pointer; font-size: 14px;
}

.toast {
    position: fixed; top: 20px; left: 50%;
    transform: translateX(-50%);
    background: rgba(15,23,42,0.92);
    color: #fff;
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 14px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    animation: pop 0.25s ease;
}

/* ============ 响应式 ============ */
@media (max-width: 640px) {
    .site-title { font-size: 30px; }
    .clock { font-size: 30px; }
    .search-btn { padding: 10px 16px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
