/* ── Variables ─────────────────────────── */
:root {
    --bg: #0a0a0b;
    --surface: #141416;
    --surface2: #1c1c1f;
    --border: #2a2a2e;
    --text: #e8e8ec;
    --text-muted: #8b8b96;
    --accent: #c084fc;
    --accent-hover: #a855f7;
    --cosplay: #f472b6;
    --fanart: #60a5fa;
    --radius: 12px;
}

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

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    position: relative;
}
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('/images/bg-static.webp') center/cover no-repeat;
    opacity: 0.10;
    z-index: 0;
    pointer-events: none;
}
.header, .search-bar, main, .footer, .lightbox {
    position: relative;
    z-index: 1;
}
.search-bar {
    z-index: 10;
}

/* ── Header ───────────────────────────── */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text);
}
.logo-icon {
    font-size: 1.5rem;
    color: var(--accent);
}
.logo-img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: cover;
}
.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
}
.subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.search-bar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem 0;
}
.search-inner {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 1rem;
    transition: border-color 0.25s, box-shadow 0.25s;
}
.search-inner:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.1);
}
.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: 0.75rem;
}
#searchInput {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.75rem 0.75rem;
    outline: none;
}
#searchInput::placeholder {
    color: var(--text-muted);
}
.search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, color 0.2s;
}
.search-clear.visible {
    opacity: 1;
    pointer-events: auto;
}
.search-clear:hover { color: var(--accent); }

.search-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.5rem 0.25rem 0;
    display: none;
}
.search-hint.visible { display: block; }

/* ── Category Nav ─────────────────────── */
.category-nav {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}
.cat-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s;
}
.cat-tab:hover { border-color: var(--accent); }
.cat-tab.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}
.cat-icon { font-size: 0.9rem; }

/* ── NSFW Toggle ──────────────────────── */
.nsfw-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 2rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}
.nsfw-btn {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.nsfw-btn:hover { border-color: var(--accent); color: var(--text); }
.nsfw-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}
.cat-count {
    background: rgba(255,255,255,0.15);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
}

/* ── Masonry Grid ─────────────────────── */
.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 3rem;
}
.masonry {
    display: flex;
    gap: 1rem;
}
.masonry-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Card ─────────────────────────────── */
.card {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    animation: fadeUp 0.4s ease both;
    transition: transform 0.2s;
}
.card:hover { transform: translateY(-3px); }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-img-wrap {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}
.card-img {
    width: 100%;
    display: block;
    transition: transform 0.3s;
    aspect-ratio: 4/5;
    object-fit: cover;
}
.card-img-wrap:hover .card-img {
    transform: scale(1.03);
}

/* Carousel indicator on card */
.card-carousel-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.card-play-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 48px; height: 48px;
    background: rgba(0,0,0,0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: background 0.2s;
}
.card-img-wrap:hover .card-play-overlay {
    background: rgba(0,0,0,0.75);
}

/* Character badge on card */
.card-character {
    position: absolute;
    bottom: 2.2rem;
    left: 0.5rem;
    background: rgba(0,0,0,0.75);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    backdrop-filter: blur(4px);
    z-index: 2;
}
.card-artist {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    background: rgba(0,0,0,0.65);
    color: #60a5fa;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    backdrop-filter: blur(4px);
    z-index: 2;
}

/* Overlay */
.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem 0.75rem 0.75rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.25s;
}
.card-img-wrap:hover .card-overlay { opacity: 1; }

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    background: rgba(0,0,0,0.5);
    transition: background 0.2s;
    margin-left: auto;
}
.source-link:hover { background: rgba(192,132,252,0.2); }

.card-caption {
    color: #fff;
    font-size: 0.8rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.card-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.card-badge.cosplay {
    background: rgba(244,114,182,0.2);
    color: var(--cosplay);
    border: 1px solid rgba(244,114,182,0.3);
}
.card-badge.fanart {
    background: rgba(96,165,250,0.2);
    color: var(--fanart);
    border: 1px solid rgba(96,165,250,0.3);
}

/* ── NSFW Blur ──────────────────────────── */
.card.nsfw .card-img,
.card.nsfw .card-carousel-track img {
    filter: blur(20px);
    transition: filter 0.3s;
}
.card.nsfw.revealed .card-img,
.card.nsfw.revealed .card-carousel-track img {
    filter: none;
}
.nsfw-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    cursor: pointer;
    z-index: 2;
    transition: opacity 0.3s;
}
.card.nsfw.revealed .nsfw-overlay {
    opacity: 0;
    pointer-events: none;
}
.nsfw-eye {
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.nsfw-eye:hover {
    transform: scale(1.1);
}
.nsfw-eye svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
}

/* ── Card Carousel (multi-image) ──────── */
.card-carousel {
    position: relative;
    overflow: hidden;
}
.card-carousel-track {
    display: flex;
    transition: transform 0.3s ease;
}
.card-carousel-track img {
    width: 100%;
    flex-shrink: 0;
    aspect-ratio: 4/5;
    object-fit: cover;
}
.card-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 5;
}
.card-carousel:hover .card-carousel-nav { opacity: 1; }
.card-carousel-prev { left: 0.4rem; }
.card-carousel-next { right: 0.4rem; }
.card-carousel-dots {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.3rem;
    z-index: 5;
}
.card-carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
}
.card-carousel-dot.active { background: #fff; }

/* ── Empty State ──────────────────────── */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
}
.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent);
}
.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* ── Loading State ─────────────────────── */
.loading-state {
    display: none;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.loading-state.visible {
    display: block;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Error State ───────────────────────── */
.error-state {
    display: none;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.error-state.visible {
    display: block;
}
.error-state button {
    margin-top: 1rem;
    padding: 0.5rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}
.error-state button:hover {
    opacity: 0.9;
}

/* ── Lightbox ─────────────────────────── */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.lightbox.active { display: flex; }

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    z-index: 210;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }

.lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 90vh;
}

/* Lightbox Carousel */
.lightbox-carousel {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 100%;
}
.lightbox-carousel img {
    max-width: 85vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(192,132,252,0.5); }
.lightbox-prev { left: 0.5rem; }
.lightbox-next { right: 0.5rem; }

.lightbox-dots {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.75rem;
}
.lightbox-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
}
.lightbox-dots .dot.active { background: var(--accent); }

.lightbox-info {
    margin-top: 1rem;
    text-align: center;
}
.lightbox-caption {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
.lightbox-character {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.lightbox-character:empty { display: none; }
.lightbox-artist {
    display: inline-block;
    color: #60a5fa;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}
.lightbox-artist:hover { color: #93c5fd; text-decoration: underline; }
.lightbox-artist:empty { display: none; }
.lightbox-source {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(192,132,252,0.3);
    border-radius: 8px;
    transition: all 0.2s;
}
.lightbox-source:hover {
    background: rgba(192,132,252,0.1);
    border-color: var(--accent);
}

/* ── Footer ───────────────────────────── */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* ── Page View Counter in Header ──────── */
.pv-count {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
    white-space: nowrap;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-stats {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.35rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface2);
    transition: all 0.15s;
    white-space: nowrap;
}
.nav-stats:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(192, 132, 252, 0.1);
}

/* ── Responsive ───────────────────────── */
@media (max-width: 1200px) {
    .masonry-col:nth-child(4) { display: none; }
}
@media (max-width: 768px) {
    .masonry { gap: 0.5rem; }
    .masonry-col:nth-child(3) { display: none; }
    .header { padding: 1rem; }
    .category-nav { padding: 1rem; gap: 0.5rem; }
    .gallery-container { padding: 0 1rem 2rem; }
    .cat-tab { padding: 0.5rem 0.8rem; font-size: 0.8rem; }
    .search-bar { padding: 1rem 1rem 0; }
    .lightbox-carousel img { max-width: 95vw; }
    .lightbox-prev, .lightbox-next { width: 36px; height: 36px; font-size: 1.2rem; }
}
@media (max-width: 480px) {
    .masonry { gap: 0.4rem; }
    .gallery-container { padding: 0 0.5rem 2rem; }
    .subtitle { display: none; }
}

/* ── Lightbox Buttons ─────────────────── */
.lightbox-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}
.lightbox-original {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    transition: all 0.2s;
}
.lightbox-original:hover {
    background: rgba(255,255,255,0.1);
    border-color: #fff;
}

/* ── Character List ──────────────────── */
.charlist-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.6rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    margin-right: 0.75rem;
}
.charlist-btn:hover { color: var(--accent); background: rgba(192,132,252,0.05); }

.charlist-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 350px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.charlist-dropdown.open { display: block; }

.charlist-header {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.charlist-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.charlist-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.charlist-tab:hover {
    color: var(--text);
    background: var(--surface2);
}

.charlist-tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

.charlist-items { padding: 0.4rem; }

.charlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.charlist-item:hover { background: var(--surface2); }

.charlist-item-name {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}

.charlist-item-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(192,132,252,0.12);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    min-width: 1.5rem;
    text-align: center;
}

.charlist-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-bar { position: relative; }

/* ── Pagination ──────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    flex-wrap: wrap;
}

.page-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.2s;
    min-width: 36px;
    text-align: center;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.page-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-dots {
    color: var(--text-muted);
    padding: 0 0.25rem;
}

.page-info {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 0.75rem;
}

@media (max-width: 768px) {
    .pagination {
        gap: 0.35rem;
        padding: 1.5rem 0.5rem;
    }
    .page-btn {
        padding: 0.4rem 0.65rem;
        font-size: 0.8rem;
        min-width: 32px;
    }
    .page-info {
        display: block;
        width: 100%;
        text-align: center;
        margin-left: 0;
        margin-top: 0.5rem;
    }
}


/* ── Artist Search ───────────────────── */
.artist-search-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 0.5rem;
    flex-shrink: 0;
}

#artistSearchInput {
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    width: 140px;
    flex-shrink: 0;
}

#artistSearchInput::placeholder {
    color: var(--text-muted);
}

#artistSearchClear {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

#artistSearchClear.visible {
    opacity: 1;
    pointer-events: auto;
}

.search-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    color: var(--accent);
    background: rgba(192,132,252,0.1);
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background: rgba(192,132,252,0.15);
    color: var(--accent);
}

.autocomplete-item .match {
    color: var(--accent);
    font-weight: 700;
}

.autocomplete-item .count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--surface2);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.autocomplete-item .name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Mobile Search Bar Fix ─────────── */
@media (max-width: 768px) {
    .search-inner {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    .artist-search-divider {
        display: none;
    }
    #artistSearchInput {
        width: 100%;
        flex-shrink: 1;
    }
    .search-group {
        flex: 1 1 100%;
    }
}

/* ═══════════════════════════════════════════
   MOBILE RESPONSIVE FIXES
   ═══════════════════════════════════════════ */

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
}

/* Hover effects only on devices that support hover */
@media (hover: hover) and (pointer: fine) {
    .card:hover {
        transform: translateY(-3px);
    }
    .card-img-wrap:hover .card-overlay {
        opacity: 1;
    }
    .card-carousel:hover .card-carousel-nav {
        opacity: 1;
    }
}

/* Touch device optimizations */
@media (pointer: coarse) {
    /* Bigger touch targets */
    .cat-tab {
        padding: 0.75rem 1rem;
        min-height: 44px;
    }
    .nsfw-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        min-height: 44px;
    }
    .search-clear,
    .search-btn {
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
    }
    .lightbox-prev,
    .lightbox-next {
        width: 48px;
        height: 48px;
        font-size: 2rem;
    }
    .lightbox-dots .dot {
        width: 14px;
        height: 14px;
    }
    .card-carousel-nav {
        width: 44px;
        height: 44px;
        opacity: 0.8;
    }
    .card-carousel-dot {
        width: 12px;
        height: 12px;
    }
    .page-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.6rem 1rem;
    }
}

/* Card overlay - tap to show on touch devices */
@media (pointer: coarse) {
    .card-img-wrap .card-overlay {
        opacity: 0;
        transition: opacity 0.2s;
    }
    .card-img-wrap.tapped .card-overlay {
        opacity: 1;
    }
}

/* Category nav wrapping */
@media (max-width: 768px) {
    .category-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 1rem;
        justify-content: center;
    }
    .cat-tab {
        flex: 0 1 auto;
    }
}

/* NSFW toggle responsive */
@media (max-width: 768px) {
    .nsfw-toggle {
        padding: 0 1rem 0.75rem;
        gap: 0.4rem;
    }
}

/* iOS Safari - prevent auto-zoom on inputs */
@media (max-width: 768px) {
    input[type="text"],
    input[type="url"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .category-nav {
        padding: 0.75rem;
        gap: 0.4rem;
    }
    .cat-tab {
        padding: 0.6rem 0.8rem;
        font-size: 0.75rem;
    }
    .nsfw-toggle {
        padding: 0 0.75rem 0.5rem;
    }
    .nsfw-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}
