/* YouTube Channel Biolink */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html.yt-light, html.yt-light body, .yt-light {
    --yt-bg: #ffffff;
    --yt-surface: #ffffff;
    --yt-text: #0f0f0f;
    --yt-text-secondary: #606060;
    --yt-border: #e5e5e5;
    --yt-hover: rgba(0, 0, 0, 0.05);
    --yt-chip-bg: #f2f2f2;
    --yt-modal-bg: #ffffff;
    --yt-banner-fallback: linear-gradient(135deg, #ff0000 0%, #cc0000 50%, #990000 100%);
    --yt-subscribe-bg: #0f0f0f;
    --yt-subscribe-text: #ffffff;
    --yt-secondary-bg: #f2f2f2;
    --yt-secondary-text: #0f0f0f;
}

html.yt-dark, html.yt-dark body, .yt-dark {
    --yt-bg: #0f0f0f;
    --yt-surface: #0f0f0f;
    --yt-text: #f1f1f1;
    --yt-text-secondary: #aaaaaa;
    --yt-border: #3f3f3f;
    --yt-hover: rgba(255, 255, 255, 0.08);
    --yt-chip-bg: #272727;
    --yt-modal-bg: #212121;
    --yt-banner-fallback: linear-gradient(135deg, #ff0000 0%, #3f3f3f 100%);
    --yt-subscribe-bg: #f1f1f1;
    --yt-subscribe-text: #0f0f0f;
    --yt-secondary-bg: #272727;
    --yt-secondary-text: #f1f1f1;
}

html, body {
    margin: 0;
    background-color: var(--yt-bg, #0f0f0f);
    color: var(--yt-text, #f1f1f1);
    font-family: Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.yt-app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--yt-bg);
    color: var(--yt-text);
}

/* Top bar */
.yt-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 16px;
    background: var(--yt-surface);
    border-bottom: 1px solid var(--yt-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.yt-logo { color: var(--yt-text); }

.yt-topbar-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    color: var(--yt-text);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-topbar-btn:active { background: var(--yt-hover); }

/* Banner */
.yt-banner {
    height: 120px;
    background: var(--yt-banner-fallback);
    background-size: cover;
    background-position: center;
}

/* Channel */
.yt-channel {
    padding: 16px 16px 0;
}

.yt-channel-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.yt-avatar img,
.yt-avatar-ring img,
.yt-avatar-ph {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.yt-avatar-ph {
    background: linear-gradient(135deg, #ff0000, #cc0000);
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-avatar-ring {
    border: none;
    background: linear-gradient(135deg, #ff0000, #ff6b6b);
    border-radius: 50%;
    padding: 3px;
    cursor: pointer;
    flex-shrink: 0;
}

.yt-avatar-ring-inner {
    display: block;
    background: var(--yt-bg);
    border-radius: 50%;
    padding: 3px;
}

.yt-channel-text { flex: 1; min-width: 0; padding-top: 8px; }

.yt-channel-name {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
    word-break: break-word;
}

.yt-channel-handle,
.yt-channel-stats {
    font-size: 13px;
    color: var(--yt-text-secondary);
    line-height: 1.4;
}

.yt-channel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.yt-btn {
    height: 36px;
    padding: 0 16px;
    border: none;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}

.yt-btn-subscribe {
    background: var(--yt-btn-primary, #ff0000);
    color: var(--yt-btn-text, #fff);
}

.yt-btn-subscribe.subscribed {
    background: var(--yt-secondary-bg);
    color: var(--yt-secondary-text);
}

.yt-btn-secondary {
    background: var(--yt-secondary-bg);
    color: var(--yt-secondary-text);
}

.yt-btn-icon {
    width: 36px;
    padding: 0;
}

.yt-bio-wrap { margin-bottom: 8px; }

.yt-bio {
    font-size: 14px;
    line-height: 1.5;
    color: var(--yt-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yt-bio.expanded {
    display: block;
    -webkit-line-clamp: unset;
}

.yt-bio-more {
    border: none;
    background: none;
    color: var(--yt-text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
    font-family: inherit;
}

.yt-website {
    display: inline-block;
    font-size: 14px;
    color: #3ea6ff;
    text-decoration: none;
    margin-bottom: 12px;
}

.yt-playlists {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.yt-playlists::-webkit-scrollbar { display: none; }

.yt-playlist-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: none;
    border-radius: 8px;
    background: var(--yt-chip-bg);
    color: var(--yt-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.yt-playlist-chip.active {
    background: var(--yt-text);
    color: var(--yt-bg);
}

.yt-playlist-chip-img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: cover;
}

/* Tabs */
.yt-tabs {
    display: flex;
    border-bottom: 1px solid var(--yt-border);
    position: sticky;
    top: 56px;
    z-index: 40;
    background: var(--yt-bg);
    overflow-x: auto;
    scrollbar-width: none;
}

.yt-tabs::-webkit-scrollbar { display: none; }

.yt-tab {
    flex: 1;
    min-width: 80px;
    height: 48px;
    border: none;
    background: none;
    color: var(--yt-text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    white-space: nowrap;
    padding: 0 12px;
}

.yt-tab.active {
    color: var(--yt-text);
    font-weight: 600;
}

.yt-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--yt-text);
}

/* Video cards */
.yt-videos { padding-bottom: 24px; }

.yt-videos[hidden],
.yt-shorts-grid[hidden] { display: none !important; }

.yt-video-card {
    cursor: pointer;
    margin-bottom: 4px;
}

.yt-video-card.hidden { display: none; }

.yt-video-card:active { background: var(--yt-hover); }

.yt-video-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.yt-video-thumb img,
.yt-video-thumb video,
.yt-thumb-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.yt-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #212121;
    color: #717171;
}

.yt-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
}

.yt-video-info {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    align-items: flex-start;
}

.yt-video-avatar img,
.yt-video-avatar-ph {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.yt-video-avatar-ph {
    background: #ff0000;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-video-meta { flex: 1; min-width: 0; }

.yt-video-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yt-video-sub {
    font-size: 12px;
    color: var(--yt-text-secondary);
    line-height: 1.4;
}

.yt-video-menu {
    border: none;
    background: none;
    color: var(--yt-text-secondary);
    font-size: 18px;
    padding: 0 4px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Shorts grid */
.yt-shorts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px 16px;
}

.yt-short-card {
    cursor: pointer;
    border: none;
    background: none;
    text-align: left;
    font-family: inherit;
    color: inherit;
    padding: 0;
}

.yt-short-card.hidden { display: none; }

.yt-short-thumb {
    aspect-ratio: 9 / 16;
    border-radius: 12px;
    overflow: hidden;
    background: #212121;
    margin-bottom: 8px;
}

.yt-short-thumb img,
.yt-short-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.yt-short-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yt-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--yt-text-secondary);
    font-size: 14px;
    grid-column: 1 / -1;
}

.yt-brand {
    padding: 24px;
    text-align: center;
    font-size: 12px;
}

.yt-brand a {
    color: var(--yt-text-secondary);
    text-decoration: none;
}

/* Story viewer */
.yt-story-viewer {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #000;
    display: flex;
    flex-direction: column;
}

.yt-story-viewer[hidden] { display: none !important; }

.yt-story-header { padding: 12px 16px 0; }

.yt-story-progress {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.yt-story-progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.yt-story-progress-fill {
    height: 100%;
    width: 0;
    background: #fff;
}

.yt-story-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.yt-story-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.yt-story-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.yt-story-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.yt-story-content img,
.yt-story-content video {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
}

.yt-story-caption {
    color: #fff;
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
}

.yt-story-link-btn {
    margin-top: 12px;
    padding: 10px 24px;
    background: #ff0000;
    color: #fff;
    border-radius: 18px;
    text-decoration: none;
    font-weight: 500;
}

.yt-story-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40%;
    height: 80%;
    border: none;
    background: transparent;
    cursor: pointer;
    z-index: 10;
}

.yt-story-prev { left: 0; }
.yt-story-next { right: 0; }

/* Modal */
.yt-modal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.yt-modal[hidden] { display: none !important; }

.yt-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.yt-modal-sheet {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    background: var(--yt-modal-bg);
    border-radius: 12px 12px 0 0;
    overflow: auto;
    z-index: 1;
}

.yt-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 2;
}

.yt-modal-player {
    background: #000;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-modal-player img,
.yt-modal-video {
    width: 100%;
    max-height: 50vh;
    object-fit: contain;
}

.yt-modal-body {
    padding: 16px;
}

.yt-modal-body h2 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    line-height: 1.4;
}

.yt-modal-body p {
    font-size: 14px;
    color: var(--yt-text-secondary);
    margin-bottom: 16px;
    line-height: 1.4;
}

.yt-modal-cta { width: 100%; }

@media (min-width: 481px) {
    .yt-modal { align-items: center; }
    .yt-modal-sheet { border-radius: 12px; }
}
