:root {
    --bg: #0b0b0f;
    --bg2: #141414;
    --card: #1a1a1f;
    --text: #f3f3f5;
    --muted: #a3a3ad;
    --accent: #e50914;
    --accent-hover: #f40612;
    --radius: 6px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    --topbar-h: 64px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    line-height: 1.5;
}

a {
    color: #fff;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: var(--topbar-h);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.65), transparent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
}

.topbar--admin {
    background: #0d0d12;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.logo {
    font-weight: 800;
    letter-spacing: -0.02em;
    font-size: 1.35rem;
    color: var(--accent);
    text-decoration: none;
}
.logo:hover {
    color: var(--accent-hover);
    text-decoration: none;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
}

.user-chip {
    color: var(--muted);
    font-size: 0.9rem;
}

.main {
    flex: 1;
    padding-bottom: 3rem;
}

.main--narrow {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 4rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    padding: 0.55rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
}
.btn:hover {
    background: rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
}

.btn-primary {
    background: var(--accent);
    border-color: transparent;
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: rgba(229, 9, 20, 0.15);
    border-color: rgba(229, 9, 20, 0.45);
    color: #ffb4b8;
}
.btn-danger:hover {
    background: rgba(229, 9, 20, 0.28);
}

.hero {
    padding: 2.5rem 1.25rem 1rem;
    background: radial-gradient(1200px 500px at 20% 0%, rgba(229, 9, 20, 0.22), transparent 55%),
        radial-gradient(900px 400px at 80% 10%, rgba(80, 120, 255, 0.12), transparent 50%),
        var(--bg);
}

.hero__inner {
    max-width: 960px;
    margin: 0 auto;
}

.hero__title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    margin: 0 0 0.5rem;
    letter-spacing: -0.03em;
}

.hero__lead {
    color: var(--muted);
    max-width: 52ch;
    margin: 0 0 1.25rem;
}

.section {
    padding: 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
}

.row-block {
    margin: 0 0 1.75rem;
}

.row-title {
    font-size: 1.15rem;
    margin: 0 0 0.65rem 1.25rem;
    letter-spacing: -0.02em;
}

.row-scroll-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.35rem;
}

.row-scroll-wrap--full {
    padding: 0;
}

.row-scroll {
    display: flex;
    gap: 0.65rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding: 0.35rem 0.85rem 0.85rem;
    scrollbar-width: thin;
    flex: 1;
}

.row-scroll--lessons {
    scroll-snap-type: x mandatory;
    padding-left: 0;
    padding-right: 0;
}

.row-scroll::-webkit-scrollbar {
    height: 8px;
}
.row-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 99px;
}

.row-chevron {
    flex: 0 0 auto;
    width: 38px;
    height: 72px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(20, 20, 20, 0.75);
    color: #fff;
    cursor: pointer;
    display: none;
}
.row-chevron:hover {
    background: rgba(40, 40, 40, 0.9);
}
@media (min-width: 900px) {
    .row-chevron {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

.row-chevron--left::before {
    content: "‹";
    font-size: 1.6rem;
    line-height: 1;
}
.row-chevron--right::before {
    content: "›";
    font-size: 1.6rem;
    line-height: 1;
}

.tile {
    flex: 0 0 clamp(220px, 28vw, 320px);
    scroll-snap-align: start;
    border-radius: 10px;
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.tile:hover {
    transform: scale(1.04);
    z-index: 2;
    text-decoration: none;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65);
}

.tile__media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
}

.tile__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.tile__shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.85));
    pointer-events: none;
}

.tile__play {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    border: 2px solid rgba(255, 255, 255, 0.35);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
}

.tile__meta {
    padding: 0.65rem 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.tile__title {
    font-weight: 700;
    font-size: 0.95rem;
}

.tile__desc {
    font-size: 0.8rem;
    color: var(--muted);
}

.course-hero {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 0.5rem;
}

.link-back {
    color: var(--muted);
    font-size: 0.9rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    color: var(--muted);
    margin: 0.75rem 0 0.25rem;
}

.course-title {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
}

.course-desc {
    color: var(--muted);
    margin: 0.75rem 0 0;
}

.player-section {
    padding: 1rem 1.25rem 0;
}

.player-wrap {
    max-width: 1100px;
    margin: 0 auto;
}

.main-player {
    width: 100%;
    border-radius: 12px;
    background: #000;
    box-shadow: var(--shadow);
    max-height: min(70vh, 620px);
}

.player-label {
    margin: 0.5rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.lessons-section {
    padding: 1.5rem 0 2rem;
}

.lessons-head {
    max-width: 1200px;
    margin: 0 auto 0.75rem;
    padding: 0 1.25rem;
}

.lessons-head h2 {
    margin: 0 0 0.35rem;
}

.lessons-hint {
    margin: 0;
    color: var(--muted);
}

.lesson-card {
    flex: 0 0 clamp(200px, 22vw, 280px);
    scroll-snap-align: start;
    cursor: pointer;
}

.lesson-card--locked {
    cursor: not-allowed;
    opacity: 0.92;
}

.lesson-card__thumb {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #0a0a0c;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.lesson-card__thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lesson-card__placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1f1f28, #12121a);
}

.lesson-card__overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.35);
}

.lesson-card--locked .lesson-card__overlay {
    background: rgba(0, 0, 0, 0.55);
}

.lesson-card__play {
    font-size: 1.5rem;
    text-shadow: 0 2px 12px #000;
}

.lesson-card__lock {
    font-size: 1.75rem;
}

.lesson-card__label {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.auth-card-wrap {
    min-height: calc(100vh - var(--topbar-h));
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}

.site--admin-login .auth-card-wrap {
    min-height: 100vh;
}

.auth-card {
    width: min(420px, 100%);
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: var(--shadow);
}

.form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 1rem;
}

.form label,
.form--inline label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.form input,
.form textarea,
.form select,
.table input {
    padding: 0.55rem 0.65rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    font: inherit;
}

.form--inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}

.checkbox-inline {
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem !important;
}

.alert {
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
}
.alert-ok {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
}
.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

.muted {
    color: var(--muted);
}

.footer {
    padding: 2rem 1.25rem;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Admin */
.admin-tiles {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.admin-tile {
    display: block;
    padding: 1.25rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    font-weight: 700;
}
.admin-tile:hover {
    background: rgba(255, 255, 255, 0.09);
    text-decoration: none;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.table th,
.table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
}

.table th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.25);
}

.td-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.input-narrow {
    max-width: 90px;
}

code {
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.form-row {
    display: inline;
}

h1, h2 {
    letter-spacing: -0.02em;
}
