/* ===== 银狼导航站 · 暗色赛博霓虹风 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    min-height: 100%;
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: #e2e0f0;
    background: linear-gradient(180deg, #0a0a1f 0%, #05041a 100%);
    position: relative;
    overflow-x: hidden;
    padding: 40px 20px 60px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 三团光晕 */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
}
body::before {
    top: -120px; left: -100px;
    width: 480px; height: 480px;
    background: rgba(167, 139, 250, 0.30); /* 紫 */
}
body::after {
    bottom: -150px; right: -100px;
    width: 520px; height: 520px;
    background: rgba(34, 211, 238, 0.22); /* 青 */
}
.glow-pink {
    position: fixed;
    top: 40%; right: -150px;
    width: 420px; height: 420px;
    border-radius: 50%;
    background: rgba(244, 114, 182, 0.20); /* 粉 */
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
}

/* 像素网格线 */
#bg-particles {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(167, 139, 250, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(167, 139, 250, 0.05) 1px, transparent 1px);
    background-size: 34px 34px;
}

/* 让内容层叠在上方 */
header, main, footer { position: relative; z-index: 2; }

/* 标题 */
header { text-align: center; margin-bottom: 30px; }

h1 {
    font-size: clamp(1.6rem, 5vw, 2.6rem);
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #a78bfa, #22d3ee, #f472b6, #a78bfa);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: shine 4s linear infinite;
}
@keyframes shine {
    0% { background-position: 0% 0; }
    100% { background-position: 300% 0; }
}

.px-char {
    -webkit-text-fill-color: initial;
    color: #f472b6;
    font-size: 0.7em;
    animation: blink 1.4s steps(2, start) infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; text-shadow: 0 0 8px #f472b6; }
    50% { opacity: 0.2; text-shadow: none; }
}

/* 主区域：响应式多列 */
#main {
    width: 100%;
    max-width: 1100px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
}

/* 分类 */
.category { min-width: 0; }

.cat-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #cdc6ff;
    padding-left: 14px;
    border-left: 4px solid;
    border-image: linear-gradient(180deg, #a78bfa, #22d3ee, #f472b6) 1;
    margin-bottom: 16px;
    letter-spacing: 1px;
    text-shadow: 0 0 12px rgba(167, 139, 250, 0.5);
}

/* 网址卡片 */
.link-card {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #e8e6fa;
    background: rgba(22, 19, 48, 0.85);
    border: 1px solid rgba(167, 139, 250, 0.18);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .link-card { background: rgba(22, 19, 48, 0.96); }
}

/* hover 上浮 + 渐变高光条 + 图标发光 */
.link-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    /* 高度与卡片圆角一致，保证弧线完整不被压缩成直角 */
    height: 14px;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(90deg, #a78bfa, #22d3ee, #f472b6);
    /* 只显示顶部 3px，弹层打开(overflow:visible)时两端也不会冒过卡片圆角 */
    -webkit-mask-image: linear-gradient(180deg, #000 0, #000 3px, transparent 3px);
    mask-image: linear-gradient(180deg, #000 0, #000 3px, transparent 3px);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.link-card:hover {
    transform: translateY(-4px);
    border-color: rgba(34, 211, 238, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 18px rgba(167, 139, 250, 0.25);
}
.link-card:hover::before { opacity: 1; }

.link-icon {
    font-size: 1.3rem;
    transition: text-shadow 0.25s ease, transform 0.25s ease;
}
.link-card:hover .link-icon {
    text-shadow: 0 0 14px #22d3ee;
    transform: scale(1.15);
}
.link-name { font-weight: 600; font-size: 1rem; }

footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.9rem;
    color: #8a86a8;
}
footer b {
    color: #f472b6;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(244, 114, 182, 0.6);
}

/* 时钟 */
#clock {
    margin-top: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: #cdc6ff;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 14px rgba(34, 211, 238, 0.55);
}

/* 搜索框 */
#search-bar {
    position: relative;
    z-index: 20;
    width: 100%;
    max-width: 560px;
    margin: 22px auto 30px;
}
#search-input {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    font-family: inherit;
    color: #e8e6fa;
    background: rgba(22, 19, 48, 0.85);
    border: 1px solid rgba(167, 139, 250, 0.25);
    border-radius: 999px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
#search-input::placeholder { color: #6f6b90; }
#search-input:focus {
    border-color: rgba(34, 211, 238, 0.6);
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.25);
}
#search-input:focus-visible { outline: 2px solid rgba(34, 211, 238, 0.5); outline-offset: 2px; }

/* 键盘导航的可见焦点 */
.link-card:focus-visible {
    outline: 2px solid #22d3ee;
    outline-offset: 2px;
    border-color: rgba(34, 211, 238, 0.6);
}
/* 搜索历史下拉面板 */
#search-history {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: rgba(22, 19, 48, 0.97);
    border: 1px solid rgba(167, 139, 250, 0.25);
    border-radius: 14px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
    z-index: 30;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
    opacity: 1;
    visibility: visible;
    transform: translateY(0) translateZ(0);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    will-change: opacity, transform;
}
#search-history.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) translateZ(0);
    pointer-events: none;
}
.hist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    cursor: pointer;
    font-size: 0.92rem;
    color: #e2e0f0;
    transition: background 0.2s ease;
}
.hist-item:hover { background: rgba(167, 139, 250, 0.14); }
.hist-item .hist-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-item .hist-del {
    flex-shrink: 0;
    color: #8a86a8;
    font-size: 1rem;
    line-height: 1;
    padding: 0 4px;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}
.hist-item .hist-del:hover { color: #f472b6; background: rgba(244, 114, 182, 0.15); }
.hist-foot {
    display: flex;
    justify-content: flex-end;
    padding: 8px 12px;
    border-top: 1px solid rgba(167, 139, 250, 0.15);
}
.hist-clear {
    cursor: pointer;
    font-size: 0.82rem;
    color: #8a86a8;
    transition: color 0.2s ease;
}
.hist-clear:hover { color: #f472b6; }
.hist-empty {
    padding: 14px 16px;
    font-size: 0.85rem;
    color: #6f6b90;
}
/* ===== 卡片详情弹层 ===== */
#detail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(5, 4, 26, 0.45);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s;
}
#detail-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    #detail-backdrop { background: rgba(5, 4, 26, 0.85); }
}

/* 弹层打开时：主区域提到遮罩之上，其余内容统一虚化 */
body.detail-open #main { z-index: 45; }
body.detail-open #bg-particles,
body.detail-open header,
body.detail-open #search-bar,
body.detail-open footer,
body.detail-open .cat-title,
body.detail-open .link-card:not(.card-open) {
    filter: blur(4px);
    pointer-events: none;
}
body.detail-open #bg-particles,
body.detail-open header,
body.detail-open #search-bar,
body.detail-open footer,
body.detail-open .cat-title { transition: filter 0.25s ease; }
body.detail-open .link-card:not(.card-open) {
    transition: filter 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

/* 当前卡片保持清晰、可交互 */
.link-card.card-open {
    z-index: 50;
    overflow: visible;
    border-color: rgba(34, 211, 238, 0.55);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 22px rgba(167, 139, 250, 0.35);
}
.link-card.card-open::before { opacity: 1; }

/* 详情面板：丝滑弹簧弹出 */
.detail-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 208px;
    max-width: calc(100vw - 16px);
    max-height: min(320px, 60vh);
    overflow-y: auto;
    padding: 6px;
    background: rgba(26, 23, 58, 0.97);
    border: 1px solid rgba(167, 139, 250, 0.32);
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55), 0 0 26px rgba(167, 139, 250, 0.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.94);
    transform-origin: top left;
    transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.3s;
}
.detail-panel.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
/* 下方空间不足时向上弹出 */
.detail-panel.up {
    top: auto;
    bottom: calc(100% + 10px);
    transform-origin: bottom left;
    transform: translateY(8px) scale(0.94);
}
.detail-panel.up.open { transform: translateY(0) scale(1); }
.detail-panel::-webkit-scrollbar { width: 6px; }
.detail-panel::-webkit-scrollbar-thumb { background: rgba(167, 139, 250, 0.35); border-radius: 3px; }

.detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 9px;
    text-decoration: none;
    color: #e2e0f0;
    font-size: 0.92rem;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.detail-item:hover {
    background: rgba(34, 211, 238, 0.12);
    color: #fff;
    transform: translateX(3px);
}
.detail-item:focus-visible {
    outline: 2px solid rgba(34, 211, 238, 0.6);
    outline-offset: -2px;
}
.detail-item .detail-name { flex: 1; white-space: nowrap; }
.detail-item .detail-arrow { color: #6f6b90; font-size: 0.8rem; transition: color 0.18s ease; }
.detail-item:hover .detail-arrow { color: #22d3ee; }

/* 卡片上的详情提示箭头 */
.link-hint {
    margin-left: auto;
    color: #6f6b90;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 2px;
    border-radius: 6px;
    transition: color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.link-hint:hover,
.link-hint:focus-visible { color: #22d3ee; background: rgba(34, 211, 238, 0.12); }
.link-hint:focus-visible { outline: 2px solid rgba(34, 211, 238, 0.5); }
.link-card:hover .link-hint { color: #22d3ee; }
.link-card.card-open .link-hint { color: #22d3ee; transform: rotate(180deg); }

/* 减少动效偏好：关闭过渡 */
@media (prefers-reduced-motion: reduce) {
    #detail-backdrop,
    .detail-panel,
    body.detail-open #bg-particles,
    body.detail-open header,
    body.detail-open #search-bar,
    body.detail-open footer,
    body.detail-open .cat-title,
    body.detail-open .link-card:not(.card-open) { transition: none; }
}

/* 中等屏（平板）：三列 */
@media (max-width: 900px) {
    #main { grid-template-columns: repeat(3, 1fr); gap: 18px; }
}

/* 移动端：两列 */
@media (max-width: 420px) {
    #main { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    h1 { font-size: 1.4rem; }
    .link-card { padding: 12px 10px; }
    .link-name { font-size: 0.9rem; }
}
