:root {
    --bg-main: #09090b;
    --bg-sub: #121215;
    --card-bg: #18181b;
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --text-main: #ffffff;
    --text-sub: #a1a1aa;
    --accent: #8b5cf6;
    --border: #27272a;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    overflow-y: scroll;
}

.navbar {
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.8rem 0;
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand {
    font-size: 1.4rem;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-link { color: var(--text-sub); text-decoration: none; font-weight: 600; font-size: 0.95rem; transition: 0.2s; }
.nav-link:hover, .nav-link.active { color: white; }

.nav-discord-btn {
    background: #5865F2;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 99px;
    font-weight: bold;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}
.nav-discord-btn:hover { background: #4752c4; transform: translateY(-1px); }

.hero {
    position: relative;
    padding: 80px 20px;
    text-align: center;
    overflow: hidden;
    background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, var(--bg-main) 70%);
    z-index: 1; 
}
.hero-content h1 { font-size: 3.5rem; font-weight: 900; line-height: 1.1; margin-bottom: 20px; }
.text-gradient { background: linear-gradient(135deg, #818cf8, #c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-content p { color: var(--text-sub); font-size: 1.1rem; margin-bottom: 30px; line-height: 1.6; }
.hero-actions { display: flex; justify-content: center; gap: 15px; }
.btn-hero {
    padding: 12px 30px; border-radius: 99px; text-decoration: none; font-weight: bold; font-size: 1rem;
    display: inline-flex; align-items: center; gap: 8px; transition: 0.3s; border: none; cursor: pointer;
}
.btn-hero.primary { background: white; color: black; }
.btn-hero.primary:hover { background: #e0e7ff; box-shadow: 0 0 20px rgba(255, 255, 255, 0.3); }
.btn-hero.secondary { background: rgba(255, 255, 255, 0.1); color: white; border: 1px solid rgba(255, 255, 255, 0.2); }
.btn-hero.secondary:hover { background: rgba(255, 255, 255, 0.2); }

.controls-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1); 
    max-height: 300px; 
    opacity: 1;
    overflow: visible; 
    padding: 20px; 
    transform: translateY(0);
    position: relative;
    z-index: 100; 
}

.controls-container.hidden {
    max-height: 0;
    opacity: 0;
    overflow: hidden; 
    padding: 0 20px; 
    transform: translateY(-10px);
    pointer-events: none;
}

.search-box { position: relative; flex: 1; min-width: 300px; }
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-sub); }
#search-input {
    width: 100%; background: var(--bg-sub); border: 1px solid var(--border);
    padding: 12px 12px 12px 45px; border-radius: 12px;
    color: white; font-size: 1rem; outline: none; transition: 0.2s; box-sizing: border-box;
}
#search-input:focus { border-color: var(--primary); background: #000; }

.filter-actions { display: flex; gap: 15px; align-items: center; }

/* --- ドロップダウン共通 --- */
.custom-dropdown-wrapper {
    position: relative;
    width: 150px; 
    font-size: 0.9rem;
}
/* タグ用のドロップダウンは少し幅を広くする */
.tag-filter-wrapper {
    width: 200px;
}

.custom-dropdown-trigger {
    background: var(--bg-sub);
    border: 1px solid var(--border);
    border-radius: 12px; 
    padding: 10px 15px;
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; color: white; font-weight: 600; transition: 0.2s;
    user-select: none; /* テキスト選択を防ぐ */
}
.custom-dropdown-trigger:hover { background: #27272a; border-color: #555; }

.custom-dropdown-options {
    position: absolute;
    top: calc(100% + 8px); 
    left: 0;
    width: 100%;
    background: #18181b; 
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 5px; 
    display: none;
    z-index: 200; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.6); 
    /* タグが多くなった時用のスクロール設定 */
    max-height: 250px;
    overflow-y: auto;
}
.custom-dropdown-options.show { display: block; animation: dropFadeIn 0.2s; }

/* スクロールバーの装飾（Webkit系） */
.custom-dropdown-options::-webkit-scrollbar { width: 6px; }
.custom-dropdown-options::-webkit-scrollbar-track { background: transparent; }
.custom-dropdown-options::-webkit-scrollbar-thumb { background: #444; border-radius: 10px; }

.custom-option {
    padding: 10px 15px;
    cursor: pointer;
    color: var(--text-sub);
    transition: 0.2s;
    border-radius: 8px; 
    font-weight: 500;
}
.custom-option:hover {
    background: #27272a;
    color: white;
}
.custom-option.selected {
    background: rgba(99, 102, 241, 0.15); 
    color: var(--primary);
    font-weight: bold;
}
.custom-option.selected::after {
    content: '✓';
    float: right;
    font-weight: bold;
}

@keyframes dropFadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

main {
    max-width: 1200px; margin: 0 auto; padding: 20px; min-height: 500px;
    position: relative; z-index: 1; 
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }

.card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
    cursor: pointer; transition: all 0.2s ease; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.5); border-color: var(--primary); }
.card-img-wrapper { position: relative; aspect-ratio: 16/9; overflow: hidden; background: #000; }
.card-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.card:hover .card-img { transform: scale(1.05); }

.price-tag {
    position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.85); color: #ffd700;
    padding: 4px 8px; border-radius: 6px; font-size: 0.8rem; font-weight: bold;
    border: 1px solid rgba(255,215,0,0.3); z-index: 2;
}
.card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.tag-pill {
    background: rgba(99, 102, 241, 0.15); color: #a5b4fc; padding: 4px 10px;
    border-radius: 6px; font-size: 0.75rem; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meta-stats {
    display: flex; gap: 12px; font-size: 0.8rem; color: var(--text-sub);
    align-items: center; white-space: nowrap; flex-shrink: 0;
}
.likes-count { color: #ff4757; font-weight: bold; display: flex; align-items: center; gap: 4px;}
.card-title {
    font-size: 1.1rem; font-weight: 700; margin: 0 0 10px 0; line-height: 1.4; color: white;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-author {
    margin-top: auto; font-size: 0.85rem; color: var(--text-sub);
    display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

.tos-container { max-width: 800px; margin: 40px auto; padding: 40px; background: var(--card-bg); border-radius: 20px; border: 1px solid var(--border); }
.tos-container h2 { text-align: center; margin-bottom: 30px; font-size: 2rem; }
.tos-content section { margin-bottom: 30px; }
.tos-content h3 { color: #fff; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 15px; }
.tos-content p { color: #ccc; line-height: 1.8; }
.tos-action { text-align: center; margin-top: 40px; }
.btn-back { background: var(--border); color: white; border: none; padding: 12px 30px; border-radius: 8px; cursor: pointer; font-weight: bold; }
.btn-back:hover { background: #333; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
    z-index: 2000; display: none; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; }
.modal-window {
    width: 90%; max-width: 1000px; max-height: 90vh;
    background: var(--card-bg); border-radius: 20px; border: 1px solid var(--border);
    display: flex; flex-direction: column; overflow: hidden; position: relative;
    transform: scale(0.95); transition: transform 0.2s;
}
.modal-overlay.show .modal-window { transform: scale(1); }
.modal-close {
    position: absolute; top: 15px; right: 15px; background: rgba(0,0,0,0.5); color: white;
    border: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; z-index: 10;
}
.modal-content { display: flex; height: 100%; overflow: hidden; }
.modal-gallery { flex: 1.5; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
#modal-main-image { max-width: 100%; max-height: 60vh; object-fit: contain; }
.thumbnails { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; max-width: 100%; }
.thumb { width: 60px; height: 40px; object-fit: cover; opacity: 0.5; cursor: pointer; border-radius: 4px; }
.thumb.active { opacity: 1; border: 2px solid var(--primary); }

.modal-info { flex: 1; padding: 40px; overflow-y: auto; background: var(--bg-sub); }
.modal-header-badges { display: flex; gap: 10px; margin-bottom: 15px; }
.badge { padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; font-weight: bold; background: #333; }
.type-badge { background: var(--primary); }
#modal-title { font-size: 2rem; margin: 0 0 10px 0; line-height: 1.2; }
.modal-author-block { margin-bottom: 20px; }
.modal-author { color: var(--text-sub); font-size: 1rem; display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.modal-date-text { color: #666; font-size: 0.9rem; margin-left: 24px; }

.modal-description-box {
    background: var(--card-bg); padding: 20px; border-radius: 12px;
    color: #e4e4e7; line-height: 1.7; flex-grow: 1; margin-bottom: 20px; white-space: pre-wrap;
}
.modal-actions { display: flex; gap: 10px; margin-top: auto; }
.btn { flex: 1; padding: 14px; border-radius: 10px; font-weight: bold; text-align: center; text-decoration: none; border: none; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px; }
.btn-primary { background: var(--primary); color: white; }
.btn-twitter { background: #000; color: white; border: 1px solid #333; }

@media (max-width: 768px) {
    .modal-content { flex-direction: column; overflow-y: auto; }
    .modal-gallery { height: 300px; flex: none; }
    .controls-container { flex-direction: column; align-items: stretch; }
}