:root {
    --bg: #faf7f4;
    --strawberry-milk: #e89b9b;
    --strawberry-light: #f5c4c4;
    --mint-jelly: #a8d8c8;
    --mint-light: #c8ece0;
    --cream-yellow: #fbe8c3;
    --cream-light: #fdf3dc;
    --lavender: #c8b8d8;
    --lavender-light: #dfd4ea;
    --border-dark: #4a4458;
    --text-primary: #3d3648;
    --text-secondary: #6b6378;
    --text-muted: #9a92a5;
    --shadow-soft: 0 4px 20px rgba(74, 68, 88, 0.08);
    --shadow-medium: 0 8px 32px rgba(74, 68, 88, 0.13);
    --shadow-deep: 0 14px 44px rgba(74, 68, 88, 0.18);
    --radius-xl: 28px;
    --border-width: 2.5px;
    --font-title: 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    --font-body: 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse at 15% 20%, rgba(232, 155, 155, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 78% 65%, rgba(168, 216, 200, 0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 40% 80%, rgba(200, 184, 216, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 60% 30%, rgba(251, 232, 195, 0.06) 0%, transparent 45%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.loading-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center; flex-direction: column;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    opacity: 1; visibility: visible;
}
.loading-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loading-gif {
    display: none;
    margin: 0 auto 20px;
    max-width: min(200px, 50vw);
    max-height: min(200px, 50vh);
    width: auto;
    height: auto;
    object-fit: contain;
}

.loading-text {
    display: none;
    margin-top: 10px;
    font-family: var(--font-title);
    font-size: 1.1rem;
    color: var(--text-secondary);
    animation: loadingPulse 1.5s ease-in-out infinite;
}
@keyframes loadingPulse { 0%,100%{opacity:0.6} 50%{opacity:1} }

.loading-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid var(--text-secondary);
    border-top-color: transparent;
    border-radius: 50%;
    margin-left: 8px;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.card-spinner {
    position: absolute;
    top: 13px;
    left: 13px;
    z-index: 6;
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-secondary);
    border-top-color: transparent;
    border-radius: 50%;
    background: rgba(255, 253, 251, 0.7);
    animation: spin 0.8s linear infinite;
    pointer-events: none;
}

.main-container { max-width: 1100px; margin: 0 auto; padding: 24px 28px 60px; }
.header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; margin-bottom: 28px; }
.logo-area { display: flex; align-items: center; gap: 14px; flex-shrink: 0; cursor: pointer; }
.logo-img { max-height: 100px; width: auto; display: block; border-radius: 16px; object-fit: contain; }
.logo-tower { display: none; flex-direction: column; align-items: center; gap: 0; }
.logo-layer { border-radius: 50%; border: 3px solid var(--border-dark); }
.logo-layer:nth-child(1) { width:44px; height:44px; background:var(--strawberry-light); z-index:3; }
.logo-layer:nth-child(2) { width:52px; height:52px; background:var(--cream-yellow); margin-top:-6px; z-index:2; }
.logo-layer:nth-child(3) { width:60px; height:60px; background:var(--mint-light); margin-top:-7px; z-index:1; }
.logo-title { font-family: var(--font-title); font-size: 1.55rem; font-weight: 700; white-space: nowrap; letter-spacing: 0.03em; position: relative; }
.logo-title::after { content: ''; display: inline-block; width: 8px; height: 8px; background: var(--strawberry-milk); border-radius: 50%; margin-left: 6px; vertical-align: middle; animation: dotPulse 2s ease-in-out infinite; }
@keyframes dotPulse { 0%,100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.8); opacity: 0.3; } }

.search-wrapper { flex:1; min-width:300px; max-width:520px; position: relative; }
.search-container { position: relative; z-index: 50; }
.search-input { width:100%; padding:15px 52px 15px 24px; font-size:0.98rem; border:var(--border-width) solid var(--border-dark); border-radius:50px; background:#fffdfb; color:var(--text-primary); outline:none; transition:all 0.3s; box-shadow:var(--shadow-soft); }
.search-input:focus { box-shadow:var(--shadow-deep); border-color:var(--strawberry-milk); }
.search-mascot { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; pointer-events: none; }
.search-mascot::before, .search-mascot::after { content: ''; position: absolute; background: var(--strawberry-light); border: 2px solid var(--border-dark); border-radius: 50%; }
.search-mascot::before { width: 18px; height: 18px; top: 2px; left: 5px; animation: mascotPeek 2.5s ease-in-out infinite; }
.search-mascot::after { width: 10px; height: 10px; bottom: 0; right: 2px; background: var(--cream-yellow); }
@keyframes mascotPeek { 0%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } 60% { transform: translateY(2px); } 85% { transform: translateY(-4px); } }

.search-dropdown { position:absolute; top:calc(100% + 8px); left:8px; right:8px; background:#fffdfb; border:var(--border-width) solid var(--border-dark); border-radius:22px; box-shadow:var(--shadow-medium); z-index:200; max-height:260px; overflow-y:auto; opacity:0; visibility:hidden; transform:translateY(-8px); transition:all 0.25s; list-style:none; padding:6px 0; }
.search-dropdown.active { opacity:1; visibility:visible; transform:translateY(0); }
.search-dropdown-item { padding:11px 20px; cursor:pointer; font-size:0.93rem; color:var(--text-primary); }
.search-dropdown-item:hover { background:#fef0f0; color:#c97a7a; }

.category-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-top: 18px; }
.category-tag { min-width: 140px; justify-content: center; display: inline-flex; align-items: center; padding: 10px 20px; background: #fffdfb; border: var(--border-width) solid var(--border-dark); border-radius: 30px 30px 22px 22px; cursor: pointer; font-size: 0.88rem; font-weight: 600; color: var(--text-primary); transition: all 0.3s var(--transition-bounce); user-select: none; box-shadow: var(--shadow-soft); }
.category-tag::before { content: ''; display: inline-block; width: 12px; height: 12px; background: var(--mint-light); border: 2px solid var(--border-dark); border-radius: 50%; margin-right: 8px; transition: background 0.3s; }
.category-tag.active { background: var(--strawberry-light); color: #fff; border-color: #c97a7a; }
.category-tag.active::before { background: #fff; border-color: #c97a7a; }

.quick-actions { display:grid; grid-template-columns:repeat(4,1fr); gap:18px; margin-bottom:36px; }
.quick-card { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 26px 18px; border: var(--border-width) solid var(--border-dark); border-radius: var(--radius-xl); text-align: center; text-decoration: none; color: var(--text-primary); font-weight: 600; box-shadow: var(--shadow-soft); transition: all 0.35s var(--transition-bounce); position: relative; overflow: hidden; }
.quick-card:nth-child(1) { background: #fff5f5; }
.quick-card:nth-child(2) { background: #f4faf8; }
.quick-card:nth-child(3) { background: #fffef5; }
.quick-card:nth-child(4) { background: #f8f6fc; }
.quick-card:hover { transform: translateY(-8px) scale(1.03); box-shadow: var(--shadow-deep); }
.quick-card::after { content: ''; position: absolute; top: -20px; right: -20px; width: 60px; height: 60px; background: rgba(255,255,255,0.5); border-radius: 50%; transform: scale(0); transition: transform 0.5s ease; }
.quick-card:hover::after { transform: scale(4); opacity: 0; }
.quick-card-title { font-family: var(--font-title); font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; position: relative; z-index: 1; }
.quick-card-desc { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; position: relative; z-index: 1; }

.mod-section-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; padding-left: 16px; border-left: 6px solid var(--strawberry-milk); position: relative; display: inline-block; }
.mod-section-title::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 40px; height: 4px; background: var(--mint-jelly); border-radius: 2px; }

.mod-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:20px; margin-bottom:40px; }
.mod-card { background:#fffdfb; border:var(--border-width) solid var(--border-dark); border-radius:var(--radius-xl); overflow:hidden; transition:all 0.35s var(--transition-bounce); box-shadow:var(--shadow-soft); cursor:pointer; position:relative; }
.mod-card:hover { transform:translateY(-7px) scale(1.02); box-shadow:var(--shadow-deep); }
.mod-cover { position:relative; height:180px; overflow:hidden; border-bottom:var(--border-width) solid var(--border-dark); }
.mod-cover-inner { width:100%; height:100%; position:relative; }
.mod-cover-gradient { width:100%; height:100%; position:absolute; }
.mod-cover-char { position:absolute; z-index:1; font-size:4rem; filter:drop-shadow(0 4px 6px rgba(0,0,0,0.1)); }
.mod-cover-img { position:absolute; width:100%; height:100%; z-index:2; border-radius:inherit; }
.mod-badge { position:absolute; top:12px; right:12px; z-index:5; background:#fffdfb; border:2px solid var(--border-dark); border-radius:20px; padding:5px 12px; font-size:0.75rem; font-weight:700; transform:rotate(6deg); }
.mod-info { padding:16px 18px; }
.mod-title { font-weight:700; font-size:1.05rem; margin-bottom:8px; }
.mod-meta { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; align-items: center; }
.mod-meta-tag { padding:5px 14px; background:#f5f2f8; border:2px solid #ddd8e5; border-radius:20px; font-size:0.78rem; color:var(--text-secondary); }
.mod-tag-list { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.mod-tag-item { padding: 3px 12px; font-size: 0.72rem; border: 2px solid var(--border-dark); border-radius: 20px; background: #fff; color: var(--text-secondary); font-weight: 500; cursor: pointer; transition: all 0.2s; }
.mod-tag-item:hover { background: var(--strawberry-light); color: #fff; border-color: #c97a7a; }
.mod-tag-item.nsfw { background: #ffe8e8; border-color: #f08c8c; color: #b14b4b; }
.mod-tag-item.sfw { background: #e8f5e8; border-color: #8cc8a0; color: #3d6b4f; }
.mod-download-btn { display:inline-block; padding:11px 26px; background:var(--strawberry-milk); color:#fff; border:var(--border-width) solid #c97a7a; border-radius:30px; font-weight:700; cursor:pointer; transition:all 0.3s var(--transition-bounce); text-decoration: none; }
.mod-download-btn:hover { background:#fff; color:var(--strawberry-milk); transform:scale(1.07); }

.modal-overlay { display: none; position: fixed; inset: 0; background: var(--bg); z-index: 300; overflow-y: auto; }
.modal-overlay.active { display: block; }
.modal-content { width: 100%; max-width: 800px; margin: 0 auto; padding: 40px 28px 60px; position: relative; min-height: 100vh; }
.modal-close { position: fixed; top: 16px; right: 24px; z-index: 310; font-size: 2rem; cursor: pointer; color: var(--text-primary); background: #fffdfb; border: var(--border-width) solid var(--border-dark); border-radius: 50%; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; line-height: 1; transition: all 0.2s; }
.modal-close:hover { background: var(--strawberry-light); color: #fff; border-color: #c97a7a; }

.carousel-container { position: relative; border-radius: 20px; overflow: hidden; margin-bottom: 24px; border: var(--border-width) solid var(--border-dark); height: 60vh; }
.carousel-track { display: flex; transition: transform 0.3s ease; height: 100%; }
.carousel-slide { min-width: 100%; height: 100%; cursor: zoom-in; }
.carousel-slide img { width: 100%; height: 100%; display: block; object-fit: contain; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: #fffdfb; border: var(--border-width) solid var(--border-dark); border-radius: 50%; width: 38px; height: 38px; font-size: 1.2rem; cursor: pointer; z-index: 5; display: flex; align-items: center; justify-content: center; color: var(--text-primary); transition: all 0.2s; box-shadow: var(--shadow-soft); }
.carousel-btn:hover { background: var(--strawberry-light); color: #fff; border-color: #c97a7a; }
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }
.carousel-dots { display: flex; justify-content: center; gap: 8px; padding: 10px 0; }
.carousel-dot { width: 10px; height: 10px; background: #ddd8e5; border-radius: 50%; cursor: pointer; transition: background 0.2s; }
.carousel-dot.active { background: var(--strawberry-milk); }

.modal-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 8px; }
.modal-rid { display: inline-block; font-size: 0.9rem; color: var(--text-secondary); background: #f4f1f8; border-radius: 14px; padding: 2px 12px; margin-bottom: 16px; cursor: pointer; border: 1px solid #ddd8e5; transition: 0.2s; user-select: none; }
.modal-rid:hover { background: #e8e2f2; border-color: #c8b8d8; }
.modal-description { margin: 20px 0; color: var(--text-secondary); line-height: 1.7; }
.desc-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; transition: all 0.3s ease; }
.desc-text.expanded { -webkit-line-clamp: unset; display: block; }
.desc-toggle { color: var(--strawberry-milk); font-weight: 600; cursor: pointer; font-size: 0.9rem; margin-top: 4px; display: inline-block; }
.desc-toggle:hover { text-decoration: underline; }

.modal-author { font-size: 1.1rem; font-weight: 700; margin: 18px 0 8px; color: var(--text-primary); }
.author-links-section { margin: 8px 0 18px; }
.author-links-label { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 6px; display: block; font-weight: 500; }
.modal-links { display: flex; gap: 12px; flex-wrap: wrap; }
.modal-link { padding: 8px 20px; border: var(--border-width) solid var(--border-dark); border-radius: 20px; text-decoration: none; color: var(--text-primary); font-weight: 600; font-size: 0.9rem; transition: 0.2s; background: #fffdfb; }
.modal-link:hover { background: var(--strawberry-light); color: #fff; border-color: #c97a7a; }

.modal-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 20px; }
.modal-tag { padding: 5px 16px; border: 2px solid var(--border-dark); border-radius: 20px; font-size: 0.85rem; font-weight: 500; background: #fffdfb; }
.modal-tag.nsfw { background: #ffe8e8; border-color: #f08c8c; color: #b14b4b; }
.modal-tag.sfw { background: #e8f5e8; border-color: #8cc8a0; color: #3d6b4f; }

.download-section { margin-top: 28px; padding-top: 24px; border-top: 2px dashed var(--border-dark); }
.download-buttons { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.download-btn-item { display: inline-block; padding: 10px 22px; background: var(--strawberry-milk); color: #fff; border: var(--border-width) solid #c97a7a; border-radius: 30px; font-weight: 700; cursor: pointer; transition: all 0.3s var(--transition-bounce); text-decoration: none; font-size: 0.9rem; white-space: nowrap; }
.download-btn-item:hover { background: #fff; color: var(--strawberry-milk); transform: scale(1.05); }

.preview-section { margin-top: 28px; border-top: 2px dashed var(--border-dark); padding-top: 20px; }
.preview-toggles { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.preview-toggle { padding: 10px 24px; background: #fffdfb; border: var(--border-width) solid var(--border-dark); border-radius: 30px; font-weight: 600; cursor: pointer; transition: all 0.3s var(--transition-bounce); font-size: 0.95rem; color: var(--text-primary); outline: none; user-select: none; box-shadow: var(--shadow-soft); }
.preview-toggle:hover { background: var(--strawberry-light); color: #fff; border-color: #c97a7a; }
.preview-toggle.active { background: var(--strawberry-light); color: #fff; border-color: #c97a7a; }
.preview-content-area { margin-top: 12px; }
.preview-image-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.preview-image-item { width: calc(50% - 6px); border-radius: 12px; border: 2px solid var(--border-dark); cursor: zoom-in; object-fit: cover; transition: transform 0.2s; }
.preview-image-item:hover { transform: scale(1.02); }
.preview-video-list { display: flex; flex-direction: column; gap: 12px; }
.preview-video-item { width: 100%; border-radius: 12px; border: 2px solid var(--border-dark); outline: none; }
.preview-empty-card { padding: 20px; text-align: center; color: var(--text-muted); font-style: italic; border: var(--border-width) solid var(--border-dark); border-radius: 20px; background: #fffdfb; }

.lightbox-overlay { display: none; position: fixed; inset: 0; background: rgba(250, 247, 244, 0.92); backdrop-filter: blur(12px); z-index: 400; align-items: center; justify-content: center; }
.lightbox-overlay.active { display: flex; }
.lightbox-img { max-width: 100%; max-height: 100%; border-radius: 0; object-fit: contain; box-shadow: var(--shadow-deep); border: none; transition: transform 0.3s var(--transition-bounce); cursor: zoom-out; }
.lightbox-img:hover { transform: scale(1.02); }
.lightbox-close { position: fixed; top: 16px; right: 24px; z-index: 410; font-size: 2rem; cursor: pointer; color: var(--text-primary); background: #fffdfb; border: var(--border-width) solid var(--border-dark); border-radius: 50%; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; line-height: 1; transition: all 0.2s; }
.lightbox-close:hover { background: var(--strawberry-light); color: #fff; border-color: #c97a7a; }

.chara-overlay {
    display: none; position: fixed; inset: 0; background: rgba(250, 247, 244, 0.92);
    backdrop-filter: blur(10px); z-index: 500; overflow-y: auto;
}
.chara-overlay.active { display: block; }

.chara-modal {
    width: 100%; min-height: 100vh; padding: 60px 24px 80px;
    display: flex; flex-direction: column; align-items: center;
    background: transparent; border: none; border-radius: 0; box-shadow: none;
    position: relative;
}

.chara-close {
    position: fixed; top: 16px; right: 24px; z-index: 510;
    font-size: 2rem; cursor: pointer; color: var(--text-primary);
    background: #fffdfb; border: var(--border-width) solid var(--border-dark);
    border-radius: 50%; width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center; line-height: 1;
    transition: all 0.2s;
}
.chara-close:hover { background: var(--strawberry-light); color: #fff; border-color: #c97a7a; }

.chara-image-wrap {
    margin-bottom: 20px; text-align: center;
}
.chara-image-wrap img {
    max-width: 90vw; max-height: 70vh;
    border-radius: 16px;
    object-fit: contain;
    display: block;
}

.chara-name { font-size: 1.4rem; font-weight: 700; margin-bottom: 14px; text-align: center; }
.chara-details { max-width: 480px; width: 100%; }
.chara-details p { margin: 6px 0; font-size: 0.92rem; color: var(--text-secondary); }
.chara-details a { color: var(--strawberry-milk); text-decoration: underline; }
.chara-desc {
    max-width: 480px; width: 100%; margin-top: 14px;
    font-size: 0.95rem; color: var(--text-primary);
    background: rgba(255,253,251,0.7); padding: 12px 16px;
    border-radius: 14px; border: 1px solid #e8e2dc;
}

.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: #fffefb;
    border: 1.5px solid #d5cdc0;
    border-radius: 24px;
    padding: 10px 22px;
    font-weight: 550;
    font-size: 0.88rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
    z-index: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
    pointer-events: none;
}
.toast.show {
    transform: translateX(-50%) translateY(0);
}

.footer { text-align:center; padding:30px 4px 20px; color:var(--text-muted); font-size:0.9rem; }

@media (max-width: 900px) {
    .quick-actions { grid-template-columns: repeat(2,1fr); }
    .mod-grid { grid-template-columns: 1fr; }
    .header { flex-direction: column; align-items: stretch; }
    .search-wrapper { max-width:100%; }
    .modal-content { padding: 24px 16px 40px; }
    .preview-image-item { width: 100%; }
    .carousel-container { height: 45vh; }
}

.modal-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(250, 247, 244, 0.85);
    backdrop-filter: blur(6px);
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.modal-loading-close {
    position: fixed;
    top: 16px;
    right: 24px;
    z-index: 360;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-primary);
    background: #fffdfb;
    border: var(--border-width) solid var(--border-dark);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s;
}
.modal-loading-close:hover {
    background: var(--strawberry-light);
    color: #fff;
    border-color: #c97a7a;
}
.modal-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--strawberry-light);
    border-top-color: var(--strawberry-milk);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}
.modal-loading-text {
    font-family: var(--font-title);
    font-size: 1.1rem;
    color: var(--text-secondary);
}