/* ====================================================
   基础重置（兼容安卓/iOS）
   ==================================================== */
*,
*::before,
*::after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    font-size: 100%;
}
body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f7fa;
    color: #1e293b;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img,
video {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}
a {
    color: #2563eb;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
    width: 100%;
}
.flex-between {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
}

/* ====================================================
   导航栏
   ==================================================== */
.navbar {
    background: #0f172a;
    color: #fff;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}
.logo-svg {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    -webkit-filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.5));
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.5));
    -webkit-transition: -webkit-transform 0.3s ease;
    transition: transform 0.3s ease;
}
.logo-svg:hover {
    -webkit-transform: scale(1.08);
    transform: scale(1.08);
}
.logo-text {
    font-family: 'Playfair Display', 'Times New Roman', serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.3), 0 0 40px rgba(251, 191, 36, 0.1);
    letter-spacing: 2px;
    line-height: 1;
}
.logo-text .gold {
    background: -webkit-linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
}

.main-nav {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    gap: 20px;
    margin: 0 20px;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
}
.main-nav a {
    font-size: 1.6rem;
    font-weight: 900;
    color: transparent;
    background: -webkit-linear-gradient(135deg, #fbbf24 0%, #f59e0b 60%, #fbbf24 100%);
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 60%, #fbbf24 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.4), 0 0 60px rgba(251, 191, 36, 0.2);
    text-decoration: none;
    -webkit-transition: 0.3s;
    transition: 0.3s;
    letter-spacing: 2px;
    padding: 6px 16px;
    border-radius: 30px;
}
.main-nav a:hover {
    text-shadow: 0 0 40px rgba(251, 191, 36, 0.8), 0 0 80px rgba(251, 191, 36, 0.4);
    -webkit-transform: scale(1.05);
    transform: scale(1.05);
    background: rgba(251, 191, 36, 0.1);
    border-radius: 30px;
}

.nav-actions {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    gap: 8px;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
}
.nav-actions .nav-link {
    color: #e2e8f0;
    text-decoration: none;
    margin-right: 12px;
    font-size: 0.95rem;
}
.nav-actions .nav-link:hover {
    color: #fbbf24;
}
.btn-outline {
    background: transparent;
    border: 1px solid #94a3b8;
    color: #e2e8f0;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
}
.btn-outline:hover {
    background: #334155;
}
.btn-gold {
    background: #fbbf24;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
}

/* 移动端导航调整（兼容所有移动设备） */
@media screen and (max-width: 799px) {
    .navbar .container {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -webkit-flex-direction: column;
        flex-direction: column;
        -webkit-box-align: stretch;
        -webkit-align-items: stretch;
        align-items: stretch;
        gap: 8px;
    }
    .logo {
        -webkit-box-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
        width: 100%;
    }
    .logo-svg {
        width: 36px;
        height: 36px;
    }
    .logo-text {
        font-size: 1.6rem;
    }
    .main-nav {
        -webkit-box-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
        gap: 12px;
        margin: 8px 0;
    }
    .main-nav a {
        font-size: 1.2rem;
        padding: 4px 12px;
    }
    .nav-actions {
        -webkit-box-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
        width: 100%;
        margin-top: 6px;
        gap: 6px;
    }
    .nav-actions .nav-link {
        margin-right: 6px;
        font-size: 0.85rem;
    }
    .btn-outline {
        padding: 3px 10px;
        font-size: 0.75rem;
    }
}

/* ====================================================
   网格系统（强制一致）
   ==================================================== */
.grid-3,
.grid-4 {
    display: -ms-grid;
    display: grid;
    width: 100%;
    gap: 20px;
    margin-bottom: 40px;
}
.grid-3 {
    -ms-grid-columns: 1fr 1fr 1fr;
    grid-template-columns: repeat(3, 1fr);
}
.grid-4 {
    -ms-grid-columns: 1fr 1fr 1fr 1fr;
    grid-template-columns: repeat(4, 1fr);
}

/* PC端以上保持不变，移动端统一为2列 */
@media screen and (max-width: 799px) {
    .grid-3 {
        -ms-grid-columns: 1fr 1fr;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .grid-4 {
        -ms-grid-columns: 1fr 1fr;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}
/* 极小屏手机（<400px）仍保持2列，避免单列，但若实在太挤可调整为1列，但2列更符合设计 */
@media screen and (max-width: 399px) {
    .grid-3,
    .grid-4 {
        -ms-grid-columns: 1fr 1fr;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* ====================================================
   卡片
   ==================================================== */
.card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    -webkit-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    -webkit-transition: 0.2s;
    transition: 0.2s;
    cursor: pointer;
    position: relative;
    width: 100%;
}
.card:hover {
    -webkit-transform: translateY(-4px);
    transform: translateY(-4px);
    -webkit-box-shadow: 0 12px 24px rgba(0, 0, 0, 0.10);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.10);
}
.card-img {
    width: 100%;
    background: #e2e8f0;
    position: relative;
    overflow: hidden;
}
.ad-card .card-img {
    aspect-ratio: 16 / 10;
}
.image-card .card-img {
    aspect-ratio: 1 / 1;
}
.card-img img {
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
    object-fit: cover;
    display: block;
}

/* 角标（兼容性） */
.badge {
    position: absolute;
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 20px;
    z-index: 2;
}
.badge-top-left {
    top: 8px;
    left: 8px;
    background: #f59e0b;
    color: #000;
}
.badge-top-right {
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: #fff;
}
.badge-bottom-left {
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}
.badge-stamp {
    position: absolute;
    bottom: 8px;
    right: 8px;
    -webkit-transform: rotate(-12deg);
    transform: rotate(-12deg);
    background: #dc2626;
    color: #fff;
    padding: 2px 8px;
    font-size: 0.7rem;
    border-radius: 4px;
    opacity: 0.9;
}
.card-title {
    padding: 10px 12px 6px;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-meta {
    padding: 0 12px 12px;
    font-size: 0.8rem;
    color: #64748b;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
}

/* ====================================================
   详情页
   ==================================================== */
.detail-container {
    max-width: 820px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    overflow: hidden; /* 防止溢出 */
}
#backHome {
    display: inline-block;
    margin-bottom: 20px;
    color: #2563eb;
    cursor: pointer;
}
.detail-content {
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
}
/* 清除浮动（兼容旧版富文本可能插入的 float） */
.detail-content::after {
    content: '';
    display: table;
    clear: both;
}
.detail-content img,
.detail-content video {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 12px 0;
}
.detail-content .text-block {
    margin: 16px 0;
    line-height: 1.8;
}
.detail-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}
.detail-content table td,
.detail-content table th {
    border: 1px solid #ccc;
    padding: 8px;
}
.detail-content pre,
.detail-content code {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    background: #f1f5f9;
    padding: 8px;
    border-radius: 4px;
    max-width: 100%;
}
.detail-content .align-left {
    text-align: left;
}
.detail-content .align-center {
    text-align: center;
}
.detail-content .align-right {
    text-align: right;
}
.detail-content .align-justify {
    text-align: justify;
}
/* 图片容器（用于浮动清除） */
.detail-content .img-wrapper {
    max-width: 100%;
    overflow: hidden;
}
.detail-content .img-wrapper img {
    margin: 0 auto;
    display: block;
}
.detail-content .img-wrapper.float-left {
    float: left;
    margin-right: 16px;
}
.detail-content .img-wrapper.float-right {
    float: right;
    margin-left: 16px;
}
@media screen and (max-width: 799px) {
    .detail-container {
        padding: 16px;
    }
    .detail-content h1 {
        font-size: 1.6rem;
    }
    .detail-content h2 {
        font-size: 1.3rem;
    }
    .detail-content p {
        font-size: 0.95rem;
    }
    .detail-content .img-wrapper.float-left,
    .detail-content .img-wrapper.float-right {
        float: none;
        margin: 12px 0;
        text-align: center;
    }
}

/* ====================================================
   互动栏
   ==================================================== */
.interact-bar {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    gap: 20px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
}
.interact-btn {
    background: #f1f5f9;
    border: none;
    padding: 8px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.95rem;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    gap: 6px;
}
.interact-btn.active {
    background: #dbeafe;
    color: #2563eb;
}

.quick-reply {
    margin-top: 20px;
}
.quick-tags {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.quick-tag {
    background: #e2e8f0;
    padding: 6px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.85rem;
    -webkit-transition: 0.2s;
    transition: 0.2s;
}
.quick-tag:hover {
    background: #cbd5e1;
}
.reply-list {
    margin-top: 16px;
    max-height: 300px;
    overflow-y: auto;
}
.reply-item {
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

/* ====================================================
   模态框
   ==================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    z-index: 999;
}
.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
}
.modal-content input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}
.close {
    float: right;
    font-size: 1.8rem;
    cursor: pointer;
}

/* ====================================================
   管理面板（内嵌前台）
   ==================================================== */
.admin-form label {
    display: block;
    margin: 6px 0;
}
.admin-input {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 200px;
}
#contentEditor {
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
    min-height: 150px;
    color: #000;
}

/* ====================================================
   辅助
   ==================================================== */
.section-title {
    font-size: 1.4rem;
    margin: 30px 0 16px;
    font-weight: 700;
}
.page {
    display: none;
}
.page.active {
    display: block;
}
#adGrid,
#imageGrid {
    width: 100%;
}

/* ====================================================
   合作联系页
   ==================================================== */
.page-container {
    max-width: 820px;
    margin: 40px auto;
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    -webkit-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.page-container h1 {
    font-size: 2rem;
    margin-bottom: 20px;
}
.page-content {
    line-height: 1.8;
}
.page-content img,
.page-content video {
    max-width: 100% !important;
    height: auto !important;
}
@media screen and (max-width: 799px) {
    .page-container {
        padding: 16px;
        margin: 20px 12px;
    }
    .page-container h1 {
        font-size: 1.6rem;
    }
}

/* ====================================================
   编辑器工具栏（后台）
   ==================================================== */
.editor-toolbar {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 10;
}
.editor-toolbar button,
.editor-toolbar select {
    background: #fff;
    border: 1px solid #d1d9e6;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
}
.editor-toolbar button:hover {
    background: #e2e8f0;
}
.editor-toolbar select {
    padding: 3px 6px;
}
.editor-content {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-top: none;
    padding: 12px;
    min-height: 200px;
    color: #000;
    line-height: 1.8;
    border-radius: 0 0 8px 8px;
}
.editor-content:focus {
    outline: 2px solid #fbbf24;
}

/* ====================================================
   图片交互（后台编辑用）
   ==================================================== */
.editor-content img {
    max-width: 100%;
    height: auto;
    cursor: pointer;
    -webkit-transition: -webkit-box-shadow 0.2s;
    transition: box-shadow 0.2s;
}
.editor-content img.selected {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}
.resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fbbf24;
    border: 2px solid #fff;
    border-radius: 50%;
    -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    pointer-events: auto;
    cursor: nwse-resize;
}
.resize-handle.nw {
    top: -7px;
    left: -7px;
    cursor: nw-resize;
}
.resize-handle.ne {
    top: -7px;
    right: -7px;
    cursor: ne-resize;
}
.resize-handle.sw {
    bottom: -7px;
    left: -7px;
    cursor: sw-resize;
}
.resize-handle.se {
    bottom: -7px;
    right: -7px;
    cursor: se-resize;
}
.image-toolbar {
    position: absolute;
    top: -44px;
    left: 50%;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    background: #0f172a;
    border-radius: 8px;
    padding: 4px 6px;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    gap: 4px;
    -webkit-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    white-space: nowrap;
    pointer-events: auto;
}
.image-toolbar button {
    background: transparent;
    border: none;
    color: #e2e8f0;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    -webkit-transition: 0.2s;
    transition: 0.2s;
}
.image-toolbar button:hover {
    background: #334155;
    color: #fbbf24;
}
.image-toolbar button.active {
    background: #fbbf24;
    color: #0f172a;
}
/* ===== 升级会员弹窗 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* 更深的背景遮罩 */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999; /* 确保在最上层 */
    backdrop-filter: blur(4px); /* 背景虚化效果，更显焦点 */
    animation: fadeIn 0.3s ease;
}

.modal-overlay .modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 30px 20px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid #fbbf24; /* 金色边框 */
    position: relative;
    animation: scaleIn 0.3s ease;
}

.modal-overlay .modal-content .close {
    position: absolute;
    top: 12px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #64748b;
    transition: 0.2s;
}
.modal-overlay .modal-content .close:hover {
    color: #0f172a;
    transform: rotate(90deg);
}

.modal-overlay .modal-content h2 {
    color: #0f172a;
    text-align: center;
    font-size: 2rem;
    margin-bottom: 20px;
    border-bottom: 2px solid #fbbf24;
    padding-bottom: 12px;
}

.modal-overlay .modal-content .btn-buy {
    background: #fbbf24;
    border: none;
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: bold;
    color: #0f172a;
    cursor: pointer;
    transition: 0.2s;
    margin: 4px;
}
.modal-overlay .modal-content .btn-buy:hover {
    background: #f59e0b;
    transform: scale(1.05);
}

/* 弹窗动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* 移动端适配 */
@media (max-width: 600px) {
    .modal-overlay .modal-content {
        padding: 20px 16px;
        border-radius: 16px;
    }
    .modal-overlay .modal-content h2 {
        font-size: 1.6rem;
    }
}
.btn-post {
    background: #fbbf24;
    border: none;
    padding: 8px 20px;
    border-radius: 30px;
    font-weight: bold;
    color: #0f172a;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}
.btn-post:hover {
    background: #f59e0b;
    transform: scale(1.03);
}
/* 发帖编辑器样式 */
#postEditor {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
#postEditor .form-group {
    margin-bottom: 12px;
}
#postEditor label {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}
#postEditor input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}
/* 所有弹窗/遮罩默认隐藏，且不阻挡点击 */
.modal-overlay,
#rechargeModal,
#paymentModal,
#rulesModal {
    display: none !important;
    pointer-events: none !important;
    opacity: 0 !important;
    z-index: -1 !important;
}

/* 激活时恢复显示（由 JS 控制） */
.modal-overlay.active,
#rechargeModal.active,
#paymentModal.active,
#rulesModal.active {
    display: flex !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    z-index: 9999 !important;
}
/* 图片选中高亮 */
.editor-content img.is-selected,
#editorContent img.is-selected {
    outline: 4px solid #fbbf24; /* 金色边框 */
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #fff, 0 0 0 6px #fbbf24;
}