/* ===== Base ===== */
.yt-board {
    color: var(--content-font-color);
    font-family: var(--content-font-family);
    width: 100%;
    max-width: 1360px;
    min-height: 75vh;
    text-align: left;
    font-size: var(--content-font-size);
    margin: 24px auto 0;
    line-height: 1.5;
    color-scheme: light
}

.yt-board * {
    box-sizing: border-box
}

.yt-board [hidden] {
    display: none !important
}

.yt-board a {
    color: inherit;
    text-decoration: none
}

.yt-board button,
.yt-board input,
.yt-board select {
    font: inherit;
    color: inherit
}

.yt-board button {
    cursor: pointer
}

.yt-board button:disabled {
    cursor: default;
    opacity: 1
}

.yt-board button:focus-visible,
.yt-board a:focus-visible,
.yt-board summary:focus-visible {
    outline: 2px solid var(--accent-color, #065fd4);
    outline-offset: 3px
}

.yt-board .yt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    vertical-align: middle;
    width: 24px;
    height: 24px;
    flex-shrink: 0
}

.yt-board .yt-side-group h2 .yt-icon,
.yt-board .yt-drop-label .yt-icon,
.yt-board .yt-empty .yt-icon {
    width: 1em;
    height: 1em;
    font-size: inherit
}

/* ===== Header ===== */
.yt-header {
    height: 80px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 20px
}

.yt-icon-button {
    display: grid;
    place-items: center;
    border: 0;
    background: none;
    width: 40px;
    height: 40px;
    border-radius: 50%
}

.yt-icon-button:hover {
    background: #eee
}

.yt-logo {
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -1.8px;
    white-space: nowrap
}

.yt-logo sup {
    font-size: 10px;
    letter-spacing: 0;
    color: #606060;
    font-weight: 400;
    margin-left: 5px;
    vertical-align: top
}

.yt-search {
    display: flex;
    margin: 0 auto;
    width: min(48%, 730px);
    height: 44px;
    border: 1px solid #ccc;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px #eee
}

.yt-search input {
    width: 100%;
    min-width: 0;
    border: 0 !important;
    background: transparent;
    padding: 0 20px;
    font-size: 17px;
    outline-offset: -3px
}

.yt-search button {
    display: grid;
    place-items: center;
    width: 68px;
    flex-shrink: 0;
    border: 0;
    color: var(--btn-primary-text);
    background: var(--btn-primary-bg)
}

.yt-create {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text) !important;
    border-radius: 24px;
    padding: 6px 18px;
    white-space: nowrap
}

.yt-board .yt-create .yt-icon {
    width: 14px;
    height: 14px;
    font-size: 14px
}

.yt-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    background: #e8eef7;
    border-radius: 50%;
    overflow: hidden
}

.yt-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.yt-board .yt-avatar .yt-icon {
    color: #6a7c95;
    font-size: 30px;
    width: 30px;
    height: 30px
}

/* ===== List layout ===== */
.yt-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 24px
}

.yt-layout.is-collapsed {
    grid-template-columns: minmax(0, 1fr);
    padding-left: 26px
}

.yt-layout.is-collapsed .yt-sidebar {
    display: none
}

.yt-sidebar {
    padding: 4px 8px
}

.yt-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    background: none;
    border-radius: 10px;
    text-align: left;
    font-size: 15px !important
}

.yt-nav.active {
    font-weight: 600
}

.yt-nav:not(:disabled):hover {
    background: var(--btn-accent-bg);
    color: var(--btn-accent-text)
}

.yt-side-group {
    border-top: 1px solid #ddd;
    margin-top: 14px;
    padding-top: 16px
}

.yt-side-group h2 {
    font-size: 18px;
    padding: 0 16px;
    margin: 0 0 10px
}

.yt-side-group h2 span {
    padding-left: 10px
}

.yt-category-icon {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-radius: 50%;
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    flex-shrink: 0
}

.yt-board .yt-category-icon .yt-icon {
    font-size: 13px;
    width: 15px;
    height: 15px
}

.yt-feed {
    padding: 4px 20px 40px 0;
    min-width: 0
}

.yt-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 18px;
    white-space: nowrap
}

.yt-chips a {
    padding: 8px 15px;
    border-radius: 8px
}

.yt-chips .selected {
    background: var(--btn-accent-bg);
    color: var(--btn-accent-text)
}

/* ===== Play bar (→ dock.js) ===== */
.yt-playbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 22px;
    padding: 10px 12px 10px 16px;
    border: 1px solid var(--container-border-color, #e5e5e5);
    background: var(--container-bg-color, #fafafa);
    border-radius: 14px
}

.yt-playbar-label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0
}

.yt-board .yt-playbar .yt-icon {
    width: 1em;
    height: 1em;
    font-size: 15px
}

.yt-playbar-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0
}

.yt-playbar button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 0;
    border-radius: 20px;
    background: var(--btn-secondary-bg, #eee);
    color: var(--btn-secondary-text, #111);
    white-space: nowrap
}

.yt-playbar .yt-playbar-main {
    background: var(--btn-primary-bg, #111);
    color: var(--btn-primary-text, #fff)
}

.yt-playbar button:hover {
    opacity: .85
}

/* ===== Cards ===== */
.yt-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px 18px
}

.yt-thumb-wrap {
    position: relative
}

.yt-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16/9;
    background: #383838;
    color: #ddd !important;
    overflow: hidden;
    border-radius: 12px
}

.yt-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s
}

.yt-thumbnail:hover img {
    transform: scale(1.025)
}

.yt-playlist-preview {
    width: 100%;
    height: 100%;
    min-height: 200px;
    border: 0;
    pointer-events: none
}

.yt-card-play {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--btn-primary-bg, #111);
    color: var(--btn-primary-text, #fff);
    box-shadow: 0 3px 10px #0004;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .15s, transform .15s
}

.yt-board .yt-card-play .yt-icon {
    width: 16px;
    height: 16px;
    font-size: 15px
}

.yt-card:hover .yt-card-play,
.yt-card-play:focus-visible {
    opacity: 1;
    transform: none
}

.yt-card-info {
    display: flex;
    gap: 10px;
    padding-top: 10px;
    align-items: flex-start
}

.yt-card-copy {
    flex: 1;
    min-width: 0
}

.yt-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.45;
    margin-bottom: 3px;
    overflow-wrap: anywhere
}

.yt-card-copy p {
    margin: 0;
    color: #606060;
    font-size: 13px
}

.yt-more {
    position: relative;
    flex: 0 0 24px
}

.yt-more summary {
    list-style: none;
    cursor: pointer;
    font-size: 26px;
    line-height: 30px;
    text-align: center;
    border-radius: 20px
}

.yt-more summary::-webkit-details-marker {
    display: none
}

.yt-more summary:hover {
    background: #eee
}

.yt-dropdown {
    position: absolute;
    right: 0;
    top: 35px;
    z-index: 5;
    min-width: 125px;
    padding: 7px 0;
    background: white;
    box-shadow: 0 4px 22px #0002;
    border-radius: 10px
}

.yt-dropdown a,
.yt-dropdown span {
    display: block;
    padding: 9px 18px;
    white-space: nowrap
}

.yt-dropdown span {
    white-space: normal;
    width: 175px;
    color: #777;
    font-size: 12px
}

.yt-dropdown a:hover {
    background: #f2f2f2
}

.yt-empty {
    padding: 70px 20px;
    text-align: center;
    color: #777
}

.yt-empty a {
    display: block;
    margin-top: 16px
}

.yt-pagination {
    text-align: center;
    margin-top: 40px
}

/* ===== View ===== */
.yt-watch {
    max-width: 1280px;
    width: calc(100% - 64px);
    margin: 14px auto 60px
}

.yt-watch-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start
}

.yt-watch-main {
    min-width: 0
}

.yt-stage {
    position: relative;
    isolation: isolate;
    width: 100%;
    min-height: 200px;
    aspect-ratio: 16/9;
    background: #171717;
    border-radius: 20px;
    overflow: hidden
}

.yt-stage iframe {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0
}

.yt-watch-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-top: 16px
}

.yt-watch-title h1 {
    font-size: 26px;
    line-height: 1.4;
    margin: 0;
    overflow-wrap: anywhere
}

.yt-watch-title nav {
    display: flex;
    flex-shrink: 0;
    gap: 8px;
    white-space: nowrap
}

.yt-back {
    display: inline-block;
    margin-top: 26px;
    color: #606060 !important
}

.yt-playlist {
    border: 1px solid var(--container-border-color);
    border-radius: var(--container-border-radius);
    overflow: hidden;
    backdrop-filter: blur(15px);
    background: var(--container-bg-color)
}

.yt-playlist-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px;
    background: #f7f7f7
}

.yt-playlist-heading h2 {
    margin: 0;
    font-size: 18px
}

.yt-playlist-heading span {
    color: #666;
    font-size: 13px
}

#yt-player-status {
    margin: 0;
    padding: 12px 20px;
    font-size: 13px;
    color: #666;
    line-height: 1.6
}

#yt-player-status:empty {
    display: none
}

#yt-tracks {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    max-height: 550px;
    overflow-y: auto
}

#yt-tracks:empty {
    padding: 0
}

#yt-tracks button {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 0;
    background: transparent;
    color: #222;
    text-align: left
}

#yt-tracks button:hover {
    background: #f5f5f5
}

#yt-tracks button.is-current {
    background: #fff0f0;
    color: #b82020
}

#yt-tracks button:focus-visible {
    outline: 2px solid #b82020;
    outline-offset: -2px
}

.yt-track-number {
    flex: 0 0 20px;
    font-size: 12px;
    text-align: center
}

.yt-track-thumb {
    flex: 0 0 88px;
    width: 88px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px
}

/* Emoji in titles may be swapped for <img> by the site; keep them text-sized. */
.yt-track-title img,
.yt-title img,
.yt-watch-title h1 img,
.yt-playlist-heading img {
    display: inline;
    width: auto;
    height: 1.15em;
    vertical-align: -.2em
}

.yt-track-title {
    min-width: 0;
    font-size: 13px;
    overflow-wrap: anywhere
}

.yt-playlist-link {
    display: block;
    padding: 14px 20px;
    border-top: 1px solid #eee;
    font-size: 13px
}

/* ===== Write: fields left, thumbnail right ===== */
.yt-editor {
    max-width: 1040px;
    margin: 18px auto 40px;
    padding: 0 28px
}

.yt-editor-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px
}

.yt-editor h1 {
    font-size: 22px;
    margin: 0
}

.yt-editor-actions {
    display: flex;
    align-items: center;
    gap: 22px
}

.yt-save {
    border: 0;
    border-radius: 24px;
    background: #0f0f0f;
    color: #fff !important;
    padding: 10px 27px;
    font-weight: 600 !important
}

.yt-save:disabled {
    background: #888
}

.yt-compose {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(0, 3fr);
    gap: 28px;
    align-items: start
}

.yt-compose.is-single {
    grid-template-columns: minmax(0, 520px)
}

.yt-compose-fields,
.yt-compose-thumb,
.yt-field {
    display: flex;
    flex-direction: column;
    min-width: 0
}

.yt-compose-fields {
    gap: 14px
}

.yt-compose-thumb,
.yt-field {
    gap: 6px
}

.yt-field>span,
.yt-field-label {
    font-size: 12px;
    font-weight: 600;
    opacity: .75
}

.yt-field-label em {
    font-style: normal;
    font-weight: 400;
    opacity: .7;
    margin-left: 4px
}

.yt-field input,
.yt-field select {
    width: 100%;
    min-width: 0;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--form-text-color, inherit);
    border: 1px solid var(--form-border-color, #ddd);
    background: var(--form-bg-color, #fff);
    border-radius: var(--form-border-radius, 8px)
}

.yt-field small {
    font-size: 11px;
    opacity: .6
}

.yt-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

.yt-error {
    margin: 0;
    font-size: 13px;
    color: #b3261e
}

.yt-error:empty,
.yt-thumb-meta span:empty {
    display: none
}

.yt-drop {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16/9;
    background: #fafafa;
    border: 1px dashed #ccc;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden
}

.yt-drop:focus-within,
.yt-drop.is-dragover {
    outline: 2px solid #065fd4;
    outline-offset: 2px;
    background: #edf4ff
}

.yt-drop input[type=file] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2
}

.yt-drop-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    pointer-events: none;
    text-align: center;
    font-size: 11px;
    color: #888
}

.yt-drop-label b {
    font-size: 13px;
    color: #333;
    font-weight: 500
}

.yt-upload-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f5f5f5
}

.yt-upload-preview:not([hidden])~.yt-drop-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fffd;
    padding: 7px
}

.yt-upload-preview:not([hidden])~.yt-drop-label>span {
    display: none
}

.yt-thumb-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    font-size: 11px;
    opacity: .7
}

.yt-thumb-meta label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer
}

/* ===== Responsive ===== */
@media (min-width: 1600px) {
    .yt-layout {
        grid-template-columns: 240px minmax(0, 1fr);
        gap: 32px
    }

    .yt-header {
        height: 84px
    }

    .yt-sidebar {
        padding: 8px 16px
    }

    .yt-nav {
        padding: 12px 16px;
        gap: 24px;
        font-size: 17px !important
    }

    .yt-chips {
        padding-bottom: 22px
    }

    .yt-grid {
        gap: 36px 20px
    }

    .yt-title {
        font-size: 20px
    }

    .yt-card-copy p {
        font-size: 15px
    }

    .yt-avatar {
        width: 46px;
        height: 46px;
        flex-basis: 46px
    }
}

@media (max-width: 1100px) {
    .yt-layout {
        grid-template-columns: 175px minmax(0, 1fr);
        gap: 18px
    }

    .yt-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }

    .yt-nav {
        gap: 16px;
        padding: 12px
    }

    .yt-header {
        gap: 12px;
        padding: 12px 16px
    }

    .yt-logo {
        font-size: 24px
    }
}

@media (max-width: 1000px) {
    .yt-watch-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
        gap: 16px
    }
}

@media (max-width: 760px) {
    .yt-watch {
        width: calc(100% - 24px);
        margin: 12px auto 35px
    }

    .yt-watch-layout,
    .yt-compose,
    .yt-compose.is-single {
        grid-template-columns: minmax(0, 1fr)
    }

    .yt-compose {
        gap: 18px
    }

    #yt-tracks {
        max-height: 380px
    }

    .yt-playbar {
        margin-bottom: 16px;
        padding: 8px 8px 8px 12px;
        font-size: 13px
    }

    .yt-playbar button {
        padding: 6px 11px
    }
}

@media (max-width: 700px) {
    .yt-header {
        height: auto;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px
    }

    .yt-header>.yt-avatar {
        margin-left: auto;
        width: 34px;
        height: 34px;
        flex-basis: 34px
    }

    .yt-search {
        order: 5;
        width: 100%;
        height: 38px
    }

    .yt-create {
        margin-left: auto;
        padding: 7px 12px;
        font-size: 12px
    }

    .yt-header>.yt-create+.yt-avatar {
        margin-left: 0
    }

    .yt-layout {
        display: block
    }

    .yt-layout.is-collapsed {
        padding-left: 0
    }

    .yt-sidebar {
        display: none
    }

    .yt-feed {
        padding: 12px
    }

    .yt-chips {
        padding-bottom: 22px
    }

    .yt-grid {
        gap: 28px 12px
    }

    .yt-title {
        font-size: 14px
    }

    .yt-card-info {
        gap: 7px
    }

    .yt-card-info .yt-avatar {
        width: 30px;
        height: 30px;
        flex-basis: 30px
    }

    .yt-card-copy p {
        font-size: 11px
    }

    .yt-more {
        flex-basis: 18px
    }

    .yt-stage {
        border-radius: 12px
    }

    .yt-watch-title h1 {
        font-size: 20px
    }

    .yt-watch-title nav {
        gap: 4px
    }

    .yt-editor {
        padding: 0 14px;
        margin-top: 15px
    }
}

@media (max-width: 430px) {
    .yt-grid,
    .yt-field-row {
        grid-template-columns: minmax(0, 1fr)
    }

    .yt-card-info .yt-avatar {
        width: 38px;
        height: 38px;
        flex-basis: 38px
    }

    .yt-title {
        font-size: 16px
    }

    .yt-playbar-label {
        font-size: 12px
    }

    .yt-drop-label b {
        font-size: 11px
    }

    .yt-drop-label>span {
        font-size: 10px
    }
}

@media (hover: none) {
    .yt-card-play {
        opacity: .9;
        transform: none;
        width: 34px;
        height: 34px
    }
}

@media (prefers-reduced-motion: reduce) {
    .yt-thumbnail img,
    .yt-card-play {
        transition: none
    }
}
