/* ========== 全局 ========== */
:root {
    --bg: #f5f0eb;
    --card-bg: #ffffff;
    --text: #2c2c2c;
    --text-light: #888;
    --accent: #ff6b81;
    --accent-light: #ffb3c1;
    --border: #e8e0d8;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

/* ========== 顶部进度条 ========== */
#top-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b81, #ffa07a);
    z-index: 9999;
    width: 0%;
    transition: width 0.1s;
}

/* ========== 导航栏 ========== */
.navbar {
    background: var(--card-bg);
    padding: 0 12px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}
.navbar .logo {
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}
/* 导航链接：可横向滚动 */
.navbar .nav-links {
    display: flex;
    gap: 14px;
    list-style: none;
    overflow-x: auto;
    white-space: nowrap;
    flex: 1;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.navbar .nav-links::-webkit-scrollbar { display: none; }
.navbar .nav-links a {
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
    flex-shrink: 0;
}
.navbar .nav-links a:hover,
.navbar .nav-links a.active { color: var(--accent); border-bottom-color: var(--accent); }
/* 搜索框 */
.navbar .search-box {
    flex-shrink: 0;
}
.navbar .search-box input {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    outline: none;
    width: 120px;
    transition: 0.3s;
}
.navbar .search-box input:focus { width: 160px; border-color: var(--accent); }

/* ========== 主布局 ========== */
.container {
    max-width: 1200px;
    margin: 16px auto;
    padding: 0 12px;
    display: grid;
    grid-template-columns: 260px 1fr 260px;
    gap: 16px;
}

/* ========== 左侧栏 ========== */
.sidebar-left .card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.profile-card { text-align: center; }
.profile-card .avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 3px solid var(--accent-light);
}
.profile-card .name { font-size: 18px; font-weight: 700; }
.profile-card .bio { font-size: 13px; color: var(--text-light); margin: 4px 0 12px; }
.profile-card .social-links {
    display: flex; justify-content: center; gap: 10px;
}
.profile-card .social-links a {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text);
    font-size: 16px;
    transition: 0.2s;
}
.profile-card .social-links a:hover { background: var(--accent); color: #fff; }

/* 音乐播放器 */
.music-player { text-align: center; }
.music-player .album-art {
    width: 160px; height: 160px;
    border-radius: 12px;
    object-fit: cover;
    margin: 0 auto 10px;
    display: block;
}
.music-player .song-name { font-size: 14px; font-weight: 600; }
.music-player .song-artist { font-size: 12px; color: var(--text-light); }
.music-player .controls { margin-top: 10px; display: flex; justify-content: center; gap: 12px; }
.music-player .controls button {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg);
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}
.music-player .controls button:hover { background: var(--accent); color: #fff; }

/* 分类/标签 */
.widget-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list .tag {
    background: var(--bg);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-light);
    text-decoration: none;
    transition: 0.2s;
}
.tag-list .tag:hover { background: var(--accent); color: #fff; }

/* ========== 中间内容 ========== */
.content-area .post-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    transition: 0.2s;
}
.content-area .post-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.post-card .post-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 6px;
}
.post-card .post-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    cursor: pointer;
    line-height: 1.4;
}
.post-card .post-title:hover { color: var(--accent); }
.post-card .post-excerpt { font-size: 14px; color: #555; line-height: 1.6; }
.post-card .post-footer {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.post-card .post-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.post-card .post-tags .tag {
    background: var(--bg);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
}

/* ========== 右侧栏 ========== */
.sidebar-right .card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.stat-item { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.stat-item .label { color: var(--text-light); }
.stat-item .value { font-weight: 600; }

/* 倒计时 */
.countdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
}
.countdown-item .days {
    background: var(--accent);
    color: #fff;
    padding: 2px 10px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 12px;
}

/* 日历 */
.calendar { text-align: center; }
.calendar .month { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.calendar table { width: 100%; border-collapse: collapse; }
.calendar th { font-size: 11px; color: var(--text-light); padding: 4px; }
.calendar td { font-size: 13px; padding: 4px; }
.calendar td.today {
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    line-height: 28px;
}

/* 进度条 */
.progress-item { margin: 8px 0; }
.progress-item .p-label { font-size: 12px; display: flex; justify-content: space-between; }
.progress-item .p-bar {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    margin-top: 4px;
    overflow: hidden;
}
.progress-item .p-bar .p-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ffa07a);
    border-radius: 3px;
    transition: width 0.5s;
}

/* ========== 自定义滚动条（桌面） ========== */
@media (min-width: 769px) {
    ::-webkit-scrollbar { width: 8px; }
    ::-webkit-scrollbar-track { background: var(--bg); }
    ::-webkit-scrollbar-thumb {
        background: var(--accent-light);
        border-radius: 4px;
    }
    ::-webkit-scrollbar-thumb:hover { background: var(--accent); }
}


/* ========== 分页控件 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
    margin-top: 10px;
}
.page-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    color: var(--text);
}
.page-btn:hover:not(:disabled) {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.page-info {
    font-size: 14px;
    color: var(--text-light);
}
@media (max-width: 768px) {
    .page-btn { padding: 6px 14px; font-size: 13px; }
    .page-info { font-size: 13px; }
}

/* ========== 页脚 ========== */
.footer {
    text-align: center;
    padding: 24px 16px;
    font-size: 13px;
    color: var(--text-light);
}
.footer .run-time { margin-top: 6px; color: var(--accent); font-weight: 600; }

/* ========== 日记页面 ========== */
.diary-entry {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
}
.diary-entry .diary-date { font-size: 12px; color: var(--text-light); }
.diary-entry .diary-content { margin-top: 8px; font-size: 14px; line-height: 1.8; }

/* ========== 设备清单 ========== */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.device-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}
.device-card .device-icon { font-size: 32px; margin-bottom: 8px; }
.device-card .device-name { font-size: 14px; font-weight: 600; }
.device-card .device-spec { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ==========================================
   ========== 移动端适配 ==========
   ========================================== */

/* 平板 & 小桌面：切换为单列，侧栏移到内容下方 */
@media (max-width: 1024px) {
    .container {
        display: flex;
        flex-direction: column;
        padding: 0 12px;
    }
    .sidebar-left { order: 1; }
    .content-area { order: 0; }
    .sidebar-right { order: 2; }
}

/* 手机端：全面优化 */
@media (max-width: 768px) {
    /* 导航栏优化 */
    .navbar {
        padding: 0 10px;
        height: 50px;
        gap: 6px;
    }
    .navbar .logo { font-size: 14px; }
    .navbar .nav-links { gap: 10px; }
    .navbar .nav-links a {
        font-size: 13px;
        padding: 3px 0;
    }
    /* 手机上搜索框缩短 */
    .navbar .search-box input {
        width: 90px;
        padding: 5px 10px;
        font-size: 12px;
    }
    .navbar .search-box input:focus { width: 130px; }

    /* 主容器 */
    .container {
        margin: 10px auto;
        padding: 0 8px;
        gap: 10px;
    }

    /* 文章卡片 */
    .content-area .post-card {
        padding: 16px;
        margin-bottom: 12px;
        border-radius: 10px;
    }
    .post-card .post-title {
        font-size: 16px;
        margin-bottom: 6px;
    }
    .post-card .post-excerpt {
        font-size: 13px;
        line-height: 1.5;
    }
    .post-card .post-footer {
        margin-top: 10px;
    }
    .post-card .post-tags .tag {
        font-size: 11px;
        padding: 2px 8px;
    }

    /* ==== 移动端侧栏重新设计 ==== */
    /* 左侧栏 - 个人信息水平布局 */
    .sidebar-left .profile-card {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 16px;
    }
    .sidebar-left .profile-card .avatar {
        width: 56px;
        height: 56px;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .sidebar-left .profile-card .profile-text {
        flex: 1;
        min-width: 0;
    }
    .sidebar-left .profile-card .name { 
        font-size: 15px; 
        font-weight: 700; 
        margin-bottom: 1px; 
    }
    .sidebar-left .profile-card .bio { 
        font-size: 12px; 
        color: var(--text-light); 
        margin-bottom: 6px; 
        line-height: 1.3;
    }
    .sidebar-left .profile-card .social-links { 
        justify-content: flex-start; 
        gap: 6px;
    }
    .sidebar-left .profile-card .social-links a {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    /* 左侧栏 - 欢迎来访 + 音乐播放器 水平并排 */
    .sidebar-left .mobile-row {
        display: flex;
        gap: 10px;
    }
    .sidebar-left .mobile-row .card {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    .sidebar-left .music-player .album-art {
        width: 100px;
        height: 100px;
        margin: 0 auto 6px;
    }
    .sidebar-left .music-player .song-name { font-size: 12px; }
    .sidebar-left .music-player .song-artist { font-size: 11px; }
    .sidebar-left .music-player .controls { gap: 8px; }
    .sidebar-left .music-player .controls button {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    /* 左侧栏 - 分类标签采用更紧凑的2列布局 */
    .sidebar-left .tag-list {
        gap: 4px;
    }
    .sidebar-left .tag-list .tag {
        font-size: 11px;
        padding: 2px 8px;
    }

    /* 左侧栏卡片通用 */
    .sidebar-left .card {
        padding: 14px;
        margin-bottom: 10px;
    }
    .sidebar-left .widget-title {
        font-size: 13px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    /* 右侧栏 - 两列网格布局 */
    .sidebar-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .sidebar-right .card {
        padding: 12px;
        margin-bottom: 0;
    }
    .sidebar-right .widget-title {
        font-size: 12px;
        margin-bottom: 6px;
        padding-bottom: 4px;
    }
    .sidebar-right .stat-item {
        font-size: 11px;
        padding: 2px 0;
    }

    /* 右侧栏 - 日历精简 */
    .sidebar-right .calendar th,
    .sidebar-right .calendar td {
        font-size: 11px;
        padding: 2px;
    }
    .sidebar-right .calendar td.today {
        width: 22px;
        height: 22px;
        line-height: 22px;
    }

    /* 右侧栏 - 倒计时精简 */
    .sidebar-right .countdown-item {
        font-size: 11px;
        padding: 4px 0;
    }
    .sidebar-right .countdown-item .days {
        font-size: 10px;
        padding: 1px 6px;
    }

    /* 右侧栏 - 进度条精简 */
    .sidebar-right .progress-item {
        margin: 4px 0;
    }
    .sidebar-right .progress-item .p-label {
        font-size: 10px;
    }
    .sidebar-right .progress-item .p-bar {
        height: 4px;
    }

    /* 日记页面 */
    .diary-entry {
        padding: 14px;
        margin-bottom: 12px;
    }
    .diary-entry .diary-content { font-size: 13px; }

    /* 设备清单 */
    .device-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .device-card {
        padding: 12px 8px;
    }
    .device-card .device-icon { font-size: 26px; }
    .device-card .device-name { font-size: 13px; }
    .device-card .device-spec { font-size: 11px; }

    /* 页脚 */
    .footer {
        padding: 16px 12px;
        font-size: 12px;
    }

    /* 小动物装饰区 */
    .content-area > div:last-child {
        gap: 4px !important;
        padding: 10px !important;
    }
    .content-area > div:last-child span {
        font-size: 18px !important;
    }
}

/* 超小屏手机 */
@media (max-width: 400px) {
    .navbar .search-box input {
        width: 70px;
        padding: 4px 8px;
        font-size: 11px;
    }
    .navbar .search-box input:focus { width: 100px; }
    .navbar .logo { font-size: 13px; }
    .navbar .nav-links { gap: 8px; }
    .navbar .nav-links a { font-size: 12px; }
    .device-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}
