* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-image: url('background.png');
    /* 本地图片 */
    background-color: #4285F4;
    min-height: 100vh;
    font-family: "等线", "Microsoft YaHei", "PingFang SC", sans-serif;
    background-repeat: no-repeat;

    /* 图片位置：居中显示 */
    background-position: center center;

    /* 图片大小：覆盖整个屏幕（保持比例，可能裁剪边缘） */
    background-size: cover;
    padding: 20px;
}

.main-container {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /* 卡片1与网格的间距减小（原20px→10px） */
    width: 100%;

    margin: 0 auto;

}

/* 通用卡片样式 */
.card {

    background-color: white;
    padding: 15px;
    /* 卡片内边距减小（原20px→15px） */
    border-radius: 6px;
    /* 圆角略小，更紧凑 */
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    /* 阴影变浅，减少视觉间隔 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.card1 {
    /* 原有样式保留 */

    width: 300px;
    flex-shrink: 0;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* 新增：作为图片的定位参考 */
    position: relative;
}



/* 侧边栏左侧紧贴图片样式 */
.sidebar-left-img {
    /* 先解决大小问题：正确设置宽度和单位 */
    width: 80px;
    /* 图片宽度（可自定义，如30px、60px） */
    height: auto;
    /* 保持比例不变 */
    object-fit: cover;

    /* 核心：以.card1为参考定位 */
    position: absolute;
    /* 绝对定位，脱离文档流 */
    top: 80%;
    /* 垂直方向居中 */
    left: -30px;
    /* 向右超出卡片1的右侧边缘（值为图片宽度的一半，刚好贴紧） */
    transform: translateY(-50%);
    /* 配合top:50%实现垂直居中 */
    z-index: 10;
    /* 显示在卡片1上方，不被遮挡 */

    opacity: 1;
    /* 探头每 10 秒一次（见 peek.js）：出现是硬的，消失有一次淡出 */
}

@keyframes peekOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.sidebar-left-img.is-leaving {
    animation: peekOut 0.32s ease forwards;
}

.card1-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    /* 各元素之间的垂直间距 */
    text-align: center;
}

/* 圆形图片容器 */
.card1-img-container {
    width: 150px;
    /* 圆形大小，可调整 */
    height: 150px;
    border-radius: 50%;
    /* 核心：圆形 */
    border: 4px solid #ffffff;
    /* 蓝色边框，与背景呼应 */
    overflow: hidden;
    /* 裁剪图片，避免超出圆形 */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    /* 图片透明时的背景 */
}

/* 图片自适应圆形 */
.card1-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 图片填充圆形，不拉伸 */
}

/* ── 点头像：捏一下（逻辑见 avatar.js）───────────────────────────────── */
.card1-img-container {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* 键盘聚焦也要看得见 */
.card1-img-container:focus-visible {
    outline: 3px solid #4285F4;
    outline-offset: 4px;
}

/* 被捏扁 → 回弹拉伸 → 小抖两下 → 归位 */
@keyframes squish {
    0% {
        transform: scale(1, 1) rotate(0deg);
    }

    16% {
        transform: scale(1.17, 0.83) rotate(-2deg);
    }

    34% {
        transform: scale(0.9, 1.12) rotate(1.6deg);
    }

    52% {
        transform: scale(1.08, 0.94) rotate(-1deg);
    }

    70% {
        transform: scale(0.97, 1.04) rotate(0.5deg);
    }

    86% {
        transform: scale(1.02, 0.99) rotate(0deg);
    }

    100% {
        transform: scale(1, 1) rotate(0deg);
    }
}

.card1-img-container.is-squish {
    animation: squish 0.75s cubic-bezier(0.36, 0.66, 0.3, 1) both;
}

@media (prefers-reduced-motion: reduce) {
    .card1-img-container.is-squish {
        animation: none !important;
    }
}

/* 文字介绍样式 */
.card1-desc {
    margin-bottom: 10px;
    /* 文字下方增加50px空白，数值越大离底部越远 */
    font-size: 30px;
    font-weight: 900;
    /* 比 bold 更粗 */
    color: #000000;
    line-height: 1.1;
    padding: 0 20px;
    /* 左右留白，避免贴边 */
}

/* 按钮组：水平排列 */
.card1-buttons {
    white-space: nowrap;
    display: flex;
    flex-wrap: wrap;
    /* 加上 X / YouTube 后共有 5 个按钮，260px 宽一行放不下 —— 让它自动换行 */
    gap: 8px;
    /* 按钮之间的间距 */

    /* 窄屏时自动换行 */
    justify-content: center;
    width: 100%;
    padding: 0 10px;
}

/* 图标按钮样式 */
.card1-btn {
    font-weight: 600;
    white-space: nowrap;
    /* 核心：强制不换行，内容在一行显示 */
    width: auto;
    /* 宽度跟着内容走。原来是 width:60px + padding:10px 40px，
       border-box 下内容盒被压成 0，文字一直溢出按钮 —— 短标签看不出来，
       「YouTube」就会明显露到药丸外面。改成 auto 后每个按钮都刚好包住内容。 */
    min-width: 0;
    height: 30px;
    align-items: center;
    /* 垂直居中（图标和文字对齐） */
    justify-content: center;
    /* 水平居中（整个内容在按钮内居中） */
    display: flex;
    gap: 5px;
    /* 图标与文字间距 */
    padding: 0 12px;
    background-color: #ffffff;
    color: rgb(0, 0, 0);
    border-radius: 30px;
    /* 圆角按钮 */
    text-decoration: none;
    /* 去掉链接下划线 */
    font-size: 14px;
    transition: all 0.3s ease;
    /* 悬浮过渡效果 */
    border: none;
    cursor: pointer;
}

.card1-xuanchuan {
     font-weight: 900;
    /* 确保链接可点击区域足够大，类似卡片 */
    display: inline-block;
    padding: 20px 30px;
    background-color: #fff;
    /* 白色背景衬托金光 */
    border-radius: 8px;
    /* 圆角更像卡片 */
    text-decoration: none;
    /* 去掉下划线 */
    color: #333;
    /* 文字颜色 */
    text-align: center;
    /* 文字居中 */
    font-size: 24px;
    /* 第一行文字大小 */
    font-weight: bold;
    position: relative;
    /* 用于内部光效定位 */
    overflow: hidden;
    /* 裁剪溢出的光效 */

    /* 核心金光动画 */
    animation: goldGlow 2s infinite ease-in-out;
}

.card1-xuanchuan p {
    margin: 5px 0 0;
    /* 去掉默认边距，调整间距 */
    color: #666;
    /* 稍浅颜色区分 */
}

.card1-xuanchuan::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right,
            rgba(255, 215, 0, 0) 0%,
            rgba(255, 215, 0, 0.3) 20%,
            rgba(255, 215, 0, 0) 100%);
    transform: rotate(30deg);
    animation: goldFlow 6s infinite linear;
}

.card1-xuanchuan:hover {
    background-color: #c5c5c5;
    /* 加深蓝色 */
    transform: translateY(-2px);
    /* 轻微上移 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.card1-btn:hover {
    background-color: #d3d3d3;
    /* 加深蓝色 */
    transform: translateY(-2px);
    /* 轻微上移 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 卡片2保持正方形，尺寸更紧凑 */
.card2 {
    border-radius: 16px;
    /* 圆角略小，更紧凑 */
    aspect-ratio: 1/1;
    font-size: 14px;
    /* 文字缩小，适配小卡片 */
    position: relative;
    /* 允许内部图片绝对定位 */

    border: 2px solid #fff;
    /* 厚边框：4px宽度 + 实线 + 白色（可自定义） */
    max-width: 400px;
    content-visibility: auto;
    contain-intrinsic-size: 220px 275px;
    background-color: rgba(255, 255, 255, 0.6);
    /* 白色背景+80%不透明 */
    /* 阴影也同步降低透明度，保持风格统一 */
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    /* 阴影透明度从0.1→0.08 */
}

/* 卡片2网格：核心紧密排列设置 */
.card2-grid {
    height: 100%;
    /* 必须：固定高度（继承主容器高度） */
    flex: 1;
    /* 占满主容器剩余宽度 */
    max-width: 100%;
    display: grid;
    /* 关键：把flex改成grid！之前误写为flex，导致滚动失效 */

    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    /* 恢复列宽配置 */
    gap: 15px;
    padding: 0;
    align-content: flex-start;
    /* 内容从顶部开始排列 */
    overflow-y: auto;
    /* 核心：内容超出高度时，显示垂直滚动条 */
    flex-shrink: 0;
}

.card2 img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 75%;
    object-fit: cover;
    /* 图片自适应卡片尺寸，裁剪多余部分（不拉伸） */
}


/* 可选：鼠标悬停时略微提高不透明度（增强交互感） */
.card2:hover {
    background-color: rgba(255, 255, 255, 0.9);
    /* 悬停时更实一点 */
    transition: background-color 0.3s ease;
    /* 平滑过渡效果 */
}

.card2 .card-content {
    padding: 15px;
    flex: 1;
    /* 占剩余高度 */
    display: flex;
    flex-direction: column;
    /* 垂直排列 */
    gap: 8px;
    /* 标题和描述的间距 */
    justify-content: flex-end;
    /* 关键：内容整体靠下对齐 */
}

/* 标题和描述保持不变（可选微调） */
.card2 .card-title {
    position: absolute;
    font-size: 15px;
    font-weight: bold;
    /* 核心：调整这三个值控制位置 */
    bottom: 40px;
    /* 距离卡片底部50px（值越大越靠上） */
    left: 10px;
    /* 距离卡片左侧15px（与padding保持一致） */
    right: 15px;
    /* 距离卡片右侧15px，确保文字不溢出 */
    /* 可选：文字居中 */
    /* text-align: center; */
}

.card2 .card-desc {
    position: absolute;
    /* 让描述也脱离流，跟随标题定位 */
    font-size: 14px;
    color: #666;
    /* 定位在标题下方 */
    bottom: 15px;
    /* 距离底部20px（比标题的bottom值小，确保在标题下方） */
    left: 10px;

}

/* ===== 跳转卡片：整张卡点开就是别的网站 ===== */
/* cards.js 里那张卡的数据带 link 字段时，会自动加上 .card2-link */
.card2-link {
    cursor: pointer;
    /* 把图片四角裁进圆角里 */
    overflow: hidden;
    border-color: rgba(255, 203, 92, 0.9);
    /* 金色边框缓慢呼吸 */
    animation: cardLinkGlow 3.6s ease-in-out infinite;
}

.card2-link:hover {
    background-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-3px);
    transition: background-color 0.3s ease, transform 0.3s ease;
}

/* 系统开了「减少动态效果」→ 边框不再呼吸 */
@media (prefers-reduced-motion: reduce) {
    .card2-link {
        animation: none;
    }
}

/* 弹窗背景遮罩（全屏，半透明，模糊背景） */
.popup-overlay {
    position: fixed;
    /* 固定在屏幕上 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* background-color: rgba(255, 255, 255, 0.5); 半透明黑色 */
    backdrop-filter: blur(5px);
    /* 模糊背景内容 */
    z-index: 1000;
    /* 确保在所有内容上方 */
    display: none;
    /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    animation: overlayFade 0.4s ease forwards;
    /* 遮罩400ms渐显 */
}

/* 应用动画到弹窗和遮罩 */

/* 卡片3弹窗样式 */
.card3 {
    background-color: white;
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    /* 用于关闭按钮定位 */
    z-index: 1001;
    /* 在遮罩上方 */
    animation: fadeInUp 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    /* 弹窗里有下载项 + 扩展包推广，内容可能比屏幕高。
       矮屏（如 1024x560）下不给上限就会被上下裁掉、扩展包完全看不到。
       这里限制高度并让内部滚动，保证任何屏幕都能看全。 */
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    /* 内容超高时滚动条贴着圆角，留点内边距更好看 */
    scrollbar-width: thin;
}

/* 关闭按钮 */
.card3 .close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

/* 弹窗内容样式（按需调整） */
.card3 .popup-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
}

.card3 .popup-desc {
    font-size: 16px;
    color: #333;
    margin-bottom: 20px;
}

.hidden-card-panel {
    max-width: 780px;
    max-height: 86vh;
    overflow-y: auto;
}

.hidden-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.hidden-card-grid.is-single {
    grid-template-columns: 1fr;
}

.hidden-card-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    min-width: 0;
}

.hidden-card-grid.is-single .hidden-card-item {
    display: grid;
    grid-template-columns: minmax(180px, 240px) 1fr;
}

.hidden-card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: #f5f5f5;
}

.hidden-card-grid.is-single .hidden-card-image {
    width: 100%;
    max-width: 220px;
    max-height: 220px;
    object-fit: contain;
    align-self: center;
    justify-self: center;
}

.hidden-card-content {
    padding: 12px;
    min-width: 0;
}

.hidden-card-grid.is-single .hidden-card-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
}

.hidden-card-title {
    font-size: 15px;
    margin-bottom: 6px;
}

.hidden-card-desc {
    color: #666;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.hidden-card-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.hidden-card-grid.is-single .hidden-card-links {
    margin-top: 4px;
    width: 100%;
}

.hidden-card-link {
    padding: 6px 10px;
    border-radius: 6px;
    background: #4285F4;
    color: #fff;
    font-size: 13px;
    text-decoration: none;
}

@media (max-width: 640px) {
    .hidden-card-grid.is-single .hidden-card-item {
        grid-template-columns: 1fr;
    }
}


@media (max-aspect-ratio: 1/1) {
    .card1 {
        width: 100%;
        /* 原来是固定 height:260px。加了 X / YouTube 后按钮变两行，
           内容高约 286px，会被裁掉一截 —— 改成 min-height 让它能撑开。 */
        min-height: 260px;

    }



    .card2-grid {

        display: grid;
        /* 核心：切换为Grid布局（替代flex） */
        grid-template-columns: repeat(2, 1fr);
        /* 关键：设置2列，每列等宽 */



    }

    .card2 .card-title {
        bottom: 25px;
        left: 10px;
    }

    .card2 .card-desc {
        bottom: 6px;
        left: 10px;
    }
}

/* 宽屏适配（去掉vw，统一固定间距） */
@media (min-aspect-ratio: 1/1) {
    .card1 {
        margin-left: 10vh;
        /* 距离屏幕左边30px，数值越大距离越远 */
        height: auto;

    }

    .card2 {
        max-width: 300px;
        min-width: 180px;
        border-radius: 16px;
        aspect-ratio: 8/10;
        font-size: 14px;
    }

    .card2-grid {
        max-height: 95vh;
    }
}

/* 更宽屏适配（仅调整列宽，间距保持固定） */
@media (min-aspect-ratio: 1.2/1) {

    .card2-grid {

        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
        /* 更宽屏可适当加大固定间距 */
        /* 列宽调整为最小260px，适配大卡片 */

    }
}

/* ── 卡片区滚动条：去掉轨道背景，只留滑块（老大 2026-10-17 要求）───────
   轨道/角落/上下箭头全透明，只有滑块本身有颜色；滑块用「透明边框 + background-clip」
   留出一点内缩，看起来是根细圆角短条，不会贴着卡片边缘。 */
.card2-grid {
    scrollbar-width: thin;                                /* Firefox：细条 */
    scrollbar-color: rgba(0, 0, 0, 0.22) transparent;      /* 滑块色 / 轨道透明 */
}

.card2-grid::-webkit-scrollbar {
    width: 8px;
    background: transparent;
}

.card2-grid::-webkit-scrollbar-track {
    background: transparent;
    box-shadow: none;
    border: none;
}

.card2-grid::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.22);
    border-radius: 8px;
    border: 2px solid transparent;      /* 透明边框 = 给滑块留气口 */
    background-clip: content-box;
}

.card2-grid::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.34);
}

/* 上下箭头、角落都不要 */
.card2-grid::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

.card2-grid::-webkit-scrollbar-corner {
    background: transparent;
}