:root {
    --bg: #0f172a;
    --panel: #111827;
    --card: #1f2937;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --accent: #22d3ee;
    --accent-2: #a855f7;
    --border: #1f2937;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #0b1224 0%, #0f172a 50%, #0b0f1f 100%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    color: var(--text);
}
a { color: inherit; text-decoration: none; }

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(90deg, rgba(34,211,238,0.1), rgba(168,85,247,0.08)), var(--panel);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand {
    font-weight: 700;
    letter-spacing: 0.05em;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.brand img {
    height: 22px;
    width: 22px;
    border-radius: 4px;
}
.brand a {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.search {
    flex: 1;
    display: flex;
    gap: 0.5rem;
}
.search input {
    flex: 1;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0b1224;
    color: var(--text);
}
.search button, .btn {
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #0f172a;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease;
}
.btn.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn:hover, .search button:hover { transform: translateY(-1px); box-shadow: 0 8px 16px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0); }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.welcome { color: var(--muted); }
.inline { display: inline; }
.linkish {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
}
.page { padding: 2rem; max-width: 1100px; margin: 0 auto; }

.intro h1 { margin: 0 0 0.5rem; }
.intro p { margin: 0 0 1.5rem; color: var(--muted); }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.shorts-strip {
    margin-bottom: 2rem;
}
.shorts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}
.shorts-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 220px;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.9rem;
}
.shorts-strip-card {
    background: linear-gradient(180deg, #151a26 0%, #121724 100%);
    border: 1px solid #1c2434;
    border-radius: 16px;
    overflow: hidden;
    min-width: 220px;
    box-shadow: 0 18px 36px rgba(0,0,0,0.3);
}
.short-thumb {
    aspect-ratio: 9 / 16;
    width: 100%;
    background: #111827;
    display: grid;
    place-items: center;
    position: relative;
}
.short-thumb .preview-video {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: #0b1224;
}
.short-thumb img,
.short-thumb .preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.short-meta {
    padding: 0.7rem 0.8rem 0.9rem;
}
.short-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
    max-height: 2.5em;
    overflow: hidden;
}
.short-sub {
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.85rem;
}
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.card.narrow { max-width: 720px; margin: 0 auto; padding: 1.25rem; }
.card-body { padding: 0.9rem 1rem 1.1rem; }
.card h2 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.card .meta { color: var(--muted); margin: 0 0 0.5rem; font-size: 0.9rem; }
.card .desc { color: var(--text); margin: 0; font-size: 0.95rem; line-height: 1.4; }

.thumb {
    position: relative;
    height: 160px;
    background: linear-gradient(145deg, rgba(34,211,238,0.25), rgba(168,85,247,0.2));
    display: grid;
    place-items: center;
    overflow: hidden;
}
.thumb img,
.preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.preview-video {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: #0b1224;
}
.thumb-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.35);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
}
.thumb-fallback {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: rgba(255,255,255,0.7);
    display: grid;
    place-items: center;
    color: #0f172a;
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    position: absolute;
    inset: 0;
    margin: auto;
    z-index: 1;
}

.tags { margin-top: 0.6rem; display: flex; gap: 0.35rem; flex-wrap: wrap; }
.tag {
    background: rgba(34,211,238,0.1);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
}

.empty {
    background: rgba(255,255,255,0.02);
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 1.2rem;
    text-align: center;
    color: var(--muted);
}

form label {
    display: block;
    margin-bottom: 0.8rem;
    color: var(--muted);
}
form input[type="text"],
form input[type="password"],
form input[type="file"],
form textarea,
form select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0b1224;
    color: var(--text);
}
textarea { resize: vertical; }
.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
}
.checkbox input[type="checkbox"] {
    width: auto;
}

.flex { display: flex; gap: 1rem; }
.grow { flex: 1; }
.auth-inline { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0.25rem 0 1rem; }

.flash {
    background: rgba(34,211,238,0.12);
    border: 1px solid rgba(34,211,238,0.4);
    color: var(--text);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal.open { display: flex; }
.modal-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    width: 360px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.modal-content h3 { margin-top: 0; }
.close {
    margin-top: 0.75rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    cursor: pointer;
}

.watch {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}
.player video {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #0b1224;
    max-height: 70vh;
}
.watch-info h1 { margin: 0 0 0.35rem; }
.watch-info .meta { color: var(--muted); margin: 0 0 0.75rem; }
.watch-info .desc { color: var(--text); margin: 0 0 1rem; line-height: 1.5; }
.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    margin: 0 0 1rem;
}
.facts dt { font-weight: 700; color: var(--muted); }
.facts dd { margin: 0; }
.meta-box {
    background: #0b1224;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    overflow: auto;
}
.meta-box pre { margin: 0; color: var(--muted); font-size: 0.9rem; }

.reactions {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
}
.reactions .btn {
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
}
.reactions .btn.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(34,211,238,0.4);
}

.table {
    display: grid;
    gap: 0.5rem;
}
.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 1fr 2fr;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.6rem 0.75rem;
    gap: 0.5rem;
}
.table-row.head {
    background: transparent;
    border: none;
    color: var(--muted);
    font-weight: 600;
}
.table-row .title { font-weight: 700; }
.table-row .meta-small { color: var(--muted); font-size: 0.85rem; }
.meta-small { color: var(--muted); font-size: 0.9rem; }
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.inline-form select {
    background: #0b1224;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem 0.5rem;
}

@media (max-width: 1000px) {
    .table-row {
        grid-template-columns: 1fr;
    }
}

.shorts-body {
    background: linear-gradient(180deg, #0b1224 0%, #0f172a 50%, #0b0f1f 100%);
}
.shorts-feed {
    height: calc(100vh - 70px);
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    margin: 0;
}
.short-card {
    position: relative;
    height: calc(100vh - 70px);
    scroll-snap-align: start;
    display: grid;
    place-items: center;
    background: #000;
}
.short-video {
    max-height: 100%;
    max-width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #0b1224;
}
.short-overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    color: var(--text);
}
.short-info h2 { margin: 0 0 0.2rem; }
.short-info .meta { margin: 0; color: var(--muted); }

.watch-suggestions {
    display: grid;
    gap: 0.8rem;
}
.suggest-card {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.6rem;
    align-items: center;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
}
.suggest-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(34,211,238,0.2), rgba(168,85,247,0.18));
    display: grid;
    place-items: center;
}
.suggest-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.suggest-info h3 {
    margin: 0 0 0.2rem;
    font-size: 0.95rem;
}
.suggest-info .meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 900px) {
    .topbar { flex-wrap: wrap; }
    .watch { grid-template-columns: 1fr; }
    .page { padding: 1.25rem; }
}
