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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    min-height: 100vh;
    color: #e0e0e0;
}

/* ===== Header ===== */
.header {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-icon { font-size: 26px; }
.header h1, .brand h1 {
    font-size: 20px; font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.2s;
}
.nav a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav a.active {
    background: linear-gradient(135deg, #a78bfa, #f472b6);
    color: #fff;
}

.welcome-banner {
    text-align: center;
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    padding: 12px 16px 0;
}

.container { max-width: 1400px; margin: 0 auto; padding: 24px 24px 40px; }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.search-box { position: relative; }
.search-box .search-icon {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%); font-size: 14px; opacity: 0.5;
}
.search-box input {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 14px 10px 36px;
    border-radius: 12px; color: #fff;
    font-size: 14px; outline: none; width: 260px; transition: all 0.2s;
}
.search-box input:focus {
    border-color: #a78bfa; background: rgba(255,255,255,0.12);
}
.search-box input::placeholder { color: rgba(255,255,255,0.3); }
.count-info { font-size: 13px; color: rgba(255,255,255,0.4); }

/* ===== Game Grid ===== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    min-height: 200px;
}
.post-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px; overflow: hidden; cursor: pointer;
    transition: all 0.3s ease;
    display: flex; flex-direction: column;
}
.post-card:hover {
    transform: translateY(-4px);
    border-color: rgba(167,139,250,0.3);
    box-shadow: 0 12px 40px rgba(167,139,250,0.15);
}
.post-thumbnail {
    position: relative; height: 168px; overflow: hidden;
    background: rgba(0,0,0,0.3);
}
.post-thumbnail img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform 0.4s;
}
.post-card:hover .post-thumbnail img { transform: scale(1.06); }
.post-thumbnail .noimg {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; opacity: 0.3;
}
.post-badge {
    position: absolute; top: 10px; left: 10px;
    font-size: 11px; font-weight: 600;
    padding: 3px 10px; border-radius: 8px; color: #fff;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    box-shadow: 0 2px 8px rgba(124,58,237,0.3);
    max-width: 80%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-content { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.post-title {
    font-size: 15px; font-weight: 600; color: #fff;
    line-height: 1.35; margin-bottom: 8px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.post-excerpt {
    font-size: 12px; color: rgba(255,255,255,0.45);
    line-height: 1.5; flex: 1;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.post-meta {
    display: flex; gap: 10px; flex-wrap: wrap;
    font-size: 11px; color: rgba(255,255,255,0.4);
    margin-top: 10px;
}
.read-more {
    margin-top: 12px;
    font-size: 13px; font-weight: 600;
    color: #a78bfa;
}

.empty-state {
    text-align: center; padding: 60px 20px;
    color: rgba(255,255,255,0.35); font-size: 15px;
    grid-column: 1 / -1;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

/* ===== Pagination ===== */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 6px; margin-top: 32px; flex-wrap: wrap;
}
.page-btn {
    padding: 6px 14px; border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.6);
    border-radius: 8px; cursor: pointer; font-size: 13px;
    transition: all 0.2s; min-width: 36px; text-align: center;
}
.page-btn:hover:not(.active):not(:disabled) {
    background: rgba(255,255,255,0.1); border-color: rgba(167,139,250,0.3); color: #fff;
}
.page-btn.active {
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    color: #fff; border-color: transparent;
}
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.footer {
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,0.25);
    padding: 8px 16px 32px;
}

/* ===== Detail Modal ===== */
.modal-overlay {
    display: none; position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
    z-index: 1000; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #1e1b4b; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px; width: 90%; max-width: 640px; max-height: 88vh;
    overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    position: relative; padding: 28px;
}
.modal-close {
    position: absolute; top: 16px; right: 16px;
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5);
    font-size: 16px; cursor: pointer;
}
.modal-close:hover { background: rgba(255,255,255,0.15); color: #fff; }
.detail-head h2 {
    font-size: 20px; font-weight: 700; color: #fff;
    margin-bottom: 16px; padding-right: 36px;
}
.detail-imgs {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px; margin-bottom: 18px;
}
.detail-img {
    width: 100%; height: 100px; object-fit: cover;
    border-radius: 10px; background: rgba(0,0,0,0.3);
}
.detail-fields {
    display: grid; gap: 8px; margin-bottom: 16px;
}
.detail-fields > div {
    display: flex; gap: 12px; font-size: 14px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
}
.detail-fields b { color: #a78bfa; min-width: 72px; font-weight: 600; }
.detail-fields span { color: rgba(255,255,255,0.75); word-break: break-all; }
.download-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%; padding: 12px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    color: #fff; border: none; border-radius: 12px;
    font-size: 15px; font-weight: 600; text-decoration: none;
    margin-bottom: 16px; transition: all 0.2s;
}
.download-btn:hover { box-shadow: 0 4px 15px rgba(124,58,237,0.35); }
.detail-desc h4 { font-size: 14px; color: #fff; margin-bottom: 8px; }
.detail-desc p { font-size: 13px; line-height: 1.7; color: rgba(255,255,255,0.65); white-space: pre-wrap; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

@media (max-width: 640px) {
    .header-inner { padding: 12px 16px; flex-direction: column; align-items: stretch; }
    .header h1, .brand h1 { text-align: center; font-size: 18px; }
    .nav { justify-content: center; }
    .search-box input { width: 100%; }
    .container { padding: 16px; }
    .posts-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .post-thumbnail { height: 110px; }
    .post-title { font-size: 13px; }
    .post-excerpt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
        overflow: hidden; font-size: 11px; line-height: 1.45; margin-top: 4px; }
}
@media (max-width: 400px) {
    .container { padding: 12px; }
    .posts-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .post-thumbnail { height: 100px; }
    .post-title { font-size: 12.5px; }
    .post-excerpt { font-size: 11px; -webkit-line-clamp: 2; margin-top: 3px; }
}

/* ===== crawler / extract-tool 兼容层 ===== */
.logo {
    font-size: 20px; font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #f472b6);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 24px; }
.admin-section {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px; padding: 24px; margin-top: 8px;
}
.admin-section h2 { font-size: 20px; color: #fff; margin-bottom: 12px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 8px; color: rgba(255,255,255,0.8); font-size: 14px; }
.form-group input, .form-group textarea, .url-row input {
    width: 100%; padding: 12px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px; color: #fff; font-size: 14px; outline: none; font-family: inherit;
}
.form-group textarea { min-height: 120px; resize: vertical; }
.btn {
    padding: 10px 20px; border: none; border-radius: 10px; cursor: pointer;
    font-size: 14px; font-weight: 600; color: #fff;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
}
.btn-primary { background: linear-gradient(135deg, #a78bfa, #7c3aed); color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }

/* ===== Login (extract-tool 复用) ===== */
.login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.login-box {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px; padding: 40px; width: 90%; max-width: 400px;
    backdrop-filter: blur(10px);
}
.login-box h2 { text-align: center; margin-bottom: 30px; color: #a78bfa; font-size: 22px; }
.login-box .form-group { margin-bottom: 20px; }
.login-box .form-group label { display: block; margin-bottom: 8px; color: rgba(255,255,255,0.8); }
.login-box .form-group input {
    width: 100%; padding: 12px; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px; background: rgba(255,255,255,0.05); color: #fff;
    font-size: 16px; box-sizing: border-box;
}
.login-box .form-group input:focus { outline: none; border-color: #a78bfa; }
.login-box .btn {
    width: 100%; padding: 12px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    border: none; border-radius: 10px; color: #fff; font-size: 16px; cursor: pointer;
}
.login-error { color: #ff6b6b; text-align: center; margin-top: 15px; font-size: 14px; display: none; }

/* ===== Detail page (game.html) ===== */
.game-detail-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px; overflow: hidden;
}
.detail-slider { position: relative; background: rgba(0,0,0,0.35); }
.detail-slides { position: relative; min-height: 300px; }
.detail-slide { display: none; }
.detail-slide.active { display: block; }
.detail-slide img {
    width: 100%; height: 320px; object-fit: contain; display: block;
}
.slider-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.1); color: #fff; font-size: 16px; cursor: pointer;
}
.slider-arrow.prev { left: 14px; }
.slider-arrow.next { right: 14px; }
.slider-arrow:hover { background: rgba(255,255,255,0.2); }
.detail-dots {
    position: absolute; bottom: 10px; left: 0; right: 0;
    display: flex; justify-content: center; gap: 6px;
}
.detail-dots .dot {
    width: 8px; height: 8px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,0.3);
}
.detail-dots .dot.active { background: #a78bfa; }
.detail-body { padding: 24px; }
.detail-title { font-size: 22px; color: #fff; margin-bottom: 10px; }
.detail-tag {
    display: inline-block; font-size: 12px; padding: 4px 12px; border-radius: 10px;
    background: rgba(167,139,250,0.15); color: #c4b5fd; margin-bottom: 14px;
}
.detail-fields { display: grid; gap: 8px; margin-bottom: 16px; }
.detail-field {
    display: flex; gap: 12px; font-size: 14px; padding: 8px 12px;
    background: rgba(255,255,255,0.04); border-radius: 10px;
}
.detail-label { color: #a78bfa; min-width: 72px; font-weight: 600; }
.detail-field span:last-child { color: rgba(255,255,255,0.75); word-break: break-all; }
.detail-desc { margin-top: 8px; }
.detail-desc-title { font-size: 14px; color: #fff; margin-bottom: 8px; }
.detail-desc-text {
    font-family: inherit; font-size: 13px; line-height: 1.7;
    color: rgba(255,255,255,0.65); white-space: pre-wrap; word-break: break-word;
    background: rgba(255,255,255,0.03); border-radius: 10px; padding: 12px;
}
.back-link {
    display: inline-block; margin-top: 20px; font-size: 13px;
    color: rgba(255,255,255,0.5); text-decoration: none;
}
.back-link:hover { color: #a78bfa; }

/* ===== 小游戏库补充 ===== */
.page-dots { color: rgba(255,255,255,0.3); padding: 0 4px; font-size: 13px; }
.detail-slides .detail-slide img { height: auto; max-height: 70vh; object-fit: contain; }
.detail-head h2 { margin-bottom: 10px; }
@media (max-width: 640px) {
    .detail-imgs { grid-template-columns: 1fr 1fr; }
    .detail-slide img { height: auto; }
}

/* ===== 详情页优化：介绍与下载按钮间距 / 手机端一屏可见 ===== */
.detail-desc + .download-btn { margin-top: 18px; }
@media (max-width: 640px) {
    .modal-box { padding: 18px 16px; max-height: 94vh; }
    .detail-head h2 { font-size: 18px; margin-bottom: 8px; }
    .detail-slides { min-height: 0; }
    .detail-slider { margin: 0 -16px; }
    .detail-slides .detail-slide img { width: 100%; height: auto; max-height: 58vh; object-fit: contain; }
    .detail-desc { margin-top: 6px; }
    .detail-desc h4 { font-size: 13px; margin-bottom: 4px; }
    .detail-desc p { font-size: 12.5px; line-height: 1.6; }
    .download-btn { margin-top: 16px; padding: 11px; margin-bottom: 6px; }
}

/* ===== 切换箭头：深底白字，避免被图片吃掉 ===== */
.slider-arrow {
    background: rgba(0,0,0,0.55) !important;
    color: #fff; font-size: 18px; z-index: 6;
    box-shadow: 0 2px 10px rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
}
.slider-arrow:hover { background: rgba(0,0,0,0.78) !important; }
.detail-dots { z-index: 6; }
.detail-dots .dot { box-shadow: 0 0 6px rgba(0,0,0,0.7); }
@media (max-width: 640px) {
    .slider-arrow { width: 36px; height: 36px; font-size: 16px; }
    .slider-arrow.prev { left: 6px; }
    .slider-arrow.next { right: 6px; }
}

/* ===== 分类标签放到游戏名旁边 ===== */
.post-badge-inline {
    display: inline-block; margin-left: 6px; vertical-align: middle;
    font-size: 10px; font-weight: 500; line-height: 1.5;
    padding: 1px 7px; border-radius: 8px; white-space: nowrap;
    background: rgba(167,139,250,0.18); color: #c4b5fd; border: 1px solid rgba(167,139,250,0.25);
}
@media (max-width: 640px) {
    .post-badge-inline { font-size: 9px; padding: 0 5px; margin-left: 4px; }
}
