/* ============================================================
   🍊 ORANGETUBE · CAPA DE ANIMACIONES Y DETALLES
   Se carga después de style.css: solo añade, nunca rompe.
   ============================================================ */

:root {
    --ot-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ot-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ot-orange-1: #FFB020;
    --ot-orange-2: #FF8C38;
    --ot-orange-3: #FF6B00;
    --ot-orange-4: #E0460A;
}

/* ============================================================
   1 · KEYFRAMES
   ============================================================ */
@keyframes otLogoFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-2px) rotate(-1.5deg); }
}

@keyframes otLogoSpin {
    0% { transform: rotate(0deg) scale(1); }
    40% { transform: rotate(200deg) scale(1.12); }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes otLeafSway {
    0%, 100% { transform: rotate(0deg); }
    45% { transform: rotate(-9deg); }
    70% { transform: rotate(4deg); }
}

@keyframes otPlayPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes otGlint {
    0%, 55% { transform: translateX(-140%) rotate(16deg); opacity: 0; }
    60% { opacity: 0.9; }
    80% { transform: translateX(160%) rotate(16deg); opacity: 0; }
    100% { transform: translateX(160%) rotate(16deg); opacity: 0; }
}

@keyframes otDrift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(4%, -6%, 0) scale(1.08); }
    100% { transform: translate3d(-5%, 5%, 0) scale(0.96); }
}

@keyframes otShine {
    0% { transform: translateX(-120%) skewX(-12deg); }
    100% { transform: translateX(220%) skewX(-12deg); }
}

@keyframes otPopIn {
    0% { opacity: 0; transform: scale(0.86) translateY(10px); }
    70% { opacity: 1; transform: scale(1.03) translateY(0); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes otToastIn {
    0% { opacity: 0; transform: translateY(18px) scale(0.94); }
    65% { opacity: 1; transform: translateY(-3px) scale(1.01); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes otBannerUp {
    0% { opacity: 0; transform: translateY(120%) scale(0.94); }
    70% { opacity: 1; transform: translateY(-6px) scale(1.01); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes otModalIn {
    0% { opacity: 0; transform: scale(0.9) translateY(24px); }
    60% { opacity: 1; transform: scale(1.02) translateY(-2px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes otSpark {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--tx, 0), var(--ty, 0)) scale(0.2); }
}

@keyframes otHeart {
    0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
    25% { opacity: 1; transform: translate(calc(var(--tx, 0px) * 0.4), calc(var(--ty, -40px) * 0.5)) scale(1.1); }
    100% { opacity: 0; transform: translate(var(--tx, 0px), var(--ty, -80px)) scale(0.7); }
}

@keyframes otRing {
    0% { transform: scale(0.85); opacity: 0.8; }
    100% { transform: scale(1.9); opacity: 0; }
}

@keyframes otBump {
    0% { transform: scale(1); }
    35% { transform: scale(0.82); }
    70% { transform: scale(1.14); }
    100% { transform: scale(1); }
}

@keyframes otIconWiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-12deg) scale(1.1); }
    60% { transform: rotate(10deg) scale(1.05); }
}

@keyframes otFloatIn {
    0% { opacity: 0; transform: translateY(14px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes otBarFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes otThemeReveal {
    from { clip-path: circle(0% at var(--ot-vt-x, 50%) var(--ot-vt-y, 50%)); }
    to { clip-path: circle(150% at var(--ot-vt-x, 50%) var(--ot-vt-y, 50%)); }
}

@keyframes otSplashPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
    70% { box-shadow: 0 0 0 26px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

@keyframes otDot {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-7px); opacity: 1; }
}

@keyframes otSweepBorder {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* ============================================================
   2 · LOGO ANIMADO
   ============================================================ */
.ot-logo-mark {
    position: relative;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 50%;
    filter: drop-shadow(0 5px 12px rgba(255, 107, 0, 0.45));
}

.ot-logo-mark svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
    animation: otLogoFloat 4.2s ease-in-out infinite;
}

.ot-logo-mark .ot-logo-leaf {
    transform-box: fill-box;
    transform-origin: 15% 92%;
    animation: otLeafSway 4.2s ease-in-out infinite;
}

.ot-logo-mark .ot-logo-play {
    transform-box: fill-box;
    transform-origin: center;
    animation: otPlayPulse 2.6s ease-in-out infinite;
}

.ot-logo-glint {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
}

.ot-logo-glint::after {
    content: '';
    position: absolute;
    top: -60%;
    left: -120%;
    width: 55%;
    height: 220%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.9), transparent);
    animation: otGlint 5.5s ease-in-out infinite;
}

.logo:hover .ot-logo-mark svg {
    animation: otLogoSpin 0.85s var(--ot-ease-bounce);
}

.logo:hover .ot-logo-mark .ot-logo-leaf {
    animation: otLeafSway 0.6s ease-in-out 2;
}

.logo:active .ot-logo-mark {
    transform: scale(0.92);
}

.ot-logo-mark.is-spinning svg {
    animation: otLogoSpin 0.9s var(--ot-ease-bounce);
}

.logo-text {
    letter-spacing: -0.4px;
    background: linear-gradient(100deg, var(--text-primary) 40%, var(--primary) 70%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text .tube {
    background: linear-gradient(100deg, var(--ot-orange-1), var(--ot-orange-3) 60%, var(--ot-orange-4));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* En modo oscuro el degradado de texto necesita más contraste */
[data-theme="dark"] .logo-text {
    --text-primary: #F7F7F7;
}

/* ============================================================
   3 · FONDO AURORA
   ============================================================ */
.ot-aurora {
    position: fixed;
    inset: -12%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.75;
    animation: pageIn 1.2s ease both;
}

.ot-aurora span {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    will-change: transform;
    animation: otDrift var(--ot-aurora-dur, 24s) ease-in-out infinite alternate;
}

.ot-aurora span:nth-child(1) {
    width: 46vmax;
    height: 46vmax;
    top: -12%;
    left: -10%;
    background: radial-gradient(circle, rgba(255, 140, 56, 0.55), transparent 65%);
}

.ot-aurora span:nth-child(2) {
    width: 38vmax;
    height: 38vmax;
    bottom: -16%;
    right: -8%;
    background: radial-gradient(circle, rgba(255, 107, 0, 0.42), transparent 65%);
    animation-delay: -8s;
    animation-duration: 28s;
}

.ot-aurora span:nth-child(3) {
    width: 34vmax;
    height: 34vmax;
    top: 38%;
    right: 18%;
    background: radial-gradient(circle, rgba(255, 196, 77, 0.35), transparent 68%);
    animation-delay: -15s;
    animation-duration: 32s;
}

.ot-aurora span:nth-child(4) {
    width: 26vmax;
    height: 26vmax;
    bottom: 18%;
    left: 12%;
    background: radial-gradient(circle, rgba(255, 61, 0, 0.22), transparent 70%);
    animation-delay: -4s;
    animation-duration: 26s;
}

[data-theme="dark"] .ot-aurora {
    opacity: 0.5;
}

/* ============================================================
   4 · SPLASH
   ============================================================ */
.ot-splash {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: radial-gradient(120% 120% at 50% -10%, #FFA640 0%, #FF6B00 48%, #C0390A 100%);
    color: #fff;
    transition: opacity 0.55s ease, visibility 0.55s ease;
}

.ot-splash.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.ot-splash-logo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    display: grid;
    place-items: center;
    animation: otSplashPulse 1.8s ease-out infinite;
}

.ot-splash-logo svg {
    width: 70px;
    height: 70px;
}

.ot-splash-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    animation: otPopIn 0.7s var(--ot-ease-bounce) both;
}

.ot-splash-sub {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.85;
    animation: otPopIn 0.7s 0.12s var(--ot-ease-bounce) both;
}

.ot-splash-dots {
    display: flex;
    gap: 7px;
    margin-top: 6px;
}

.ot-splash-dots i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    animation: otDot 1.1s ease-in-out infinite;
}

.ot-splash-dots i:nth-child(2) { animation-delay: 0.15s; }
.ot-splash-dots i:nth-child(3) { animation-delay: 0.3s; }

/* ============================================================
   5 · PROGRESO DE SCROLL + NAVBAR DE CRISTAL
   ============================================================ */
.ot-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 1100;
    transform: scaleX(var(--p, 0));
    transform-origin: 0 50%;
    background: linear-gradient(90deg, var(--ot-orange-1), var(--ot-orange-3) 55%, #FF3D00);
    box-shadow: 0 0 14px rgba(255, 107, 0, 0.65);
    pointer-events: none;
    transition: transform 0.12s linear;
}

.navbar {
    transition: background-color var(--transition), box-shadow var(--transition), backdrop-filter var(--transition);
}

.navbar.is-scrolled {
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.28);
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
}

[data-theme="dark"] .navbar.is-scrolled {
    background: rgba(15, 15, 15, 0.78);
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.8);
}

/* ============================================================
   6 · REVELADO AL HACER SCROLL
   ============================================================ */
.ot-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.65s var(--ot-ease-out), transform 0.65s var(--ot-ease-out);
    transition-delay: var(--ot-delay, 0ms);
}

.ot-reveal.is-in {
    opacity: 1;
    transform: none;
}

/* ============================================================
   7 · TARJETAS DE VIDEO
   ============================================================ */
.video-card {
    --tiltX: 0deg;
    --tiltY: 0deg;
    animation-delay: calc(var(--i, 0) * 45ms);
    transition: transform 0.35s var(--ot-ease-out), box-shadow 0.35s ease, border-color 0.3s ease;
}

.video-card.is-ready {
    animation: none;
    transform: perspective(900px) rotateX(var(--tiltX)) rotateY(var(--tiltY));
}

.video-card.is-ready:hover {
    transform: perspective(900px) rotateX(var(--tiltX)) rotateY(var(--tiltY)) translateY(-6px) scale(1.012);
    box-shadow: 0 24px 46px -22px rgba(255, 107, 0, 0.55), 0 12px 26px -18px rgba(0, 0, 0, 0.45);
    border-color: var(--primary);
}

.video-thumbnail img {
    transition: filter 0.55s ease, transform 0.45s var(--ot-ease-out);
}

.video-thumbnail img:not(.is-loaded) {
    filter: blur(12px);
    transform: scale(1.04);
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.06);
}

/* Destello al pasar el ratón */
.video-thumbnail::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, 0.38) 48%, transparent 62%);
    transform: translateX(-130%);
    pointer-events: none;
    opacity: 0;
}

.video-card:hover .video-thumbnail::before {
    opacity: 1;
    animation: otShine 0.85s var(--ot-ease-out);
}

.video-card:hover .video-card-avatar {
    box-shadow: 0 0 0 2px var(--primary);
}

.video-card:hover .video-duration {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

.video-duration {
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.video-card:hover .video-card-title {
    color: var(--primary);
    transition: color 0.25s ease;
}

.yt-badge {
    animation: otPopIn 0.5s var(--ot-ease-bounce) both;
}

/* ============================================================
   8 · CHIPS, BOTONES Y BUSCADOR
   ============================================================ */
.chip {
    position: relative;
    overflow: hidden;
    transition: transform 0.22s var(--ot-ease-out), background 0.25s ease,
                color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.chip:hover {
    transform: translateY(-2px);
    color: var(--primary);
    box-shadow: 0 8px 16px -10px rgba(255, 107, 0, 0.8);
}

.chip.active {
    background: linear-gradient(135deg, var(--ot-orange-2), #F25C00);
    border-color: transparent;
    box-shadow: 0 10px 22px -10px rgba(255, 107, 0, 0.9);
}

.chip i {
    margin-right: 4px;
}

.chip:hover i {
    animation: otIconWiggle 0.6s ease;
}

.btn-primary,
.upload-btn,
.btn-upload,
.btn-select {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn-primary::after,
.upload-btn::after,
.btn-upload::after,
.btn-select::after {
    content: '';
    position: absolute;
    top: -40%;
    left: -60%;
    width: 40%;
    height: 180%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: translateX(-40%) skewX(-14deg);
    opacity: 0;
    pointer-events: none;
}

.btn-primary:hover::after,
.upload-btn:hover::after,
.btn-upload:hover::after,
.btn-select:hover::after {
    opacity: 1;
    animation: otShine 0.8s ease;
}

.btn-primary:hover,
.btn-upload:hover {
    box-shadow: 0 14px 28px -12px rgba(255, 107, 0, 0.9);
}

.search-box {
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.16), 0 10px 25px -18px rgba(255, 107, 0, 0.9);
    transform: translateY(-1px);
}

.search-btn:hover i {
    animation: otIconWiggle 0.55s ease;
}

.mobile-search {
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.mobile-search:focus-within {
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.16), 0 12px 26px -18px rgba(255, 107, 0, 0.9);
    border-color: var(--primary);
}

input.ph-swap::placeholder {
    animation: otPopIn 0.45s ease both;
}

/* ============================================================
   9 · MENÚ LATERAL Y BARRA INFERIOR
   ============================================================ */
.sidebar-item {
    position: relative;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s var(--ot-ease-out);
}

.sidebar-item:hover {
    transform: translateX(4px);
}

.sidebar-item:hover i {
    animation: otIconWiggle 0.6s ease;
    color: var(--primary);
}

.sidebar-item.active {
    overflow: hidden;
}

.sidebar-item.active::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 40%, rgba(255, 255, 255, 0.12) 50%, transparent 60%);
    background-size: 300% 100%;
    animation: otSweepBorder 4s linear infinite;
    pointer-events: none;
}

.bottom-nav-item .bottom-nav-icon {
    transition: transform 0.3s var(--ot-ease-bounce), color 0.25s ease;
}

.bottom-nav-item:active .bottom-nav-icon {
    animation: otBump 0.45s var(--ot-ease-bounce);
}

.bottom-nav-item.active .bottom-nav-icon {
    transform: translateY(-2px) scale(1.08);
}

.bottom-nav-item.accent .bottom-nav-icon {
    background: linear-gradient(135deg, var(--ot-orange-2), #F25C00);
    box-shadow: 0 10px 22px -10px rgba(255, 107, 0, 0.95);
}

.bottom-nav-item.accent:hover .bottom-nav-icon {
    animation: otBump 0.5s var(--ot-ease-bounce);
}


/* ============================================================
   10 · PÁGINA DE VIDEO
   ============================================================ */
.video-player-container {
    box-shadow: 0 30px 70px -40px rgba(255, 107, 0, 0.7);
    transition: box-shadow 0.4s ease;
}

.video-title {
    position: relative;
}

.player-extras .pe-btn {
    transition: transform 0.2s var(--ot-ease-bounce), background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.player-extras .pe-btn:hover {
    transform: translateY(-2px);
}

.player-extras .pe-btn.active {
    animation: otSplashPulse 2.4s ease-out infinite;
}

.player-extras .pe-btn:active {
    transform: scale(0.94);
}

.channel-avatar {
    transition: transform 0.3s var(--ot-ease-bounce), box-shadow 0.3s ease;
}

.channel-info:hover .channel-avatar {
    transform: scale(1.06) rotate(-3deg);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.35);
}

.subscribe-btn.subscribed {
    animation: otPopIn 0.5s var(--ot-ease-bounce);
}

.action-btn:hover,
.like-comment:hover {
    transform: translateY(-2px);
}

.action-btn.active i,
#likeBtn.active i {
    animation: otBump 0.5s var(--ot-ease-bounce);
}

/* Comentarios: entrada suave */
.comment {
    animation: otFloatIn 0.45s var(--ot-ease-out) both;
}

/* ============================================================
   11 · EXPLORAR Y SUBIR
   ============================================================ */
.ex-channel {
    transition: transform 0.28s var(--ot-ease-out), box-shadow 0.28s ease;
}

.ex-channel:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 16px 30px -20px rgba(255, 107, 0, 0.9);
}

.ex-channel:active {
    transform: scale(0.96);
}

.ex-channel-avatar {
    transition: box-shadow 0.3s ease, transform 0.3s var(--ot-ease-bounce);
}

.ex-channel:hover .ex-channel-avatar {
    transform: scale(1.07);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.35);
}

.ex-instance-list > * {
    transition: background 0.25s ease, transform 0.25s ease;
}

.ex-panel {
    animation: otPopIn 0.45s var(--ot-ease-out) both;
}

.progress-fill {
    background: linear-gradient(90deg, var(--ot-orange-1), var(--ot-orange-3), var(--ot-orange-1));
    background-size: 200% 100%;
    animation: otBarFlow 1.6s linear infinite;
}

.btn-select:hover {
    transform: translateY(-2px);
}

.char-count {
    transition: color 0.25s ease;
}

/* ============================================================
   12 · MODALES, TOASTS Y AVISOS
   ============================================================ */
@media (min-width: 769px) {
    .modal-overlay.active .modal {
        animation: otModalIn 0.45s var(--ot-ease-bounce) both;
    }
}

.modal-overlay {
    transition: opacity 0.3s ease, background 0.3s ease;
}

.modal-logo {
    animation: otPlayPulse 2.4s ease-in-out infinite;
}

.toast {
    animation: otToastIn 0.45s var(--ot-ease-bounce) both;
}

.toast-action {
    transition: background 0.25s ease, transform 0.2s ease;
}

.toast-action:hover {
    transform: scale(1.05);
}

.install-banner {
    animation: otBannerUp 0.65s var(--ot-ease-bounce) both;
}

.install-banner .install-icon,
.install-banner i {
    animation: otIconWiggle 1.8s ease-in-out infinite;
}

.offline-banner {
    animation: otBannerUp 0.5s var(--ot-ease-out) both;
}

.scroll-top {
    position: fixed;
}

.scroll-top .scroll-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.scroll-top .scroll-ring circle {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.scroll-top .scroll-ring .ring-track {
    stroke: currentColor;
    opacity: 0.18;
}

.scroll-top .scroll-ring .ring-fill {
    stroke: var(--primary);
    stroke-dasharray: var(--ring-len, 132);
    stroke-dashoffset: var(--ring-offset, 132);
    transition: stroke-dashoffset 0.12s linear;
}

/* ============================================================
   13 · PARTÍCULAS (chispas, corazones, confeti)
   ============================================================ */
.ot-spark {
    position: fixed;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle, #FFE0A3, var(--ot-orange-3) 70%);
    pointer-events: none;
    z-index: 9500;
    animation: otSpark 0.62s ease-out forwards;
}

.ot-heart {
    position: fixed;
    font-size: 16px;
    pointer-events: none;
    z-index: 9500;
    animation: otHeart 1s ease-out forwards;
    will-change: transform, opacity;
}

#otConfetti {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9400;
}

/* Anillo al pulsar la barra inferior */
.ot-tap-ring {
    position: fixed;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    border-radius: 50%;
    border: 2px solid rgba(255, 107, 0, 0.7);
    pointer-events: none;
    z-index: 9300;
    animation: otRing 0.55s ease-out forwards;
}

/* ============================================================
   14 · TRANSICIÓN DE TEMA (View Transitions)
   ============================================================ */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}


.theme-btn i {
    transition: transform 0.4s var(--ot-ease-bounce);
}

.theme-btn:hover i {
    transform: rotate(25deg) scale(1.12);
}

.theme-btn:active i {
    transform: rotate(-30deg) scale(0.9);
}

/* ============================================================
   15 · DETALLES SUELTOS
   ============================================================ */
.skeleton,
.skeleton-thumb,
.skeleton-line {
    background-image: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.35) 50%,
        rgba(255, 255, 255, 0) 100%);
    background-repeat: no-repeat;
    background-size: 400px 100%;
    animation: shimmer 1.4s linear infinite;
}

[data-theme="dark"] .skeleton,
[data-theme="dark"] .skeleton-thumb,
[data-theme="dark"] .skeleton-line {
    background-image: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0) 100%);
}

/* Telón del menú lateral: oscurece y desenfoca lo de atrás.
   (Sin animación de opacidad: se controla con la clase .show) */
.sidebar-backdrop {
    -webkit-backdrop-filter: blur(10px) saturate(130%);
    backdrop-filter: blur(10px) saturate(130%);
    background: rgba(10, 6, 2, 0.45);
    animation: none !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.spinner {
    box-shadow: 0 0 18px rgba(255, 107, 0, 0.35);
}

.no-results i,
.no-results .ot-empty-icon {
    animation: otLogoFloat 3.6s ease-in-out infinite;
}

.sidebar-footer p:first-child {
    background: linear-gradient(100deg, var(--ot-orange-1), var(--ot-orange-3));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
}

/* Scrollbar animada */
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--ot-orange-2), var(--ot-orange-4));
}

/* Foco visible y bonito (accesibilidad) */
:focus-visible {
    outline: 3px solid rgba(255, 107, 0, 0.55);
    outline-offset: 2px;
    border-radius: 8px;
}

/* ============================================================
   16 · AJUSTES MÓVILES Y RENDIMIENTO
   ============================================================ */
@media (max-width: 768px) {
    .ot-logo-mark {
        width: 30px;
        height: 30px;
    }

    .ot-aurora span {
        filter: blur(48px);
    }

    .ot-splash-logo {
        width: 84px;
        height: 84px;
    }

    .ot-splash-logo svg {
        width: 62px;
        height: 62px;
    }

    .video-card.is-ready:hover {
        transform: none;
        box-shadow: none;
    }
}

@media (hover: none) {
    .video-card:hover {
        transform: none;
    }

    .video-thumbnail::before {
        display: none;
    }
}

/* ============================================================
   17 · MENOS MOVIMIENTO
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .ot-aurora,
    .ot-splash,
    .ot-progress,
    #otConfetti,
    .ot-spark,
    .ot-heart,
    .ot-tap-ring {
        display: none !important;
    }

    .ot-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .ot-logo-mark svg,
    .ot-logo-mark .ot-logo-leaf,
    .ot-logo-mark .ot-logo-play,
    .ot-logo-glint::after {
        animation: none !important;
    }

    .video-thumbnail img {
        filter: none;
    }
}

/* ============================================================
   18 · REMATES
   ============================================================ */
/* Si el navegador no recorta degradados de texto, que se lea igual */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
    .logo-text,
    .logo-text .tube,
    .sidebar-footer p:first-child {
        background: none;
        -webkit-text-fill-color: currentColor;
        color: inherit;
    }

    .logo-text .tube {
        color: var(--primary);
    }
}

.ot-modal-mark {
    display: inline-grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 14px;
    border-radius: 50%;
    font-size: 22px !important;
    color: #fff !important;
    background: radial-gradient(circle at 32% 26%, #FFC65C, #FF8C38 45%, #E0460A 100%);
    box-shadow: 0 16px 34px -16px rgba(255, 107, 0, 0.95);
    animation: otLogoFloat 4s ease-in-out infinite, otSplashPulse 2.6s ease-out infinite;
}

.ot-modal-mark i {
    transform: translateX(2px);
}

.scroll-top .scroll-ring .ring-track {
    stroke: #fff;
    opacity: 0.28;
}

.scroll-top .scroll-ring .ring-fill {
    stroke: #fff;
}


.video-card.is-ready:active {
    transform: perspective(900px) rotateX(var(--tiltX)) rotateY(var(--tiltY)) scale(0.985);
}

/* La barra inferior no debe tapar el confeti */
#otConfetti {
    z-index: 9400;
}

/* En pantallas muy pequeñas el splash se hace más compacto */
@media (max-width: 360px) {
    .ot-splash-title { font-size: 21px; }
    .ot-splash-logo { width: 74px; height: 74px; }
    .ot-splash-logo svg { width: 54px; height: 54px; }
}

/* ============================================================
   19 · EXTRAS DE DISEÑO
   ============================================================ */

/* Barra inferior tipo cristal */
.bottom-nav {
    box-shadow: 0 -10px 30px -12px rgba(0, 0, 0, 0.35);
}

.bottom-nav-item {
    border-radius: 14px;
    transition: background 0.25s ease, color 0.25s ease;
}

.bottom-nav-item:active {
    background: rgba(255, 107, 0, 0.1);
}

/* Estado vacío con halo naranja */
.no-results {
    position: relative;
    isolation: isolate;
}

.no-results::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 220px;
    height: 220px;
    margin: -110px 0 0 -110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 0, 0.22), transparent 68%);
    animation: otSplashPulse 3.4s ease-out infinite;
    z-index: -1;
    pointer-events: none;
}

.loading p {
    animation: otDot 1.6s ease-in-out infinite;
    letter-spacing: 0.3px;
}

/* Miniaturas relacionadas */
.related-video-card {
    transition: background 0.25s ease, transform 0.25s var(--ot-ease-out);
}

.related-video-card:hover {
    transform: translateX(4px);
}

.related-video-card:hover .related-thumbnail img {
    transform: scale(1.06);
}

.related-thumbnail img {
    transition: transform 0.4s var(--ot-ease-out);
}

/* Botón de volver arriba con brillo */
.scroll-top {
    transition: transform 0.25s var(--ot-ease-bounce), box-shadow 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 10px 24px -10px rgba(255, 107, 0, 0.9);
}

.scroll-top:hover {
    transform: translateY(-3px);
}

/* Avatar del usuario */
.user-avatar {
    transition: transform 0.3s var(--ot-ease-bounce), box-shadow 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.08);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.28);
}

/* Menú de hamburguesa */
.menu-btn:hover i,
.back-btn:hover i {
    animation: otIconWiggle 0.5s ease;
}

/* Formularios: etiquetas y foco */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.14);
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

/* Barra de progreso de la subida lista */
.progress-bar {
    overflow: hidden;
    border-radius: 999px;
}

/* Insignias y avisos con latido */
.yt-badge,
.ex-badge {
    transition: transform 0.25s var(--ot-ease-bounce);
}

.video-card:hover .yt-badge {
    transform: translateY(-2px) scale(1.04);
}

/* Transición entre páginas (View Transitions, Chrome/Edge) */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: otPageOut 0.28s ease both;
}

::view-transition-new(root) {
    animation: otPageIn 0.4s var(--ot-ease-out) both;
}

html.ot-theming::view-transition-old(root) {
    animation: none;
}

html.ot-theming
@keyframes otPageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@keyframes otPageOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none !important;
    }
}

/* El logo debe seguir viéndose en pantallas pequeñas
   (la regla antigua ocultaba todos los <span> del logo) */
@media (max-width: 480px) {
    .logo .ot-logo-mark {
        display: inline-flex;
        width: 28px;
        height: 28px;
    }

    .logo .ot-logo-glint {
        display: block;
    }
}

.logo-text {
    white-space: nowrap;
}

/* ============================================================
   20 · AJUSTES DE MOVIMIENTO (desde la página de Ajustes)
   ============================================================ */
html.ot-fx-off *,
html.ot-fx-off *::before,
html.ot-fx-off *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

html.ot-fx-off .ot-aurora,
html.ot-fx-off .ot-splash,
html.ot-fx-off .ot-progress,
html.ot-fx-off .ot-spark,
html.ot-fx-off .ot-heart,
html.ot-fx-off #otConfetti {
    display: none !important;
}

html.ot-fx-soft .ot-aurora {
    opacity: 0.35;
}

html.ot-fx-soft .video-card {
    animation: none;
}

html.ot-fx-soft .video-card.is-ready {
    transition-duration: 0.18s;
}

/* Ahorro de datos: sin fondo animado */
html[data-saver="1"] .ot-aurora {
    display: none !important;
}

/* ============================================================
   21 · CAJÓN DEL MENÚ LATERAL (MÓVIL)
   ============================================================ */
.sidebar-drawer-head {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-backdrop {
        z-index: 1900;
    }

    .sidebar {
        top: 0;
        height: 100vh;
        height: 100dvh;
        width: min(86vw, 330px);
        z-index: 1955;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
        border-right: none;
        border-radius: 0 22px 22px 0;
        box-shadow: 30px 0 70px -34px rgba(0, 0, 0, 0.85);
        background: var(--bg-sidebar);
        overflow-y: auto;
        overscroll-behavior: contain;
        will-change: transform;
        transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.4s;
        visibility: hidden;
    }

    .sidebar.open {
        transform: translateX(0);
        visibility: visible;
        box-shadow: 30px 0 70px -34px rgba(0, 0, 0, 0.85);
    }

    .sidebar-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 2px 14px 12px;
        margin-bottom: 6px;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-drawer-title {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font-size: 15px;
        font-weight: 700;
        letter-spacing: -0.3px;
    }

    .sidebar-drawer-title span {
        display: grid;
        place-items: center;
        width: 28px;
        height: 28px;
        border-radius: 9px;
        font-size: 15px;
        background: rgba(255, 107, 0, 0.14);
    }

    .sidebar-close {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: grid;
        place-items: center;
        background: var(--bg-hover);
        color: var(--text-primary);
        font-size: 14px;
        transition: transform 0.3s var(--ot-ease-bounce), background 0.25s ease, color 0.25s ease;
    }

    .sidebar-close:hover,
    .sidebar-close:active {
        transform: rotate(90deg);
        background: rgba(255, 107, 0, 0.16);
        color: var(--primary);
    }

    /* Los elementos del cajón aparecen en cascada */
    .sidebar.open .sidebar-section {
        animation: otFloatIn 0.4s var(--ot-ease-out) both;
    }

    .sidebar.open .sidebar-section:nth-of-type(2) {
        animation-delay: 0.06s;
    }

    .sidebar.open .sidebar-section:nth-of-type(3) {
        animation-delay: 0.12s;
    }

    .sidebar.open .sidebar-footer {
        animation: otFloatIn 0.4s 0.16s var(--ot-ease-out) both;
    }
}

/* Escritorio: el cajón no aplica */
@media (min-width: 769px) {
    .sidebar-backdrop {
        display: none !important;
    }
}

/* ============================================================
   22 · PREFERENCIAS DE APARIENCIA (desde Ajustes)
   ============================================================ */

/* Tamaño del texto / interfaz */
html.ot-text-sm { zoom: 0.94; }
html.ot-text-lg { zoom: 1.08; }

/* Densidad */
html.ot-compact .main-content { padding: 14px; }
html.ot-compact .video-grid { gap: 12px; }
html.ot-compact .video-card-info { padding: 8px 10px; }
html.ot-compact .category-chips { padding: 4px 0 12px; }
html.ot-compact .settings-card { padding: 14px 14px 4px; }
html.ot-compact .st-row { padding: 10px 0; }
html.ot-compact .settings-page { gap: 12px; }
html.ot-compact .sidebar-item { padding-top: 7px; padding-bottom: 7px; }

/* Esquinas */
html.ot-corners-soft {
    --radius: 20px;
    --radius-sm: 14px;
}

html.ot-corners-sharp {
    --radius: 6px;
    --radius-sm: 4px;
}

html.ot-corners-sharp .chip,
html.ot-corners-sharp .search-box,
html.ot-corners-sharp .st-segment,
html.ot-corners-sharp .st-segment button,
html.ot-corners-sharp .bottom-nav-item {
    border-radius: 8px;
}

html.ot-corners-sharp .st-switch,
html.ot-corners-sharp .st-switch span,
html.ot-corners-sharp .user-avatar,
html.ot-corners-sharp .menu-btn,
html.ot-corners-sharp .theme-btn,
html.ot-corners-sharp .scroll-top {
    border-radius: 10px;
}

/* Tipografía del sistema */
html.ot-font-system body,
html.ot-font-system button,
html.ot-font-system input,
html.ot-font-system textarea,
html.ot-font-system select,
html.ot-font-system .logo-text {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif !important;
}

/* Logo sin animación */
html.ot-logo-static .ot-logo-mark svg,
html.ot-logo-static .ot-logo-mark .ot-logo-leaf,
html.ot-logo-static .ot-logo-mark .ot-logo-play,
html.ot-logo-static .ot-logo-glint::after {
    animation: none !important;
}

html.ot-logo-static .ot-logo-glint {
    display: none;
}

/* Alto contraste */
html.ot-contrast {
    --text-secondary: #3A3A3A;
    --text-muted: #4A4A4A;
    --border: #9A9A9A;
}

html.ot-contrast[data-theme="dark"] {
    --text-secondary: #DADADA;
    --text-muted: #C4C4C4;
    --border: #7A7A7A;
}

html.ot-contrast .video-card,
html.ot-contrast .settings-card,
html.ot-contrast .st-switch,
html.ot-contrast .st-segment,
html.ot-contrast .search-box {
    border-width: 2px;
}

/* Subrayar enlaces */
html.ot-underline a {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
}

/* Botones grandes */
html.ot-big-touch button,
html.ot-big-touch .chip,
html.ot-big-touch .sidebar-item,
html.ot-big-touch .bottom-nav-item,
html.ot-big-touch .st-btn {
    min-height: 48px;
}

html.ot-big-touch .chip {
    padding: 12px 18px;
}

html.ot-big-touch .st-switch {
    width: 56px;
    height: 32px;
}

html.ot-big-touch .st-switch span {
    width: 24px;
    height: 24px;
}

html.ot-big-touch .st-switch.on span {
    transform: translateX(24px);
}

/* Barra inferior oculta */
html.ot-no-nav .bottom-nav {
    display: none !important;
}

html.ot-no-nav body {
    padding-bottom: 0 !important;
}

@media (max-width: 768px) {
    html.ot-no-nav .scroll-top {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
}

/* Acceso a Ajustes en el navbar cuando la barra inferior está oculta */
.nav-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-primary);
    background: transparent;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s var(--ot-ease-bounce);
}

.nav-settings-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
    transform: rotate(15deg);
}

/* ============================================================
   23 · EXTRAS DE APARIENCIA (Ajustes)
   ============================================================ */

/* Negro puro (AMOLED) */
html.ot-amoled[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #0A0A0A;
    --bg-card: #0C0C0C;
    --bg-sidebar: #000000;
    --bg-hover: #1A1A1A;
    --border: #242424;
}

/* Tarjetas planas (sin sombras) */
html.ot-flat-cards .video-card,
html.ot-flat-cards .video-card:hover,
html.ot-flat-cards .settings-card,
html.ot-flat-cards .related-video-card,
html.ot-flat-cards .install-banner {
    box-shadow: none !important;
}

/* Ocultar insignias / duración */
html.ot-hide-badges .yt-badge {
    display: none !important;
}

html.ot-hide-duration .video-duration {
    display: none !important;
}

/* Columnas del feed */
@media (min-width: 900px) {
    html.ot-grid-2 .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    html.ot-grid-3 .video-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
