/* Basic reset */
* { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; }
body { margin: 0; padding: 0; min-height: 100vh; display: flex; flex-direction: column; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; background: #0b0e11; color: #e8eef5; }
img { max-width: 100%; height: auto; display: block; }

a { color: #8bc4ff; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 100; background: #0f141a; border-bottom: 1px solid #1e2936; }
.header-inner { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.brand { font-weight: 700; color: #fff; font-size: 1.1rem; padding: 6px 10px; border-radius: 6px; background: #1a2430; }
.nav { display: flex; gap: 8px; }
.nav-link { padding: 6px 10px; border-radius: 6px; background: #13202b; color: #cfe6ff; }

/* Search */
.search-form { display: flex; gap: 8px; margin-left: auto; }
.search-form input { background: #0b1117; border: 1px solid #1f2b3a; color: #e8eef5; padding: 6px 10px; border-radius: 6px; }
.search-form button { background: #1b4b8a; color: #fff; border: 0; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.search-form button:hover { background: #2563ad; }

/* Footer */
.site-footer { border-top: 1px solid #1e2936; background: #0f141a; margin-top: 24px; }
.site-footer .container { display: flex; align-items: center; gap: 10px; padding: 12px 0; font-size: 0.9rem; }
.spacer { flex: 1; }
.api-label input { width: 220px; background: #0b1117; border: 1px solid #1f2b3a; color: #e8eef5; padding: 4px 8px; border-radius: 6px; }

/* Sections */
.section { padding: 20px 0; }
.section-title { margin: 0 0 12px; font-size: 1.2rem; }

/* Grid & Cards */
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: stretch; }
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 700px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 360px) { .grid { grid-template-columns: 1fr; } }

.card { background: #0f141a; border: 1px solid #1e2936; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; height: 100%; }
.card-thumb { display: block; background: #0b0e11; aspect-ratio: 16 / 9; overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #9fb4c9; background: #0b1117; }
.card-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }
.card-title { font-size: 0.95rem; margin: 0; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meta { color: #9fb4c9; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: auto; }

/* Model header */
.model-header { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.model-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 1px solid #243244; }
.model-meta h2 { margin: 0 0 6px; }
.model-meta p { margin: 0; color: #c5d7ea; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; background: #122030; color: #cfe6ff; border: 1px solid #1f2b3a; }
.chip.active { background: #1b4b8a; color: #fff; border-color: #1b4b8a; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: #122030; color: #cfe6ff; border: 1px solid #1f2b3a; padding: 2px 8px; border-radius: 999px; font-size: 0.8rem; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.page-btn { background: #13202b; color: #cfe6ff; border: 1px solid #1f2b3a; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.page-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.page-info { color: #9fb4c9; font-size: 0.9rem; }

/* Video view */
.video-view { display: grid; gap: 12px; }
.video-title { margin: 0; }
.video-player-wrap { background: #0b1117; border: 1px solid #1f2b3a; border-radius: 8px; overflow: hidden; }
.video-player { width: 100%; height: auto; display: block; background: #000; }
.video-meta { color: #c5d7ea; display: grid; gap: 6px; }
.video-desc { background: #0f141a; border: 1px solid #1e2936; border-radius: 8px; padding: 10px; overflow: auto; }
.video-desc pre { white-space: pre-wrap; margin: 0; font-family: inherit; }
.video-actions .btn { display: inline-block; background: #1b4b8a; color: #fff; padding: 6px 12px; border-radius: 6px; }

/* Preview gallery */
.preview-section { display: grid; gap: 8px; }
.section-subtitle { margin: 4px 0 6px; font-size: 1.05rem; }
.preview-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.preview-item { display: block; background: #0b1117; border: 1px solid #1f2b3a; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 9; }
.preview-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 200ms ease; }
.preview-item:hover img { transform: scale(1.02); }

/* States */
.loading, .error, .empty, .no-video { padding: 12px; border-radius: 8px; }
.loading { background: #0b1117; border: 1px solid #1f2b3a; color: #9fb4c9; }
.error { background: #2b1212; border: 1px solid #5a1f1f; color: #ffd6d6; }
.empty, .no-video { background: #0b1117; border: 1px solid #1f2b3a; color: #9fb4c9; }

/* Layout: sticky footer */
main { flex: 1 0 auto; }

/* Interactions & focus */
.nav-link { transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease; }
.nav-link:hover { background: #1a2a3a; }
.nav-link.active { background: #1b4b8a; color: #fff; }

.card { transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease; }
.card:hover { transform: translateY(-2px); border-color: #2a3b52; box-shadow: 0 6px 24px rgba(0,0,0,0.35); }
.card-thumb img { transition: transform 200ms ease; }
.card-thumb:hover img { transform: scale(1.02); }

.page-btn { transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease; }
.page-btn:hover:not([disabled]) { background: #1a2d3d; transform: translateY(-1px); border-color: #2a3b52; }

.chip { transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease; }
.chip:hover { background: #163048; border-color: #2a3b52; }

.video-actions .btn { transition: background-color 120ms ease, transform 120ms ease; }
.video-actions .btn:hover { background: #2563ad; transform: translateY(-1px); }

a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid #3182ce; outline-offset: 2px; }

/* Cursor-following bubble tooltip */
.cursor-bubble {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    background: #0f141a;
    color: #e8eef5;
    border: 1px solid #2a3b52;
    border-radius: 8px;
    padding: 6px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    max-width: min(60vw, 520px);
    max-height: 50vh;
    overflow: auto;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 120ms ease, transform 120ms ease;
    font-size: 0.9rem;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
}
.cursor-bubble.show {
    opacity: 1;
    transform: translateY(0);
}
