* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    background: #ffffff;
    color: #1c1c1e;
}
a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */
.site-header {
    text-align: center;
    padding: 32px 16px 20px;
    background: #f7f7f9;
    border-bottom: 1px solid #e5e5ea;
}
.site-header.compact { padding: 16px; text-align: left; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.logo { font-size: 1.3rem; font-weight: 700; }
.tagline { color: #6b6b73; margin: 6px 0 20px; font-size: 0.95rem; }
.top-nav a { margin-right: 16px; color: #6b6b73; font-size: 0.9rem; }
.top-nav a:hover { color: #1c1c1e; }

.search-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.search-bar input[type="text"] {
    width: 340px;
    max-width: 80vw;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #d8d8de;
    background: #ffffff;
    color: #1c1c1e;
    font-size: 16px; /* prevents iOS zoom-on-focus */
}
.search-bar select, .search-bar button {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #d8d8de;
    background: #ffffff;
    color: #1c1c1e;
    cursor: pointer;
    font-size: 16px;
}
.search-bar button { background: #6c5ce7; border-color: #6c5ce7; color: #fff; }

.category-nav {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 0 8px;
}
.category-nav a {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #d8d8de;
    font-size: 0.85rem;
    color: #55555d;
    white-space: nowrap;
    background: #ffffff;
}
.category-nav a.active, .category-nav a:hover { background: #6c5ce7; border-color: #6c5ce7; color: #fff; }

/* ---------- Ad slots ---------- */
.ad-slot {
    max-width: 1400px;
    margin: 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9a9aa5;
    font-size: 0.75rem;
    background: #f7f7f9;
    border: 1px dashed #e0e0e6;
    border-radius: 10px;
}
.ad-slot-banner { min-height: 90px; }
.ad-slot-infeed { grid-column: 1 / -1; min-height: 100px; }
.ad-slot-incontent { min-height: 100px; margin: 24px auto; }

/* ---------- Grid / Cards ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    padding: 16px;
    max-width: 1400px;
    margin: 0 auto;
}
.card {
    display: block;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e5ea;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { border-color: #6c5ce7; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); }
.card img { width: 100%; height: 180px; object-fit: cover; display: block; background: #f0f0f3; }
.card-body { padding: 12px; }
.prompt-text {
    font-size: 0.85rem;
    color: #333338;
    max-height: 4.5em;
    overflow: hidden;
    margin: 0 0 8px;
}
.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #797983;
}
.empty { text-align: center; color: #6b6b73; padding: 60px 16px; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px 40px;
    flex-wrap: wrap;
}
.pagination a {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid #d8d8de;
    background: #ffffff;
    color: #1c1c1e;
}
.pagination a.active { background: #6c5ce7; border-color: #6c5ce7; color: #fff; }

/* ---------- Prompt detail page ---------- */
.breadcrumbs { max-width: 1100px; margin: 16px auto; padding: 0 16px; font-size: 0.8rem; color: #6b6b73; }
.breadcrumbs a { color: #6b6b73; }
.detail-grid {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 32px;
}
.detail-image img, .detail-image video { width: 100%; border-radius: 12px; display: block; border: 1px solid #e5e5ea; }
.detail-content h1 { font-size: 1.4rem; line-height: 1.3; margin: 0 0 12px; }
.detail-meta { display: flex; gap: 12px; align-items: center; font-size: 0.85rem; color: #6b6b73; margin-bottom: 20px; flex-wrap: wrap; }
.badge { background: #f0f0f3; color: #1c1c1e; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; }

.prompt-block { margin-bottom: 20px; }
.prompt-block-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.prompt-block-header h2 { font-size: 1rem; margin: 0; color: #4a4a52; }
.full-prompt-text {
    background: #f7f7f9;
    border: 1px solid #e5e5ea;
    border-radius: 10px;
    padding: 14px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #1c1c1e;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}
.copy-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    background: #6c5ce7;
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.usage-tips { font-size: 0.85rem; color: #6b6b73; line-height: 1.6; }
.usage-tips h2 { font-size: 1rem; color: #4a4a52; }

.related-prompts { max-width: 1400px; margin: 0 auto; padding: 0 16px 40px; }
.related-prompts h2 { font-size: 1.1rem; margin: 0 0 16px 16px; }

/* ---------- Footer ---------- */
.site-footer {
    text-align: center;
    padding: 24px 16px 40px;
    font-size: 0.8rem;
    color: #8a8a95;
    border-top: 1px solid #e5e5ea;
}
.site-footer a { margin: 0 10px; color: #8a8a95; }
.site-footer a:hover { color: #1c1c1e; }

/* ---------- Video preview frame (Civitai video results) ---------- */
.card .media-frame {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f0f0f3;
}
.card .media-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card .media-frame .play-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(28, 28, 30, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.card .media-frame .play-badge svg {
    width: 18px;
    height: 18px;
    fill: #fff;
    margin-left: 2px;
}

/* ---------- Mobile responsiveness ---------- */
@media (max-width: 720px) {
    .site-header.compact { flex-direction: column; align-items: flex-start; gap: 8px; }
    .search-bar input[type="text"] { width: 100%; }
    .search-bar select, .search-bar button { flex: 1; min-width: 90px; }
    .detail-grid { grid-template-columns: 1fr; gap: 16px; }
    .detail-content h1 { font-size: 1.2rem; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 10px; }
    .card img, .card .media-frame { height: 140px; }
    .category-nav { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
    .pagination a { padding: 10px 14px; } /* keep tap targets comfortable */
}