@property --angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 180deg;
}

:root {
    --primary-blue: #83D4FC;
    --center-blue: #D7F6FF;
    --nav-text: #FFFFFF;
    --nav-font-size: 20px;
    --logo-width: 248px;
    --logo-height: 48px;
    --social-size: 48px;
    --social-gap: 24px;
    --menu-gap: 48px;
    
    /* 响应式边距计算：1920px -> 970px 对应 90px/80px -> 24px */
    --side-left: clamp(24px, calc(24px + (90 - 24) * (100vw - 970px) / (1920 - 970)), 90px);
    --side-right: clamp(24px, calc(24px + (80 - 24) * (100vw - 970px) / (1920 - 970)), 80px);
}

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

body {
    font-family: 'IBM Plex Mono', monospace, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: white;
    overflow-x: hidden;
    min-height: 100vh;
    background-color: var(--center-blue);
}

/* 背景动效容器 */
.bg-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
}

.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-layer.active {
    opacity: 1;
}

.himacly-bg {
    --x: calc(50% + 50% * cos(var(--angle)));
    --y: calc(50% + 50% * sin(var(--angle)));
    background: radial-gradient(circle at var(--x) var(--y), var(--primary-blue) 0%, var(--center-blue) 80%);
}

.himacly-bg.active {
    animation: bgRiseArc 3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.sunmuse-bg {
    background: linear-gradient(180deg, #FFCC9C 0%, #FCEDCF 34%, #E6DFE7 76%, #97CDF2 100%);
}

.aboutme-bg {
    background: linear-gradient(180deg, #E7E7E7 0%, #F5F8F9 100%);
}

@keyframes bgRiseArc {
    from { --angle: 180deg; }
    to { --angle: 270deg; }
}

/* 导航栏样式 */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: var(--side-left);
    padding-right: var(--side-right);
    width: 100%;
    max-width: 1920px;
    height: 120px;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.nav-left {
    flex-shrink: 0;
    z-index: 110;
}

.nav-left .logo {
    width: var(--logo-width);
    height: var(--logo-height);
    display: block;
    transition: opacity 0.3s ease;
}

.nav-left a:hover .logo {
    opacity: 0.7;
}

.nav-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--menu-gap);
    align-items: center;
}

.nav-item {
    text-decoration: none;
    color: #FFFFFF;
    font-size: var(--nav-font-size);
    font-weight: 500;
    opacity: 0.9;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
    padding: 10px 0;
}

.nav-item:hover {
    opacity: 1;
}

.nav-item.active {
    font-weight: 700; /* 修改为 Bold */
    opacity: 1;
}

/* 下划线 */
.nav-underline {
    position: absolute;
    bottom: -2px;
    height: 4px;
    background-color: #FFFFFF;
    border-radius: 2px;
    transition: all 0.5s cubic-bezier(0.65, 0, 0.35, 1);
    pointer-events: none;
}

/* 移除之前的 active::after 样式 */
.nav-item.active::after {
    display: none;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 24px; /* 增加语言选择器与社交图标的间距 */
    z-index: 110;
}

/* 语言选择器 */
.lang-selector {
    position: relative;
    font-family: 'IBM Plex Mono', monospace;
}

.lang-trigger {
    background: none;
    border: none;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    transition: background 0.3s ease;
}

.lang-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-arrow {
    transition: transform 0.3s ease;
}

.lang-selector.open .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 6px;
    display: none;
    flex-direction: column;
    min-width: 80px; /* 减小最小宽度 */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 150;
}

.lang-selector.open .lang-dropdown {
    display: flex;
}

.lang-dropdown a {
    text-decoration: none;
    color: #FFFFFF;
    font-size: 14px;
    padding: 8px 12px; /* 缩小内边距 */
    border-radius: 10px;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center; /* 文字居中 */
}

.lang-dropdown a:hover {
    background: rgba(255, 255, 255, 0.2);
}

.social-icons {
    display: flex;
    gap: var(--social-gap);
    align-items: center;
}

.social-link {
    display: flex;
    width: var(--social-size);
    height: var(--social-size);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.social-link img {
    width: 100%;
    height: 100%;
}

/* 汉堡菜单按钮 */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 120;
}

.burger-menu span {
    width: 32px;
    height: 3px;
    background: #FFFFFF;
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

/* 移动端菜单遮罩层 */
.mobile-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: rgba(131, 212, 252, 0.95);
    backdrop-filter: blur(20px);
    z-index: 105;
    transition: right 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 60px;
}

.mobile-overlay.open {
    right: 0;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.mobile-nav-item {
    text-decoration: none;
    color: #FFFFFF;
    font-size: 32px;
    font-weight: 500;
}

.mobile-nav-item.active {
    font-weight: 700; /* 修改为 Bold */
}

.mobile-social {
    display: flex;
    gap: 32px;
}

/* 主体内容布局 */
.content {
    padding-top: 140px;
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-container {
    display: none;
    align-items: center;
    gap: clamp(48px, calc(48px + (80 - 48) * (100vw - 1200px) / (1920 - 1200)), 80px);
    max-width: 1920px;
    padding: 0 90px;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease; /* 增加位移感更优雅 */
    transform: translateY(10px);
}

.main-container.section-active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.sunmuse-desc {
    color: #5C5C5C !important;
}

/* Sunmuse 特有布局：单个 iPhone 居中 */
#section-sunmuse {
    justify-content: center;
}

/* About me 特有布局：居中 */
#section-aboutme {
    justify-content: center;
}

/* iPhone 容器 */
.iphone-container {
    width: 348px;
    height: 720px;
    background: transparent;
    backdrop-filter: blur(0px);
    border: 4px solid rgba(255, 255, 255, 0.6);
    border-radius: 72px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* 改为顶部对齐以对齐左侧 */
    padding-top: 130px; /* 必须与左侧 padding-top 一致以实现 Logo 对齐 */
    position: relative;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.iphone-container:hover {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(40px);
}

/* 灵动岛 */
.dynamic-island {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 36px;
    background-color: transparent; /* 去掉填充 */
    border: 4px solid rgba(255, 255, 255, 0.6); /* 保持与外框一致的 4px 描边 */
    border-radius: 18px;
    z-index: 10;
}

/* iPhone 内部内容 */
.iphone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.app-logo-s {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 24px;
}

.appstore-btn {
    display: block;
    height: 48px;
    transition: transform 0.3s ease;
    margin-bottom: 72px; /* 间距 72 以对齐左侧文案位置 */
}

.iphone-desc {
    max-width: calc(100% - 16px); /* 确保左右各留出 8px 安全距离 */
    padding: 0 8px;
}

.appstore-btn:hover {
    transform: scale(1.05);
}

.appstore-btn img {
    height: 48px;
    width: auto;
    display: block;
}

/* Mac mini 容器 */
.mac-mini-container {
    width: 720px;
    height: 720px;
    background: transparent;
    backdrop-filter: blur(0px);
    border: 4px solid rgba(255, 255, 255, 0.6);
    border-radius: 150px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* 改为顶部对齐，通过 padding 控制位置 */
    padding-top: 130px; /* 预估居中起始位 */
    position: relative;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.mac-mini-container:hover {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(40px);
}

/* 内部居中内容 */
.mac-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 520px; 
}

.app-logo {
    width: 120px; /* 改为 120 */
    height: 120px;
    object-fit: contain;
    margin-bottom: 24px;
}

.app-name {
    font-size: 28px;
    font-weight: 700;
    color: #000000;
    margin-bottom: 48px;
    line-height: 1; /* 确保文字行高不干扰对齐 */
}

.btn-group {
    display: flex;
    gap: 20px;
    margin-bottom: 72px;
}

.btn {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 48px;
    padding: 0 40px;
    border-radius: 32px; /* 胶囊形状 */
    text-decoration: none;
    font-size: 18px;
    font-weight: 500; /* Medium */
    transition: all 0.3s ease;
}

.btn-download {
    background-color: #000000;
    color: #FFFFFF;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.btn-guide {
    background-color: rgba(83, 168, 196, 0.2); /* #53A8C4 20% 透明度 */
    color: #3E95BD;
}

.btn-guide:hover {
    background-color: rgba(83, 168, 196, 0.3);
    transform: translateY(-2px);
}

.app-description {
    font-size: 16px;
    font-weight: 500; /* Medium */
    color: #3E95BD;
    line-height: 1.6;
    max-width: 520px;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.2);
    z-index: 200;
    display: flex; /* 保持 flex 以支持居中 */
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden; /* 使用 visibility 代替 display:none 以支持动画 */
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    width: 882px;
    height: 578px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(36px);
    -webkit-backdrop-filter: blur(36px);
    border-radius: 24px;
    position: relative;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    /* 初始状态：轻微缩小并下沉 */
    transform: scale(0.95) translateY(20px);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.show .modal-container {
    /* 激活状态：恢复正常并升起 */
    transform: scale(1) translateY(0);
}

.modal-mobile-header {
    display: none; /* 默认隐藏 */
    width: 100%;
    height: 60px;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.modal-back {
    position: absolute;
    left: 0;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.modal-close {
    position: absolute;
    top: -24px; /* 向上偏移按钮高度的一半，使其圆心对准顶点 */
    right: -24px; /* 向右偏移按钮宽度的一半 */
    width: 48px;
    height: 48px;
    background: #FFFFFF;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10;
    transition: transform 0.2s ease;
}

.modal-close:hover {
    transform: scale(1.1);
}

.modal-body {
    display: flex;
    gap: 16px;
    height: 100%;
    overflow-y: auto; /* 允许滚动内容 */
}

.modal-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.8); /* 纯白色 80% 透明度 */
    border-radius: 24px;
    padding: 24px; /* 修改为 24px */
    display: flex;
    flex-direction: column;
}

@media (max-width: 970px) {
    .modal-container {
        width: 100%;
        height: 92%; /* 类似 sheet，顶部留出空隙 */
        margin-top: 8%;
        border-radius: 24px 24px 0 0;
        padding: 16px;
        background: rgba(255, 255, 255, 0.95);
        /* 移动端初始状态：从底部完全滑出 */
        transform: translateY(100%); 
        transition: transform 0.5s cubic-bezier(0.32, 1, 0.2, 1);
    }

    .modal-overlay.show .modal-container {
        /* 移动端激活状态：滑入屏幕 */
        transform: translateY(0);
    }

    .modal-close {
        display: none; /* 移动端使用 back 按钮 */
    }

    .modal-mobile-header {
        display: flex;
    }

    .modal-body {
        flex-direction: column;
        padding-bottom: 40px;
    }

    .modal-card {
        flex: none;
        width: 100%;
        margin-bottom: 16px;
    }

    .step-image, .step-image-s {
        max-width: 100%;
        height: auto;
    }
}

.step-title {
    font-size: 24px;
    font-weight: 700;
    color: #000;
    margin-bottom: 24px;
}

.step-requirement {
    font-size: 14px;
    color: #8E8E93;
    margin-bottom: 24px;
}

.step-instructions {
    font-size: 14px;
    color: #000;
    line-height: 1.8;
    margin-bottom: 16px; /* 修改为 16px */
    width: 100%;
}

.step-item {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.step-item:last-child {
    margin-bottom: 0; /* 去掉最后一个步骤的额外边距，防止与父容器边距叠加 */
}

.inline-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin: 0 4px;
    display: inline-block;
}

.step-image-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

.step-image {
    width: 357px;
    height: 183px;
    object-fit: contain;
}

.step-image-s {
    width: 261px;
    height: 243px;
    object-fit: contain;
}

.step-footer {
    font-size: 14px;
    color: #000;
    margin-top: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* 导航栏主题切换：About me 灰色主题 */
.navbar.nav-gray .logo {
    filter: brightness(0.6); /* 将白色 Logo 变为 #999999 左右的灰色 */
}

.navbar.nav-gray .nav-item {
    color: #999999;
}

.navbar.nav-gray .nav-item.active {
    color: #999999;
}

.navbar.nav-gray .nav-underline {
    background-color: #999999;
}

.navbar.nav-gray .lang-trigger {
    color: #999999;
}

.navbar.nav-gray .lang-arrow path {
    stroke: #999999;
}

.navbar.nav-gray .burger-menu span {
    background: #999999;
}

.navbar.nav-gray .lang-dropdown a {
    color: #999999;
}

/* 强制覆盖：当移动端菜单打开时，无论在哪个页面，导航栏元素都统一为白色 */
.navbar.menu-open .logo {
    filter: none !important;
}

.navbar.menu-open .lang-trigger {
    color: #FFFFFF !important;
}

.navbar.menu-open .lang-arrow path {
    stroke: #FFFFFF !important;
}

.navbar.menu-open .burger-menu span {
    background: #FFFFFF !important;
}

/* About me 页面布局 */
.aboutme-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: #5C5C5C;
    width: 100%;
    max-width: 560px;
}

.personal-logo {
    width: 200px;
    height: auto;
    margin-bottom: 48px;
}

.occupation-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 136px;
    color: #5C5C5C;
}

.personal-intro {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.6;
    margin-bottom: 136px;
    color: #5C5C5C;
}

.inline-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: opacity 0.2s ease;
}

.inline-link:hover {
    opacity: 0.6;
}

.contact-text {
    font-size: 16px;
    font-weight: 500;
    color: #5C5C5C;
}

/* 微信图标逻辑 */
.wechat-only { display: flex; }
html:not([lang^="zh"]) .wechat-only { display: none; }

/* 响应式适配：1200px 宽度 */
@media (max-width: 1200px) {
    .content {
        padding-top: 120px;
    }

    .main-container {
        gap: 48px;
        padding: 0 40px;
    }

    /* 左侧 Mac mini 容器适配 */
    .mac-mini-container {
        width: 480px;
        height: 480px;
        border-radius: 120px;
        padding-top: 80px; /* 重新计算 480 高度下的居中起始位 */
    }

    .app-logo {
        width: 72px;
        height: 72px;
        margin-bottom: 16px;
    }

    .app-name {
        font-size: 20px;
        margin-bottom: 48px;
    }

    .btn-group {
        gap: 16px;
        margin-bottom: 48px;
    }

    .btn {
        width: 114px;
        height: 36px;
        font-size: 14px;
        padding: 0;
    }

    .app-description {
        font-size: 14px;
        max-width: 380px;
    }

    /* 右侧 iPhone 容器适配 */
    .iphone-container {
        width: 232px;
        height: 480px;
        border-radius: 48px;
        padding-top: 80px; /* 与左侧保持一致以对齐 */
    }

    .dynamic-island {
        top: 16px;
        width: 80px;
        height: 24px;
        border-width: 3px; /* 缩小描边感 */
    }

    .app-logo-s {
        width: 72px;
        height: 72px;
        margin-bottom: 16px;
    }

    .appstore-btn {
        height: 36px;
        margin-bottom: 48px;
    }

    .appstore-btn img {
        height: 36px;
    }

    .iphone-desc {
        max-width: calc(100% - 16px); /* 左右各留出 8px 安全距离 */
        padding: 0 8px;
    }

    .iphone-desc br {
        display: none; /* 隐藏换行符 */
    }
}

/* 响应式断点：970px 及移动端垂直布局 */
@media (max-width: 970px) {
    .nav-center, .social-icons {
        display: none;
    }
    
    .burger-menu {
        display: flex;
    }

    /* 汉堡菜单打开时的动画 */
    .burger-menu.open span:nth-child(1) {
        transform: rotate(45deg);
    }
    .burger-menu.open span:nth-child(2) {
        opacity: 0;
        transform: translateX(20px);
    }
    .burger-menu.open span:nth-child(3) {
        transform: rotate(-45deg);
    }

    /* 移动端垂直堆叠布局 */
    .content {
        padding-top: 120px;
        padding-bottom: 80px;
        height: auto;
        align-items: flex-start;
    }

    .main-container {
        flex-direction: column !important;
        align-items: center !important;
        gap: 60px !important;
        padding: 0 24px !important; /* 左右 24 安全距离 */
        width: 100% !important;
    }

    /* Mac mini 移动端适配 */
    .mac-mini-container {
        width: calc(100vw - 48px) !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 80px !important; 
        padding-top: 0 !important;
        justify-content: center !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }

    .mac-content {
        width: 100% !important;
        max-width: calc(100% - 40px) !important;
    }

    /* iPhone 移动端适配 */
    .iphone-container {
        width: calc(100vw - 144px) !important; /* 左右各 72 安全距离 */
        max-width: 320px !important;
        height: auto !important;
        aspect-ratio: 348 / 720 !important; /* 保持宽高比 */
        border-radius: 48px !important;
        padding-top: 0 !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* 移动端内容统一参数 */
    .app-logo, .app-logo-s {
        width: 72px !important;
        height: 72px !important;
        margin-bottom: 16px !important;
    }

    .app-name {
        font-size: 20px !important;
        margin-bottom: 32px !important;
    }

    .btn-group {
        gap: 16px !important;
        margin-bottom: 40px !important;
    }

    .btn {
        width: 127px !important;
        height: 36px !important;
        font-size: 14px !important;
        padding: 0 !important;
    }

    .appstore-btn {
        height: 36px !important;
        margin-bottom: 40px !important;
    }

    .appstore-btn img {
        height: 36px !important;
    }

    .app-description {
        font-size: 12px !important;
        max-width: calc(100% - 32px) !important;
        line-height: 1.5 !important;
    }

    .iphone-desc {
        max-width: calc(100% - 16px) !important;
        padding: 0 8px !important;
    }

    .iphone-desc br {
        display: block !important; /* 移动端建议恢复换行以适应窄屏 */
    }

    .dynamic-island {
        width: 80px !important;
        height: 24px !important;
        top: 16px !important;
        border-width: 3px !important;
    }

    /* About me 移动端适配 */
    .aboutme-content {
        max-width: calc(100% - 48px) !important; /* 左右留出 24px 间距 */
    }

    .personal-logo {
        height: 48px !important;
        width: auto !important;
        margin-bottom: 32px !important; /* 移动端适当减小间距 */
    }

    .occupation-text, .personal-intro {
        margin-bottom: 60px !important; /* 移动端适当减小间距 */
    }
}
