:root {
    color-scheme: dark
}

* {
    box-sizing: border-box
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: #1d293d;
    color: #f5f5f5;
    font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
    font: inherit
}

button,
a,
select {
    transition: background .16s, color .16s, border-color .16s
}

a {
    color: inherit;
    text-decoration: none
}

button {
    cursor: pointer
}

.video-portal {
    min-height: 100vh
}

.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: #0f172b;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 24px;
    min-width: 220px
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 22px;
    white-space: nowrap
}

.brand-play {
    background: #e9233e;
    color: white;
    width: 34px;
    height: 24px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 14px
}

.icon-button {
    width: 42px;
    height: 42px;
    border: 1px solid #3c3c3c;
    border-radius: 50%;
    background: #222;
    color: #fff;
    font-size: 22px
}

.menu-button {
    border-radius: 9px;
    background: transparent
}

.icon-button:hover,
.icon-button:focus-visible {
    background: #363636
}

.search-box {
    height: 42px;
    width: min(620px, 48vw);
    display: flex
}

.search-box input {
    width: 100%;
    min-width: 0;
    border: 1px solid #343434;
    border-radius: 24px 0 0 24px;
    background: #111;
    color: #fff;
    padding: 0 20px;
    outline: none
}

.search-box input:focus {
    border-color: #6090d0
}

.search-box button {
    width: 62px;
    flex: none;
    border: 1px solid #343434;
    border-left: 0;
    border-radius: 0 24px 24px 0;
    background: #222;
    color: #fff;
    font-size: 26px
}

.search-box button:hover {
    background: #343434
}

.account {
    position: relative
}

.account-panel {
    position: absolute;
    right: 0;
    top: 55px;
    width: 322px;
    border: 1px solid #383838;
    border-radius: 14px;
    background: #232323;
    box-shadow: 0 16px 45px #0009;
    padding: 18px;
    z-index: 30
}

.account-panel[hidden] {
    display: none
}

.account-panel h2 {
    font-size: 18px;
    margin: 0 0 12px
}

.panel-caption,
.account-panel small {
    color: #aaa;
    font-size: 12px;
    line-height: 1.45
}

.visitor-form {
    display: grid;
    gap: 9px
}

.visitor-form label {
    font-size: 12px;
    margin-top: 7px
}

.visitor-form input {
    width: 100%;
    height: 41px;
    background: #111;
    border: 1px solid #777;
    border-radius: 7px;
    color: #fff;
    padding: 0 12px
}

.visitor-form button {
    height: 40px;
    border: 0;
    border-radius: 6px;
    background: #e9233e;
    color: white;
    font-weight: 700;
    margin-top: 13px
}

.visitor-form button:hover {
    background: #fa3650
}

.form-error {
    padding: 10px;
    background: #5e2330;
    border-radius: 7px;
    font-size: 12px
}

.admin-link {
    display: block;
    color: #bbb;
    font-size: 12px;
    margin-top: 18px
}

.account-panel>a,
.account-panel>button.account-menu-action,
.account-exit {
    display: block;
    width: 100%;
    padding: 11px 9px;
    border: 0;
    border-radius: 7px;
    text-align: left;
    background: none;
    color: #eee;
    font-size: 14px
}

.account-panel>a:hover,
.account-panel>button.account-menu-action:hover,
.account-exit:hover {
    background: #373737
}

.account-name {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #444;
    padding-bottom: 14px;
    margin-bottom: 8px
}

.account-name strong,
.account-name small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px
}

.account-name strong {
    font-size: 14px
}

.portal-modal {
    width: min(520px, calc(100vw - 24px));
    max-width: none;
    max-height: min(85vh, 760px);
    margin: auto;
    overflow: auto;
    border: 1px solid #475569;
    border-radius: 14px;
    background: #1f2937;
    color: #f8fafc;
    padding: 22px;
    box-shadow: 0 20px 60px rgb(0 0 0 / 45%)
}

.portal-modal::backdrop {
    background: rgb(3 7 18 / 72%);
    backdrop-filter: blur(2px)
}

.portal-modal form {
    display: grid;
    gap: 10px
}

.portal-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 18px
}

.portal-modal-header h2 {
    margin: 0;
    color: #fff;
    font-size: 20px;
    font-weight: 700
}

.portal-modal-header p {
    margin: 5px 0 0;
    color: #cbd5e1;
    font-size: 13px
}

.portal-modal-header > button {
    flex: none;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: #374151;
    color: #fff;
    font-size: 24px;
    line-height: 1
}

.portal-profile-fields {
    display: grid;
    gap: 10px
}

.portal-profile-fields > div {
    display: grid;
    gap: 4px;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 10px 12px
}

.portal-profile-fields span,
.portal-modal-label {
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 600
}

.portal-profile-fields strong {
    overflow-wrap: anywhere;
    color: #fff;
    font-size: 14px
}

.portal-modal-input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #64748b;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    padding: 9px 11px
}

.portal-modal-input:focus {
    outline: 2px solid #eab308;
    outline-offset: 1px
}

.portal-modal-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px
}

.portal-modal-primary,
.portal-modal-secondary {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 700
}

.portal-modal-primary {
    background: #eab308;
    color: #111827
}

.portal-modal-secondary {
    background: #374151;
    color: #f8fafc
}

.portal-modal-errors,
.portal-modal-success,
.portal-modal-note {
    margin: 0 0 12px;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px
}

.portal-modal-errors {
    border: 1px solid #7f1d1d;
    background: #450a0a;
    color: #fecaca
}

.portal-modal-errors p {
    margin: 0
}

.portal-modal-success {
    border: 1px solid #166534;
    background: #14532d;
    color: #dcfce7
}

.portal-modal-note {
    margin: 14px 0 0;
    background: #374151;
    color: #cbd5e1
}

.portal-shell {
    display: flex;
    min-height: calc(100vh - 72px)
}

.sidebar {
    width: 220px;
    flex: none;
    padding: 17px 12px;
    position: sticky;
    top: 72px;
    height: calc(100vh - 72px);
    overflow: auto
}

.sidebar.sidebar-collapsed {
    display: none
}

.sidebar-is-collapsed .portal-main {
    max-width: none
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 23px;
    min-height: 42px;
    padding: 0 15px;
    border-radius: 9px;
    margin: 3px 0;
    font-size: 14px
}

.nav-item>span {
    width: 17px;
    font-size: 18px;
    text-align: center
}

.nav-item:hover,
.nav-item.active {
    background: #292929
}

.nav-item.active {
    font-weight: 700
}

.nav-divider {
    height: 1px;
    background: #303030;
    margin: 25px 10px 20px
}

.nav-heading {
    font-size: 12px;
    color: #aaa;
    margin: 0 12px 8px
}

.playlist-folder-list {
    margin: 2px 0 8px
}

.playlist-folder-item {
    display: flex;
    align-items: center;
    gap: 3px
}

.playlist-folder-item .playlist-folder-link {
    flex: 1;
    min-width: 0
}

.playlist-folder-actions {
    position: relative;
    flex: none
}

.playlist-folder-actions > summary {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 7px;
    color: #cbd5e1;
    cursor: pointer;
    list-style: none
}

.playlist-folder-actions > summary::-webkit-details-marker {
    display: none
}

.playlist-folder-actions > summary:hover,
.playlist-folder-actions[open] > summary {
    background: #374151;
    color: #fff
}

.playlist-folder-menu {
    position: absolute;
    z-index: 25;
    top: 30px;
    right: 0;
    width: 145px;
    border: 1px solid #475569;
    border-radius: 8px;
    background: #1f2937;
    padding: 5px;
    box-shadow: 0 8px 20px rgb(0 0 0 / 35%)
}

.playlist-folder-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #f8fafc;
    padding: 8px;
    text-align: left;
    font-size: 12px
}

.playlist-folder-menu button:hover {
    background: #374151
}

.playlist-folder-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 6px 10px 6px 24px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 13px
}

.playlist-folder-link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.playlist-folder-link:hover,
.playlist-folder-link.active {
    background: #292929;
    color: #fff
}

.playlist-folder-empty {
    margin: 4px 8px 8px 24px;
    color: #a1a1aa;
    font-size: 12px;
    line-height: 1.5
}

.playlist-folder-create {
    display: flex;
    gap: 6px;
    margin: 6px 2px 8px
}

.playlist-folder-create input {
    min-width: 0;
    width: 100%;
    border: 1px solid #475569;
    border-radius: 7px;
    background: #1f2937;
    color: #fff;
    padding: 7px 9px;
    font-size: 12px
}

.playlist-folder-create input::placeholder {
    color: #a1a1aa
}

.playlist-folder-create button {
    flex: none;
    width: 34px;
    border: 0;
    border-radius: 7px;
    background: #eab308;
    color: #111827
}

.playlist-folder-error {
    margin: 0 4px 8px;
    color: #fca5a5;
    font-size: 12px
}

.playlist-save {
    position: relative
}

.playlist-save > summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 9px 13px;
    border-radius: 22px;
    background: #2c2c2c;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    list-style: none
}

.playlist-save > summary::-webkit-details-marker {
    display: none
}

.playlist-save > summary:hover,
.playlist-save > summary.selected {
    background: #505050;
    color: #60a5fa
}

.playlist-save-panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    left: 0;
    width: min(290px, calc(100vw - 32px));
    max-height: 65vh;
    overflow: auto;
    border: 1px solid #475569;
    border-radius: 10px;
    background: #1f2937;
    color: #f8fafc;
    padding: 14px;
    box-shadow: 0 12px 30px rgb(0 0 0 / 35%)
}

.playlist-save-panel form {
    display: grid;
    gap: 10px
}

.playlist-save-panel label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 0;
    overflow-wrap: anywhere
}

.playlist-save-panel form > button {
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: #eab308;
    color: #111827;
    padding: 9px 12px;
    font-weight: 700
}

.playlist-save-status {
    border: 1px solid #166534;
    border-radius: 8px;
    background: #14532d;
    color: #dcfce7;
    padding: 10px 14px
}

.portal-main {
    flex: 1;
    min-width: 0;
    padding: 26px 24px 60px
}

.catalog-heading .eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.8px;
    color: #fef9c2;
    margin: 0 0 12px;
}

.catalog-heading h1 {
    font-size: 28px;
    line-height: 1.2;
    font-weight: 700;
    margin: 0 0 17px;
    color: #fdc700;
}

.catalog-heading-1 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 260px);
    align-items: center;
    gap: 16px;
}

.catalog-heading-title,
.catalog-heading-filter,
.group-filter {
    min-width: 0;
}

.group-filter {
    width: 100%;
}

.group-filter select {
    background: #f4f4f4;
    border: 0;
    border-radius: 9px;
    color: #111;
    font-weight: 700;
    font-size: 13px;
    padding: 11px 14px;
    width: 100%;
    min-width: 0;
    max-width: 100%
}

.results-count {
    font-size: 13px;
    font-weight: 700;
    /* margin: 25px 0 20px */
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 34px 18px
}

.video-card {
    min-width: 0
}

.card-cover {
    position: relative;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #081430, #184b6b);
    border-radius: 11px;
    overflow: hidden
}

.card-cover img,
.next-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block
}

.cover-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: #111b;
    color: white;
    font-size: 20px;
    opacity: 0
}

.video-card:hover .cover-play,
.video-card:focus-visible .cover-play {
    opacity: 1
}

.private-cover {
    display: flex;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: radial-gradient(circle at 25% 25%, #29678a, #0b1e31 65%)
}

.private-cover>span {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    color: #143047;
    font-size: 24px
}

.private-cover small {
    letter-spacing: 1.5px;
    font-weight: 700
}

.duration {
    position: absolute;
    right: 9px;
    bottom: 8px;
    background: #000c;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700
}

.card-details {
    display: flex;
    gap: 11px;
    padding: 11px 2px
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #50617e;
    color: white;
    display: grid;
    place-items: center;
    flex: none;
    font-size: 14px
}

.card-details h2 {
    font-size: 15px;
    line-height: 1.35;
    margin: 2px 0 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden
}

.card-details p {
    font-size: 12px;
    color: #aaa;
    margin: 0
}

.card-details p span {
    margin: 0 4px
}

.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 90px 20px;
    color: #aaa
}

.empty-state>span {
    font-size: 48px
}

.empty-state h2 {
    color: white;
    font-size: 20px
}

.pagination {
    margin-top: 32px
}

.pagination nav {
    display: flex;
    gap: 6px
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 7px 10px;
    background: #252525;
    border-radius: 6px
}

.watch-shell .portal-main {
    padding: 20px 24px
}

.watch-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(285px, 1fr);
    gap: 24px
}

.watch-primary {
    min-width: 0
}

.player-frame {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    background: #020615
}

.player-frame iframe {
    width: 100%;
    height: 100%;
    border: 0
}

.watch-primary h1 {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    margin: 18px 0 14px
}

.watch-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap
}

.channel {
    display: flex;
    align-items: center;
    gap: 12px
}

.channel strong,
.channel small {
    display: block
}

.channel strong {
    font-size: 14px
}

.channel small {
    font-size: 12px;
    color: #aaa;
    margin-top: 4px
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 7px
}

.action-buttons button {
    border: 0;
    border-radius: 22px;
    background: #2c2c2c;
    color: #fff;
    padding: 10px 15px;
    font-size: 12px;
    font-weight: 700
}

.action-buttons button:hover,
.action-buttons button.selected {
    background: #505050
}

.action-buttons button.selected {
    color: #ff677a
}

.description {
    position: relative;
    white-space: normal;
    background: #242424;
    border-radius: 12px;
    padding: 16px;
    margin-top: 18px;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere
}

.description.is-collapsed {
    max-height: 174px;
    overflow: hidden;
    padding-bottom: 48px
}

.description.is-collapsed::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 58px;
    background: linear-gradient(transparent, #242424 58%);
    content: "";
    pointer-events: none
}

.description-toggle {
    display: inline-block;
    border: 0;
    background: transparent;
    color: #93c5fd;
    padding: 8px 0 0;
    font-size: 13px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px
}

.description-toggle:hover,
.description-toggle:focus-visible {
    color: #bfdbfe;
    outline: none
}

.description.is-collapsed .description-toggle {
    position: absolute;
    z-index: 1;
    bottom: 13px;
    left: 16px;
    padding: 0
}

.description-toggle[hidden] {
    display: none
}

.description > :first-child {
    margin-top: 0
}

.description > :last-child {
    margin-bottom: 0
}

.description p {
    margin: 0 0 10px
}

.description h1,
.description h2,
.description h3,
.description h4,
.description h5,
.description h6 {
    font-weight: 700;
    line-height: 1.35;
    margin: 14px 0 8px
}

.description h1 { font-size: 20px }
.description h2 { font-size: 18px }
.description h3 { font-size: 16px }
.description h4,
.description h5,
.description h6 { font-size: 15px }

.description ul,
.description ol {
    margin: 8px 0 12px;
    padding-left: 22px
}

.description ul {
    list-style: disc
}

.description ol {
    list-style: decimal
}

.description li {
    margin: 4px 0
}

.description a {
    color: #60a5fa;
    text-decoration: underline
}

.description a:hover {
    color: #93c5fd
}

.description blockquote {
    margin: 10px 0;
    padding: 8px 14px;
    border-left: 3px solid #60a5fa;
    background: #1b1b1b;
    border-radius: 0 6px 6px 0
}

.description pre,
.description code {
    font-family: monospace;
    background: #181818;
    border-radius: 6px
}

.description code {
    padding: 2px 5px;
    font-size: 13px
}

.description pre {
    padding: 12px;
    overflow-x: auto;
    margin: 10px 0
}

.description table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0
}

.description th,
.description td {
    border: 1px solid #3c3c3c;
    padding: 8px 10px;
    text-align: left
}

.description img {
    max-width: 100%;
    height: auto;
    border-radius: 8px
}

.watch-next h2 {
    font-size: 17px;
    font-weight: 500;
    margin: 4px 0 17px
}

.next-video {
    display: flex;
    gap: 12px;
    margin-bottom: 13px
}

.next-cover {
    width: 47%;
    min-width: 130px;
    aspect-ratio: 16/9;
    border-radius: 9px;
    overflow: hidden;
    background: linear-gradient(135deg, #25436d, #12646c);
    display: grid;
    place-items: center;
    font-size: 24px
}

.next-video>span {
    flex: 1;
    min-width: 0
}

.next-video strong {
    font-size: 13px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden
}

.next-video small {
    display: block;
    color: #aaa;
    font-size: 12px;
    margin-top: 6px
}

.next-summary {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
}

@media(max-width:1150px) {
    .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }
    .watch-layout {
        grid-template-columns: minmax(0, 1fr) 290px
    }
}

@media(max-width:850px) {
    .sidebar {
        width: 68px;
        padding: 17px 5px
    }
    .nav-item {
        justify-content: center;
        padding: 0
    }
    .nav-item>span {
        width: auto
    }
    .nav-item {
        font-size: 0
    }
    .nav-heading,
    .nav-divider {
        display: none
    }
    .watch-layout {
        grid-template-columns: 1fr
    }
    .watch-next {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px
    }
    .watch-next h2 {
        grid-column: 1/-1
    }
    .topbar-brand {
        min-width: auto
    }
    .search-box {
        width: min(50vw, 500px)
    }
}

@media(max-width:700px) {
    .catalog-heading-1 {
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
    }
}

@media(max-width:600px) {
    .topbar {
        padding: 0 12px;
        gap: 9px;
        height: 62px
    }
    .topbar-brand {
        gap: 8px
    }
    .brand {
        gap: 6px;
        font-size: 15px
    }
    .brand-play {
        width: 26px;
        height: 20px;
        font-size: 11px
    }
    .icon-button {
        width: 34px;
        height: 34px;
        font-size: 17px
    }
    .search-box {
        height: 36px;
        width: auto;
        flex: 1
    }
    .search-box input {
        padding: 0 10px;
        font-size: 12px
    }
    .search-box button {
        width: 38px;
        font-size: 19px
    }
    .account-panel {
        right: -2px;
        max-width: calc(100vw - 20px)
    }
    .portal-main {
        padding: 21px 12px
    }
    .sidebar {
        display: none
    }
    .catalog-heading h1 {
        font-size: 23px
    }
    .video-grid {
        grid-template-columns: 1fr;
        gap: 15px
    }
    .watch-shell .portal-main {
        padding: 10px 12px
    }
    .watch-next {
        grid-template-columns: 1fr
    }
    .watch-actions {
        align-items: flex-start
    }
}

@media(max-width:600px) {
    .sidebar.sidebar-mobile-open {
        display: block;
        position: fixed;
        top: 62px;
        left: 0;
        z-index: 18;
        width: 220px;
        height: calc(100vh - 62px);
        background: #161616;
        box-shadow: 12px 0 35px #0009
    }
    .sidebar.sidebar-mobile-open .nav-item {
        font-size: 14px;
        justify-content: flex-start;
        padding: 0 15px
    }
    .sidebar.sidebar-mobile-open .nav-heading,
    .sidebar.sidebar-mobile-open .nav-divider {
        display: block
    }
}

.card-cover .thumbnail-video,
.next-cover .thumbnail-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0
}

.card-cover .thumbnail-video.ready,
.next-cover .thumbnail-video.ready {
    opacity: 1
}
form[id^="reply-form-"][hidden] { display: none !important; }


/* Theme switch controls */
.assistive-buttons { display:flex; align-items:center; gap:5px }
.assistive-buttons > button { border:0; border-radius:50%; background:transparent; padding:0 }
.assistive-buttons > button .avatar { transition:background .16s, outline-color .16s; outline:2px solid transparent; outline-offset:2px }
.assistive-buttons > button:hover .avatar, .assistive-buttons > button:focus-visible .avatar { background:#64748b }
.assistive-buttons > button[aria-pressed="true"] .avatar { outline-color:#facc15 }
.account > button[data-toggle-account] { border:0; border-radius:50%; background:transparent; padding:0 }
.account > button[data-toggle-account]:focus-visible { outline:2px solid #facc15; outline-offset:3px }

/* Light theme; dark remains the default. */
html[data-portal-theme="light"], html[data-portal-theme="light"] body, html[data-portal-theme="light"] .video-portal { color-scheme:light; background:#f1f5f9; color:#172033 }
html[data-portal-theme="light"] .topbar { background:#fff; color:#172033; box-shadow:0 1px 8px #0f172a20 }
html[data-portal-theme="light"] .sidebar { background:#fff; border-right:1px solid #dbe2ea }
html[data-portal-theme="light"] .nav-item, html[data-portal-theme="light"] .playlist-folder-link { color:#334155 }
html[data-portal-theme="light"] .nav-item:hover, html[data-portal-theme="light"] .nav-item.active, html[data-portal-theme="light"] .playlist-folder-link:hover, html[data-portal-theme="light"] .playlist-folder-link.active { background:#e2e8f0; color:#0f172a }
html[data-portal-theme="light"] .nav-divider { background:#dbe2ea }
html[data-portal-theme="light"] .account-name { border-color:#dbe2ea }
html[data-portal-theme="light"] .nav-heading, html[data-portal-theme="light"] .playlist-folder-empty, html[data-portal-theme="light"] .panel-caption, html[data-portal-theme="light"] .account-panel small, html[data-portal-theme="light"] .card-details p, html[data-portal-theme="light"] .channel small, html[data-portal-theme="light"] .next-video small, html[data-portal-theme="light"] .empty-state { color:#64748b }
html[data-portal-theme="light"] .search-box input, html[data-portal-theme="light"] .visitor-form input, html[data-portal-theme="light"] .playlist-folder-create input, html[data-portal-theme="light"] .portal-modal-input { background:#fff; color:#172033; border-color:#cbd5e1 }
html[data-portal-theme="light"] .search-box button, html[data-portal-theme="light"] .action-buttons button, html[data-portal-theme="light"] .playlist-save > summary, html[data-portal-theme="light"] .pagination a, html[data-portal-theme="light"] .pagination span { background:#e2e8f0; color:#172033 }
html[data-portal-theme="light"] .account-panel, html[data-portal-theme="light"] .playlist-folder-menu, html[data-portal-theme="light"] .playlist-save-panel { background:#fff; border-color:#cbd5e1; color:#172033; box-shadow:0 16px 40px #0f172a2e }
html[data-portal-theme="light"] .account-panel > a, html[data-portal-theme="light"] .account-panel > button.account-menu-action, html[data-portal-theme="light"] .account-exit, html[data-portal-theme="light"] .playlist-folder-menu button { color:#172033 }
html[data-portal-theme="light"] .account-panel > a:hover, html[data-portal-theme="light"] .account-panel > button.account-menu-action:hover, html[data-portal-theme="light"] .account-exit:hover, html[data-portal-theme="light"] .playlist-folder-menu button:hover { background:#f1f5f9 }
html[data-portal-theme="light"] .portal-main, html[data-portal-theme="light"] .card-details h2, html[data-portal-theme="light"] .watch-primary h1, html[data-portal-theme="light"] .watch-next h2, html[data-portal-theme="light"] .next-video strong, html[data-portal-theme="light"] .empty-state h2 { color:#172033 }
html[data-portal-theme="light"] .catalog-heading .eyebrow { color:#475569 }
html[data-portal-theme="light"] .description { background:#fff; color:#263449; box-shadow:0 1px 4px #0f172a1a }
html[data-portal-theme="light"] .description.is-collapsed::after {
    background: linear-gradient(transparent, #fff 58%)
}
html[data-portal-theme="light"] .description-toggle { color: #1d4ed8 }
html[data-portal-theme="light"] .description-toggle:hover,
html[data-portal-theme="light"] .description-toggle:focus-visible { color: #1e40af }

html[data-portal-theme="light"] .description blockquote, html[data-portal-theme="light"] .description pre, html[data-portal-theme="light"] .description code { background:#f1f5f9; color:#263449 }
html[data-portal-theme="light"] .description th, html[data-portal-theme="light"] .description td { border-color:#cbd5e1 }
html[data-portal-theme="light"] .portal-modal { background:#fff; color:#172033; border-color:#cbd5e1; box-shadow:0 20px 60px #0f172a40 }
html[data-portal-theme="light"] .portal-modal-header h2, html[data-portal-theme="light"] .portal-profile-fields strong { color:#172033 }
html[data-portal-theme="light"] .portal-modal-header p, html[data-portal-theme="light"] .portal-profile-fields span, html[data-portal-theme="light"] .portal-modal-label { color:#475569 }
html[data-portal-theme="light"] .portal-modal-header > button, html[data-portal-theme="light"] .portal-modal-secondary, html[data-portal-theme="light"] .portal-modal-note { background:#e2e8f0; color:#172033 }
html[data-portal-theme="light"] .portal-profile-fields > div { border-color:#dbe2ea }
html[data-portal-theme="light"] .playlist-save-panel label { color:#172033 }
@media(max-width:600px) { .assistive-buttons { gap:2px } .assistive-buttons .avatar { width:30px; height:30px } }


/* Contraste dos controles na pagina de reproducao quando o tema claro estiver ativo. */
html[data-portal-theme="light"] .assistive-buttons .avatar {
    background: #e2e8f0;
    color: #334155
}
html[data-portal-theme="light"] .assistive-buttons > button[aria-pressed="true"] .avatar {
    background: #cbd5e1
}
html[data-portal-theme="light"] .assistive-buttons .fa-sun,
html[data-portal-theme="light"] .assistive-buttons .fa-moon {
    color: #334155 !important
}
html[data-portal-theme="light"] .icon-button {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #334155
}
html[data-portal-theme="light"] .menu-button {
    background: transparent
}
html[data-portal-theme="light"] .menu-button:hover,
html[data-portal-theme="light"] .menu-button:focus-visible {
    background: #e2e8f0
}
html[data-portal-theme="light"] .channel small,
html[data-portal-theme="light"] .video-views,
html[data-portal-theme="light"] .next-video small,
html[data-portal-theme="light"] .next-summary,
html[data-portal-theme="light"] .watch-next .text-slate-400,
html[data-portal-theme="light"] .watch-next .text-slate-500,
html[data-portal-theme="light"] .watch-primary .text-slate-400,
html[data-portal-theme="light"] .watch-primary .text-slate-500 {
    color: #475569 !important
}
html[data-portal-theme="light"] .action-buttons button .vote-count {
    color: inherit
}
html[data-portal-theme="light"] .watch-next .border-slate-500,
html[data-portal-theme="light"] .watch-next .border-slate-700,
html[data-portal-theme="light"] .watch-primary .border-slate-700 {
    border-color: #cbd5e1
}
html[data-portal-theme="light"] .watch-primary textarea,
html[data-portal-theme="light"] .watch-primary input:not([type="hidden"]) {
    color: #172033
}
html[data-portal-theme="light"] .watch-primary textarea {
    background: #fff
}


.portal-password-field {
    position: relative;
    width: 100%
}
.portal-password-field > input {
    width: 100%;
    padding-right: 48px
}
.portal-password-field > .portal-password-toggle {
    position: absolute;
    top: -12;
    right: 6px;
    bottom: 0;
    display: grid;
    width: 34px;
    place-items: center;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #94a3b8;
    padding: 0;
    line-height: 1
}
.portal-password-toggle i {
    display: block;
    line-height: 1
}
.portal-password-field > .portal-password-toggle:hover,
.portal-password-field > .portal-password-toggle:focus-visible {
    /* background: #334155; */
    background-color: transparent;
    color: #fff;
    outline: none
}
html[data-portal-theme="light"] .portal-password-field > .portal-password-toggle {
    color: #475569
}
html[data-portal-theme="light"] .portal-password-field > .portal-password-toggle:hover,
html[data-portal-theme="light"] .portal-password-field > .portal-password-toggle:focus-visible {
    background: #e2e8f0;
    color: #0f172a
}


.password-flow-card {
    width: min(520px, 100%);
    margin: 28px auto;
    padding: 28px;
    border: 1px solid #383838;
    border-radius: 14px;
    background: #232323;
    color: #f8fafc;
    box-shadow: 0 16px 40px rgb(0 0 0 / 20%)
}
.password-flow-card h1 {
    margin: 0 0 10px;
    font-size: 24px;
    font-weight: 700
}
.password-flow-card > p {
    color: #cbd5e1;
    line-height: 1.55
}
.password-flow-form {
    display: grid;
    gap: 10px;
    margin-top: 22px
}
.password-flow-form label {
    font-size: 13px;
    font-weight: 600
}
.password-flow-form > input,
.password-flow-form .portal-password-field > input {
    min-height: 42px;
    border: 1px solid #64748b;
    border-radius: 8px;
    background: #111827;
    color: #f8fafc;
    padding: 9px 12px
}
.password-flow-form .portal-password-field > input {
    padding-right: 48px
}
.password-flow-form > button {
    min-height: 42px;
    margin-top: 8px;
    border: 0;
    border-radius: 8px;
    background: #e9233e;
    color: #fff;
    font-weight: 700
}
.password-flow-back {
    display: inline-block;
    margin-top: 20px;
    color: #cbd5e1;
    text-decoration: underline
}
.forgot-password-link {
    margin: 14px 0 0;
    color: #cbd5e1;
    font-size: 12px
}
.forgot-password-link a {
    color: #60a5fa;
    text-decoration: underline
}
.form-success {
    padding: 10px 12px;
    border: 1px solid #166534;
    border-radius: 8px;
    background: #14532d;
    color: #dcfce7;
    font-size: 13px
}
.form-error p {
    margin: 0
}
html[data-portal-theme="light"] .password-flow-card {
    border-color: #dbe2ea;
    background: #fff;
    color: #172033;
    box-shadow: 0 16px 40px rgb(15 23 42 / 10%)
}
html[data-portal-theme="light"] .password-flow-card > p,
html[data-portal-theme="light"] .password-flow-back,
html[data-portal-theme="light"] .forgot-password-link {
    color: #475569
}
html[data-portal-theme="light"] .password-flow-form > input,
html[data-portal-theme="light"] .password-flow-form .portal-password-field > input {
    border-color: #cbd5e1;
    background: #fff;
    color: #172033
}
html[data-portal-theme="light"] .forgot-password-link a {
    color: #1d4ed8
}


.portal-zoom-controls {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 38px;
    padding: 2px 5px;
    border-radius: 22px;
    background: #1e293b;
    color: #f8fafc
}
.portal-zoom-controls button {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 17px
}
.portal-zoom-controls button:hover:not(:disabled),
.portal-zoom-controls button:focus-visible {
    background: #475569;
    outline: none
}
.portal-zoom-controls button:disabled {
    cursor: not-allowed;
    opacity: .45
}
.portal-zoom-controls output {
    min-width: 42px;
    text-align: center;
    font-size: 12px;
    font-variant-numeric: tabular-nums
}
html[data-portal-theme="light"] .portal-zoom-controls {
    background: #e2e8f0;
    color: #334155
}
html[data-portal-theme="light"] .portal-zoom-controls button:hover:not(:disabled),
html[data-portal-theme="light"] .portal-zoom-controls button:focus-visible {
    background: #cbd5e1
}

@media(max-width:600px) {
    .portal-zoom-controls {
        min-height: 32px;
        gap: 0;
        padding: 1px 3px
    }
    .portal-zoom-controls button {
        width: 27px;
        height: 28px;
        font-size: 15px
    }
    .portal-zoom-controls output {
        min-width: 34px;
        font-size: 11px
    }
}


/* Cards do catalogo respeitam o tema selecionado. */
html[data-portal-theme="light"] .video-card {
    border-color: #dbe2ea;
    background: #fff;
    color: #172033;
    box-shadow: 0 2px 8px rgb(15 23 42 / 8%)
}
html[data-portal-theme="light"] .video-card:hover,
html[data-portal-theme="light"] .video-card:focus-visible {
    border-color: #94a3b8;
    box-shadow: 0 6px 18px rgb(15 23 42 / 12%)
}
html[data-portal-theme="light"] .video-card .card-details h2 {
    color: #172033
}
html[data-portal-theme="light"] .video-card .card-details p,
html[data-portal-theme="light"] .video-card .video-views {
    color: #475569
}
html[data-portal-theme="light"] .video-card .card-details .avatar {
    background: #e2e8f0;
    color: #334155
}
html[data-portal-theme="light"] .catalog-heading-1 {
    border-color: #cbd5e1
}
html[data-portal-theme="light"] .catalog-heading-title .text-yellow-100 {
    color: #64748b
}
html[data-portal-theme="light"] .catalog-heading h1 {
    color: #92400e
}
.portal-tools-dropdown { display: contents }
.portal-tools-toggle { display: none }
.portal-tools-panel { display: contents }
@media(max-width:600px) {
 .topbar { gap:7px; padding-inline:10px }
 .topbar-brand { flex:none; gap:7px }
 .brand { gap:0 }
 .brand strong { display:none }
 .brand img { width:38px; height:38px; max-width:42px }
 .topbar-controls { flex:none; gap:8px !important; position:relative }
 .portal-tools-dropdown { display:block; position:relative }
 .portal-tools-toggle { display:grid; place-items:center; width:34px; height:34px; border:0; border-radius:50%; background:#1e293b; color:#f8fafc; font-size:16px }
 .portal-tools-panel { display:none; position:absolute; z-index:40; top:calc(100% + 10px); right:0; min-width:164px; padding:10px; border:1px solid #334155; border-radius:12px; background:#0f172b; color:#f8fafc; box-shadow:0 14px 32px #0006; gap:10px; flex-direction:column }
 .portal-tools-panel.is-open { display:flex }
 .portal-tools-panel .assistive-buttons { justify-content:center; gap:10px }
 .portal-tools-panel .portal-zoom-controls { justify-content:center }
 .account-panel { z-index:45; right:0; max-width:calc(100vw - 16px) }
 html[data-portal-theme="light"] .portal-tools-toggle { background:#e2e8f0; color:#334155 }
 html[data-portal-theme="light"] .portal-tools-panel { background:#fff; border-color:#cbd5e1; color:#172033 }
}
/* Header compact layout for tablets and narrow desktop widths. */
@media(max-width:767px) {
 .topbar { gap:8px; padding-inline:12px }
 .topbar-brand { min-width:0; flex:none; gap:8px }
 .brand { gap:0 }
 .brand strong { display:none }
 .brand img { width:42px; height:42px; max-width:44px }
 .search-box { width:auto; min-width:0; flex:1 1 auto }
 .topbar-controls { min-width:0; flex:none; gap:8px !important; position:relative }
 .portal-tools-dropdown { display:block; position:relative }
 .portal-tools-toggle { display:grid; place-items:center; width:36px; height:36px; border:0; border-radius:50%; background:#1e293b; color:#f8fafc; font-size:16px }
 .portal-tools-panel { display:none; position:absolute; z-index:40; top:calc(100% + 10px); right:0; min-width:164px; padding:10px; border:1px solid #334155; border-radius:12px; background:#0f172b; color:#f8fafc; box-shadow:0 14px 32px #0006; gap:10px; flex-direction:column }
 .portal-tools-panel.is-open { display:flex }
 .portal-tools-panel .assistive-buttons { justify-content:center; gap:10px }
 .portal-tools-panel .portal-zoom-controls { justify-content:center }
 .account-panel { z-index:45; right:0; max-width:calc(100vw - 16px) }
 html[data-portal-theme="light"] .portal-tools-toggle { background:#e2e8f0; color:#334155 }
 html[data-portal-theme="light"] .portal-tools-panel { background:#fff; border-color:#cbd5e1; color:#172033 }
}
@media(max-width:767px) {
 .topbar-controls > :not([hidden]) ~ :not([hidden]) { margin-left:0 }
}
