/* 颜色变量定义 - 灰色与淡粉色调 */
:root {
    --bg-color: #fcf4f5; /* 背景淡粉灰 */
    --widget-bg: rgba(255, 255, 255, 0.85); /* 组件白底带透明度 */
    --text-main: #6b6364; /* 主文本深灰 */
    --text-sub: #a19899; /* 副文本浅灰 */
    --pink-light: #f4d9dd; /* 浅粉色图标背景 */
    --pink-dark: #dca3ad; /* 深一点的粉色点缀 */
    --gray-light: #e3ddde; /* 浅灰色背景 */
    --gray-dark: #8c8283; /* 深灰色图标 */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --dock-total-height: 110px;
}

/* 全局重置：让页面铺满视口，无滚动条干扰 */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background-color: var(--bg-color); /* 背景统一为页面主色 */
}
html {
    -webkit-text-size-adjust: 100%;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button,
a,
[role="button"],
.app-item,
.dock-icon {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

button,
a {
    transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

button:active,
a:active,
[role="button"]:active,
.app-item:active,
.dock-icon:active {
    transform: translateY(1px) scale(0.97);
}

body {
    display: block;
    min-height: 100vh;
    background-color: #e0dcdc; /* 外围大背景 */
    opacity: 0;
    transform: translate3d(0, 10px, 0);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

body.page-ready {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

body.page-leaving {
    opacity: 0;
    transform: translate3d(0, 8px, 0);
}

/* 手机主容器 → 改为全屏容器 */
.phone {
    width: 100vw;
    height: 100svh;
    height: 100dvh;
    background-color: var(--bg-color);
    /* 移除圆角，全屏无圆角 */
    border-radius: 0;
    /* 移除阴影，或保留轻微阴影也无妨，但全屏下通常不需要 */
    box-shadow: none;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 max(14px, calc(14px + var(--safe-right))) calc(var(--dock-total-height) + max(10px, var(--safe-bottom))) max(14px, calc(14px + var(--safe-left)));
}


/* 背景点缀小星星/心形 (使用CSS绘制) */
.bg-deco {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--pink-light);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    opacity: 0.6;
}
.deco-1 { top: 12%; left: 10%; }
.deco-2 { top: 10%; right: 20%; background: var(--gray-light); width: 15px; height: 15px;}
.deco-3 { top: 30%; left: 5%; background: var(--pink-dark); width: 8px; height: 8px;}
.deco-4 { bottom: 20%; right: 15%; }

/* 状态栏 */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 16px;
    margin-top: 5px;
}
.status-right {
    display: flex;
    align-items: center;
    gap: 5px;
}
.status-right svg {
    width: 16px;
    height: 16px;
    fill: var(--text-main);
}

.phone.status-bar-hidden .status-bar {
    display: none;
}

.phone.status-bar-hidden {
    padding-top: 0;
}

.phone.status-bar-hidden .top-widget {
    margin-top: calc(12px + var(--safe-top));
}

/* 顶部个人卡片组件 */
.top-widget {
    background: var(--widget-bg);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(220, 163, 173, 0.1);
    margin-bottom: 25px;
    position: relative;
}
.top-widget .wifi-icon, .top-widget .bt-icon {
    position: absolute;
    top: 15px;
    width: 14px;
    height: 14px;
    fill: var(--text-sub);
}
.top-widget .wifi-icon { left: 15px; }
.top-widget .bt-icon { right: 15px; }

.avatar-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gray-light);
    margin: -40px auto 10px; /* 向上凸起效果 */
    border: 4px solid var(--bg-color);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}
.avatar-wrapper svg { width: 30px; fill: var(--gray-dark); }

.name {
    font-weight: bold;
    color: var(--text-main);
    font-size: 15px;
    margin-bottom: 5px;
}
.quote {
    font-size: 11px;
    color: var(--text-sub);
    margin-bottom: 15px;
    letter-spacing: 1px;
}
.stats {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-main);
}
.stats span { color: var(--text-sub); margin-right: 2px;}

/* 中部网格区域 */
.grid-area {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

/* 左侧长条组件 */
.music-widget {
    grid-column: span 2;
    background: var(--widget-bg);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 5px 15px rgba(220, 163, 173, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 80px;   
    max-width: 200px;   /* 根据需要调整，例如 260px、300px */
    /* 其他样式保持不变 */

}
.music-top { display: flex; gap: 10px;}
.music-cover {
    width: 45px;
    height: 45px;
    background:
        radial-gradient(circle at 68% 30%, rgba(255,255,255,0.78) 0 12%, transparent 13%),
        radial-gradient(circle at 26% 72%, rgba(220, 163, 173, 0.34) 0 24%, transparent 25%),
        linear-gradient(145deg, #f3ebed 0%, #e1d7d9 52%, #d4c9cc 100%);
    border-radius: 5px;
    border: 2px solid white;
    position: relative;
    overflow: hidden;
}
.music-cover::after {
    content: "";
    position: absolute;
    left: 8px;
    bottom: 7px;
    width: 29px;
    height: 11px;
    border-radius: 7px;
    background: rgba(107, 99, 100, 0.14);
}
.music-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 10px;
    margin-top: auto;
}
.wave-bar {
    width: 2px;
    background: var(--pink-dark);
    border-radius: 1px;
}
/* ========== 模拟音波动画（适配现有音乐组件） ========== */
/* 调整波形区域高度和对齐方式，为跳动留出空间 */
.music-wave {
    display: flex;
    align-items: flex-end;   /* 改为底部对齐，让波形从底部向上伸展 */
    gap: 2.5px;
    height: 32px;           /* 增加高度，使动画变化更明显 */
    margin-top: 8px;
    padding: 0 2px;
    contain: layout paint;
}

/* 波形条基础样式：增加过渡与底部变形原点 */
.wave-bar {
    width: 3px;
    background: var(--pink-dark, #dca3ad);
    border-radius: 2px;
    height: 12px;           /* 初始高度，动画会通过 scaleY 改变 */
    transform-origin: bottom;
    animation: audioWave 0.9s infinite alternate ease-in-out;
    box-shadow: 0 -1px 1px rgba(220, 163, 173, 0.3);
}

/* 主音波动画：模拟不规则跳动 */
@keyframes audioWave {
    0% {
        transform: scaleY(0.3);
        background: #e8b5be;
    }
    30% {
        transform: scaleY(1.0);
        background: var(--pink-dark, #dca3ad);
    }
    55% {
        transform: scaleY(0.6);
        background: #d4919c;
    }
    80% {
        transform: scaleY(1.2);
        background: #cc7f8b;
    }
    100% {
        transform: scaleY(0.4);
        background: #e0a5b0;
    }
}

/* 第二个变体：更强烈的节奏感 */
@keyframes audioWaveStrong {
    0% { transform: scaleY(0.2); background: #d4919c; }
    40% { transform: scaleY(1.3); background: #c57482; }
    70% { transform: scaleY(0.7); background: #dca3ad; }
    100% { transform: scaleY(0.5); background: #e8b5be; }
}

/* 第三个变体：轻快高频跳动 */
@keyframes audioWaveSharp {
    0% { transform: scaleY(0.4); background: #e0a5b0; }
    25% { transform: scaleY(1.2); background: #cc7f8b; }
    60% { transform: scaleY(0.5); background: #d4919c; }
    100% { transform: scaleY(0.9); background: #dca3ad; }
}

/* ===== 为不同的波形条分配独立的动画时长、延迟及变体，营造错落有致的频谱感 ===== */
/* 假设您的.music-wave内至少有6个.wave-bar，如果数量不足可自行增减 */
.wave-bar:nth-child(1) {
    animation: audioWave 0.68s infinite alternate ease-in-out;
    animation-delay: 0s;
}
.wave-bar:nth-child(2) {
    animation: audioWave 0.92s infinite alternate ease-in-out;
    animation-delay: 0.07s;
}
.wave-bar:nth-child(3) {
    animation: audioWaveStrong 0.8s infinite alternate ease-in-out;
    animation-delay: 0.15s;
}
.wave-bar:nth-child(4) {
    animation: audioWaveSharp 0.75s infinite alternate ease-in-out;
    animation-delay: 0.22s;
}
.wave-bar:nth-child(5) {
    animation: audioWave 0.85s infinite alternate ease-in-out;
    animation-delay: 0.31s;
}
.wave-bar:nth-child(6) {
    animation: audioWaveStrong 1.05s infinite alternate ease-in-out;
    animation-delay: 0.4s;
}
/* 如果有第7、第8个条形，继续丰富 */
.wave-bar:nth-child(7) {
    animation: audioWaveSharp 0.72s infinite alternate ease-in-out;
    animation-delay: 0.18s;
}
.wave-bar:nth-child(8) {
    animation: audioWave 0.96s infinite alternate ease-in-out;
    animation-delay: 0.5s;
}

/* 可选：为波形区域增加柔和光晕 */
.music-wave {
    filter: drop-shadow(0 1px 2px rgba(220, 163, 173, 0.2));
}

/* 尊重用户减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    .wave-bar {
        animation: none !important;
        transform: scaleY(0.65) !important;
    }
}
/* 应用图标样式 */
.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.12s ease;
}
.app-icon {
    width: 55px;
    height: 55px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.app-name {
    font-size: 11px;
    color: var(--text-main);
}

.app-item:active .app-icon,
.app-item:active .app-name,
.dock-icon:active {
    filter: saturate(1.02);
}

.dock-icon {
    transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

/* 纯CSS/SVG重绘的图标 (粉灰主题) */
.icon-camera {
    background: radial-gradient(circle at 30% 30%, #fff, var(--gray-light));
}
.icon-camera-inner {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--text-main); border: 2px solid #fff;
}
.icon-gallery {
    background: conic-gradient(var(--pink-light) 0 90deg, var(--gray-light) 90deg 180deg, var(--pink-dark) 180deg 270deg, var(--text-sub) 270deg 360deg);
}
.icon-wechat {
    background: var(--pink-light);
}
.icon-qq {
    background: white; border: 1px solid var(--gray-light);
}

/* 底部散落图片区域 */
.scattered-area {
    position: relative;
    height: 180px;
}
.polaroid {
    position: absolute;
    background: white;
    padding: 6px 6px 20px 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}
.polaroid-img {
    background: var(--gray-light);
    width: 100%;
    height: 100%;
}
.photo-left {
    background:
        linear-gradient(18deg, rgba(255,255,255,0.25), rgba(255,255,255,0) 40%),
        radial-gradient(circle at 68% 26%, rgba(244,217,221,0.9) 0 18%, rgba(244,217,221,0) 19%),
        linear-gradient(155deg, #dbd3d5 0%, #cdc3c6 48%, #bfb6ba 100%);
}
.photo-back {
    background:
        linear-gradient(35deg, rgba(255,255,255,0.25), rgba(255,255,255,0) 42%),
        radial-gradient(circle at 30% 72%, rgba(244,217,221,0.75) 0 20%, rgba(244,217,221,0) 21%),
        linear-gradient(145deg, #dfd8da, #cfc7ca);
}
.photo-front {
    background:
        linear-gradient(26deg, rgba(255,255,255,0.27), rgba(255,255,255,0) 38%),
        radial-gradient(circle at 72% 20%, rgba(220,163,173,0.45) 0 20%, rgba(220,163,173,0) 21%),
        linear-gradient(152deg, #ddd5d8 0%, #cac1c4 55%, #bfb6ba 100%);
}
.tape {
    position: absolute;
    width: 35px;
    height: 12px;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(0,0,0,0.05);
    top: -6px;
    left: 50%;
    margin-left: -17px;
    transform: rotate(-5deg);
}
.pic-left {
    width: 100px; height: 100px;
    left: 10px; top: 10px;
    padding: 5px;
}
.pic-right {
    width: 110px; height: 120px;
    right: 15px; top: 20px;
    transform: rotate(5deg);
}
.photo-stack {
    position: absolute;
    right: 15px;
    top: 20px;
    width: 125px;
    height: 140px;
}
.photo-stack .polaroid {
    width: 95px;
    height: 110px;
}
.stack-back {
    top: 8px;
    left: 0;
    transform: rotate(-8deg);
    z-index: 1;
}
.stack-front {
    top: 0;
    left: 28px;
    transform: rotate(7deg);
    z-index: 2;
}
.photo-stack .polaroid-img {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}

/* 分页点 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    margin-bottom: 15px;
}
.dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--gray-light);
}
.dot.active { background: var(--text-main); }

/* 底部毛玻璃 Dock */
.dock {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 25px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(220, 163, 173, 0.15);
    position: fixed;
    left: max(12px, calc(12px + var(--safe-left)));
    right: max(12px, calc(12px + var(--safe-right)));
    bottom: max(10px, var(--safe-bottom));
    z-index: 20;
}
.dock-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.dock-phone { background: var(--pink-light); }
.dock-msg { background: var(--gray-light); }
.dock-browser { background: linear-gradient(135deg, var(--pink-light), var(--gray-light)); }
.dock-settings { background: var(--text-main); cursor: pointer; }


@media (max-width: 768px) {
    .top-widget,
    .music-widget,
    .polaroid,
    .dock {
        box-shadow: 0 3px 10px rgba(220, 163, 173, 0.08);
    }
}
/* ========== API 配置面板样式 ========== */
.api-modal {
    position: absolute;
    inset: 0;
    background: rgba(107, 99, 100, 0.22);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.api-modal.show {
    display: flex;
}
.api-panel {
    width: 100%;
    height: 100%;
    background: rgba(252, 244, 245, 0.96);
    border-radius: 0;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.api-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
}
.api-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.4px;
}
.api-close {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 12px;
    color: var(--text-main);
    background: rgba(227, 221, 222, 0.9);
    cursor: pointer;
    font-size: 15px;
    line-height: 24px;
    text-align: center;
}
.api-active-chip {
    align-self: flex-start;
    font-size: 10px;
    color: var(--text-main);
    background: rgba(220, 163, 173, 0.28);
    border-radius: 999px;
    padding: 4px 9px;
}
.api-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
}
.api-field label {
    display: block;
    font-size: 10px;
    color: var(--text-sub);
    margin-bottom: 3px;
    letter-spacing: 0.4px;
}
.api-input,
.api-select {
    width: 100%;
    border: 1px solid rgba(140, 130, 131, 0.22);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 12px;
    padding: 9px 10px;
    outline: none;
}
.api-input:focus,
.api-select:focus {
    border-color: rgba(220, 163, 173, 0.8);
    box-shadow: 0 0 0 2px rgba(244, 217, 221, 0.65);
}
.api-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}
.api-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-top: 2px;
}
.api-btn {
    border: none;
    border-radius: 12px;
    padding: 9px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-main);
}
.api-btn.fetch {
    background: var(--gray-light);
}
.api-btn.save {
    background: var(--pink-light);
}
.api-btn.clear {
    background: rgba(227, 221, 222, 0.9);
}
.api-list-title {
    margin-top: 4px;
    color: var(--text-sub);
    font-size: 10px;
    letter-spacing: 0.5px;
}
.preset-list {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(140, 130, 131, 0.16);
    border-radius: 14px;
    padding: 8px;
    overflow-y: auto;
    min-height: 70px;
    max-height: 170px;
}
.preset-empty {
    color: var(--text-sub);
    font-size: 11px;
    text-align: center;
    padding: 12px 0;
}
.preset-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid transparent;
    margin-bottom: 6px;
    background: rgba(252, 244, 245, 0.75);
}
.preset-item:last-child {
    margin-bottom: 0;
}
.preset-item.active {
    border-color: rgba(220, 163, 173, 0.8);
    background: rgba(244, 217, 221, 0.5);
}
.preset-main {
    cursor: pointer;
}
.preset-name {
    color: var(--text-main);
    font-size: 11px;
    font-weight: 700;
}
.preset-meta {
    color: var(--text-sub);
    font-size: 9px;
    margin-top: 2px;
    word-break: break-all;
}
.preset-ops {
    display: flex;
    gap: 4px;
}
.preset-op {
    border: none;
    background: rgba(227, 221, 222, 0.95);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 10px;
    padding: 5px 6px;
    cursor: pointer;
}
.preset-op.del {
    background: rgba(220, 163, 173, 0.35);
}
.api-msg {
    font-size: 10px;
    min-height: 14px;
    color: var(--text-sub);
}
