/* ==========================================================
   「氦」个人主页 — 浅色简约扁平化设计系统（三页共用）
   ========================================================== */

/* ---------- 设计令牌 ---------- */
:root {
    /* 颜色 */
    --bg: #F3F5F7;             /* 页面浅灰底 */
    --card: #FFFFFF;           /* 卡片 */
    --text: #232830;           /* 主文字 */
    --text-2: #5C6672;         /* 次级文字 */
    --text-3: #97A0AB;         /* 弱化文字（备案号、说明） */
    --border: #E4E8EC;         /* 1px 细分割线 */
    --accent: #4FA046;         /* MC 草方块绿 */
    --accent-strong: #37823A;  /* 绿深色（文字级） */
    --accent-soft: #EBF5E8;    /* 绿色浅底 */
    --amber: #E7A23C;          /* 琥珀 = 氦辉光色 */
    --amber-strong: #B97A1E;   /* 琥珀文字级 */
    --amber-soft: #FBF0DF;     /* 琥珀浅底 */
    --live: #E5484D;           /* 直播红 */
    --focus-ring: rgba(79, 160, 70, .22);

    /* 圆角 */
    --r-lg: 24px;
    --r-md: 16px;
    --r-sm: 10px;
    --r-pill: 999px;

    /* 极浅阴影（扁平感，仅悬停时出现） */
    --shadow-sm: 0 1px 2px rgba(23, 32, 42, .05), 0 2px 8px rgba(23, 32, 42, .04);
    --shadow-md: 0 4px 12px rgba(23, 32, 42, .06), 0 12px 28px rgba(23, 32, 42, .07);

    /* 字体（纯系统栈，零外部依赖） */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;

    /* 缓动 */
    --ease-out: cubic-bezier(.22, .61, .36, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* ---------- 基础层 ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    overflow-x: clip; /* 裁剪装饰形状，避免横向滚动条 */
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text);
    line-height: 1.7;
    background-color: var(--bg);
    /* 浅灰底 + 四角柔光（绿/琥珀/蓝/青）+ 斜向光带 + 双层点阵网格 */
    background-image:
        radial-gradient(680px 460px at 8% 4%, rgba(79, 160, 70, .15), transparent 64%),
        radial-gradient(760px 540px at 94% 12%, rgba(231, 162, 60, .13), transparent 64%),
        radial-gradient(600px 500px at 88% 92%, rgba(91, 168, 224, .11), transparent 64%),
        radial-gradient(460px 400px at 4% 86%, rgba(79, 191, 176, .1), transparent 62%),
        linear-gradient(160deg, rgba(79, 160, 70, .05), transparent 38%, rgba(231, 162, 60, .05)),
        radial-gradient(rgba(35, 40, 48, .055) 1px, transparent 1.5px),
        radial-gradient(rgba(35, 40, 48, .05) 1.6px, transparent 2.2px);
    background-size: auto, auto, auto, auto, auto, 22px 22px, 88px 88px;
    background-attachment: fixed;
}

/* iOS Safari 对 fixed 背景支持不佳，降级为 scroll */
@supports (-webkit-touch-callout: none) {
    body {
        background-attachment: scroll;
    }
}

/* 背景装饰：超大「氦」字水印 + 浮动色点 */
body::before {
    content: "氦";
    position: fixed;
    top: -4%;
    right: -2%;
    z-index: -1;
    font-size: clamp(200px, 38vw, 560px);
    font-weight: 800;
    line-height: 1;
    color: rgba(79, 160, 70, .05);
    transform: rotate(-6deg);
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    top: 26%;
    left: 10%;
    z-index: -1;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--amber);
    opacity: .5;
    pointer-events: none;
    animation: floatY 4.6s var(--ease-out) infinite alternate;
}

::selection {
    background: var(--accent-soft);
}

/* ---------- 页面容器 + 几何装饰 ---------- */
.page {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px 32px;
}

/* 装饰形状：右上旋转圆角方块 + 左下虚线圆环 */
.page::before,
.page::after {
    content: "";
    position: fixed;
    z-index: -1;
    pointer-events: none;
}

.page::before {
    top: 7%;
    right: 8%;
    width: 150px;
    height: 150px;
    border: 3px solid var(--accent-soft);
    border-radius: 36px;
    animation: floatTilt 6s var(--ease-out) infinite alternate;
}

.page::after {
    bottom: 12%;
    left: 5%;
    width: 180px;
    height: 180px;
    border: 2px dashed rgba(231, 162, 60, .4);
    border-radius: 50%;
    box-shadow: 92px 62px 0 -58px rgba(79, 160, 70, .35); /* 旁侧小绿点，随圆环一起旋转 */
    animation: ringSpin 48s linear infinite;
}

/* ---------- 主卡片 ---------- */
.box1 {
    position: relative;
    max-width: 880px;
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: clamp(48px, 7vw, 80px) clamp(32px, 6vw, 72px);
    text-align: center;
    animation: fadeUp .6s var(--ease-out) both;
}

/* 卡片四角探出的装饰小形状 */
.box1::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 36px;
    width: 24px;
    height: 24px;
    background: var(--amber);
    border-radius: 7px;
    transform: rotate(45deg);
    z-index: -1;
    animation: floatY 3.6s var(--ease-out) infinite alternate;
}

.box1::after {
    content: "";
    position: absolute;
    bottom: -8px;
    right: 56px;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    z-index: -1;
    animation: floatY 4.2s var(--ease-out) infinite alternate-reverse;
}

/* ---------- 标题「氦」 ---------- */
.logo {
    position: relative;
    display: inline-block;
    margin: 0;
    font-size: clamp(64px, 13vw, 108px);
    font-weight: 800;
    line-height: 1;
    color: var(--accent-strong);
    background: var(--accent-soft); /* 自身衬底，避免负 z-index 沉入卡片 */
    border-radius: 28px;
    padding: 16px 48px;
    animation: pop .55s var(--ease-spring) both;
}

/* 琥珀小方块点缀，随氦气辉光缓缓浮动 */
.logo::after {
    content: "";
    position: absolute;
    top: 12px;
    right: 22px;
    width: 16px;
    height: 16px;
    background: var(--amber);
    border-radius: 5px;
    animation: floatY 3.2s var(--ease-out) infinite alternate;
}

.welcome {
    margin: 24px 0 32px;
    font-size: clamp(26px, 3.5vw, 36px);
    font-weight: 500;
    animation: fadeUp .6s var(--ease-out) .1s both;
}

/* ---------- 链接胶囊 ---------- */
.mainLink {
    display: inline-flex;
    align-items: center;
    padding: 10px 22px;
    border-radius: var(--r-pill);
    font-size: 16px;
    color: var(--text-2);
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--card);
    transition: transform .2s var(--ease-out), border-color .2s, color .2s,
        background-color .2s, box-shadow .2s;
}

.mainLink:hover {
    color: var(--accent-strong);
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ---------- 快捷入口（二级菜单 / 文件下载 / 任意门 / 直播） ---------- */
.quickLinks {
    position: relative;
    z-index: 30; /* 高于下方 .linkButton 的层叠上下文，保证下拉面板不被遮挡 */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin: 0 0 36px;
    animation: fadeUp .6s var(--ease-out) .26s both;
}

.mainLink--download {
    padding: 14px 36px;
    font-size: 17px;
    font-weight: 600;
    background: var(--accent);
    border-color: var(--accent);
    color: #FFFFFF;
}

.mainLink--download:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    color: #FFFFFF;
}

.mainLink--portal {
    gap: 8px;
    padding: 14px 36px;
    font-size: 17px;
    font-weight: 600;
    background: var(--amber-soft);
    border-color: rgba(231, 162, 60, .4);
    color: var(--amber-strong);
}

/* 任意门图标：随文字颜色自动变色 */
.mainLink--portal svg {
    width: 18px;
    height: 18px;
    flex: none;
}

.mainLink--portal:hover {
    background: var(--amber);
    border-color: var(--amber);
    color: #FFFFFF;
}

/* ---------- 二级菜单（MC常用工具网站） ---------- */
.dropdown {
    position: relative;
}

.mainLink--menu {
    gap: 6px;
    padding: 14px 36px; /* 与文件下载/任意门/直播等一级按钮一致 */
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.7; /* button 不继承 line-height，需显式与其余按钮一致 */
    font-weight: 600;
    cursor: pointer;
}

.mainLink--menu .chevron {
    width: 14px;
    height: 14px;
    flex: none;
    transition: transform .25s var(--ease-out);
}

.dropdown.open .chevron {
    transform: rotate(180deg);
}

.dropdown-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    min-width: 220px;
    max-width: calc(100vw - 32px);
    padding: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    transform: translate(-50%, 8px);
    opacity: 0;
    visibility: hidden;
    transition: transform .22s var(--ease-out), opacity .22s var(--ease-out), visibility .22s;
    z-index: 20;
}

.dropdown.open .dropdown-panel {
    transform: translate(-50%, 0);
    opacity: 1;
    visibility: visible;
}

.dropdown-item {
    display: block;
    padding: 9px 16px;
    border-radius: var(--r-sm);
    font-size: 15px;
    color: var(--text-2);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s, color .15s;
}

.dropdown-item:hover {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

/* ---------- 直播入口 ---------- */
.mainLink--live {
    gap: 9px;
    padding: 14px 36px;
    font-size: 17px;
    font-weight: 600;
    background: var(--card);
    border-color: rgba(229, 72, 77, .45);
    color: #D93A40;
}

.mainLink--live:hover {
    background: var(--live);
    border-color: var(--live);
    color: #FFFFFF;
}

.live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--live);
    animation: ping 1.8s var(--ease-out) infinite;
}

.mainLink--live:hover .live-dot {
    background: #FFFFFF;
}

/* ---------- 胶片长廊入口（胶片风格） ---------- */
.mainLink--film {
    position: relative;
    gap: 8px;
    padding: 14px 36px;
    font-size: 17px;
    font-weight: 600;
    background: #2A2D34; /* 胶片深灰 */
    border-color: #2A2D34;
    color: #F2F3F5;
    overflow: hidden;
}

.mainLink--film svg {
    width: 18px;
    height: 18px;
    flex: none;
}

/* 上下两排胶片齿孔 */
.mainLink--film::before,
.mainLink--film::after {
    content: "";
    position: absolute;
    left: -42px;
    right: -42px;
    height: 6px;
    background-image: radial-gradient(circle, rgba(255, 255, 255, .28) 2.4px, transparent 3px);
    background-size: 14px 6px;
    background-repeat: repeat-x;
}

.mainLink--film::before {
    top: 7px;
}

.mainLink--film::after {
    bottom: 7px;
}

.mainLink--film:hover {
    background: #1E2126;
    border-color: #1E2126;
    color: #FFFFFF;
}

/* 悬停时齿孔滚动，像胶片转动 */
.mainLink--film:hover::before,
.mainLink--film:hover::after {
    animation: filmRoll 1s linear infinite;
}

@keyframes filmRoll {
    from {
        background-position-x: 0;
    }
    to {
        background-position-x: 14px; /* 恰好一个齿孔间距，循环无缝 */
    }
}

/* ---------- 图标按钮 ---------- */
.linkButton {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-top: 36px;
    animation: fadeUp .6s var(--ease-out) .32s both;
}

.buttonBox {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 10px 16px;
    border-radius: var(--r-md);
    background: var(--bg);
    border: 1px solid transparent;
    text-decoration: none;
    animation: fadeUp .6s var(--ease-out) both;
    animation-delay: calc(.32s + var(--i, 0) * 60ms); /* 入场阶梯延迟 */
    transition: transform .22s var(--ease-out), border-color .22s,
        background-color .22s, box-shadow .22s;
}

.buttonBox:hover {
    transform: translateY(-4px);
    background: var(--card);
    border-color: var(--border);
    box-shadow: var(--shadow-md);
}

.buttonBox img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    transition: transform .22s var(--ease-spring);
}

.buttonBox:hover img {
    transform: scale(1.12) rotate(-4deg);
}

/* KOOK 图标更宽但高度与其余一致，保证标签对齐 */
.buttonBox--lg img {
    width: 44px;
    height: 32px;
}

.buttonLabel {
    font-size: 13px;
    color: var(--text-2);
    transition: color .2s;
}

.buttonBox:hover .buttonLabel {
    color: var(--accent-strong);
}

/* ---------- 备案号 ---------- */
.beian {
    margin-top: auto; /* flex 列布局下钉在底部 */
    padding: 24px 0 4px;
    text-align: center;
    font-size: 13px;
}

.beian a {
    color: var(--text-3);
    text-decoration: none;
    transition: color .2s;
}

.beian a:hover {
    color: var(--text-2);
}

/* ---------- 返回主页按钮（非主页页面左上角） ---------- */
.homeButton {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform .2s var(--ease-out), border-color .2s, box-shadow .2s;
}

.homeButton:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.homeButton img {
    width: 24px;
    height: 24px;
}

/* ---------- 动效关键帧 ---------- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes floatY {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-8px);
    }
}

/* 右上装饰方块：旋转 24° 的同时上下漂浮 */
@keyframes floatTilt {
    from {
        transform: rotate(24deg) translateY(0);
    }
    to {
        transform: rotate(24deg) translateY(-8px);
    }
}

@keyframes ringSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes ping {
    from {
        transform: scale(1);
        opacity: .7;
    }
    to {
        transform: scale(2.4);
        opacity: 0;
    }
}

/* ---------- 减弱动态效果降级 ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
    .page {
        padding: 24px 16px;
    }

    .box1 {
        padding: 36px 24px;
        border-radius: 20px;
    }

    .mainLink {
        font-size: 15px;
        padding: 9px 18px;
    }

    .buttonLabel {
        font-size: 12px;
    }

    .linkButton {
        grid-template-columns: repeat(3, 1fr); /* 5 按钮 3+2 */
        gap: 10px;
    }

    .buttonBox {
        padding: 14px 8px 12px;
    }

    .buttonBox img {
        width: 28px;
        height: 28px;
    }

    .buttonBox--lg img {
        width: 38px;
        height: 28px;
    }

    .quickLinks {
        gap: 10px;
    }

    /* 装饰形状缩小，避免溢出视口 */
    .page::before {
        width: 90px;
        height: 90px;
        right: 3%;
    }

    .page::after {
        width: 130px;
        height: 130px;
        left: 1%;
    }

    body::after {
        display: none;
    }
}

@media (max-width: 400px) {
    .buttonBox img {
        width: 26px;
        height: 26px;
    }

    .buttonBox--lg img {
        width: 34px;
        height: 26px;
    }

    .mainLink {
        padding: 8px 14px;
        font-size: 14px;
    }
}
