html, body {
    max-width: 100%;
    overflow-x: hidden; /* Prevents horizontal scrolling/zooming */
    margin: 0;
    padding: 0;
}

:root { 
    --bg-base: #09090b; 
    --bg-surface: #18181b; 
    --bg-glass: rgba(24, 24, 27, 0.65);
    --text-primary: #fafafa; 
    --text-secondary: #a1a1aa; 
    --accent: #6366f1; /* Modern Indigo */
    --accent-hover: #4f46e5;
    --border-light: rgba(255, 255, 255, 0.08); 
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #52525b; }

* { box-sizing: border-box; }
body { 
    background-color: var(--bg-base); 
    background-image: radial-gradient(circle at 50% 0%, #1a1a24 0%, var(--bg-base) 60%);
    background-attachment: fixed;
    color: var(--text-primary); 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; 
}

.yt-layout { display: flex; width: 100%; min-height: 100vh; max-width: 1800px; margin: 0 auto; }

/* FIXED: Added top padding to clear the fixed mobile header */
.yt-main { flex: 1; padding: 85px 30px 30px 30px; min-width: 0; }

.watch-layout { display: grid; grid-template-columns: 2.8fr 1.2fr; gap: 32px; }

/* Cinematic Player Shell */
.watch-video-shell { 
    border-radius: var(--radius-lg); 
    overflow: hidden; 
    background: #000; 
    position: relative; 
    box-shadow: var(--shadow-glow), 0 20px 40px rgba(0,0,0,0.6); 
    border: 1px solid var(--border-light);
}

/* FIXED: Modern aspect ratio prevents collapsing */
.watch-video-frame { 
    position: relative; 
    width: 100%; 
    aspect-ratio: 16 / 9; 
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.watch-video-frame iframe,
.watch-video-frame #qtp-player { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: 1; 
    border: none; 
    object-fit: cover;
}

.unmute-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); cursor: pointer;
    transition: opacity 0.3s ease;
}
.unmute-btn {
    background: rgba(255,255,255,0.1); color: #fff; padding: 14px 28px; border-radius: 9999px;
    font-weight: 600; font-size: 16px; border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(12px); transition: all 0.2s ease; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    display: flex; align-items: center; gap: 10px;
}
.unmute-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }

.watch-body { padding: 24px; background: transparent; border-top: 1px solid var(--border-light); }

/* MUSIC FOCUSED TYPOGRAPHY */
.music-artist {
    color: blue;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.watch-title { 
    font-size: 1.6rem; 
    margin: 0 0 12px 0; 
    word-break: break-word; 
    font-weight: 800; 
    line-height: 1.25; 
    color: #ffffff; 
}

.watch-meta-row { display: flex; flex-wrap: wrap; gap: 16px; color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; }

/* Modern Pill Buttons */
.v-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.v-action-btn { 
    background: rgba(255,255,255,0.04); 
    color: var(--text-primary); 
    border: 1px solid var(--border-light); 
    padding: 10px 20px; 
    border-radius: 9999px; 
    font-size: 0.9rem; 
    cursor: pointer; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(8px);
}
.v-action-btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); transform: translateY(-2px); border-color: rgba(255,255,255,0.2); }
.v-action-btn.is-on { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4); }
.v-action-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; padding: 10px 24px !important; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover) !important; border-color: var(--accent-hover) !important; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4) !important; }

/* Comments Section */
.comments-section { padding: 24px; margin-top: 32px; background: transparent; backdrop-filter: none; border-radius: var(--radius-lg); border: 1px solid var(--border-light); }
.comments-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.comments-header-row h3 { margin: 0; font-size: 1.25rem; font-weight: 600; color: #ffffff; }

.comment-sort select {
    background: rgba(0,0,0,0.4); border: 1px solid var(--border-light); color: var(--text-primary); 
    padding: 8px 12px; border-radius: var(--radius-sm); outline: none; font-size: 0.9rem; font-family: inherit;
    cursor: pointer; transition: all 0.2s;
}
.comment-sort select:hover, .comment-sort select:focus { border-color: var(--accent); }
.comment-sort select option { background: var(--bg-surface); color: var(--text-primary); }

.comment-input-area { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }
.comment-input-area textarea { 
    width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--border-light); 
    color: var(--text-primary); padding: 16px; border-radius: var(--radius-md); resize: none; 
    outline: none; font-family: inherit; transition: all 0.2s; font-size: 0.95rem;
}
.comment-input-area textarea:focus { border-color: var(--accent); background: rgba(0,0,0,0.5); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2); }
.comment-actions { display: flex; justify-content: flex-end; }

.comment-item { display: flex; gap: 16px; margin-bottom: 24px; }
.comment-avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--bg-surface), #27272a); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; border: 1px solid var(--border-light); }
.comment-content { flex: 1; }
.comment-header { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.comment-author { font-weight: 600; font-size: 0.95rem; color: #ffffff; }
.comment-time { font-size: 0.8rem; color: var(--text-secondary); }
.comment-body { font-size: 0.95rem; line-height: 1.6; color: #ffffff; }

/* Glassmorphism Modals */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); z-index: 1000; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease; }
.modal-active { display: flex; opacity: 1; }
.pl-modal { background: var(--bg-surface); padding: 28px; border-radius: var(--radius-lg); width: min(380px, 92vw); box-sizing: border-box; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7); border: 1px solid var(--border-light); transform: translateY(20px); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); color: #ffffff; }
.modal-active .pl-modal { transform: translateY(0); }
.pl-input { flex-grow: 1; padding: 12px 16px; background: rgba(0,0,0,0.3); border: 1px solid var(--border-light); color: #ffffff; border-radius: var(--radius-sm); outline: none; transition: all 0.2s; }
.pl-input:focus { border-color: var(--accent); }
.pl-item { padding: 12px 16px; cursor: pointer; border-radius: var(--radius-sm); transition: all 0.2s; font-size: 0.95rem; display: flex; align-items: center; gap: 12px; border: 1px solid transparent; color: #ffffff; }
.pl-item:hover { background: rgba(255,255,255,0.05); border-color: var(--border-light); }

/* Playlist Queue Card */
.playlist-card { background: var(--bg-glass); backdrop-filter: blur(12px); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 32px; width: 100%; }
.playlist-header { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light); font-weight: 600; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.playlist-list { list-style: none; padding: 0; max-height: 450px; overflow-y: auto; margin: 0; padding-right: 4px; }
.playlist-item { display: flex; gap: 12px; padding: 10px; cursor: pointer; border-radius: var(--radius-md); align-items: center; transition: all 0.2s; border: 1px solid transparent; margin-bottom: 4px; }
.playlist-item:hover { background: rgba(255,255,255,0.04); }
.playlist-item-active { background: rgba(99, 102, 241, 0.1); border: 1px solid rgba(99, 102, 241, 0.3); }
.playlist-thumb { width: 90px; aspect-ratio: 16/9; background: #000; border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0; position: relative; }
.playlist-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.playlist-item:hover .playlist-thumb img { transform: scale(1.05); }
.playlist-info-title { font-size: 0.9rem; line-height: 1.4; font-weight: 500; color: var(--text-primary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Modern Sidebar Grid */
.recommend-header { margin-bottom: 20px; }
.recommend-header h3 { margin: 0; font-size: 1.2rem; font-weight: 600; display: flex; align-items: center; gap: 10px; color: var(--text-primary); }

.music-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 16px; 
}

.m-card { 
    background: transparent; 
    border-radius: var(--radius-md); 
    cursor: pointer; 
    transition: all 0.3s ease; 
    position: relative;
}
.m-card:hover { transform: translateY(-4px); }

.m-thumb { 
    position: relative; 
    width: 100%; 
    aspect-ratio: 16/10; 
    border-radius: var(--radius-md); 
    overflow: hidden; 
    background: #27272a; 
    margin-bottom: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 1px solid var(--border-light);
}
.m-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.m-card:hover .m-thumb img { transform: scale(1.08); }

.m-duration { 
    position: absolute; 
    bottom: 8px; 
    left: 8px; 
    background: rgba(0,0,0,0.7); 
    backdrop-filter: blur(4px);
    color: #fff; 
    font-size: 11px; 
    font-weight: 600;
    padding: 4px 8px; 
    border-radius: var(--radius-sm); 
}

.play-button {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.play-button svg { width: 18px; height: 18px; fill: #fff; margin-left: 2px; }
.m-card:hover .play-button { opacity: 1; transform: translateY(0); }
.play-button:hover { transform: scale(1.1); background: var(--accent-hover); }

.m-details { display: flex; flex-direction: column; gap: 4px; padding: 0 4px; }
.m-title { 
    font-size: 0.95rem; 
    font-weight: 600; 
    color: var(--text-primary); 
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}
.m-channel { 
    font-size: 0.85rem; 
    color: var(--text-secondary); 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.loading-spinner { border: 3px solid rgba(99, 102, 241, 0.1); border-top: 3px solid var(--accent); border-radius: 50%; width: 28px; height: 28px; animation: spin 1s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* MOBILE RESPONSIVE FIXES */
@media (max-width: 1100px) { 
    .watch-layout { grid-template-columns: 1fr; } 
    .watch-right { max-width: 800px; margin: 0 auto; width: 100%; }
    .music-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
@media (max-width: 600px) {
    /* Critical: 85px top padding clears the fixed mobile header */
    .yt-main { padding: 85px 16px 16px 16px; } 
    .watch-layout { gap: 24px; }
    .watch-video-shell { border-radius: var(--radius-md); border: none; }
    .watch-title { font-size: 1.35rem; }
    .watch-body { padding: 16px; }
    .music-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    
    /* Allow scrolling of the action buttons on small screens */
    .v-actions { overflow-x: auto; padding-bottom: 8px; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .v-action-btn { white-space: nowrap; flex-shrink: 0; }
}