/* ========== CSS 变量 & 重置 ========== */
:root {
    --primary: #007AFF;
    --primary-light: #5AC8FA;
    --primary-dark: #0055CC;
    --glass-bg: rgba(255, 255, 255, 0.18);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-shadow: 0 8px 32px rgba(0, 122, 255, 0.12);
    --text-primary: #1C1C1E;
    --text-secondary: #3A3A3C;
    --text-light: #8E8E93;
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --safe-top: env(safe-area-inset-top, 20px);
    --safe-bottom: env(safe-area-inset-bottom, 20px);
    --island-height: 44px;
    --island-width: 126px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(145deg, #E8F4FD 0%, #D4E9FF 100%);
    min-height: 100vh;
    color: var(--text-primary);
    padding-top: calc(var(--island-height) + 28px);
    padding-bottom: 40px;
    overflow-x: hidden;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* ========== 通用玻璃卡片 ========== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.glass:hover {
    box-shadow: 0 12px 48px rgba(0, 122, 255, 0.18);
    transform: translateY(-2px);
}

/* ========== 容器 ========== */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 18px;
}

/* ========== 灵动岛 (Dynamic Island) ========== */
#dynamic-island {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: var(--island-width);
    height: var(--island-height);
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    overflow: hidden;
    user-select: none;
}
#dynamic-island.expanded {
    width: 280px;
    height: 52px;
    border-radius: 60px;
}
#dynamic-island .island-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0 18px;
    gap: 10px;
    color: #fff;
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0.3px;
    position: relative;
}
#dynamic-island .island-content .welcome-text {
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.4s ease;
    font-weight: 600;
    background: linear-gradient(135deg, #fff 30%, #5AC8FA 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
#dynamic-island .island-content .welcome-text.hidden {
    opacity: 0;
    width: 0;
    overflow: hidden;
}
#dynamic-island .island-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-light);
    box-shadow: 0 0 12px rgba(90, 200, 250, 0.5);
    flex-shrink: 0;
    transition: all 0.3s ease;
}
#dynamic-island .island-nav {
    display: flex;
    gap: 8px;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    flex: 1;
    justify-content: center;
}
#dynamic-island.expanded .island-nav {
    opacity: 1;
    pointer-events: auto;
}
#dynamic-island .island-nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 40px;
    background: rgba(255, 255, 255, 0.08);
    transition: all 0.25s ease;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
#dynamic-island .island-nav a:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.04);
}
#dynamic-island .island-nav a svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ========== 轮播图 ========== */
.carousel-wrapper {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 28px;
    box-shadow: 0 8px 30px rgba(0, 122, 255, 0.10);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    height: 200px;
}
.carousel-track {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    height: 100%;
    will-change: transform;
}
.carousel-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
    flex-shrink: 0;
}
.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.carousel-slide .slide-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 24px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.45));
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    backdrop-filter: blur(4px);
}
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.08);
}
.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }
.carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 5;
}
.carousel-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transition: all 0.3s ease;
    cursor: pointer;
}
.carousel-dots span.active {
    background: #fff;
    width: 24px;
    border-radius: 6px;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

/* ========== 广告位 ========== */
.ad-banner {
    position: relative;
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    overflow: hidden;
}
.ad-banner.hidden { display: none; }
.ad-banner .ad-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 30px;
    transition: all 0.2s ease;
    opacity: 0.6;
}
.ad-banner .ad-close:hover {
    background: rgba(0, 0, 0, 0.05);
    opacity: 1;
}
.ad-banner .ad-close svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
.ad-banner .ad-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.ad-banner .ad-body { flex: 1; }
.ad-banner .ad-body h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}
.ad-banner .ad-body p {
    font-size: 13px;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* ========== 文章卡片 ========== */
.post-card {
    padding: 24px 26px;
    margin-bottom: 22px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 24px rgba(0, 122, 255, 0.06);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}
.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0, 122, 255, 0.12);
}
.post-card .top-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 14px;
    border-radius: 30px;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}
.post-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.post-card .meta {
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 12px;
    align-items: center;
}
.post-card .meta svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    vertical-align: middle;
    margin-right: 4px;
}
.post-card .excerpt {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
    margin-top: 8px;
    opacity: 0.85;
}
.post-card .post-image {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
}

/* ========== 文章详情页 ========== */
.article-full {
    padding: 28px 30px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 30px rgba(0, 122, 255, 0.06);
    margin-bottom: 24px;
}
.article-full h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.3;
}
.article-full .article-meta {
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.article-full .article-body {
    font-size: 16.5px;
    line-height: 1.9;
    color: var(--text-secondary);
}
.article-full .article-body p { margin-bottom: 18px; }

/* ========== 评论区域 ========== */
.comment-section {
    padding: 24px 26px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px) saturate(170%);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    margin-top: 18px;
}
.comment-section h4 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.comment-item {
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.comment-item:last-child { border-bottom: none; }
.comment-item .comment-author {
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.comment-item .comment-author .badge {
    background: var(--primary-light);
    color: #fff;
    font-size: 10px;
    padding: 0 10px;
    border-radius: 30px;
    font-weight: 500;
}
.comment-item .comment-time {
    font-size: 12px;
    color: var(--text-light);
    margin-left: 8px;
}
.comment-item .comment-text {
    margin-top: 6px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}
.comment-form input,
.comment-form textarea {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}
.comment-form input:focus,
.comment-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
    background: rgba(255, 255, 255, 0.25);
}
.comment-form textarea {
    min-height: 90px;
    resize: vertical;
}

/* ========== 胶囊悬浮按钮 ========== */
.btn-capsule {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    border-radius: 60px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.25);
    text-decoration: none;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-capsule:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 32px rgba(0, 122, 255, 0.35);
    background: var(--primary-dark);
}
.btn-capsule:active { transform: scale(0.96); }
.btn-capsule.outline {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: var(--text-primary);
    box-shadow: none;
}
.btn-capsule.outline:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}
.btn-capsule.small {
    padding: 8px 20px;
    font-size: 13px;
}

/* ========== 点赞按钮 ========== */
.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 16px 6px 12px;
    border-radius: 40px;
    transition: all 0.25s ease;
    background: rgba(255, 255, 255, 0.05);
}
.like-btn:hover { background: rgba(255, 255, 255, 0.15); }
.like-btn.liked { color: #FF3B30; }
.like-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: transform 0.25s ease;
}
.like-btn.liked svg {
    fill: #FF3B30;
    transform: scale(1.1);
}

/* ========== 公告 ========== */
.announcement-item {
    padding: 18px 24px;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-light);
    transition: all 0.3s ease;
}
.announcement-item:hover { background: rgba(255, 255, 255, 0.22); }
.announcement-item .ann-title {
    font-weight: 700;
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.announcement-item .ann-title .top-tag {
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    padding: 0 12px;
    border-radius: 30px;
    font-weight: 600;
}
.announcement-item .ann-content {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}
.announcement-item .ann-time {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 6px;
}

/* ========== 页面标题 ========== */
.page-header {
    margin-bottom: 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h2 {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== 后台样式 ========== */
.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 18px;
}
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    margin-bottom: 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.admin-header h1 { font-size: 24px; font-weight: 700; }
.admin-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.admin-nav a {
    padding: 8px 18px;
    border-radius: 40px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.25s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
}
.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(0, 122, 255, 0.08);
    border-color: var(--primary);
    color: var(--primary);
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.admin-table th {
    text-align: left;
    padding: 12px 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}
.admin-table tr:hover td { background: rgba(255, 255, 255, 0.04); }
.admin-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}
.admin-form input,
.admin-form textarea,
.admin-form select {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
    margin-bottom: 16px;
}
.admin-form input:focus,
.admin-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.08);
    background: rgba(255, 255, 255, 0.15);
}
.admin-form textarea { min-height: 140px; resize: vertical; }
.admin-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.admin-actions .btn-capsule {
    font-size: 13px;
    padding: 8px 20px;
}
.badge-danger {
    background: #FF3B30;
    color: #fff;
    padding: 2px 12px;
    border-radius: 30px;
    font-size: 12px;
}
.badge-success {
    background: #34C759;
    color: #fff;
    padding: 2px 12px;
    border-radius: 30px;
    font-size: 12px;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    :root { --island-width: 100px; --island-height: 40px; }
    body { padding-top: calc(var(--island-height) + 24px); padding-bottom: 24px; }
    #dynamic-island.expanded { width: 220px; height: 46px; }
    #dynamic-island .island-nav a { font-size: 11px; padding: 4px 10px; }
    #dynamic-island .island-content .welcome-text { font-size: 13px; }
    .container { padding: 0 12px; }
    .post-card { padding: 18px 18px; }
    .article-full { padding: 20px 18px; }
    .article-full h1 { font-size: 22px; }
    .carousel-wrapper { height: 150px; }
    .admin-form .form-row { grid-template-columns: 1fr; }
    .admin-nav a { font-size: 12px; padding: 6px 12px; }
    .page-header h2 { font-size: 20px; }
}
@media (max-width: 420px) {
    #dynamic-island.expanded { width: 180px; height: 40px; }
    #dynamic-island .island-nav a { font-size: 10px; padding: 3px 8px; }
    #dynamic-island .island-dot { width: 7px; height: 7px; }
}

/* ========== 工具类 ========== */
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.w-full { width: 100%; }
.text-muted { color: var(--text-light); font-size: 14px; }

/* ========== 登录页 ========== */
.login-box {
    max-width: 380px;
    margin: 80px auto 0;
    padding: 40px 36px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 60px rgba(0, 122, 255, 0.08);
}
.login-box h2 { text-align: center; margin-bottom: 28px; font-size: 26px; }
.login-box .btn-capsule { width: 100%; justify-content: center; }

/* ========== 灵动岛动画 ========== */
@keyframes islandPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(90, 200, 250, 0.2); }
    50% { box-shadow: 0 0 30px 8px rgba(90, 200, 250, 0.08); }
}
#dynamic-island.welcome-active { animation: islandPulse 2s ease-in-out infinite; }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-light);
}
.empty-state svg {
    width: 60px;
    height: 60px;
    fill: currentColor;
    opacity: 0.2;
    margin-bottom: 16px;
}